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: solana resigning #5124

Merged
merged 13 commits into from
Aug 15, 2024
Merged

feat: solana resigning #5124

merged 13 commits into from
Aug 15, 2024

Conversation

ramizhasan111
Copy link
Contributor

@ramizhasan111 ramizhasan111 commented Aug 6, 2024

Pull Request

Closes: PRO-1524

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have written sufficient tests.
  • I have written and tested required migrations.
  • I have updated documentation where appropriate.

Summary

Please include a succinct description of the purpose and content of the PR. What problem does it solve, and how? Link issues, discussions, other PRs, and anything else that will help the reviewer.

Non-Breaking changes

If this PR includes non-breaking changes, select the non-breaking label. On merge, CI will automatically cherry-pick the commit to a PR against the release branch.

@albert-llimos
Copy link
Contributor

I think it'd be good to have a test for the Solana resigning if possible, especially given that we are not rebuilding the transaction but rather replacing some accounts.

Copy link

codecov bot commented Aug 6, 2024

Codecov Report

Attention: Patch coverage is 93.23308% with 9 lines in your changes missing coverage. Please review.

Project coverage is 71%. Comparing base (ecf4c58) to head (a4f1554).
Report is 1 commits behind head on main.

Files Patch % Lines
state-chain/pallets/cf-broadcast/src/lib.rs 64% 2 Missing and 2 partials ⚠️
state-chain/chains/src/sol/api.rs 78% 2 Missing ⚠️
state-chain/runtime/src/chainflip.rs 95% 2 Missing ⚠️
state-chain/cf-integration-tests/src/solana.rs 99% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #5124   +/-   ##
=====================================
- Coverage     71%     71%   -0%     
=====================================
  Files        460     460           
  Lines      81931   81896   -35     
  Branches   81931   81896   -35     
=====================================
- Hits       58431   58341   -90     
- Misses     20408   20454   +46     
- Partials    3092    3101    +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ramizhasan111 ramizhasan111 marked this pull request as ready for review August 7, 2024 09:23
@syan095
Copy link
Contributor

syan095 commented Aug 8, 2024

Might be worth it to write an integration test just to be safe.

@ramizhasan111
Copy link
Contributor Author

I think it'd be good to have a test for the Solana resigning if possible, especially given that we are not rebuilding the transaction but rather replacing some accounts.

tried to write a unit test but realized that it is not possible. will write an integration test.

Copy link
Collaborator

@dandanlen dandanlen left a comment

Choose a reason for hiding this comment

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

I left some comments.

Also, reading this, I'm not sure why the signer was added inside the ApiCall instead of adding it next to the ApiCall in storage ((signer, api_call)) - might have made things simpler?

@ramizhasan111
Copy link
Contributor Author

Also, reading this, I'm not sure why the signer was added inside the ApiCall instead of adding it next to the ApiCall in storage ((signer, api_call)) - might have made things simpler?

would have been much simpler, yes (especially the migrations 😢 ). I wanted it to be a part of the apicall type because

  1. it couples the signer info tightly with the call and its signature. We store the signature in the Apicall and it makes sense to store the signer with it so they cant get out of sync and have to be changed together.
  2. the signer information is fundamental to the Apicall and we might need it elsewhere in the future while using the Apicall type

@dandanlen
Copy link
Collaborator

Also, reading this, I'm not sure why the signer was added inside the ApiCall instead of adding it next to the ApiCall in storage ((signer, api_call)) - might have made things simpler?

would have been much simpler, yes (especially the migrations 😢 ). I wanted it to be a part of the apicall type because

1. it couples the signer info tightly with the call and its signature. We store the signature in the Apicall and it makes sense to store the signer with it so they cant get out of sync and have to be changed together.

2. the signer information is fundamental to the Apicall and we might need it elsewhere in the future while using the Apicall type

tbh. I don't really agree with this (re. 1. we have already seen that the call.signer can get out of sync with the values in the inner tx, see above, and 2. is quite speculative) but i suppose now it's done, we can live with it.

@ramizhasan111
Copy link
Contributor Author

tried to write an integration test that tests the edge case where solana resigning is required but realized that that is also not possible easily because there is no mock cfe functionality of submitting/failing tx broadcasts. Insteadm I wrote an integration test that functions as a unit test for the requires_signature_refresh logic.

@albert-llimos
Copy link
Contributor

tried to write an integration test that tests the edge case where solana resigning is required but realized that that is also not possible easily because there is no mock cfe functionality of submitting/failing tx broadcasts. Insteadm I wrote an integration test that functions as a unit test for the requires_signature_refresh logic.

Makes sense. I'll try to add some extra checks to ensure that we obtain a valid transaction, let's see if I can make that work.

@ramizhasan111 ramizhasan111 added this pull request to the merge queue Aug 15, 2024
Merged via the queue into main with commit cb90e23 Aug 15, 2024
48 checks passed
@ramizhasan111 ramizhasan111 deleted the feat/solana-resigning branch August 15, 2024 13:16
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