wealdtech / ethereal

Apache License 2.0
209 stars 41 forks source link

Can't send transactions on Polygon zkEVM #55

Closed danimesq closed 1 month ago

danimesq commented 1 month ago

ethereal version: 2.8.7

blockchain-writer-suite/poster/blockchain-poster on  main [✘!+?⇡] took 3s ❯ bash script.sh msg.txt 0x117483E977B4EdEe761486F645bca5824b02b1d3 --network polygonzkevm [DEBUG] plain_contents: 0x546573740A506F73742076696120434C49202868747470733A2F2F6769746875622E636F6D2F466C6F666C69732F626C6F636B636861696E2D7772697465722D73756974652E6769742920696E7374656164206F662062726F777365720A416E6F746865722074657374206C696E65E29CA80A4D6573736167650A Waiting for your transaction to be mined... panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x5bd7c8]

goroutine 1 [running]: math/big.(Int).Mul(0xc000898b80, 0xc000898b80, 0x0) /opt/hostedtoolcache/go/1.19.5/x64/src/math/big/int.go:167 +0xa8 github.com/ethereum/go-ethereum/consensus/misc.CalcBaseFee(0xc00090a240?, 0xc00090a480) /home/runner/go/pkg/mod/github.com/ethereum/go-ethereum@v1.10.26/consensus/misc/eip1559.go:86 +0x409 github.com/wealdtech/ethereal/v2/conn.(Conn).CurrentBaseFee(0xc0007fbcc0, {0x2377eb0, 0xc00003a0c8}) /home/runner/work/ethereal/ethereal/conn/currentbasefee.go:54 +0x290 github.com/wealdtech/ethereal/v2/conn.(Conn).CalculateFees(0xc0007fbcc0?) /home/runner/work/ethereal/ethereal/conn/calculatefees.go:29 +0x3c github.com/wealdtech/ethereal/v2/conn.(Conn).CreateTransaction(0xc0007fbcc0, {0x2377eb0, 0xc00003a0c8}, 0xc0000dfaa0) /home/runner/work/ethereal/ethereal/conn/transaction.go:79 +0x189 github.com/wealdtech/ethereal/v2/conn.(Conn).CreateSignedTransaction(0x0?, {0x2377eb0, 0xc00003a0c8}, 0xc0000dfaa0) /home/runner/work/ethereal/ethereal/conn/transaction.go:31 +0x48 github.com/wealdtech/ethereal/v2/cmd.glob..func75(0x2855760?, {0xcf2c31?, 0xb?, 0xb?}) /home/runner/work/ethereal/ethereal/cmd/transactionsend.go:157 +0x9b3 github.com/spf13/cobra.(Command).execute(0x2855760, {0xc0002bc790, 0xb, 0xb}) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:920 +0x847 github.com/spf13/cobra.(Command).ExecuteC(0x2852680) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd github.com/spf13/cobra.(Command).Execute(...) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968 github.com/wealdtech/ethereal/v2/cmd.Execute() /home/runner/work/ethereal/ethereal/cmd/root.go:294 +0x25 main.main() /home/runner/work/ethereal/ethereal/main.go:19 +0x17

mcdee commented 1 month ago

ethereal doesn't support other chains, however I have put in a speculative fix for this issue. You can try the latest master to see if it works, but if not I'm afraid I can't help further.

danimesq commented 1 month ago

@mcdee Thank you, will try ASAP

There's issues with other networks too, that could be the new issue to affect Polygon zkEVM:

On networks such as Arbitrum, zkSync, Optimism, Base, I get the following errors:

blockchain-writer-suite/poster/blockchain-poster on  main [!?⇡] ❯ bash script.sh msg.txt 0x117483E977B4EdEe761486F645bca5824b02b1d3 --network zksyncera [DEBUG] plain_contents: 0x546573740A506F73742076696120434C49202868747470733A2F2F6769746875622E636F6D2F466C6F666C69732F626C6F636B636861696E2D7772697465722D73756974652E6769742920696E7374656164206F662062726F777365720A416E6F746865722074657374206C696E65E29CA80A4D6573736167650A Waiting for your transaction to be mined... Failed to create transaction: failed to obtain current base fee: transaction type not supported [DEBUG] tx_id: Loaded configuration file /home/daniella/.ethereal.json Message (probably) sent successfully to 0x117483E977B4EdEe761486F645bca5824b02b1d3! (You may) Find details in transaction_id.json

blockchain-writer-suite/poster/blockchain-poster on  main [!?⇡] ❯ bash script.sh msg.txt 0x117483E977B4EdEe761486F645bca5824b02b1d3 --network zksyncera [DEBUG] plain_contents: 0x546573740A506F73742076696120434C49202868747470733A2F2F6769746875622E636F6D2F466C6F666C69732F626C6F636B636861696E2D7772697465722D73756974652E6769742920696E7374656164206F662062726F777365720A416E6F746865722074657374206C696E65E29CA80A4D6573736167650A Waiting for your transaction to be mined... Failed to send transaction: failed to send transaction: intrinsic gas too low [DEBUG] tx_id: Loaded configuration file /home/daniella/.ethereal.json Message (probably) sent successfully to 0x117483E977B4EdEe761486F645bca5824b02b1d3! (You may) Find details in transaction_id.json

The Failed to create transaction: failed to obtain current base fee: transaction type not supported being the more frequent on several tries.

Settings I'm currently using in my script:

if [ "$3" = "--network" ]; then if [ "$4" = "polygon" ]; then choosen_network="https://polygon-mainnet.public.blastapi.io" network_chainid="137" network_gas_standard="$(curl -s 'https://gasstation.polygon.technology/v2' | jq -r '.standard.maxPriorityFee')" network_gaslimit="0" fi if [ "$4" = "polygonzkevm" ]; then choosen_network="https://rpc.ankr.com/polygon_zkevm" network_chainid="1101" network_gas_standard="$(curl -s 'https://gasstation.polygon.technology/zkevm' | jq -r '.standard')" network_gaslimit="500" fi if [ "$4" = "arbitrum" ]; then choosen_network="https://arbitrum-one.public.blastapi.io" network_chainid="42161" network_gas_standard="0.1" network_gas_standard="2" network_gaslimit="500" fi if [ "$4" = "optimism" ]; then choosen_network="https://rpc.ankr.com/optimism" network_chainid="10" network_gas_standard="0.1" network_gas_standard="2" network_gaslimit="500" fi if [ "$4" = "base" ]; then choosen_network="https://base.llamarpc.com" network_chainid="8453" network_gas_standard="0.1" network_gas_standard="2" network_gaslimit="500" fi if [ "$4" = "zksyncera" ]; then choosen_network="https://mainnet.era.zksync.io" network_chainid="324" network_gas_standard="0.025" network_gas_standard="2" network_gaslimit="500" fi fi

tx_id=$(ethereal --connection="$choosen_network" --chainid="$network_chainid" transaction send --from=$USER_ADDRESS --to=$destination_address --amount="0" --data "$plain_contents" --gaslimit "$network_gaslimit" --base-fee-per-gas "$network_gaslimit" --priority-fee-per-gas "$network_gas_standard Gwei" --debug --wait)

Are there a way to obtain the sent tx ID without depending on this variable-command?

danimesq commented 1 month ago

New error I get now on Polygon zkEVM, after updating ethereal:

Failed to send transaction: failed to send transaction: RPC error response: invalid sender

But the sender address is correct: USER_ADDRESS=$(jq -r '.eth' /1/config/user.json)

~ on  main [!?] ❯ jq -r '.eth' /1/config/user.json 0xDDfC2e10702d8A781727A34D83B3bb3CA94a3E91