-
Notifications
You must be signed in to change notification settings - Fork 1
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: relayer large incoming message support #9
Conversation
// this is a security check, because the relayer is a signer, we don't want to | ||
// sign a tx where a malicious destination contract could drain the account. This is | ||
// because the `AxelarMessagePayload` defines an interface where the accounts get | ||
// dynamically appended, thus it could also include the relayers account. | ||
if let Ok(decoded_payload) = AxelarMessagePayload::decode(&payload) { | ||
let relayer_signer_acc_included = decoded_payload | ||
.account_meta() | ||
.iter() | ||
.any(|acc| acc.pubkey == signer); | ||
if relayer_signer_acc_included { | ||
eyre::bail!( | ||
"relayer will not execute a transaction where its own key is included" | ||
); | ||
} | ||
} | ||
validate_relayer_not_in_payload(&payload, signer)?; |
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.
Moved this to a function because it was cluttering the main flow.
This step is important, so having its own function makes it a clear and explicit part of the process.
/// Maximum size for payload chunks in bytes. | ||
// TODO: we should either fine tune this or make this configurable | ||
const CHUNK_SIZE: usize = 500; |
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.
I'm not sure if this should be configured or not, given that he maximum size of a transaction is 1232 bytes1.
If we stick to send a transaction with only a single "write" instruction, we can determine the exact, optimal value for this.
Footnotes
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.
I'm not sure there's much value in allowing this to be configurable 🤔 . IMHO figuring out the optimal value and setting it here with a comment explaining how it was obtained would be a good solution.
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
use solana_sdk::signature::Keypair; | ||
use solana_sdk::signer::Signer as _; | ||
|
||
use super::send_transaction; |
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.
You should use send_gateway_tx
instead.
This is important for idempotency purposes, as it will check the GatewayError to figure out if we have a hard error or just a task that had already been executed.
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.
#12 I created a new issue for this
Summary:
MessagePayload
PDA account before executing the message, and close it afterwards.Open topics for discussion:
eyre::WrapErr
)