Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account on-chain tracking #485

Merged
merged 5 commits into from
Mar 12, 2024
Merged

Account on-chain tracking #485

merged 5 commits into from
Mar 12, 2024

Conversation

hackaugusto
Copy link
Contributor

@hackaugusto hackaugusto commented Feb 27, 2024

Built on top of: #481

This PR does:

  • Create a builder for ProvenTransactions
  • The above builder adds validation for the account and note details
  • Add a flag so that the transaction prover will track the account details Use the on-chain flag from the account id

Will come on follow-ups:

  • Note details tracking (Looking into how to determine which notes should be tracked)

@hackaugusto hackaugusto force-pushed the hacka-issue-403-2 branch 2 times, most recently from 7a4a711 to dabbbc8 Compare February 28, 2024 15:21
Comment on lines 92 to 99
let builder = match on_chain_account {
true => {
let account_details = if tx_witness.account().is_new() {
AccountDetails::Full(tx_witness.account().clone())
} else {
AccountDetails::Delta(account_delta)
};

builder.account_details(account_details)
},
tx_outputs.account.hash(),
input_notes,
tx_outputs.output_notes.into(),
tx_script_root,
block_hash,
proof,
))
false => builder,
};
Copy link
Contributor Author

@hackaugusto hackaugusto Feb 28, 2024

Choose a reason for hiding this comment

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

I'm not particularly fond of this API. But as the things are currently set, this seems to be the best place to have it.

An alternative would be to decouple the ProvenTransaction from the account/note state. But at the same time I don't think that would be worth the effort.

@hackaugusto
Copy link
Contributor Author

@bobbinth ping. In case you missed this PR :)

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Thank you! Looks good. I left some comments inline.

Looking into how to determine which notes should be tracked

One option could be to modify TransactionProver::prove_transaction() method to take a vector of notes as an extra parameter (i.e., it would be Vec<Note>).

Another option is to modify TransactionWitness to add something like expected_output_notes field to it. I think this might be cleaner - but I haven't considered all pros/cons.

@hackaugusto
Copy link
Contributor Author

One option could be to modify TransactionProver::prove_transaction() method to take a vector of notes as an extra parameter (i.e., it would be Vec).

Another option is to modify TransactionWitness to add something like expected_output_notes field to it. I think this might be cleaner - but I haven't considered all pros/cons.

In the issue it was describe this should be determined by the MASM code. Any reason to change that?

@hackaugusto hackaugusto changed the base branch from main to next March 5, 2024 18:09
@hackaugusto
Copy link
Contributor Author

closing/reopening to trigger the ci

@hackaugusto hackaugusto closed this Mar 5, 2024
@hackaugusto hackaugusto reopened this Mar 5, 2024
@hackaugusto hackaugusto force-pushed the hacka-issue-403-2 branch 5 times, most recently from afa034e to e9623b4 Compare March 6, 2024 17:10
@hackaugusto
Copy link
Contributor Author

Note: I changed a few tests from using an ON_CHAIN account type to an OFF_CHAIN account type, because this PR does not implement the delta yet.

@hackaugusto hackaugusto dismissed bobbinth’s stale review March 6, 2024 17:11

applied requested changes

@hackaugusto hackaugusto requested a review from bobbinth March 6, 2024 17:11
@hackaugusto hackaugusto mentioned this pull request Mar 8, 2024
@hackaugusto
Copy link
Contributor Author

@bobbinth ping, the PR is ready for another review :)

@hackaugusto hackaugusto requested a review from polydez March 8, 2024 15:05
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Thank you! Looks good! I left a few more comments inline - but pretty much all are minor.

Also, could you create an issue mentioned in #485 (comment)?

@bobbinth
Copy link
Contributor

bobbinth commented Mar 8, 2024

Oh - and let's also update the changelog.

polydez
polydez previously requested changes Mar 9, 2024
@hackaugusto
Copy link
Contributor Author

Oh - and let's also update the changelog.

added

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! I left a couple of small comments inline. After these, let's merge.

@hackaugusto hackaugusto dismissed polydez’s stale review March 12, 2024 15:42

comments have ben resolved

@hackaugusto hackaugusto merged commit 6bcefdc into next Mar 12, 2024
8 checks passed
@hackaugusto hackaugusto deleted the hacka-issue-403-2 branch March 12, 2024 15:42
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.

3 participants