Closed rho-cassiopeiae closed 3 weeks ago
i think you will solve just using make devnet-up-deploy
, when "devnet-up" just compilation and basic tasks are completed, at "deploy" some txns are executed over your L1+L2 devnet and fund main accounts :D
Hey @rho-cassiopeiae, can you dm me on telegram (@rflihxyz)! I'm trying to do the same and would love to chat about it! Best
@rho-cassiopeiae Thanks for being interested in trying to run a bundler on optimism devnet! I've opened a couple of PRs attempting to make this process easier.
We currently have 2 devnets and I am working on consolidating them into a single devnet. The two commands are:
make devnet-up
make devnet-up-deploy
Regarding the lack of funds, #6463 was created to add more accounts with funds at genesis for make devnet-up
. You can check the balance of an account using cast balance
- if the accounts do not have funds on L1, then something is wrong. Be sure to use the right port, I believe 8545
is the L1 port.
It would be super helpful to confirm if make devnet-up
or make devnet-up-deploy
has the genesis funds at the dev accounts.
I see here that the hardhat config for the bundler contracts uses the same mnemonic that we use to seed genesis accounts so it seems like they are not funded in the genesis? https://github.com/eth-infinitism/bundler/blob/623991115d891419408ccffb8b65c0c4bb48421c/packages/bundler/hardhat.config.ts#L11
HI @rflihxyz @netzulo @rho-cassiopeiae
Lovely to see this discussion, would love to invite you to our exclusive builders chat here: https://t.me/+nUBuIdVYanZjZWZh
We have an AA specific channel where you can ask questions and get connected with others in the eco!
If you want to verify me, feel free to DM me on twitter @binji_x
If the link is broken, you can use this one : https://t.me/+oUu1W1Z6WI03MTFh
I was unable to make eth-infinitism bundler work, but found one that does work – etherspot. Incidentally, it also does better job estimating user operation gas.
--rpc.allow-unprotected-txs
flag to both entrypoint files in ops-bedrock
folder.make devnet-up
bundler-config.json
file anywhere you want with this content:
{
"networks": {
"dev": {
"entryPoints": [
"0x48e60BBb664aEfAc9f14aDB42e5FB5b4a119EB66"
],
"relayer": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
"beneficiary": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"rpcEndpoint": "http://host.docker.internal:9545",
"estimationStaticBuffer": 21000,
"validationGasLimit": 10e6,
"receiptLookupRange": 1024,
"conditionalTransactions": false
}
}
}
0x48e60BBb664aEfAc9f14aDB42e5FB5b4a119EB66
is the address at which we will deploy EntryPoint later. Bundler can be started before deploying it.
http://host.docker.internal:9545
– use this endpoint since both devnet and bundler run in Docker but on different networks.
docker run --rm -d --mount type=bind,source=/absolute/path/to/bundler-config.json,target=/usr/app/config.json,readonly -p 3000:14337 etherspot/skandha:0.0.31 start --unsafeMode
Source path has to be absolute.
git clone https://github.com/eth-infinitism/account-abstraction
somewhere and cd
into ityarn && yarn install
optimismLocal: getNetwork1('http://localhost:9545')
In 1_deploy_entrypoint.ts replace the lines:
const from = await provider.getSigner().getAddress()
await new Create2Factory(ethers.provider).deployFactory()
with
const signer = provider.getSigner()
const from = await signer.getAddress()
await new Create2Factory(ethers.provider).deployFactory(signer)
And in 2_deploy_SimpleAccountFactory.ts where there is a line checking chainId
add a condition for 901 (OP devnet chain id).
yarn hardhat deploy --network optimismLocal
You will most likely need to run this command 4-5 times, because for some reason first several attempts fail with various errors (not enough funds / unable to deterministically deploy / nonce already used / etc). I don't know why it doesn't work right away, so just keep running it until it works. Not the greatest method, I know. You can make a loop with try-catch in the code I suppose, instead.http://localhost:3000/1337
. Unfortunately the /1337
path is hardcoded in the bundler code when you specify dev
network in the config (like we did), so have to use it even though the network id is actually 901. It doesn't affect anything.eth_estimateUserOperationGas
this bundler implementation returns the value for verificationGasLimit
under the key verificationGas
(without "Limit"), which differs from most other bundler implementations I've seen.executeBatch
method which accepts only 2 arguments, while SimpleAccountFactory which we deployed locally has this method accepting 3 arguments, since it's newer implementation. This caused me a couple of hours of pulling my hair out trying to figure out why single operations work while batched ones do not.As you can see this is not the cleanest method but it works. Would be great it someone figures out how to do it with less steps.
I'm trying to run this bundler together with local devnet, but have no luck.
I first add
--rpc.allow-unprotected-txs
flag to both entrypoint.sh files in ops-bedrock folder, since without it I get "only replay-protected (EIP-155) transactions allowed over RPC" error later. Then I launch the devnet usingmake devnet-up
and make some adjustments in the bundler code: change all relevant target ports from 8545 to 9545 and in the 2-deploy-entrypoint.ts file comment out the code that checks thatchainId
is either 1337 or 31337, since it is actually 901.But when I run
yarn hardhat-deploy --network localhost
to deploy the entrypoint, I get "Insufficient funds" error.I think I need to change some private key-related settings of the devnet, but I'm not sure which ones. I tried changing
BLOCK_SIGNER_PRIVATE_KEY
andBLOCK_SIGNER_ADDRESS
to0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
and0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
(test*11 junk
mnemonic account 0), since the bundler seems to be using this account for deployment, but still got the same error.Describe the solution you'd like It would be great to have a local bundler out of the box, since there is already support for ERC-4337 on both OP Goerli and OP Mainnet.
Describe alternatives you've considered Currently I have to run the bundler on hardhat L1. It works fine without any adjustments, but since I'm developing for Optimism it's not what I ultimately need.
Hi @rho-cassiopeiae this bundler run smoothly in my fresh Ubuntu 22.04, Make sure you start the devnet correctly. I recommend install geth by make install-geth
in the optimism mono.
Successful Launch: After following these steps, I successfully ran the bundler on port 3000 and made sure it was bound to port 9545.
Removed ChainID Validation: To adapt to a specific network setting, I removed the ChainID validation located in the ./bundler/packages/bundler/deploy/2-deploy-entrypoint.ts
.
Port Adjustment: I changed the port number to 9545 in both./bundler/packages/bundler/hardhat.config.ts
and ./bundler/packages/bundler/localconfig/bundler.config.json
.
Shell Script Update: I revised the ./optimism/ops-bedrock/entrypoint-l2.sh
script to accommodate the new configurations and environment variables.
Funds deploymentSignerAddress: Using port 9545, I sent 1 ETH to the address 0x3fab184622dc19b6109349b94811493bf2a45362.
I also find the process pretty cumbersome. So, I'm planning to create a middleware that combines op-devnet and bundler, making the whole setup plug-and-play.
let me know if you have more question.
I was unable to make eth-infinitism bundler work, but found one that does work – etherspot. Incidentally, it also does better job estimating user operation gas.
- Add
--rpc.allow-unprotected-txs
flag to both entrypoint files inops-bedrock
folder.make devnet-up
- Create
bundler-config.json
file anywhere you want with this content:{ "networks": { "dev": { "entryPoints": [ "0x48e60BBb664aEfAc9f14aDB42e5FB5b4a119EB66" ], "relayer": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", "beneficiary": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "rpcEndpoint": "http://host.docker.internal:9545", "estimationStaticBuffer": 21000, "validationGasLimit": 10e6, "receiptLookupRange": 1024, "conditionalTransactions": false } } }
0x48e60BBb664aEfAc9f14aDB42e5FB5b4a119EB66
is the address at which we will deploy EntryPoint later. Bundler can be started before deploying it.http://host.docker.internal:9545
– use this endpoint since both devnet and bundler run in Docker but on different networks.
- Start bundler
docker run --rm -d --mount type=bind,source=/absolute/path/to/bundler-config.json,target=/usr/app/config.json,readonly -p 3000:14337 etherspot/skandha:0.0.31 start --unsafeMode
Source path has to be absolute.
git clone https://github.com/eth-infinitism/account-abstraction
somewhere andcd
into ityarn && yarn install
- Need to make a couple of changes here: In hardhat.config.ts add a new network:
optimismLocal: getNetwork1('http://localhost:9545')
In 1_deploy_entrypoint.ts replace the lines:const from = await provider.getSigner().getAddress() await new Create2Factory(ethers.provider).deployFactory()
with
const signer = provider.getSigner() const from = await signer.getAddress() await new Create2Factory(ethers.provider).deployFactory(signer)
And in 2_deploy_SimpleAccountFactory.ts where there is a line checking
chainId
add a condition for 901 (OP devnet chain id).
yarn hardhat deploy --network optimismLocal
You will most likely need to run this command 4-5 times, because for some reason first several attempts fail with various errors (not enough funds / unable to deterministically deploy / nonce already used / etc). I don't know why it doesn't work right away, so just keep running it until it works. Not the greatest method, I know. You can make a loop with try-catch in the code I suppose, instead.- The output will show the addresses of EntryPoint and SimpleAccountFactory contracts. Make sure that the EntryPoint address matches the one specified in bundler-config.json.
- Fund EntryPoint address with eth. Not sure if this step is necessary, but this is what etherspot do in their tests.
- Bundler will be available at
http://localhost:3000/1337
. Unfortunately the/1337
path is hardcoded in the bundler code when you specifydev
network in the config (like we did), so have to use it even though the network id is actually 901. It doesn't affect anything.- Gotcha 1: when calling
eth_estimateUserOperationGas
this bundler implementation returns the value forverificationGasLimit
under the keyverificationGas
(without "Limit"), which differs from most other bundler implementations I've seen.- Gotcha 2: SimpleAccountFactory currently deployed on various test and mainnets deploys SimpleAccount that has
executeBatch
method which accepts only 2 arguments, while SimpleAccountFactory which we deployed locally has this method accepting 3 arguments, since it's newer implementation. This caused me a couple of hours of pulling my hair out trying to figure out why single operations work while batched ones do not.As you can see this is not the cleanest method but it works. Would be great it someone figures out how to do it with less steps.
I suspect the reason for having to run it multiple times might be insufficient funding. All in all, I'm working on a middleware to make the integration between the two more seamless.
https://github.com/joohhnnn/OPBundlerAutoConfig @rho-cassiopeiae Hope this repo can help you
0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789
. The address reflects the code (and also compiler settings), so your address obviously reference another one.The entrypoints are not preinstalls on OP Stack chains
I'm trying to run this bundler together with local devnet, but have no luck.
I first add
--rpc.allow-unprotected-txs
flag to both entrypoint.sh files in ops-bedrock folder, since without it I get "only replay-protected (EIP-155) transactions allowed over RPC" error later. Then I launch the devnet usingmake devnet-up
and make some adjustments in the bundler code: change all relevant target ports from 8545 to 9545 and in the 2-deploy-entrypoint.ts file comment out the code that checks thatchainId
is either 1337 or 31337, since it is actually 901.But when I run
yarn hardhat-deploy --network localhost
to deploy the entrypoint, I get "Insufficient funds" error.I think I need to change some private key-related settings of the devnet, but I'm not sure which ones. I tried changing
BLOCK_SIGNER_PRIVATE_KEY
andBLOCK_SIGNER_ADDRESS
to0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
and0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
(test*11 junk
mnemonic account 0), since the bundler seems to be using this account for deployment, but still got the same error.Describe the solution you'd like It would be great to have a local bundler out of the box, since there is already support for ERC-4337 on both OP Goerli and OP Mainnet.
Describe alternatives you've considered Currently I have to run the bundler on hardhat L1. It works fine without any adjustments, but since I'm developing for Optimism it's not what I ultimately need.