0xPolygonHermez / cdk-erigon

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

[RPC] Pending txs event not working #1134

Open Damantino opened 1 week ago

Damantino commented 1 week ago

System information

output of git branch

* (HEAD detached at v1.2.15.7)
  zkevm

Config File

datadir: /path/to/my/cdk-erigon/datadir
chain: hermez-mainnet
http: true
private.api.addr: localhost:9091
zkevm.l2-chain-id: 1101
zkevm.l2-sequencer-rpc-url: https://zkevm-rpc.com
zkevm.l2-datastreamer-url: stream.zkevm-rpc.com:6900
zkevm.l1-chain-id: 1
zkevm.l1-rpc-url: http://my-l1-node

zkevm.address-sequencer: "0x148Ee7dAF16574cD020aFa34CC658f8F3fbd2800"
zkevm.address-zkevm: "0x519E42c24163192Dca44CD3fBDCEBF6be9130987"
zkevm.address-admin: "0x242daE44F5d8fb54B198D03a94dA45B5a4413e21"
zkevm.address-rollup: "0x5132A183E9F3CB7C848b0AAC5Ae0c4f0491B7aB2"
zkevm.address-ger-manager: "0x580bda1e7A0CFAe92Fa7F6c20A3794F169CE3CFb"

zkevm.default-gas-price: 1
zkevm.max-gas-price: 0
zkevm.gas-price-factor: 0.0375

zkevm.l1-rollup-id: 1
zkevm.l1-block-range: 20000
zkevm.l1-query-delay: 6000
zkevm.l1-first-block: 16896700
zkevm.rpc-ratelimit: 250
zkevm.datastream-version: 2

externalcl: true
http.api: [eth, debug, net, trace, web3, erigon, zkevm]
http.addr: 0.0.0.0
http.vhosts: any
http.corsdomain: any
ws: true

Erigon Command (with flags/config):

./build/bin/cdk-erigon --config="/mnt/ethereum/cdk-erigon/hermezconfig-mainnet.yaml" --ws

Erigon RPC

./build/bin/rpcdaemon --datadir=/path/to/cdk-erigon/data --txpool.api.addr=localhost:9091 --private.api.addr=localhost:9091 --http.api=eth,erigon,web3,net,debug,trace,txpool,zkevm --ws --ws.compression

Expected behaviour

When I connect to the pending txs event, txs are emitted

> wscat -c http://NODE.URL:PORT/
Connected (press CTRL+C to quit)
> { "id": 1, "jsonrpc": "2.0", "method": "eth_subscribe", "params": ["newPendingTransactions"] }
< {"jsonrpc":"2.0","id":1,"result":"0x5559abef09455d8ad1866b59df71bbf4"}

Actual behaviour

It doesn't emit pending txs

Steps to reproduce the behaviour

  1. Launch node, wait until synchronises
  2. Connect via wscat
  3. Subscribe to the event
V-Staykov commented 1 week ago

I can't seem to be able to reproduce it neither on v1.2.15.7 nor on latest zkevm

Here is what I get on Cardona:

> { "id": 1, "jsonrpc": "2.0", "method": "eth_subscribe", "params": ["newPendingTransactions"] }
< {"jsonrpc":"2.0","id":1,"result":"0xbba81772d7f99d0750f8ad4290a62e62"}
Damantino commented 1 week ago

Hi @V-Staykov the problem is not that it connects to the event, the problem is that it doesn't emit pending txs! Is that a feature or a bug?

V-Staykov commented 1 week ago

Sorry, I got a bit confused, but got it now. So this currently works on a sequencer, but the RPC nodes don't hold the txpool, so they are not notified on a new pending transaction and thus the WS subscription is not updated.

maybe @mandrigin can elaborate on when and if it is planned for our txpool to copy the sequencer one.

Damantino commented 6 days ago

@V-Staykov Thanks for the response and summonning @mandrigin .

Me and my team are building a block explorer for zkevm (https://polygon-zkevm.txain.com/) and would like to have access to show them if possible.