-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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(protocol): redesign Bridge fee & gasLimit and remove 2-step processing #16739
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
feat(protocol): redesign Bridge fee & gasLimit and remove 2-step processing
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
- removed "refundTo" and "memo" from messages and vaults. - reordered field in bridge messagen and vault's op structs to make it use fewer slots
…o-mono into bridge_improvement
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.
Will go over the code again later today, but everything looks good so approving so I'm not blocking anything.
Objectives
Allow users to specify the message's fee to a large value without worrying about that all the fees will be taken by the relayer. The relayer should only make a small profit if the block's base fee is smaller than the message's specified max fee per gas, which is
message.fee /message.gasLimit
; the relayer will also only charge for the actual gas used.Allow the relayer to make simple decision regarding whether it should process a message: if
block.basefee <= message.fee /message.gasLimit
, process the message, otherwise, no.Allow the relayer to use a really large gas limit to transact
processMessage
without worrying about the actual invocation will eat all gas. The relayer can also simply just usemessage.gasLimit
as the gas limit for hisprocessMessage
call, or with a reasonable overhead.Modifications
removed two step processing to simplify design/impl, remove suspend message feature.
message.refundTo
is deprecated, thedestOwner
field is used instead.gasLimit
no longer means the invocation gas limit, it covers the entireprocessMessage
call. The gas limit for the message invocation is calculated as:gasDeductedForCallData
is the call data gas reseve for the message struct itself, we reserve 32 gas per byte as a message may be processed in two steps._GAS_RESERVE
is a constant value, all processing gas cost will use this part of gas reserve, including the calldata for proof.The new implementation ensures even if the relayer specific a large gas limit for his
processMessage
transaction, the actual invocation will only use up toinvocationGasLimit
gas.@cyberhorsey To calculate the proper
message.gasLimit
, the relayer can useBridge.getMessageMinGasLimit(message) + expectedInvocationGasLimit
.refund 20000 gas per cache operation.