Skip to content

fix(wallet): save complete burn proof in file#7726

Open
sdbondi wants to merge 2 commits intotari-project:developmentfrom
sdbondi:console-wallet-burn-proof-file
Open

fix(wallet): save complete burn proof in file#7726
sdbondi wants to merge 2 commits intotari-project:developmentfrom
sdbondi:console-wallet-burn-proof-file

Conversation

@sdbondi
Copy link
Member

@sdbondi sdbondi commented Mar 18, 2026

Description

fix(wallet): save complete burn proof in file

Motivation and Context

Use a shared file location for burn proofs, this allows L2 wallets to pick up burns for claiming

How Has This Been Tested?

Manually

What process can a PR reviewer use to test or verify this change?

Breaking Changes

  • None
  • Requires data directory on base node to be deleted
  • Requires hard fork
  • Other - Please specify

@sdbondi sdbondi requested a review from a team as a code owner March 18, 2026 12:48
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the handling of burn proofs within the wallet, moving from a manual file path input to an automated system that saves complete burn proofs to a designated shared directory. This change aims to improve interoperability with L2 wallets by providing a standardized and accessible location for burn claim data. The console wallet's user interface has been simplified as a result, and the underlying transaction service now emits events upon successful burn proof confirmation and persistence.

Highlights

  • Burn Proof Persistence: Burn proofs are now automatically saved to a shared file location after a burn transaction completes, enabling L2 wallets to easily access them for claiming.
  • Console Wallet UI Simplification: The console wallet UI has been streamlined by removing the manual input field for the burn proof filepath, as proofs are now automatically managed.
  • Configuration and Dependencies: New dependencies (dirs-next, tempfile) were added to facilitate cross-platform directory handling and temporary file operations. A new CLI argument (--burn-proof-out) was introduced for the console wallet to specify the output directory for burn proofs.
  • Transaction Eventing: A new TransactionBurnConfirmed event has been added to the transaction service, providing a clear signal when a burn transaction has been confirmed and its proof saved.
  • Complete Burn Proof Structure: A new CompleteClaimBurnProof struct was introduced to encapsulate all necessary data for a burn claim, including the claim proof, merkle proof, encrypted data, kernel, and value.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sdbondi sdbondi force-pushed the console-wallet-burn-proof-file branch from f38a803 to a1eb4ee Compare March 18, 2026 12:50
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the burn proof saving mechanism to use a shared directory, which is a solid improvement for interoperability with L2 wallets. The logic has been moved to a more appropriate place in the transaction lifecycle. The changes are mostly clean and correct. I have a few suggestions to improve robustness and code style.

kernel: proof.kernel,
value,
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The code writes a file but doesn't ensure the directory exists. This could lead to an error if the directory hasn't been created yet. It's safer to create the directory before attempting to write the file.

    if let Some(parent) = final_path.parent() {
        fs::create_dir_all(parent).await?;
    }
    fs::write(&final_path, serde_json::to_vec_pretty(&complete_proof)?).await?;

TransactionValidationFailed(OperationId, u64),
TransactionBurnConfirmed {
output_hash: HashOutput,
commitment: Box<CompressedCommitment>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

CompressedCommitment is a small, 32-byte Copy type. Boxing it with Box<CompressedCommitment> is unnecessary and introduces a heap allocation. It's better to store it directly. This also allows restoring the Hash derive on the TransactionEvent enum, which was removed in this PR.

This would also simplify the event creation in fetch_claim_burn_merkle_proofs.rs to commitment: burn.burn_proof.commitment.

Suggested change
commitment: Box<CompressedCommitment>,
commitment: CompressedCommitment,

Comment on lines +188 to +192
fs::create_dir_all(&burn_proofs_dir).await?;
let kernel_merkle_proof = proof
.kernel_merkle_proof
.ok_or_else(|| anyhow!("No kernel_merkle_proof"))?;
let encrypted_data = proof.encrypted_data.ok_or_else(|| anyhow!("No encrypted_data"))?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These ok_or_else calls can be made more idiomatic by using the Context trait from anyhow. This improves readability. You'll need to add use anyhow::Context; to the file.

Suggested change
fs::create_dir_all(&burn_proofs_dir).await?;
let kernel_merkle_proof = proof
.kernel_merkle_proof
.ok_or_else(|| anyhow!("No kernel_merkle_proof"))?;
let encrypted_data = proof.encrypted_data.ok_or_else(|| anyhow!("No encrypted_data"))?;
let kernel_merkle_proof = proof.kernel_merkle_proof.context("No kernel_merkle_proof")?;
let encrypted_data = proof.encrypted_data.context("No encrypted_data")?;
let value = proof.value.context("No value")?;

@sdbondi sdbondi force-pushed the console-wallet-burn-proof-file branch from a1eb4ee to 20f18fd Compare March 18, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant