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

evm+solana: Add comments to clarify the order of struct parsing #246

Merged
merged 2 commits into from
Mar 12, 2024

Conversation

johnsaigle
Copy link
Collaborator

The 'wire format' of the Transceiver messages encodes/decodes the fields of the struct in reverse order to how they are declared in the Solidity and Rust structs.
This is done safely, and we have unit tests to verify that the encoding/decoding process is consistent on both sides. However, it's not clear that this is intentional when reading through the code. This comment should help with readability and hopefully will stop reviewers from falling down rabbit holes.

@johnsaigle johnsaigle requested review from kcsongor and mdulin2 March 1, 2024 21:24
@johnsaigle johnsaigle force-pushed the comments-for-parsing branch from 6b3a70a to 5a86faf Compare March 1, 2024 21:25
@johnsaigle johnsaigle marked this pull request as draft March 1, 2024 21:26
@johnsaigle johnsaigle force-pushed the comments-for-parsing branch 3 times, most recently from 11ba8ad to 2cd182d Compare March 1, 2024 21:35
@johnsaigle johnsaigle marked this pull request as ready for review March 1, 2024 21:36
@johnsaigle johnsaigle force-pushed the comments-for-parsing branch from 2cd182d to 7ce5400 Compare March 4, 2024 14:02
@djb15
Copy link
Collaborator

djb15 commented Mar 4, 2024

#248 will get rid of the structs, but the same idea applies that the encoding is swapped around in the wire format

@johnsaigle
Copy link
Collaborator Author

Thanks @djb15. I'll rebase after #248 is merged and add documentation there where appropriate

@johnsaigle johnsaigle force-pushed the comments-for-parsing branch from 7ce5400 to 4d5f464 Compare March 5, 2024 16:03
@johnsaigle
Copy link
Collaborator Author

Rebase done, should be up-to-date with origin/main and the changes to TrimmedAmount

Verified

This commit was signed with the committer’s verified signature.
johnsaigle John Saigle
The 'wire format' of the Transceiver messages encodes/decodes the fields
of the struct in reverse order to how they are declared in the Solidity
and Rust structs.
This is done safely, and we have unit tests to verify that the
encoding/decoding process is consistent on both sides. However, it's not
clear that this is intentional when reading through the code.
This comment should help with readability and hopefully will stop
reviewers from falling down rabbit holes.
@johnsaigle johnsaigle force-pushed the comments-for-parsing branch from 4d5f464 to e0aa2fc Compare March 6, 2024 14:27

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@johnsaigle johnsaigle merged commit 4e666c6 into wormhole-foundation:main Mar 12, 2024
4 checks passed
@johnsaigle johnsaigle deleted the comments-for-parsing branch March 12, 2024 19:40
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.

None yet

3 participants