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

feat(ifl-776): size method note primitives #3868

Merged
merged 4 commits into from
May 1, 2023

Conversation

jowparks
Copy link
Contributor

@jowparks jowparks commented May 1, 2023

Summary

  • Adding size methods for Note/NoteEncrypted primitives
  • Add test to make sure these stay up to date

Reason for addition

Our constants were becoming stale rather quickly (e.g. NOTE_ENCRYPTED_SERIALIZED_SIZE_IN_BYTE), so this pattern attempts to do two things.

  1. Tightly couple the size via a static method to our objects (rather than an unrelated constant)
  2. Add a test that verifies this always stays up to date. It is currently possible to update the serialized size of these objects (rust side) without updating these methods. Now if these values change, the tests will break.

Testing Plan

tests pass

Documentation

Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference
)? If yes, link a
related documentation pull request for the website.

[ ] Yes

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and
what additional work is required, if any.

[ ] Yes

@jowparks jowparks requested a review from a team as a code owner May 1, 2023 16:18
@jowparks jowparks changed the base branch from master to staging May 1, 2023 16:18
@jowparks jowparks force-pushed the joe/ifl-776/size-method-note-primitive branch from 0820fb9 to e0a55be Compare May 1, 2023 16:41
@NullSoldier
Copy link
Contributor

NullSoldier commented May 1, 2023

This change looks good, but can we get a comment on the systemic implications here? Is this a new pattern we should be going for? When ever we start moving the code base in a new direction with a new pattern it'd be nice to comment on that in the description as others will look back here for an explanation on why this was done, and if they should do the same.

Co-authored-by: Jason Spafford <nullprogrammer@gmail.com>
Co-authored-by: Jason Spafford <nullprogrammer@gmail.com>
@jowparks jowparks force-pushed the joe/ifl-776/size-method-note-primitive branch from aa0e51f to 63ff756 Compare May 1, 2023 19:39
@jowparks jowparks merged commit f2cf103 into staging May 1, 2023
@jowparks jowparks deleted the joe/ifl-776/size-method-note-primitive branch May 1, 2023 19:51
@jowparks jowparks changed the title feat(ifl 776): size method note primitives feat(ifl-776): size method note primitives May 1, 2023
@dguenther dguenther mentioned this pull request May 9, 2023
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.

2 participants