0xPolygonHermez / cdk-erigon

Ethereum implementation on the efficiency frontier
GNU Lesser General Public License v3.0
35 stars 33 forks source link

How to test with local zkEVM Nodes? #19

Closed zjg555543 closed 9 months ago

zjg555543 commented 9 months ago

The cdk-erigion is great! Thank you very much!

Quesion

I have tested it on hermezconfig-testnet.yaml succeed with the readme.md. BTW

Failed details

Flow as

# setup zkevm node
git clone https://github.com/0xPolygonHermez/zkevm-node.git

cd zkevm-node
git checkout v0.4.1
make build-docker
cd test/
make run
docker ps -a | grep zkevm-sequencer
# the datastreamer is listen with 6900
#set up erigon
git clone https://github.com/0xPolygonHermez/cdk-erigon.git
./build/bin/zkevm-erigon --config="dev.yaml"
# dev.yaml
datadir : '/data/zhujianguo/erigon-rpc/erigon_data'
chain : "dev"
http : true
private.api.addr : "localhost:9093"
zkevm.l2-chain-id: 1001 
zkevm.l2-sequencer-rpc-url: "http://127.0.0.1:8123"
zkevm.l2-datastreamer-url: "127.0.0.1:6900"
zkevm.l1-chain-id: 1337
zkevm.l1-rpc-url: "http://127.0.0.1:8545"
zkevm.l1-contract-address: "0x610178dA211FEF7D417bC0e6FeD39F05609AD788"
zkevm.l1-matic-contract-address: "0x5FbDB2315678afecb367f032d93F642f64180aa3"
zkevm.l1-ger-manager-contract-address: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6"
zkevm.l1-first-block: 134 
zkevm.rpc-ratelimit: 250
torrent.port: 42071

externalcl: true
http.api : ["eth","debug","net","trace","web3","erigon","zkevm"]

The error like this:

INFO[12-15|03:50:48.502] logging to file system                   log dir=/root/.local/share/erigon/logs file prefix=erigon log level=info json=false
INFO[12-15|03:50:48.517] Build info                               git_branch=zkevm git_tag=v2.31.0-rc.4-881-g737410d98a git_commit=737410d98a5a51dc5dcbc5e5adfc964aa487f0ca
INFO[12-15|03:50:48.517] Starting Erigon in ephemeral dev mode... 
INFO[12-15|03:50:48.518] Maximum peer count                       ETH=100 total=100
INFO[12-15|03:50:48.518] Development chain flags set              --nodiscover=true --v5disc=false --port=:0
INFO[12-15|03:50:48.519] starting HTTP APIs                       APIs=eth,debug,net,trace,web3,erigon,zkevm
INFO[12-15|03:50:48.519] torrent verbosity                        level=WRN
INFO[12-15|03:50:50.622] Set global gas cap                       cap=50000000
INFO[12-15|03:50:50.622] Using developer account                  address=0x67b1d87101671b127f5f8714789C7192f7ad340e
INFO[12-15|03:50:50.622] Using custom developer period            seconds=0
INFO[12-15|03:50:50.623] [Downloader] Runnning with               ipv6-enabled=true ipv4-enabled=true download.rate=16mb upload.rate=4mb
INFO[12-15|03:50:50.623] Opening Database                         label=chaindata path=/data/zhujianguo/erigon-rpc/erigon_data/chaindata
INFO[12-15|03:50:50.624] Initialised chain configuration          config="{ChainID: 1337, Homestead: 0, DAO: <nil>, Tangerine Whistle: 0, Spurious Dragon: 0, Byzantium: 0, Constantinople: 0, Petersburg: 0, Istanbul: 0, Muir Glacier: 0, Berlin: 0, London: 18446744073709551615, Arrow Glacier: <nil>, Gray Glacier: <nil>, Terminal Total Difficulty: <nil>, Merge Netsplit: <nil>, Shanghai: 18446744073709551615, Cancun: 18446744073709551615, Prague: 18446744073709551615, Engine: clique, Mordor: 0}" genesis=0xd3f7028a6eeb6ed65c17aef746f786902bef102a0159645ecab4698d3650266b
INFO[12-15|03:50:50.624] Effective                                prune_flags= snapshot_flags= history.v3=false
INFO[12-15|03:50:50.629] Initialising Ethereum protocol           network=1337
INFO[12-15|03:50:50.633] Starting private RPC server              on=localhost:9093
INFO[12-15|03:50:50.634] new subscription to logs established 
INFO[12-15|03:50:50.634] Starting datastream client... 
INFO[12-15|03:50:50.644] rpc filters: subscribing to Erigon events 
INFO[12-15|03:50:50.644] [txpool] Started 
INFO[12-15|03:50:50.644] new subscription to newHeaders established 
INFO[12-15|03:50:50.644] New txs subscriber joined 
INFO[12-15|03:50:50.645] Reading JWT secret                       path=/data/zhujianguo/erigon-rpc/erigon_data/jwt.hex
INFO[12-15|03:50:50.645] HTTP endpoint opened for Engine API      url=127.0.0.1:8551 ws=true ws.compression=true
INFO[12-15|03:50:50.645] HTTP endpoint opened                     url=127.0.0.1:8545 ws=false ws.compression=true grpc=false
INFO[12-15|03:50:50.649] Started P2P networking                   version=68 self=enode://5a3608fbb5b582584056559810a35a234ed76594bdfa3be43b775f9d206de578b6f45bd44c3c1dd3e141659f0393747adad90f2691ee4ac13065a628b1d9e63a@127.0.0.1:0 name=erigon/v2.43.0-dev-737410d9/linux-amd64/go1.20.12
INFO[12-15|03:50:50.652] Started P2P networking                   version=67 self=enode://5a3608fbb5b582584056559810a35a234ed76594bdfa3be43b775f9d206de578b6f45bd44c3c1dd3e141659f0393747adad90f2691ee4ac13065a628b1d9e63a@127.0.0.1:0 name=erigon/v2.43.0-dev-737410d9/linux-amd64/go1.20.12
INFO[12-15|03:50:50.655] [1/14 L1Syncer] Starting L1 sync stage 
INFO[12-15|03:50:50.655] Starting L1 syncer thread 
INFO[12-15|03:50:50.657] [1/14 L1Syncer] No new L1 blocks to sync 
INFO[12-15|03:50:50.657] [1/14 L1Syncer] Finished L1 sync stage  
INFO[12-15|03:50:50.657] [2/14 Batches] Starting batches stage 
INFO[12-15|03:50:50.657] [2/14 Batches] Starting stream           startBlock=0
INFO[12-15|03:50:50.657] [2/14 Batches] Reading blocks from the datastream. 
INFO[12-15|03:50:50.657] [2/14 Batches] Started downloading L2Blocks routine 
INFO[12-15|03:50:50.658] [2/14 Batches] Finished downloading L2Blocks routine 
INFO[12-15|03:50:50.658] [2/14 Batches] Finished Batches stage 
EROR[12-15|03:50:50.658] Staged Sync                              err="[2/14 Batches] l2blocks download routine error: 127.0.0.1:38482 read full L2 blocks error: failed to read full block: parse l2Transaction error: expected encoded length: 3299738289, got: 77"
INFO[12-15|03:50:51.159] [2/14 Batches] Starting batches stage 
INFO[12-15|03:50:51.159] [2/14 Batches] Starting stream           startBlock=0
INFO[12-15|03:50:51.159] [2/14 Batches] Reading blocks from the datastream. 
INFO[12-15|03:50:51.159] [2/14 Batches] Started downloading L2Blocks routine 
INFO[12-15|03:50:51.159] [2/14 Batches] Finished Batches stage 
EROR[12-15|03:50:51.159] Staged Sync                              err="[2/14 Batches] l2blocks download routine error: bad bookmark"
INFO[12-15|03:50:51.159] [2/14 Batches] Finished downloading L2Blocks routine 
INFO[12-15|03:50:51.659] [2/14 Batches] Starting batches stage 

I think the problem is the ./core/allocs/dev.json, but after i replaced this file, there is the same error too.

revitteth commented 9 months ago

Thanks! In order to wire up a dev.json in allocs and chainspecs you would also need to add code. I think the best way to quickly try this would be to override the allocs/chainspecs and set config for hermez-devnet. This should allow changing the genesis, the chainid, etc.

The chain in your yaml config would then be hermez-devnet.