-
Notifications
You must be signed in to change notification settings - Fork 4
feat: ID-4134: Support Bootstrap Flow for Wallet Initial Transaction #74
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
base: main
Are you sure you want to change the base?
Conversation
Hook into signature validation to bootstrap wallet deployment for first txn without user signature.
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.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on December 13
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| } | ||
|
|
||
| // Defensive check: compare extracted address with target address | ||
| if (IMMUTABLE_SIGNER_CONTRACT != address(0) && addr == IMMUTABLE_SIGNER_CONTRACT) { |
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.
Remove check that Immtuable signer contract is zero
| compilers: [{ | ||
| version: '0.8.17', | ||
| settings: { | ||
| viaIR: true, |
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.
@drinkcoffee I tweaked this settling to resolve a "stack too deep" error. Not sure if there's any unintended side effects that I'm not aware of. Pls advise.
Summary:
This PR implements support for the bootstrap flow in the v1 wallet system. This is done by checking if the initial txn is signed by the Immutable signer without requiring a pre-stored image hash.
Motivation:
Pre-change:
When a new wallet is created, the image hash (representing the wallet's signer configuration) needs to be stored before transactions can be validated. In the absence of the imageHash, the first transaction is validated by recalculating the CREATE2 address of the wallet using the imageHash as the salt. The imageHash is retrieved from the signed message and the message payload. If the calculated address (CFA) matches the deployed wallet address then the imageHash is stored and used to validate subsequent transactions.
The problem
Currently in the Immutable ZKEVM chain, the primary wallet owner / signer identity instrument is stored by a 3rd party and we access the signer via their TEE. In a multi-chain world, we would potentially be integrating with different infrastructure providers across chain and therefore have different signers.
The primary wallet owner / signer influences the CFA i.e the user's Passport wallet address and since we need to preserve the same CFA, the current model of validating the first transaction by verifying if the recalculated wallet CFA matches the deployed wallet address doesn't work.
Post-change
To work around the above problem, this PR introduces the following changes:
Overall Flow:

Note
Introduces immutable signer–based bootstrap to validate the first wallet transaction without user signature, updating constructors, deployments, and compiler settings.
ModuleAuthDynamic: AddsIMMUTABLE_SIGNER_CONTRACTand overrides signature validation to auto-approve first tx (nonce=0) when immutable signer is present; integrates nonce/image checks viaModuleStorage/NonceKey.MainModuleDynamicAuth+ mocks (MainModuleMockV1/2/3): Constructors now accept and pass_immutableSignerContract.ModuleAuth: ExposesFLAG_*asinternal; marks validation functionsvirtualto enable overrides.scripts/deploy.ts&scripts/step4.ts: DeployImmutableSignerbeforeMainModuleDynamicAuthand supply its address during deployment; output includes immutable signer details.hardhat.config.ts: EnablesviaIRin Solidity compiler settings..gitignore: Ignoreslib/.Written by Cursor Bugbot for commit 7716f65. This will update automatically on new commits. Configure here.