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

refactor: add TransactionParameters and DetectionData fields in TransactionBody #2839

Merged
merged 3 commits into from
Jul 21, 2023

Conversation

redshiftzero
Copy link
Member

@redshiftzero redshiftzero commented Jul 14, 2023

Closes #2784

The scope of this is refactoring the TransactionBody to contain two new fields:

  • the TransactionParameters (new struct) that contains the expiry height and chain ID (both previously fields directly on the TransactionBody).
  • the optional DetectionData (new struct) that contains the Fuzzy Message Detection (FMD) clues for that transaction (previously a field directly on the TransactionBody).

In this PR I have not modified the EffectHash implementation (see #2808). The idea is (per the comment at the end of #2784):

This will also allow us to refactor the effect hash computation so that a signer can consider each of the parts of the transaction in turn, without having to load an entire transaction plan all at once. The effect hash could be computed by, for instance, individually hashing the memo packet, the parameters packet, and each of the actions, and then combining these hashes.

Note: CI job Protobuf / Lint protobuf (pull_request) will fail during the check for breaking changes to the protobufs, but breaking changes to the protobufs are unavoidable here.

@redshiftzero redshiftzero temporarily deployed to smoke-test July 14, 2023 17:11 — with GitHub Actions Inactive
In this commit I also modified the `TransactionBodyView` such that
it represents the same structure as the current `TransactionBody`. Since
there is no private data in either the `DetectionData` or the
`TransactionParameters`, there are no view structures added for
those structs.
@redshiftzero redshiftzero temporarily deployed to smoke-test July 17, 2023 22:57 — with GitHub Actions Inactive
@redshiftzero redshiftzero marked this pull request as ready for review July 17, 2023 23:28
@redshiftzero redshiftzero requested a review from cronokirby July 18, 2023 20:40
Copy link
Member

@hdevalence hdevalence left a comment

Choose a reason for hiding this comment

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

This looks good, but I think we should pull out the encrypted memo into another proto message so that the TransactionBody only has sub-messages as fields. (We don't have to do anything on the domain types, I think just changing the protos is sufficient for forward compatibility).

Copy link
Contributor

@cronokirby cronokirby left a comment

Choose a reason for hiding this comment

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

I agree with @hdevalence about the protobuf comments.

Had a very minor nit in terms of code simplification as well.

Otherwise, looks good to me! :)

@redshiftzero redshiftzero temporarily deployed to smoke-test July 19, 2023 20:47 — with GitHub Actions Inactive
@redshiftzero
Copy link
Member Author

This has had review comments addressed - lmk if there is any other feedback else I'll plan to merge in the next few hours

@cronokirby cronokirby self-requested a review July 21, 2023 15:13
Copy link
Contributor

@cronokirby cronokirby 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 to me!

@redshiftzero redshiftzero merged commit 4902863 into main Jul 21, 2023
@redshiftzero redshiftzero deleted the 2784-tx-params branch July 21, 2023 17:12
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.

Refactor TransactionBody to include a TransactionParameters
3 participants