Bump nim-eth: Change block timestamp from std.Time to distinct uint64 (#5510)
* Bump nim-eth: Change block timestamp from std.Time to distinct uint64 Also change tx.maxFeePerBlobGas from GasInt to UInt256 following Cancun latest spec * Fix EthTime.now from func to proc due to sideeffects
This commit is contained in:
parent
3b62ab87e9
commit
0f9b52933e
|
@ -1258,7 +1258,7 @@ proc ETHExecutionBlockHeaderCreateFromJson(
|
||||||
blockNumber: distinctBase(data.number).u256,
|
blockNumber: distinctBase(data.number).u256,
|
||||||
gasLimit: cast[int64](data.gasLimit),
|
gasLimit: cast[int64](data.gasLimit),
|
||||||
gasUsed: cast[int64](data.gasUsed),
|
gasUsed: cast[int64](data.gasUsed),
|
||||||
timestamp: fromUnix(int64.saturate distinctBase(data.timestamp)),
|
timestamp: EthTime(int64.saturate distinctBase(data.timestamp)),
|
||||||
extraData: distinctBase(data.extraData),
|
extraData: distinctBase(data.extraData),
|
||||||
mixDigest: data.mixHash.asEth2Digest,
|
mixDigest: data.mixHash.asEth2Digest,
|
||||||
nonce: distinctBase(data.nonce.get),
|
nonce: distinctBase(data.nonce.get),
|
||||||
|
@ -1413,7 +1413,7 @@ type
|
||||||
value: UInt256
|
value: UInt256
|
||||||
input: seq[byte]
|
input: seq[byte]
|
||||||
accessList: seq[ETHAccessTuple]
|
accessList: seq[ETHAccessTuple]
|
||||||
maxFeePerBlobGas: uint64
|
maxFeePerBlobGas: UInt256
|
||||||
blobVersionedHashes: seq[Eth2Digest]
|
blobVersionedHashes: seq[Eth2Digest]
|
||||||
signature: seq[byte]
|
signature: seq[byte]
|
||||||
bytes: TypedTransaction
|
bytes: TypedTransaction
|
||||||
|
@ -1500,7 +1500,7 @@ proc ETHTransactionsCreateFromJson(
|
||||||
doAssert sizeof(uint64) == sizeof(ChainId)
|
doAssert sizeof(uint64) == sizeof(ChainId)
|
||||||
doAssert sizeof(int64) == sizeof(data.gasPrice)
|
doAssert sizeof(int64) == sizeof(data.gasPrice)
|
||||||
doAssert sizeof(int64) == sizeof(data.maxPriorityFeePerGas.get)
|
doAssert sizeof(int64) == sizeof(data.maxPriorityFeePerGas.get)
|
||||||
doAssert sizeof(int64) == sizeof(data.maxFeePerBlobGas.get)
|
doAssert sizeof(UInt256) == sizeof(data.maxFeePerBlobGas.get)
|
||||||
if data.chainId.get(default(UInt256)) > distinctBase(ChainId.high).u256:
|
if data.chainId.get(default(UInt256)) > distinctBase(ChainId.high).u256:
|
||||||
return nil
|
return nil
|
||||||
if distinctBase(data.gasPrice) > int64.high.uint64:
|
if distinctBase(data.gasPrice) > int64.high.uint64:
|
||||||
|
@ -1510,8 +1510,8 @@ proc ETHTransactionsCreateFromJson(
|
||||||
if distinctBase(data.maxPriorityFeePerGas.get(0.Quantity)) >
|
if distinctBase(data.maxPriorityFeePerGas.get(0.Quantity)) >
|
||||||
int64.high.uint64:
|
int64.high.uint64:
|
||||||
return nil
|
return nil
|
||||||
if distinctBase(data.maxFeePerBlobGas.get(0.Quantity)) >
|
if data.maxFeePerBlobGas.get(0.u256) >
|
||||||
int64.high.uint64:
|
uint64.high.u256:
|
||||||
return nil
|
return nil
|
||||||
if distinctBase(data.gas) > int64.high.uint64:
|
if distinctBase(data.gas) > int64.high.uint64:
|
||||||
return nil
|
return nil
|
||||||
|
@ -1542,7 +1542,7 @@ proc ETHTransactionsCreateFromJson(
|
||||||
else:
|
else:
|
||||||
@[],
|
@[],
|
||||||
maxFeePerBlobGas:
|
maxFeePerBlobGas:
|
||||||
distinctBase(data.maxFeePerBlobGas.get(0.Quantity)).GasInt,
|
data.maxFeePerBlobGas.get(0.u256),
|
||||||
versionedHashes:
|
versionedHashes:
|
||||||
if data.blobVersionedHashes.isSome:
|
if data.blobVersionedHashes.isSome:
|
||||||
data.blobVersionedHashes.get.mapIt(
|
data.blobVersionedHashes.get.mapIt(
|
||||||
|
@ -1618,7 +1618,7 @@ proc ETHTransactionsCreateFromJson(
|
||||||
accessList: tx.accessList.mapIt(ETHAccessTuple(
|
accessList: tx.accessList.mapIt(ETHAccessTuple(
|
||||||
address: ExecutionAddress(data: it.address),
|
address: ExecutionAddress(data: it.address),
|
||||||
storageKeys: it.storageKeys.mapIt(Eth2Digest(data: it)))),
|
storageKeys: it.storageKeys.mapIt(Eth2Digest(data: it)))),
|
||||||
maxFeePerBlobGas: tx.maxFeePerBlobGas.uint64,
|
maxFeePerBlobGas: tx.maxFeePerBlobGas,
|
||||||
blobVersionedHashes: tx.versionedHashes,
|
blobVersionedHashes: tx.versionedHashes,
|
||||||
signature: @rawSig,
|
signature: @rawSig,
|
||||||
bytes: rlpBytes.TypedTransaction)
|
bytes: rlpBytes.TypedTransaction)
|
||||||
|
@ -1946,7 +1946,7 @@ func ETHAccessTupleGetStorageKey(
|
||||||
addr accessTuple[].storageKeys[storageKeyIndex.int]
|
addr accessTuple[].storageKeys[storageKeyIndex.int]
|
||||||
|
|
||||||
func ETHTransactionGetMaxFeePerBlobGas(
|
func ETHTransactionGetMaxFeePerBlobGas(
|
||||||
transaction: ptr ETHTransaction): ptr uint64 {.exported.} =
|
transaction: ptr ETHTransaction): ptr UInt256 {.exported.} =
|
||||||
## Obtains the max fee per blob gas of a transaction.
|
## Obtains the max fee per blob gas of a transaction.
|
||||||
##
|
##
|
||||||
## * The returned value is allocated in the given transaction.
|
## * The returned value is allocated in the given transaction.
|
||||||
|
|
|
@ -464,7 +464,7 @@ proc blockToBlockHeader*(blck: ForkyBeaconBlock): ExecutionBlockHeader =
|
||||||
blockNumber : payload.block_number.u256,
|
blockNumber : payload.block_number.u256,
|
||||||
gasLimit : cast[GasInt](payload.gas_limit),
|
gasLimit : cast[GasInt](payload.gas_limit),
|
||||||
gasUsed : cast[GasInt](payload.gas_used),
|
gasUsed : cast[GasInt](payload.gas_used),
|
||||||
timestamp : fromUnix(int64.saturate payload.timestamp),
|
timestamp : EthTime(int64.saturate payload.timestamp),
|
||||||
extraData : payload.extra_data.asSeq,
|
extraData : payload.extra_data.asSeq,
|
||||||
mixDigest : payload.prev_randao, # EIP-4399 `mixDigest` -> `prevRandao`
|
mixDigest : payload.prev_randao, # EIP-4399 `mixDigest` -> `prevRandao`
|
||||||
nonce : default(BlockNonce),
|
nonce : default(BlockNonce),
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 894ec07d9f977a5ef9487630b71764df9163982f
|
Subproject commit e34a9c4e5daee654d6ea16f6c4595253548ffb17
|
|
@ -1 +1 @@
|
||||||
Subproject commit 70f22351c44b849a321b78b94dc0f9cd4ac9a5e1
|
Subproject commit ebf4a12cbaf8d07c2a6c315adf6278a67c1fdc54
|
Loading…
Reference in New Issue