-
Notifications
You must be signed in to change notification settings - Fork 55
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
fix(svm): root bundles over cctp #687
Conversation
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
constraint = is_local_or_remote_owner(&signer, &state) @ CustomError::NotOwner | ||
)] | ||
pub signer: Signer<'info>, | ||
|
||
#[account(mut)] | ||
// We do not restrict who can receive lamports from closing root_bundle account as that would require storing the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense, as long as it's authenticated with is_local_or_remote_owner
we don't really mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In remote authentication this checks only that this is coming from HubPool via CCTP, but we do not use permissioned caller to receive the message on Solana side (though CCTP has that option). So there might be a case that someone frontruns receiving message on Solana and gets all lamports from the closing of root bundle account. But I think this is rare enough when we would use this emergency method and it should be no concern that someone else could gain some extra lamports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Anyone can “finalize” these messages.
However, I’m wondering if it might make sense to use the feature you mentioned, where CCTP allows authentication of specific finalizers, so we can handle these admin actions with more control if needed. (Just throwing an open question)
@@ -82,6 +82,18 @@ fn translate_message(data: &Vec<u8>) -> Result<Vec<u8>> { | |||
(origin_token, destination_chain_id, enabled) | |||
.encode_instruction_data("global:set_enable_route") | |||
} | |||
s if s == utils::encode_solidity_selector("relayRootBundle(bytes32,bytes32)") => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great! we can now test this on testnet as well over cctp
// Same 3 remaining accounts passed for HandleReceiveMessage context. | ||
const relayRootBundleRemainingAccounts = remainingAccounts.slice(0, 3); | ||
// payer in self-invoked SetEnableRoute. | ||
relayRootBundleRemainingAccounts.push({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does order matter here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regular accounts have named props, so the client can reorder them as needed, but remaining accounts is plain array, so I believe the ordering here matters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
We require ability to relay and emergency delete root bundles over CCTP.
Fixes: https://linear.app/uma/issue/ACX-3029/instructionsadminrs-remote-relay-emergency-delete-root-bundle