-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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(mcms/solana): update helpers to support solana #16276
Conversation
The MCMS proposal helpers currently only support EVM, this commit update it to support the solana chain. JIRA: https://smartcontract-it.atlassian.net/browse/DPA-1361
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.
lgtm
|
_, err = chain.Confirm(evmTransaction) | ||
require.NoError(t, err) | ||
// no need to confirm transaction on solana as the MCMS sdk confirms it internally | ||
if family == chainsel.FamilyEVM { |
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.
if you consider future chains, it's probably safer to do family != chainsel.FamilySolana
. But, since this is a test helper, I'd also consider (unnecessarily) calling Confirm
on Solana, if there are no side-effects. Just to make it easier to maintain the code.
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.
if you consider future chains, it's probably safer to do family != chainsel.FamilySolana.
I feel like if we introduce any future changes , the switch statement at the top will have to be updated, so we have to come back to this function regardless and i cant be sure other chains require confirmation or not, it is more of an assumption at this point?
I'd also consider (unnecessarily) calling Confirm on Solana, if there are no side-effects.
True, the reason i didn do it is because i will be adding more branches/switch since the chain.Confirm
is a different struct for solana compare to evm , so maintenance will involve another branch of code, not necessarily easier?
eg a new branch
if family == chainsel.FamilyEVM {
chain := env.Chains[sel]
evmTransaction := tx.RawTransaction.(*gethtypes.Transaction)
_, err = chain.Confirm(evmTransaction)
require.NoError(t, err)
}
if family == chainsel.FamilySolana {
chain := env.SolChains[sel]
solTransaction := tx.RawTransaction.(*solana.Transaction)
_ = chain.Confirm(solTransaction)
}
merging first since the queue is quiet, happy to open a PR to address any other issue
The MCMS proposal helpers currently only support EVM, this commit update it to support the solana chain.
JIRA: https://smartcontract-it.atlassian.net/browse/DPA-1361