rootchain and supernet commands are not working on anvil becuases of of " failed to get fee history"
RonTuretzky opened this issue · comments
[ Binary command such as rootchain deploy, polybft supert not working on Anvil Goerli fork ]
Description
I am running an anvil goerli fork like so
anvil --fork-url https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161 --host 0.0.0.0 > /dev/null 2>&1 &
and the following command
./polygon-edge rootchain deploy \
--stake-manager ${stakeManagerAddr} \
--stake-token ${stakeToken} \
--proxy-contracts-admin ${proxyContractsAdmin} \
--json-rpc $ROOTCHAIN_RPC_URL \
--deployer-key $PRIVATE_KEY
fails with
failed to deploy rootchain contracts: failed sending CustomSupernetManager contract deploy transaction: failed to get fee history: {"code":-32602,"message":"invalid type: null, expected a sequence"}
similarly
finalizing genesis validator set failed. Error: failed to get fee history: {"code":-32602,"message":"invalid type: null, expected a sequence"}
Environment
- MacOS 14.1.1 (23B81)
- Polygon Edge 1.3.1
- Branch : Official Release 1.3.1
- Ran Locally
Steps to reproduce
Run the anvil command
Attempt to follow the rest of the polygon edge deploy steps
Expected behavior
Deployment should proceed as expected
@Stefan-Ethernal any insight would be appreciated 🙏🏻
ran this
cast rpc eth_feeHistory '[3, "latest", []]' --raw
with the following result
{"baseFeePerGas":["0x8","0x8","0x8","0x7"],"gasUsedRatio":[0.056730833333333335,0.0219493,0.12383936666666667],"oldestBlock":"0x9cab53"}
so it seems like the rpc endpoint is working, what is the binary expecting?
seems like in txrelayer/txrelayer.go line 158
if txn.MaxFeePerGas == nil {
// retrieve the latest base fee
feeHist, err := t.Client().Eth().FeeHistory(1, ethgo.Latest, nil)
if err != nil {
return ethgo.ZeroHash, fmt.Errorf("failed to get fee history: %w", err)
}
is what's causing the error, with the "invalid type: null, expected a sequence" , perhaps addresed to the "nil" value in line 160
although this test
seems to suggest that's not the problem
Maybe Anvil Goerli client, to which you are sending the given JSON RPC request is not handling nil values for reward percentiles properly.
Since Edge is not actively maintained anymore, can you try with forking the repository and changing the following line this way (providing an empty array instead of nil
?
feeHist, err := t.Client().Eth().FeeHistory(1, ethgo.Latest, []float64{})
Also, it probably makes sense to report the issue to the Anvil Goerli client as well, so they can take a look on their side as well, how they are handling nil
reward percentiles parameter.
Maybe Anvil Goerli client, to which you are sending the given JSON RPC request is not handling nil values for reward percentiles properly.
Since Edge is not actively maintained anymore, can you try with forking the repository and changing the following line this way (providing an empty array instead ofnil
?feeHist, err := t.Client().Eth().FeeHistory(1, ethgo.Latest, []float64{})Also, it probably makes sense to report the issue to the Anvil Goerli client as well, so they can take a look on their side as well, how they are handling
nil
reward percentiles parameter.
I did end up doing that and it worked! Thank you. Will submit an issue to foundry as well.
Will there be future releases to polygon edge or is this end of the line for the product?
Unfortunately, this is the end for the Edge. Officially it is now treated as the community project and seems like Polygon does not have interest in maintaining it anymore. This is the blog post that elaborates it (https://polygon.technology/blog/polygon-labs-to-focus-contributions-on-polygon-cdk-discontinues-contributions-for-edge).
Unfortunately, this is the end for the Edge. Officially it is now treated as the community project and seems like Polygon does not have interest in maintaining it anymore. This is the blog post that elaborates it (https://polygon.technology/blog/polygon-labs-to-focus-contributions-on-polygon-cdk-discontinues-contributions-for-edge).
Thank you for all your hard work!