From eae66dc9620436369f6316a843eb587941be1fa3 Mon Sep 17 00:00:00 2001 From: Alex Forshtat Date: Thu, 12 Sep 2024 14:33:46 +0200 Subject: [PATCH] AA-382: Emit system-level events for RIP-7560 transactions (#1) * AA-382: Emit system-level events for RIP-7560 transactions * Force * Update * Split the 'nonce' field into 'nonceKey' and 'nonceSequence' * Re-introduce 'RIP7560AccountDeployed' event --- contracts/interfaces/IRip7560EntryPoint.sol | 59 ++++++++++++++++++++ contracts/interfaces/IRip7560Transaction.sol | 2 +- package.json | 2 +- 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/contracts/interfaces/IRip7560EntryPoint.sol b/contracts/interfaces/IRip7560EntryPoint.sol index 1929d8b..c11fd11 100644 --- a/contracts/interfaces/IRip7560EntryPoint.sol +++ b/contracts/interfaces/IRip7560EntryPoint.sol @@ -6,4 +6,63 @@ interface IRip7560EntryPoint { function sigFailAccount(uint256 validAfter, uint256 validUntil) external; function acceptPaymaster(uint256 validAfter, uint256 validUntil, bytes calldata context) external; function sigFailPaymaster(uint256 validAfter, uint256 validUntil, bytes calldata context) external; + + + /** + * An event emitted after each successful request. + * @param sender - The account that generates this request. + * @param paymaster - If non-null, the paymaster that pays for this request. + * @param nonceKey - The nonce key value from the request. + * @param nonceSequence - The nonce sequence value from the request. + * @param executionStatus - True if the sender transaction succeeded, false if reverted. + */ + event RIP7560TransactionEvent( + address indexed sender, + address indexed paymaster, + uint256 nonceKey, + uint256 nonceSequence, + uint256 executionStatus + ); + + /** + * An event emitted after "sender" account has been deployed. + * @param sender - The account that has been deployed. + * @param paymaster - The paymaster used by this transaction. + * @param deployer - The deployer factory contract used to deploy this account. + */ + event RIP7560AccountDeployed( + address indexed sender, + address indexed paymaster, + address indexed deployer + ); + + /** + * An event emitted if the RIP-7560 transaction "executionData" reverted with non-zero length. + * @param sender - The sender of this request. + * @param nonceKey - The nonce key value from the request. + * @param nonceSequence - The nonce sequence value from the request. + * @param revertReason - The return bytes from the reverted "executionData" call. + */ + event RIP7560TransactionRevertReason( + address indexed sender, + uint256 nonceKey, + uint256 nonceSequence, + bytes revertReason + ); + + /** + * An event emitted if the RIP-7560 transaction Paymaster's "postOp" call reverted with non-zero length. + * @param sender - The sender of this request. + * @param paymaster - The paymaster that pays for this request. + * @param nonceKey - The nonce key value from the request. + * @param nonceSequence - The nonce sequence value from the request. + * @param revertReason - The return bytes from the reverted call to "postOp". + */ + event RIP7560TransactionPostOpRevertReason( + address indexed sender, + address indexed paymaster, + uint256 nonceKey, + uint256 nonceSequence, + bytes revertReason + ); } diff --git a/contracts/interfaces/IRip7560Transaction.sol b/contracts/interfaces/IRip7560Transaction.sol index 9131d45..517dbce 100644 --- a/contracts/interfaces/IRip7560Transaction.sol +++ b/contracts/interfaces/IRip7560Transaction.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.23; struct RIP7560Transaction { address sender; uint256 nonceKey; - uint256 nonce; + uint256 nonceSequence; uint256 validationGasLimit; uint256 paymasterValidationGasLimit; uint256 postOpGasLimit; diff --git a/package.json b/package.json index 7519128..75d37b1 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "scripts": { "test-hardhat": "hardhat test", "test-forge": "forge test", - "compile-hardhat": "npx hardhat compile", + "compile-hardhat": "npx hardhat compile --force", "ci": "yarn test-hardhat && yarn test-forge" }, "devDependencies": {