Skip to content

Commit

Permalink
Merge pull request coinbase#43 from base-org/wilson/cleanup
Browse files Browse the repository at this point in the history
remove unused references and other cleanup
  • Loading branch information
wilsoncusack authored Feb 9, 2024
2 parents 594d987 + 732bbf0 commit 7aa092a
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 52 deletions.
38 changes: 19 additions & 19 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,35 @@ AddOwnerAtIndexTest:testRevertsIfCalledByNonOwner() (gas: 13726)
AddOwnerAtIndexTest:testRevertsIfOwnerIndexNot255() (gas: 966358)
AddOwnerAtIndexTest:testSetsIsOwner() (gas: 90496)
AddOwnerAtIndexTest:testSetsOwnerAtIndex() (gas: 98354)
ERC1271Test:test_returnsExpectedDomainHashWhenProxy() (gas: 15396)
ERC4337FactoryTest:testDeployDeterministicPassValues() (gas: 265838)
ERC4337FactoryTest:test_createAccountDeploysToPredeterminedAddress() (gas: 267079)
ERC4337FactoryTest:test_createAccountSetsOwnersCorrectly() (gas: 266266)
ERC4337Test:testExecute() (gas: 424916)
ERC4337Test:testExecuteBatch() (gas: 728197)
ERC4337Test:testExecuteBatch(uint256) (runs: 256, μ: 3645336, ~: 3788305)
ERC1271Test:test_returnsExpectedDomainHashWhenProxy() (gas: 15399)
ERC4337FactoryTest:testDeployDeterministicPassValues() (gas: 265746)
ERC4337FactoryTest:test_createAccountDeploysToPredeterminedAddress() (gas: 267009)
ERC4337FactoryTest:test_createAccountSetsOwnersCorrectly() (gas: 266174)
ERC4337Test:testExecute() (gas: 425516)
ERC4337Test:testExecuteBatch() (gas: 729429)
ERC4337Test:testExecuteBatch(uint256) (runs: 256, μ: 3636833, ~: 3491940)
ERC4337Test:testInitialize() (gas: 21035)
ERC4337Test:testRevertsIfEthereumSignatureButWrongOwnerLength() (gas: 31953)
ERC4337Test:testRevertsIfPasskeySigButWrongOwnerLength() (gas: 58953)
ERC4337Test:testRevertsIfPasskeySigButWrongOwnerLength() (gas: 39483)
ERC4337Test:testValidateSignatureWithEOASigner() (gas: 25076)
ERC4337Test:testValidateSignatureWithEOASignerFailsWithWrongSigner() (gas: 23939)
ERC4337Test:testValidateSignatureWithPasskeySigner() (gas: 444660)
ERC4337Test:testValidateSignatureWithPasskeySignerFailsBadOwnerIndex() (gas: 54003)
ERC4337Test:testValidateSignatureWithPasskeySignerFailsWithWrongBadSignature() (gas: 441472)
ERC4337Test:testValidateSignatureWithPasskeySigner() (gas: 425190)
ERC4337Test:testValidateSignatureWithPasskeySignerFailsBadOwnerIndex() (gas: 34533)
ERC4337Test:testValidateSignatureWithPasskeySignerFailsWithWrongBadSignature() (gas: 422002)
ERC4337Test:testValidateUserOp() (gas: 447685)
ERC4337Test:test__codesize() (gas: 54122)
ERC4337Test:test_cannotInitImplementation() (gas: 2922300)
ERC4337Test:test__codesize() (gas: 53984)
ERC4337Test:test_cannotInitImplementation() (gas: 2916608)
MultiOwnableInitializeTest:testRevertsIfLength32ButLargerThanAddress() (gas: 78949)
MultiOwnableInitializeTest:testRevertsIfLengthNot32Or64() (gas: 101256)
RemoveOwnerAtIndexTest:testEmitsRemoveOwner() (gas: 36894)
RemoveOwnerAtIndexTest:testRemovesOwner() (gas: 32786)
RemoveOwnerAtIndexTest:testRemovesOwnerAtIndex() (gas: 27752)
RemoveOwnerAtIndexTest:testRevertsIfCalledByNonOwner() (gas: 11389)
RemoveOwnerAtIndexTest:testRevertsIfNoOwnerAtIndex() (gas: 16708)
TestCanSkipChainIdValidation:test_approvedSelectorsReturnTrue() (gas: 20395)
TestCanSkipChainIdValidation:test_otherSelectorsReturnFalse() (gas: 12891)
TestExecuteWithoutChainIdValidation:test_canChangeOwnerWithoutChainId() (gas: 288400)
TestExecuteWithoutChainIdValidation:test_cannotCallExec() (gas: 220294)
TestCanSkipChainIdValidation:test_approvedSelectorsReturnTrue() (gas: 19987)
TestCanSkipChainIdValidation:test_otherSelectorsReturnFalse() (gas: 12755)
TestExecuteWithoutChainIdValidation:test_canChangeOwnerWithoutChainId() (gas: 288405)
TestExecuteWithoutChainIdValidation:test_cannotCallExec() (gas: 220299)
TestExecuteWithoutChainIdValidation:test_revertsIfCallerNotEntryPoint() (gas: 8598)
TestExecuteWithoutChainIdValidation:test_revertsIfWrongNonceKey() (gas: 62326)
TestExecuteWithoutChainIdValidation:test_revertsWithReservedNonce() (gas: 82297)
TestExecuteWithoutChainIdValidation:test_revertsIfWrongNonceKey() (gas: 62331)
TestExecuteWithoutChainIdValidation:test_revertsWithReservedNonce() (gas: 82302)
7 changes: 0 additions & 7 deletions remappings.txt

This file was deleted.

3 changes: 1 addition & 2 deletions script/Transact.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import {Script, console2} from "forge-std/Script.sol";

import {ERC4337Factory, ERC4337Account} from "../src/ERC4337Factory.sol";
import {WebAuthn} from "../src/WebAuthn.sol";
import {IEntryPoint, UserOperation} from "account-abstraction/contracts/interfaces/IEntryPoint.sol";
import {IEntryPoint, UserOperation} from "account-abstraction/interfaces/IEntryPoint.sol";
import "../test/Utils.sol";
import "p256-verifier/src/P256.sol";

contract TransactScript is Script {
ERC4337Factory f = ERC4337Factory(0x748e5dD94d5F619371d763adfcBB0eDB863905fD);
Expand Down
4 changes: 2 additions & 2 deletions src/ERC4337Account.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.21;
pragma solidity 0.8.23;

import {Receiver} from "solady/src/accounts/Receiver.sol";
import {UUPSUpgradeable} from "solady/src/utils/UUPSUpgradeable.sol";
import {SignatureCheckerLib} from "solady/src/utils/SignatureCheckerLib.sol";
import {UserOperation, UserOperationLib} from "account-abstraction/contracts/interfaces/UserOperation.sol";
import {UserOperation, UserOperationLib} from "account-abstraction/interfaces/UserOperation.sol";
import {WebAuthn} from "./WebAuthn.sol";

import {MultiOwnable} from "./MultiOwnable.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/WebAuthn.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
pragma solidity ^0.8.0;

// TODO check apache license
import {Base64Url} from "FreshCryptoLib/utils/Base64Url.sol";
Expand Down
3 changes: 1 addition & 2 deletions test/ERC4337Account.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import "solady/test/utils/TestPlus.sol";
import {SignatureCheckerLib} from "solady/src/utils/SignatureCheckerLib.sol";
import {UUPSUpgradeable} from "solady/src/utils/UUPSUpgradeable.sol";
import {Ownable} from "solady/src/auth/Ownable.sol";
import "p256-verifier/src/utils/Base64URL.sol";
import {IEntryPoint, UserOperation, UserOperationLib} from "account-abstraction/contracts/interfaces/IEntryPoint.sol";
import {IEntryPoint, UserOperation, UserOperationLib} from "account-abstraction/interfaces/IEntryPoint.sol";

import "./Utils.sol";
import {MockEntryPoint} from "./mocks/MockEntryPoint.sol";
Expand Down
3 changes: 1 addition & 2 deletions test/ERC4337Account/ERC4337AccountTestBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.21;

import {Test, console2, stdError} from "forge-std/Test.sol";
import {IEntryPoint} from "account-abstraction/contracts/interfaces/IEntryPoint.sol";
import {IEntryPoint} from "account-abstraction/interfaces/IEntryPoint.sol";

import "../../src/ERC4337Account.sol";
import {MockERC4337Account} from "../mocks/MockERC4337Account.sol";
Expand All @@ -23,7 +23,6 @@ contract AccountTestBase is Test {
bytes userOpCalldata;

function setUp() public virtual {
vm.etch(0xc2b78104907F722DABAc4C69f826a522B2754De4, Static.P256_BYTES);
vm.etch(0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789, Static.ENTRY_POINT_BYTES);
account = new MockERC4337Account();
owners.push(abi.encode(signer));
Expand Down
12 changes: 1 addition & 11 deletions test/ERC4337Account/ExecuteWithoutChainIdValidation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ pragma solidity ^0.8.21;
import "./ERC4337AccountTestBase.t.sol";

contract TestExecuteWithoutChainIdValidation is AccountTestBase {
event UserOperationEvent(
bytes32 indexed userOpHash,
address indexed sender,
address indexed paymaster,
uint256 nonce,
bool success,
uint256 actualGasCost,
uint256 actualGasUsed
);

function setUp() public override {
super.setUp();
userOpNonce = account.REPLAYABLE_NONCE_KEY() << 64;
Expand Down Expand Up @@ -51,7 +41,7 @@ contract TestExecuteWithoutChainIdValidation is AccountTestBase {
);
UserOperation memory userOp = _getUserOpWithSignature();
vm.expectEmit(true, true, true, true);
emit UserOperationEvent(
emit IEntryPoint.UserOperationEvent(
entryPoint.getUserOpHash(userOp), userOp.sender, address(0), userOp.nonce, false, 0, 48245
);
_sendUserOperation(userOp);
Expand Down
4 changes: 0 additions & 4 deletions test/ERC4337Account/Static.sol

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

import "../src/ERC4337Account.sol";
import "p256-verifier/src/utils/Base64URL.sol";
import {Base64Url} from "FreshCryptoLib/utils/Base64Url.sol";

struct WebAuthnInfo {
bytes authenticatorData;
Expand All @@ -12,7 +12,7 @@ struct WebAuthnInfo {

library Utils {
function getWebAuthnStruct(bytes32 challenge) public pure returns (WebAuthnInfo memory) {
string memory challengeb64url = Base64URL.encode(abi.encode(challenge));
string memory challengeb64url = Base64Url.encode(abi.encode(challenge));
string memory clientDataJSON = string(
abi.encodePacked(
'{"type":"webauthn.get","challenge":"',
Expand Down

0 comments on commit 7aa092a

Please sign in to comment.