-
Notifications
You must be signed in to change notification settings - Fork 672
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
Expose userOpHash
of the user op currently being executed
#337
Comments
In ERC-4337, we tried to keep the same "separation of layers" as in normal transactions. Do you have explicit use-cases where you need the above information ? |
In our contract wallet design, we have abstract contract SelfAuthorized {
function requireSelfCall() private view {
require(msg.sender == address(this), "GS031");
}
modifier authorized() {
// Modifiers are copied around during compilation. This is a function call as it minimized the bytecode size
requireSelfCall();
_;
}
}
function addOwnerWithThreshold(address owner, uint256 _threshold) public authorized {
...
} But we would like to improve on this pattern as So what we are thinking is, to add a more granular check on top of Enum CoreOps {
Upgrade,
Ownership,
}
modifier authorized(bytes32 userOpHash, CoreOps op) {
require(msg.sender == address(this));
require(isCoreOpValidated[userOpHash][op]);
_;
}
function validateUserOp(...) {
...
if (selector == this.upgradeTo.selector) {
// validate
...
(isCoreOpValidated[userOpHash][CoreOps.Upgrade] = true;
} else if
...
}
function execute(...) {
...
address(to).call(data); // `to` would be the wallet contract itself if the user is to perform core ops like upgrade
...
}
function upgradeTo(...) authorized(entrypoint.getUserOpHash(), CoreOps.Upgrade) {
...
} |
What you suggest is that the admin function is called by "execute" method, and is protected by "authorizeSelf", but then you find this authorization too wide, and want to add state info to check if it was validated. My suggestion:
|
Yes, that was initially our implementation but then we discovered that in native AA like StarkNet and zkSync, there's a fixed entry function during execution phase, i.e., the AA OS will always call the So in order to have an architecture that we can use across 4337 and native AAs, we decided to use the |
During the execution phase, it would be helpful for the account contract to know the transaction hash of the transaction currently being executed. Like in StarkNet AA, you can use
get_tx_info
to get the transaction hash or in zkSync AA, the transaction hash is also passed intoexecuteTransaction
.The text was updated successfully, but these errors were encountered: