Test EIP-1559 on testnet and devnet
1. RPC
1.1 Devnet
RPC="https://devnetstats.hashlabs.apothem.network/devnet"
1.2 Testnet(Apothem network)
RPC="https://erpc.apothem.network/"
RPC="https://earpc.apothem.network/"
1.3 Mainnet(Xinfin network)
The EIP-1559 feature is not available on the mainnet now. Please wait for 1-2 months.
2. Install foundry
We will use foundry to do some tests. Please install it according to the document, such as:
curl -L https://foundry.paradigm.xyz | bash
source ${HOME}/.bashrc
foundryup
Then create a sample project for test:
cd ${HOME}
rm -rf ${HOME}/counter/
forge init counter
cd counter
# our testnet and devnet support solidity v0.8.28 now
forge build --use solc:0.8.28
3. EIP-1559 block
- devnet: 0
- testnet(Apothem): 71550000 (14th Feb 2025)
- mainet(Xinfin): TBD
4. Test cases
The following cases should be tested before and after EIP-1559 block.
4.1 api eth_getBlockByNumber
Request:
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "eth_getBlockByNumber",
"params": [
"latest",
false
]
}' | jq
Verify baseFeePerGas
field in response:
- before EIP-1559 block: this field should not exist
- after EIP-1559 block: the value should be
0x2e90edd00
(12500000000)
4.2 api eth_maxPriorityFeePerGas
Request:
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1002,
"method": "eth_maxPriorityFeePerGas",
"params": []
}' | jq
Verify the value of result
field in response is reasonable:
- before EIP-1559 block: should be the current gas price
- after EIP-1559 block: should be non negative, such as
0x0
4.3 api eth_gasPrice
Request:
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1003,
"method": "eth_gasPrice",
"params": []
}' | jq
Verify the value of result
field in response is right:
- before EIP-1559 block: should equal to
eth_maxPriorityFeePerGas
- after EIP-1559 block: should equal to
baseFeePerGas
+eth_maxPriorityFeePerGas
4.4 api eth_feeHistory
Usage: https://docs.infura.io/api/networks/ethereum/json-rpc-methods/eth_feehistory#parameters
Request:
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1004,
"method": "eth_feeHistory",
"params": [
"0x3",
"latest",
[20,50]
]
}' | jq
Verify the value of baseFeePerGas
field in response:
- before EIP-1559 block: the value should equal to 0
- after EIP-1559 block: the value should be
0x2e90edd00
(12500000000)
4.5 eth_getTransactionByHash
Submit 3 transactions to network and record their transaction id:
cd ${HOME}
export PRIVATE_KEY=<YOUR_PRIVATE_KEY>
# tx1: legacy tx
forge create --broadcast --use solc:0.8.28 --rpc-url ${RPC} --private-key ${PRIVATE_KEY} --gas-price 12500000000 --legacy src/Counter.sol:Counter
# tx2: EIP-1559 tx with parameter maxFeePerGas
forge create --broadcast --use solc:0.8.28 --rpc-url ${RPC} --private-key ${PRIVATE_KEY} --gas-price 12500000000 src/Counter.sol:Counter
# tx3: EIP-1559 tx with maxPriorityFeePerGas
forge create --broadcast --use solc:0.8.28 --rpc-url ${RPC} --private-key ${PRIVATE_KEY} --priority-gas-price 0 src/Counter.sol:Counter
- tx1: should be successful before and after EIP-1559 block
- tx2: should be successful only after EIP-1559 block
- tx3: should be successful only after EIP-1559 block
# eg: hash="0xc64985e6faccc11c96a8baef1d989888022b75c958095e69d5e30938142a0375"
hash=<TX_HASH_ID>
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1005,
"method": "eth_getTransactionByHash",
"params": [
"'"${hash}"'"
]
}' | jq
Verify the following fields in the response:
- type: should be 0 in tx1, be 2 in tx2 and tx3
- gasPrice: exist in all transactions
- maxFeePerGas: only exist in tx2 and tx3, the value in tx2 should be 12501000000
- maxPriorityFeePerGas: only exist in tx2 and tx3, the value in tx3 should be 1000
4.6 eth_getTransactionReceipt
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1006,
"method": "eth_getTransactionReceipt",
"params": [
"'"${hash}"'"
]
}' | jq
Verify tx's type and effectiveGasPrice in the response.
4.7 eth_getBlockReceipts
# eg: NUMBER="0x8"
NUMBER=<NUMBER>
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1007,
"method": "eth_getBlockReceipts",
"params": [
"'"${NUMBER}"'"
]
}' | jq
Verify tx's type and effectiveGasPrice in the response.
4.8 eth_getLogs
Request:
FROM=<FROM_BLOCK_NUMBER>
TO=<TO_BLOCK_NUMBER>
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc":"2.0",
"id": 1008,
"method":"eth_getLogs",
"params":[
{
"fromBlock": "'"${FROM}"'",
"toBlock": "'"${TO}"'"
}
]
}' | jq
Verify the result is right.
4.9 Test synchronization
Setup a node and sync with network.
4.10
Test with other tools, such as: MetaMask, Remix.
Discussion (0)