stackup-wallet / stackup-bundler

A fast, reliable, and modular ERC-4337 Bundler written in Go.
https://docs.stackup.sh
GNU General Public License v3.0
226 stars 128 forks source link

BSC Testnet: simpleAccount transfer results in runtime error #125

Closed weiihann closed 1 year ago

weiihann commented 1 year ago

I'm attempting to execute ERC4337 in BSC Testnet. I'm running a StackUp bundler, where the ERC4337_BUNDLER_ETH_CLIENT_URL in .env is set to "https://data-seed-prebsc-1-s1.binance.org:8545", which is an RPC URL provided in https://docs.bnbchain.org/docs/BSCtestnet.

When I attempted to run yarn run simpleAccount transfer --to <address> --amount <eth> following the guide at https://docs.stackup.sh/docs/guides/quickstart, I got the following error:

{"level":"info","bundler_mode":"private","client_id":"127.0.0.1","opsSeen":0,"opsIncluded":0,"v":0,"logger":"stackup_bundler/relayer/filter_by_client","caller":"/server2/weihan/bsc-stackup-bundler/pkg/modules/relay/relayer.go:139","time":"2023-03-23T05:30:36Z","message":"client ok"}
{"level":"info","bundler_mode":"private","client_id":"127.0.0.1","method":"POST","status_code":200,"body_size":41,"path":"/","latency":"216.936µs","rpc_method":"eth_chainId","v":0,"logger":"stackup_bundler/http","caller":"/server2/weihan/bsc-stackup-bundler/internal/logger/middleware.go:60","time":"2023-03-23T05:30:36Z"}
{"level":"info","bundler_mode":"private","client_id":"127.0.0.1","opsSeen":0,"opsIncluded":0,"v":0,"logger":"stackup_bundler/relayer/filter_by_client","caller":"/server2/weihan/bsc-stackup-bundler/pkg/modules/relay/relayer.go:139","time":"2023-03-23T05:30:36Z","message":"client ok"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x612a85]

goroutine 87 [running]:
math/big.(*Int).Cmp(0x0?, 0x0?)
    /server2/go/src/math/big/int.go:324 +0x25
github.com/stackup-wallet/stackup-bundler/pkg/modules/checks.ValidateFeePerGas(0xc0005b8210, 0x0?)
    /server2/weihan/bsc-stackup-bundler/pkg/modules/checks/gasfee.go:17 +0x3b
github.com/stackup-wallet/stackup-bundler/pkg/modules/checks.(*Standalone).ValidateOpValues.func1.6()
    /server2/weihan/bsc-stackup-bundler/pkg/modules/checks/standalone.go:64 +0x25
golang.org/x/sync/errgroup.(*Group).Go.func1()
    /root/go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57 +0x67
created by golang.org/x/sync/errgroup.(*Group).Go
    /root/go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:54 +0x8d

Any clue why this is happening?

hazim-j commented 1 year ago

Are you running the latest release of the bundler? Some other networks (e.g. Optimism) had a similar issue which was patched in https://github.com/stackup-wallet/stackup-bundler/pull/119

weiihann commented 1 year ago

Yup I'm running on the latest release

hazim-j commented 1 year ago

Looks like this is caused because BSC doesn't support EIP-1559 style transactions. The bundler currently assumes all networks are enabled for EIP-1559. We'll need to create a patch to fallback to legacy transaction types for cases like this.

weiihann commented 1 year ago

Got it, thanks for the information!