diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea6647f2..5a184f95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,13 @@ jobs: runs-on: ubuntu-latest services: localgeth: - image: dtr22/geth-dev + ports: [ '8545:8545' ] + image: ethereum/client-go:release-1.14 + command: | + --verbosity 2 + --http -http.addr 0.0.0.0 --http.api 'eth,net,web3,debug' --http.port 8545 + --http.vhosts '*,localhost,host.docker.internal' + --dev --rpc.allow-unprotected-txs steps: - uses: actions/setup-node@v1 diff --git a/gascalc/GasChecker.ts b/gascalc/GasChecker.ts index 6221e0b1..2666c01f 100644 --- a/gascalc/GasChecker.ts +++ b/gascalc/GasChecker.ts @@ -27,7 +27,8 @@ const gasCheckerLogFile = './reports/gas-checker.txt' const ethers = hre.ethers const provider = hre.ethers.provider -let ethersSigner = provider.getSigner() +const junkWallet = Wallet.fromMnemonic('test test test test test test test test test test test junk') +const globalSigner = new Wallet(junkWallet.privateKey, provider) let lastGasUsed: number const minDepositOrBalance = parseEther('0.1') @@ -130,7 +131,7 @@ export class GasChecker { defaultAbiCoder.encode(['address'], [this.entryPoint().address]) ]), 0, 2885201) console.log('factaddr', factoryAddress) - const fact = SimpleAccountFactory__factory.connect(factoryAddress, ethersSigner) + const fact = SimpleAccountFactory__factory.connect(factoryAddress, globalSigner) // create accounts const creationOps: PackedUserOperation[] = [] for (const n of range(count)) { @@ -165,7 +166,7 @@ export class GasChecker { await GasCheckCollector.inst.entryPoint.depositTo(addr, { value: minDepositOrBalance.mul(5) }) } } - await this.entryPoint().handleOps(creationOps, ethersSigner.getAddress()) + await this.entryPoint().handleOps(creationOps, globalSigner.getAddress()) } /** @@ -206,7 +207,7 @@ export class GasChecker { const destBalance = await getBalance(dest) if (destBalance.eq(0)) { console.log('dest replenish', dest) - await ethersSigner.sendTransaction({ to: dest, value: 1 }) + await globalSigner.sendTransaction({ to: dest, value: 1 }) } } const accountExecFromEntryPoint = this.accountExec(dest, destValue, destCallData) @@ -335,20 +336,13 @@ export class GasCheckCollector { } async _init (entryPointAddressOrTest: string = 'test'): Promise { - console.log('signer=', await ethersSigner.getAddress()) + console.log('signer=', await globalSigner.getAddress()) DefaultGasTestInfo.beneficiary = createAddress() - const bal = await getBalance(ethersSigner.getAddress()) - if (bal.gt(parseEther('100000000'))) { - console.log('DONT use geth miner.. use account 2 instead') - await checkForGeth() - ethersSigner = ethers.provider.getSigner(2) - } - if (entryPointAddressOrTest === 'test') { this.entryPoint = await deployEntryPoint(provider) } else { - this.entryPoint = EntryPoint__factory.connect(entryPointAddressOrTest, ethersSigner) + this.entryPoint = EntryPoint__factory.connect(entryPointAddressOrTest, globalSigner) } const tableHeaders = [ diff --git a/reports/gas-checker.txt b/reports/gas-checker.txt index 958390df..6d67773e 100644 --- a/reports/gas-checker.txt +++ b/reports/gas-checker.txt @@ -2,9 +2,9 @@ the destination is "account.entryPoint()", which is known to be "hot" address used by this account it little higher than EOA call: its an exec from entrypoint (or account owner) into account contract, verifying msg.sender and exec to target) ╔══════════════════════════╤════════╗ -║ gas estimate "simple" │ 28979 ║ +║ gas estimate "simple" │ 29327 ║ ╟──────────────────────────┼────────╢ -║ gas estimate "big tx 5k" │ 125224 ║ +║ gas estimate "big tx 5k" │ 126098 ║ ╚══════════════════════════╧════════╝ ╔════════════════════════════════╤═══════╤═══════════════╤════════════════╤═════════════════════╗ @@ -12,44 +12,44 @@ ║ │ │ │ (delta for │ (compared to ║ ║ │ │ │ one UserOp) │ account.exec()) ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ simple │ 1 │ 80016 │ │ ║ +║ simple │ 1 │ 80004 │ │ ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ simple - diff from previous │ 2 │ │ 42192 │ 13213 ║ +║ simple - diff from previous │ 2 │ │ 42168 │ 12841 ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ simple │ 10 │ 459919 │ │ ║ +║ simple │ 10 │ 459895 │ │ ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ simple - diff from previous │ 11 │ │ 42235 │ 13256 ║ +║ simple - diff from previous │ 11 │ │ 42235 │ 12908 ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ simple paymaster │ 1 │ 86159 │ │ ║ +║ simple paymaster │ 1 │ 86147 │ │ ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ simple paymaster with diff │ 2 │ │ 41024 │ 12045 ║ +║ simple paymaster with diff │ 2 │ │ 41048 │ 11721 ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ simple paymaster │ 10 │ 455670 │ │ ║ +║ simple paymaster │ 10 │ 455682 │ │ ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ simple paymaster with diff │ 11 │ │ 41112 │ 12133 ║ +║ simple paymaster with diff │ 11 │ │ 41148 │ 11821 ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ big tx 5k │ 1 │ 181060 │ │ ║ +║ big tx 5k │ 1 │ 181036 │ │ ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ big tx - diff from previous │ 2 │ │ 142702 │ 17478 ║ +║ big tx - diff from previous │ 2 │ │ 142702 │ 16604 ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ big tx 5k │ 10 │ 1465489 │ │ ║ +║ big tx 5k │ 10 │ 1465441 │ │ ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ big tx - diff from previous │ 11 │ │ 142710 │ 17486 ║ +║ big tx - diff from previous │ 11 │ │ 142722 │ 16624 ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ paymaster+postOp │ 1 │ 87770 │ │ ║ +║ paymaster+postOp │ 1 │ 87758 │ │ ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ paymaster+postOp with diff │ 2 │ │ 42659 │ 13680 ║ +║ paymaster+postOp with diff │ 2 │ │ 42647 │ 13320 ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ paymaster+postOp │ 10 │ 471836 │ │ ║ +║ paymaster+postOp │ 10 │ 471848 │ │ ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ paymaster+postOp with diff │ 11 │ │ 42692 │ 13713 ║ +║ paymaster+postOp with diff │ 11 │ │ 42704 │ 13377 ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ token paymaster │ 1 │ 128821 │ │ ║ +║ token paymaster │ 1 │ 128809 │ │ ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ token paymaster with diff │ 2 │ │ 66408 │ 37429 ║ +║ token paymaster with diff │ 2 │ │ 66384 │ 37057 ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ ║ token paymaster │ 10 │ 726686 │ │ ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ token paymaster with diff │ 11 │ │ 66524 │ 37545 ║ +║ token paymaster with diff │ 11 │ │ 66536 │ 37209 ║ ╚════════════════════════════════╧═══════╧═══════════════╧════════════════╧═════════════════════╝ diff --git a/scripts/docker-gascalc.yml b/scripts/docker-gascalc.yml index 9dd3901f..af112974 100644 --- a/scripts/docker-gascalc.yml +++ b/scripts/docker-gascalc.yml @@ -16,5 +16,10 @@ services: #configuration is a copy of github/.workflows/build.xml localgeth: - image: dtr22/geth-dev - container_name: localgeth + ports: [ '8545:8545' ] + image: ethereum/client-go:release-1.14 + command: | + --verbosity 2 + --http -http.addr 0.0.0.0 --http.api 'eth,net,web3,debug' --http.port 8545 + --http.vhosts '*,localhost,host.docker.internal' + --dev --rpc.allow-unprotected-txs diff --git a/test/testutils.ts b/test/testutils.ts index 72ede652..59205a3e 100644 --- a/test/testutils.ts +++ b/test/testutils.ts @@ -224,13 +224,13 @@ export async function checkForGeth (): Promise { // NOTE: must run geth with params: // --http.api personal,eth,net,web3 // --allow-insecure-unlock - if (currentNode.match(/geth/i) != null) { - for (let i = 0; i < 2; i++) { - const acc = await provider.request({ method: 'personal_newAccount', params: ['pass'] }).catch(rethrow()) - await provider.request({ method: 'personal_unlockAccount', params: [acc, 'pass'] }).catch(rethrow()) - await fund(acc, '10') - } - } + // if (currentNode.match(/geth/i) != null) { + // for (let i = 0; i < 2; i++) { + // const acc = await provider.request({ method: 'personal_newAccount', params: ['pass'] }).catch(rethrow()) + // await provider.request({ method: 'personal_unlockAccount', params: [acc, 'pass'] }).catch(rethrow()) + // await fund(acc, '10') + // } + // } } // remove "array" members, convert values to strings.