Skip to content

Commit

Permalink
Merge branch 'master' into native-4337-bundler-collector
Browse files Browse the repository at this point in the history
  • Loading branch information
forshtat authored Oct 23, 2024
2 parents be571e4 + f464796 commit 610f413
Show file tree
Hide file tree
Showing 66 changed files with 2,571 additions and 647 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
path = submodules/account-abstraction
url = https://github.com/eth-infinitism/account-abstraction.git
branch = releases/v0.7
[submodule "submodules/rip7560"]
path = submodules/rip7560
url = https://github.com/eth-infinitism/rip7560_contracts.git
2 changes: 0 additions & 2 deletions .idea/aa-bundler.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions .idea/runConfigurations/all_bundler_tests.xml

This file was deleted.

2 changes: 2 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
"workspaces": {
"packages": [
"packages/*",
"submodules/account-abstraction/contracts"
"submodules/account-abstraction/contracts",
"submodules/rip7560"
],
"nohoist": [
"**eslint**"
]
},
"scripts": {
"bundler": "yarn --cwd packages/bundler bundler",
"bundler-rip7560": "yarn --cwd packages/bundler bundler-rip7560",
"runop": "yarn --cwd packages/bundler runop",
"runop-goerli": "yarn runop --network goerli --unsafe",
"create-all-deps": "jq '.dependencies,.devDependencies' packages/*/package.json |sort -u > all.deps",
Expand All @@ -34,7 +36,7 @@
"preprocess1": "yarn submodule-update && yarn && cd submodules/account-abstraction && yarn && yarn --cwd contracts prepack",
"submodule-update": "git submodule update --remote --init --recursive",
"runop-self": "ts-node ./packages/bundler/src/runner/runop.ts --deployFactory --selfBundler --unsafe",
"ci": "env && yarn depcheck && yarn preprocess ; yarn lerna-test"
"ci": "env && yarn depcheck && yarn preprocess && yarn lerna-test"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.33.0",
Expand Down
20 changes: 0 additions & 20 deletions packages/bundler/contracts/BundlerHelper.sol

This file was deleted.

11 changes: 8 additions & 3 deletions packages/bundler/localconfig/bundler.config.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"chainId": 1337,
"gasFactor": "1",
"port": "3000",
"privateApiPort": "3001",
"network": "http://127.0.0.1:8545",
"entryPoint": "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
"beneficiary": "0xd21934eD8eAf27a67f0A70042Af50A1D6d195E81",
"minBalance": "1",
"mnemonic": "./localconfig/mnemonic.txt",
"maxBundleGas": 5e6,
"minStake": "1" ,
"minUnstakeDelay": 0 ,
"minStake": "1",
"minUnstakeDelay": 0,
"autoBundleInterval": 3,
"autoBundleMempoolSize": 10
"autoBundleMempoolSize": 10,
"rip7560": false,
"rip7560Mode": "PULL",
"gethDevMode": true
}
19 changes: 19 additions & 0 deletions packages/bundler/localconfig/bundler.rip7560.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"chainId": 1337,
"gasFactor": "1",
"port": "3000",
"privateApiPort": "3001",
"network": "http://127.0.0.1:8545",
"entryPoint": "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
"beneficiary": "0xd21934eD8eAf27a67f0A70042Af50A1D6d195E81",
"minBalance": "1",
"mnemonic": "./localconfig/mnemonic.txt",
"maxBundleGas": 30e6,
"minStake": "1",
"minUnstakeDelay": 0,
"autoBundleInterval": 3,
"autoBundleMempoolSize": 10,
"rip7560": true,
"rip7560Mode": "PULL",
"gethDevMode": true
}
1 change: 1 addition & 0 deletions packages/bundler/mnemonic.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test test test test test test test test test test test junk
4 changes: 4 additions & 0 deletions packages/bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"scripts": {
"runop": "ts-node ./src/runner/runop.ts",
"bundler": "TS_NODE_TRANSPILE_ONLY=1 ts-node ./src/exec.ts --config ./localconfig/bundler.config.json",
"bundler-rip7560": "ts-node ./src/exec.ts --config ./localconfig/bundler.rip7560.config.json",
"clear": "rm -rf dist artifacts cache src/types",
"hardhat-compile": "hardhat compile",
"hardhat-node": "npx hardhat node --no-deploy",
Expand All @@ -27,6 +28,7 @@
"@account-abstraction/sdk": "^0.7.0",
"@account-abstraction/utils": "^0.7.0",
"@account-abstraction/validation-manager": "^0.7.0",
"@ethereumjs/rlp": "^5.0.2",
"@ethersproject/abi": "^5.7.0",
"@ethersproject/providers": "^5.7.0",
"@types/cors": "^2.8.12",
Expand All @@ -51,10 +53,12 @@
"@types/chai": "^4.2.0",
"@types/mocha": "^9.1.0",
"@types/node": "^16.4.12",
"@types/sinon": "^17.0.3",
"body-parser": "^1.20.0",
"chai": "^4.2.0",
"hardhat": "^2.17.0",
"hardhat-deploy": "^0.11.11",
"sinon": "^18.0.0",
"solidity-coverage": "^0.7.21",
"ts-node": ">=8.0.0",
"typechain": "^8.1.0"
Expand Down
49 changes: 48 additions & 1 deletion packages/bundler/src/BundlerConfig.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
// TODO: consider adopting config-loading approach from hardhat to allow code in config file
import ow from 'ow'

// RIP-7560 EntyPoint address
const MIN_UNSTAKE_DELAY = 86400
const MIN_STAKE_VALUE = 1e18.toString()

export interface BundlerConfig {
chainId: number
beneficiary: string
entryPoint: string
gasFactor: string
minBalance: string
mnemonic: string
network: string
port: string
privateApiPort: string
unsafe: boolean
tracerRpcUrl?: string
debugRpc?: boolean
Expand All @@ -23,17 +27,32 @@ export interface BundlerConfig {
minUnstakeDelay: number
autoBundleInterval: number
autoBundleMempoolSize: number
rip7560: boolean
rip7560Mode: string
gethDevMode: boolean

// Config overrides for PreVerificationGas calculation
fixedGasOverhead?: number
perUserOpGasOverhead?: number
perUserOpWordGasOverhead?: number
zeroByteGasCost?: number
nonZeroByteGasCost?: number
expectedBundleSize?: number
estimationSignatureSize?: number
estimationPaymasterDataSize?: number
}

// TODO: implement merging config (args -> config.js -> default) and runtime shape validation
export const BundlerConfigShape = {
chainId: ow.number,
beneficiary: ow.string,
entryPoint: ow.string,
gasFactor: ow.string,
minBalance: ow.string,
mnemonic: ow.string,
network: ow.string,
port: ow.string,
privateApiPort: ow.string,
unsafe: ow.boolean,
tracerRpcUrl: ow.optional.string,
debugRpc: ow.optional.boolean,
Expand All @@ -45,13 +64,41 @@ export const BundlerConfigShape = {
minStake: ow.string,
minUnstakeDelay: ow.number,
autoBundleInterval: ow.number,
autoBundleMempoolSize: ow.number
autoBundleMempoolSize: ow.number,
rip7560: ow.boolean,
rip7560Mode: ow.string.oneOf(['PULL', 'PUSH']),
gethDevMode: ow.boolean,

// Config overrides for PreVerificationGas calculation
fixedGasOverhead: ow.optional.number,
perUserOpGasOverhead: ow.optional.number,
perUserOpWordGasOverhead: ow.optional.number,
zeroByteGasCost: ow.optional.number,
nonZeroByteGasCost: ow.optional.number,
expectedBundleSize: ow.optional.number,
estimationSignatureSize: ow.optional.number,
estimationPaymasterDataSize: ow.optional.number
}

/**
* Only parameters in this object can be provided by a 'debug_bundler_setConfiguration' API.
*/
export const DebugBundlerConfigShape = {
fixedGasOverhead: ow.optional.number,
perUserOpGasOverhead: ow.optional.number,
perUserOpWordGasOverhead: ow.optional.number,
zeroByteGasCost: ow.optional.number,
nonZeroByteGasCost: ow.optional.number,
expectedBundleSize: ow.optional.number,
estimationSignatureSize: ow.optional.number,
estimationPaymasterDataSize: ow.optional.number
}

// TODO: consider if we want any default fields at all
// TODO: implement merging config (args -> config.js -> default) and runtime shape validation
export const bundlerConfigDefault: Partial<BundlerConfig> = {
port: '3000',
privateApiPort: '3001',
entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032',
unsafe: false,
conditionalRpc: false,
Expand Down
Loading

0 comments on commit 610f413

Please sign in to comment.