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

[Solana][NONEVM-1028] Deduplicate accounts in execution #477

Merged
merged 5 commits into from
Jan 28, 2025

Conversation

PabloMansanet
Copy link
Contributor

No description provided.

@PabloMansanet PabloMansanet requested a review from a team as a code owner January 21, 2025 10:16
Copy link
Contributor

@agusaldasoro agusaldasoro left a comment

Choose a reason for hiding this comment

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

We need to ensure that the hash of the message is the same offchain and onchain. Saving space for those values in the extra args message means that the offchain code will need to hash the message with those values in, and then remove them to send the message through the contract. Then the program will need to do the same but the other way out, adding them on the hash.
If you feel that the saved space is worth it we could do this change, but if not it feels like a possible UX concern of the protocol, as all the nodes will need to sign a message with those values in, but then the message sent through is different.

@agusaldasoro agusaldasoro self-requested a review January 21, 2025 15:56
@PabloMansanet
Copy link
Contributor Author

CC @aalu1418 after our sync discussion yesterday on how to proceed with this 🙂

@PabloMansanet PabloMansanet force-pushed the deduplicate_accounts branch 3 times, most recently from 741a4fc to 614f00b Compare January 23, 2025 09:39
Copy link
Contributor

@agusaldasoro agusaldasoro left a comment

Choose a reason for hiding this comment

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

Let's keep the serialization of the accounts inside the hash, with this change the hash values should remain the same.

Can you add a test validating that when sending different accounts in remaining accounts to the ones in the hash then execution fails? So that way we can check that there is no override of the accounts

@PabloMansanet PabloMansanet force-pushed the deduplicate_accounts branch 3 times, most recently from 66d5e3b to 5772fce Compare January 24, 2025 15:35
Copy link
Contributor

@agusaldasoro agusaldasoro left a comment

Choose a reason for hiding this comment

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

Excelent work!

Can we add tests (as I don't think we have that already covered) for:

  • Sending the correct accounts but a wrong bitmap for writable
  • Hashing some accounts different than the ones sent in the transaction

@PabloMansanet
Copy link
Contributor Author

@agusaldasoro addressed your review comments and added the tests you mentioned, PTAL when you have a moment :)

aalu1418
aalu1418 previously approved these changes Jan 27, 2025
agusaldasoro
agusaldasoro previously approved these changes Jan 27, 2025
Copy link
Contributor

@agusaldasoro agusaldasoro left a comment

Choose a reason for hiding this comment

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

Awesome work!

PabloMansanet and others added 2 commits January 28, 2025 11:14
Remove unneeded field

Rework test comment

Update test hash

deduplicate logic receiver

Fix execution check

Address review comments

Hash accounts separately

Fix more tests

Don't hash token accounts

[CCIP-4938] Use map instead of slice in token price observations and outcome (#498)

* check number of observed timestamps is at least 2f+1

* Change token price processor to observe feed tokens as a map instead of slice

Using maps instead of slices make it sure that no duplicates can be added.

Apply comment suggestions

Co-authored-by: Agustina Aldasoro <[email protected]>
@PabloMansanet
Copy link
Contributor Author

@agusaldasoro @aalu1418 resolved conflicts, feel free to merge right away when green :)

Copy link

Metric deduplicate_accounts main
Coverage 76.6% 76.4%

@PabloMansanet PabloMansanet merged commit b962f09 into main Jan 28, 2025
17 checks passed
@aalu1418 aalu1418 deleted the deduplicate_accounts branch January 28, 2025 15:32
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.

4 participants