Closed KaoImin closed 9 months ago
References:
nonce
: a scalar valuegasPrice
: a scalar valuegasLimit
: a scalar valuevalue
: a scalar valuechainId
: unknowndifficulty
: a scalar valuenumber
: a scalar valuegasLimit
: a scalar valuegasUsed
: a scalar valuetimestamp
: a scalar valuenonce
: a 64-bit valuechainID() *big.Int
gas() uint64
gasPrice() *big.Int
gasTipCap() *big.Int
gasFeeCap() *big.Int
value() *big.Int
nonce() uint64
Difficulty *big.Int `json:"difficulty" gencodec:"required"`
Number *big.Int `json:"number" gencodec:"required"`
GasLimit uint64 `json:"gasLimit" gencodec:"required"`
GasUsed uint64 `json:"gasUsed" gencodec:"required"`
Time uint64 `json:"timestamp" gencodec:"required"`
Extra []byte `json:"extraData" gencodec:"required"`
MixDigest common.Hash `json:"mixHash"`
Nonce BlockNonce `json:"nonce"`
References:
4.2. The Transaction
nonce
: a scalar valuegasPrice
: a scalar valuegasLimit
: a scalar valuevalue
: a scalar valuechainId
: unknown4.3. The Block
difficulty
: a scalar valuenumber
: a scalar valuegasLimit
: a scalar valuegasUsed
: a scalar valuetimestamp
: a scalar valuenonce
: a 64-bit valueGo Etherem:
Difficulty *big.Int `json:"difficulty" gencodec:"required"` Number *big.Int `json:"number" gencodec:"required"` GasLimit uint64 `json:"gasLimit" gencodec:"required"` GasUsed uint64 `json:"gasUsed" gencodec:"required"` Time uint64 `json:"timestamp" gencodec:"required"` Extra []byte `json:"extraData" gencodec:"required"` MixDigest common.Hash `json:"mixHash"` Nonce BlockNonce `json:"nonce"`
chainID() *big.Int gas() uint64 gasPrice() *big.Int gasTipCap() *big.Int gasFeeCap() *big.Int value() *big.Int nonce() uint64
According to the PR description, some types such as nonce
, gasPrice
, gasLimit
, gasUsed
have a specific range limitation, it is a waste of performance to use a variable-length BigUint
. The Ethereum timestamp
is accurate to the second, so u64
is enough. The only one that using variable-length scalar is chainId
. The explanation of using U64
is written in the description.
Wait for @sunchengzhu upgrade Web3 Compatible Tests
workflow. cc @Flouse
/run-ci
/run-ci
run OpenZeppelin tests as well
/run-ci
/run-ci
/run-ci
What this PR does / why we need it?
This PR is substitute for #1539
Some mainly changes:
nonce
fromU256
toU64
according to the EIP-2681 limit the account nonce to be between0
and2^64-1
.gas_limit
fromU256
toU64
. According to the current gas cost of the most complex ethereum transaction is on the order of million,U64
is enough.chain_id
fromU256
toU64
according to metamask limit. TheChainId
opcode returns a 256-bit value, so it should not larger thanU256::MAX / 2 - 35
.This issue does not lead to consensus in Ethereum community, however, I think limit the max chain ID to4503599627370476
is enough currently. Many temporary L2/L3 need a unique chain ID is the demand of variable-lenght chain ID in foreseeable future. But we do not have the demand now. If the day comes, we can change the chain ID type toU256
even without hardfork.Default Max Price
as500
Gwei that is same as go-ethereum. Meanwhile, change the type ofgas_price
fromU256
toU64
.What is the impact of this PR?
Breaking change
PR relation:
CI Settings
### **CI Usage** **Tip**: Check the CI you want to run below, and then comment `/run-ci`. **CI Switch** - [x] Web3 Compatible Tests - [x] OpenZeppelin tests - [x] OCT 1-5 And 12-15 - [x] OCT 6-10 - [x] OCT 11 - [x] OCT 16-19 - [x] v3 Core Tests ### **CI Description** | CI Name | Description | | ----------------------------------------- | ------------------------------------------------------------------------- | | *Web3 Compatible Test* | Test the Web3 compatibility of Axon | | *v3 Core Test* | Run the compatibility tests provided by Uniswap V3 | | *OCT 1-5 \| 6-10 \| 11 \| 12-15 \| 16-19* | Run the compatibility tests provided by OpenZeppelin |