-
Notifications
You must be signed in to change notification settings - Fork 75
fix: [C01, M01] Remove EIP-1271 signature recovery support and add destination chain ID to relay data #79
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
Conversation
…ain ID to relay data
| uint256 fillAmount, | ||
| uint256 repaymentChainId, | ||
| uint256 originChainId, | ||
| uint256 destinationChainId, |
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 do this then please also add the originChainId to FundsDeposited
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.
done
| import { toBNWei, SignerWithAddress, Contract, ethers, seedWallet, toBN } from "../utils"; | ||
| import { constructRelayParams, warmSpokePool, sendRelay } from "./utils"; | ||
| import * as constants from "../constants"; | ||
| import { spokePoolFixture, enableRoutes } from "../fixtures/SpokePool.Fixture"; |
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.
🍉
chrismaree
left a comment
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! makes sence as a change
mrice32
left a comment
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 great! Two minor comments
contracts/SpokePool.sol
Outdated
| // This function is isolated and made virtual to allow different L2's to implement chain specific recovery of | ||
| // signers from signatures because some L2s might not support ecrecover, such as those with account abstraction | ||
| // like ZKSync. | ||
| // like ZKSync. To be safe, consider always reverting this function for L2s where ecrecover is different from how |
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 ZKSync not support standard ecrecover?
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 guess they do now, but its a special case so we need to be careful when integrating with zksync: https://v2-docs.zksync.io/dev/testnet/status.html#currently-supported-features
contracts/SpokePool.sol
Outdated
| address destinationToken, | ||
| uint256 amount, | ||
| uint256 originChainId, | ||
| uint256 destinationChainId, |
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.
Maybe we should omit this to save calldata and assume that the current chainId is the one they intended? Thoughts?
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.
Yup done
Issue:
multiple tokens and spoke pools. A valid root bundle would ensure the poolRebalanceRoot has a leaf
for every spoke chain. When this rebalance leaf is processed, the slowRelayRoot will also be sent to
the corresponding spoke pool.
batch across the whole system. When the slow relay is executed, the Spoke Pool does not filter on the
destination chain id, which means that any slow relay can be executed on any spoke chain where the
Spoke Pool has sufficient funds in the destinationToken. Consider including the destination chain ID in
the slow relay details so the Spoke Pool can filter out relays that are intended for other chains.
intention. The message is verified on the origin chain before emitting the event that notifies relayers,
and verified again on the destination chain before the new fee can be used to fill the relay. If the
depositor used a static ECDSA signature and both chains support the ecrecover opcode, both
verifications should be identical. However, verification uses the OpenZeppelin Signature Checker
library, which also supports EIP-1271 validation for smart contracts. If the smart contract validation
behaves differently on the two chains, valid contract signatures may be rejected on the destination
chain. A plausible example would be a multisignature wallet on the source chain that is not replicated
on the destination chain.
RequestedSpeedUpDeposit event in the off-chain UMIP specification, so that relayers that comply with
the event would be reimbursed. This mitigation would need a mechanism to handle relayers that
incorrectly fill relays with excessively large relayer fees, which would prevent the recipient from
receiving their full payment. Alternatively, consider removing support for EIP-1271 validation and
relying entirely on ECDSA signatures.
Resolution:
destinationChainIdto the Relay Data is important so that slow relays can be associated deterministically to relays on a specific chain. Imagine a scenario where a slow relay to fill a relay on chain 100 is added to theslowRelayRoot. This slow relay is valid so the root bundle including theslowRelayRooton the HubPool successfully passes liveness. Now, anyone can submit that slow relay leaf to a chain 200 to take funds out of a SpokePool