diff --git a/.gas-snapshot b/.gas-snapshot index 1ea3e3e..889228f 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -23,7 +23,7 @@ CoinbaseSmartWalletFactoryTest:test_implementation_returnsExpectedAddress() (gas CoinbaseSmartWalletFactoryTest:test_initCodeHash() (gas: 7912) CoinbaseSmartWalletFactoryTest:test_revertsIfNoOwners() (gas: 29232) ERC1271Test:test_returnsExpectedDomainHashWhenProxy() (gas: 29198) -ERC1271Test:test_static() (gas: 3249331) +ERC1271Test:test_static() (gas: 3229650) MultiOwnableInitializeTest:testRevertsIfLength32ButLargerThanAddress() (gas: 81111) MultiOwnableInitializeTest:testRevertsIfLength32NotAddress() (gas: 81092) MultiOwnableInitializeTest:testRevertsIfLengthNot32Or64() (gas: 103395) @@ -45,29 +45,29 @@ TestCanSkipChainIdValidation:test_approvedSelectorsReturnTrue() (gas: 17781) TestCanSkipChainIdValidation:test_otherSelectorsReturnFalse() (gas: 12579) TestExecuteWithoutChainIdValidation:testExecute() (gas: 424837) TestExecuteWithoutChainIdValidation:testExecuteBatch() (gas: 728897) -TestExecuteWithoutChainIdValidation:testExecuteBatch(uint256) (runs: 256, μ: 3631749, ~: 3655292) -TestExecuteWithoutChainIdValidation:test__codesize() (gas: 49987) -TestExecuteWithoutChainIdValidation:test__codesize() (gas: 50222) -TestExecuteWithoutChainIdValidation:test_revertsWithReservedNonce() (gas: 82347) +TestExecuteWithoutChainIdValidation:testExecuteBatch(uint256) (runs: 256, μ: 3597261, ~: 3458766) +TestExecuteWithoutChainIdValidation:test__codesize() (gas: 49890) +TestExecuteWithoutChainIdValidation:test__codesize() (gas: 50125) +TestExecuteWithoutChainIdValidation:test_revertsWithReservedNonce() (gas: 81983) TestExecuteWithoutChainIdValidation:test_reverts_whenCallerNotEntryPoint() (gas: 11053) -TestExecuteWithoutChainIdValidation:test_reverts_whenOneCallReverts() (gas: 467957) -TestExecuteWithoutChainIdValidation:test_reverts_whenOneSelectorNotApproved() (gas: 179805) -TestExecuteWithoutChainIdValidation:test_reverts_whenSelectorNotApproved() (gas: 106879) -TestExecuteWithoutChainIdValidation:test_succeeds_whenSelectorAllowed() (gas: 424401) +TestExecuteWithoutChainIdValidation:test_reverts_whenOneCallReverts() (gas: 467715) +TestExecuteWithoutChainIdValidation:test_reverts_whenOneSelectorNotApproved() (gas: 179684) +TestExecuteWithoutChainIdValidation:test_reverts_whenSelectorNotApproved() (gas: 106758) +TestExecuteWithoutChainIdValidation:test_succeeds_whenSelectorAllowed() (gas: 423916) TestImplementation:testImplementation() (gas: 12623) TestInitialize:testInitialize() (gas: 21034) -TestInitialize:test_cannotInitImplementation() (gas: 2904513) +TestInitialize:test_cannotInitImplementation() (gas: 2885066) TestIsValidSignature:testReturnsInvalidIfPasskeySigButWrongOwnerLength() (gas: 40187) TestIsValidSignature:testRevertsIfEthereumSignatureButWrongOwnerLength() (gas: 24040) TestIsValidSignature:testRevertsIfOwnerIsInvalidEthereumAddress() (gas: 22021) -TestIsValidSignature:testSmartWalletSigner() (gas: 3180147) +TestIsValidSignature:testSmartWalletSigner() (gas: 3160701) TestIsValidSignature:testValidateSignatureWithEOASigner() (gas: 24922) TestIsValidSignature:testValidateSignatureWithEOASignerFailsWithWrongSigner() (gas: 23877) TestIsValidSignature:testValidateSignatureWithPasskeySigner() (gas: 423238) TestIsValidSignature:testValidateSignatureWithPasskeySignerFailsBadOwnerIndex() (gas: 35664) TestIsValidSignature:testValidateSignatureWithPasskeySignerFailsWithWrongBadSignature() (gas: 430704) TestUpgradeToAndCall:testUpgradeToAndCall() (gas: 25477) -TestValidateUserOp:test_reverts_whenReplayableNonceKeyInvalidForSelector() (gas: 14551) -TestValidateUserOp:test_reverts_whenSelectorInvalidForReplayableNonceKey() (gas: 14816) -TestValidateUserOp:test_succeedsWithEOASigner() (gas: 447664) -TestValidateUserOp:test_succeedsWithPasskeySigner() (gas: 785032) \ No newline at end of file +TestValidateUserOp:test_reverts_whenReplayableNonceKeyInvalidForSelector() (gas: 14187) +TestValidateUserOp:test_reverts_whenSelectorInvalidForReplayableNonceKey() (gas: 14452) +TestValidateUserOp:test_succeedsWithEOASigner() (gas: 447938) +TestValidateUserOp:test_succeedsWithPasskeySigner() (gas: 785169) \ No newline at end of file diff --git a/src/CoinbaseSmartWallet.sol b/src/CoinbaseSmartWallet.sol index 9c34412..8d8cfb3 100644 --- a/src/CoinbaseSmartWallet.sol +++ b/src/CoinbaseSmartWallet.sol @@ -144,9 +144,7 @@ contract CoinbaseSmartWallet is MultiOwnable, UUPSUpgradeable, Receiver, ERC1271 { uint256 key = userOp.nonce >> 64; - if ( - userOp.callData.length >= 4 && bytes4(userOp.callData[0:4]) == this.executeWithoutChainIdValidation.selector - ) { + if (bytes4(userOp.callData) == this.executeWithoutChainIdValidation.selector) { userOpHash = getUserOpHashWithoutChainId(userOp); if (key != REPLAYABLE_NONCE_KEY) { revert InvalidNonceKey(key); @@ -181,7 +179,7 @@ contract CoinbaseSmartWallet is MultiOwnable, UUPSUpgradeable, Receiver, ERC1271 function executeWithoutChainIdValidation(bytes[] calldata calls) public payable virtual onlyEntryPoint { for (uint256 i; i < calls.length; i++) { bytes calldata call = calls[i]; - bytes4 selector = bytes4(call[0:4]); + bytes4 selector = bytes4(call); if (!canSkipChainIdValidation(selector)) { revert SelectorNotAllowed(selector); }