Skip to content
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: add sendTokensToHubPool script to test finalizations #574

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

bmzig
Copy link
Contributor

@bmzig bmzig commented Aug 6, 2024

The intended strategy is to deploy two copies of the spoke pool for each chain, but for one spoke pool, set the crossDomainAdmin as the L1 chain adapter and the hubPool as the MOCK_ADMIN address. Ideally, this would allow us to submit an empty relayer refund root with a nonzero amountToReturn, since the onlyAdmin modifier will succeed in this setup, and calling _bridgeTokensToHubPool will send these funds back to our EOA. For completeness, the withdrawal should be triggered by the finalizer.

@bmzig
Copy link
Contributor Author

bmzig commented Aug 7, 2024

Example output:

$ yarn hardhat run scripts/sendTokensToHubPool.ts --network base-sepolia
yarn run v1.22.22
secp256k1 unavailable, reverting to browser version
secp256k1 unavailable, reverting to browser version
[+] Successfully constructed all contracts. Determining root bundle Id to use.
[+] Obtained latest root bundle Id 8
[+] Called L1 adapter (0x0B44A7CBC9489a6a881a2397b469D76320aaB90C) to relay refund leaf message to mock spoke pool at 0x55a8EC3Fe18f8074D090Eea8aBd56501A4Ba098E. Txn: 0x32f836936f67b42b11a83511322b8ab260f0468fae3ee26234412bac9b554d1e
[i] Optimistically waiting 5 minutes for L1 message to propagate. If root bundle is not observed, will check spoke every minute thereafter.
[-] Root bundle not found on L2. Waiting another 60 seconds.
[+] Root bundle observed on L2 spoke pool. Attempting to execute.
[+] Executed root bundle with transaction hash 0xa3ebd61d9ded2d9b09033fff143b41b92a813a092fef5a037e6895ec142c2362. You can now test the finalizer in the relayer repository.
Done in 381.96s.

@bmzig
Copy link
Contributor Author

bmzig commented Aug 7, 2024

Not sure how automated we want this. Some bridges will require the EOA to send a msg.value to fund the L2 transaction, and this is tricky since in order to get the exact amount, we need to query that bridge directly, which isn't generalizable. Should we just add an environment variable where the user needs to specify a msg.value? We would be the only ones using this script anyways...

@bmzig bmzig marked this pull request as ready for review August 7, 2024 18:23
@bmzig bmzig changed the title [WIP] feat: create mock spoke pool to test for finalizations feat: create mock spoke pool to test for finalizations Aug 7, 2024
@bmzig bmzig changed the title feat: create mock spoke pool to test for finalizations feat: add sendTokensToHubPool script to test finalizations Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant