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:
andri lim 2023-10-18 07:37:57 +07:00 committed by GitHub
parent 3b62ab87e9
commit 0f9b52933e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 11 deletions

View File

@ -1258,7 +1258,7 @@ proc ETHExecutionBlockHeaderCreateFromJson(
blockNumber: distinctBase(data.number).u256,
gasLimit: cast[int64](data.gasLimit),
gasUsed: cast[int64](data.gasUsed),
timestamp: fromUnix(int64.saturate distinctBase(data.timestamp)),
timestamp: EthTime(int64.saturate distinctBase(data.timestamp)),
extraData: distinctBase(data.extraData),
mixDigest: data.mixHash.asEth2Digest,
nonce: distinctBase(data.nonce.get),
@ -1413,7 +1413,7 @@ type
value: UInt256
input: seq[byte]
accessList: seq[ETHAccessTuple]
maxFeePerBlobGas: uint64
maxFeePerBlobGas: UInt256
blobVersionedHashes: seq[Eth2Digest]
signature: seq[byte]
bytes: TypedTransaction
@ -1500,7 +1500,7 @@ proc ETHTransactionsCreateFromJson(
doAssert sizeof(uint64) == sizeof(ChainId)
doAssert sizeof(int64) == sizeof(data.gasPrice)
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:
return nil
if distinctBase(data.gasPrice) > int64.high.uint64:
@ -1510,8 +1510,8 @@ proc ETHTransactionsCreateFromJson(
if distinctBase(data.maxPriorityFeePerGas.get(0.Quantity)) >
int64.high.uint64:
return nil
if distinctBase(data.maxFeePerBlobGas.get(0.Quantity)) >
int64.high.uint64:
if data.maxFeePerBlobGas.get(0.u256) >
uint64.high.u256:
return nil
if distinctBase(data.gas) > int64.high.uint64:
return nil
@ -1542,7 +1542,7 @@ proc ETHTransactionsCreateFromJson(
else:
@[],
maxFeePerBlobGas:
distinctBase(data.maxFeePerBlobGas.get(0.Quantity)).GasInt,
data.maxFeePerBlobGas.get(0.u256),
versionedHashes:
if data.blobVersionedHashes.isSome:
data.blobVersionedHashes.get.mapIt(
@ -1618,7 +1618,7 @@ proc ETHTransactionsCreateFromJson(
accessList: tx.accessList.mapIt(ETHAccessTuple(
address: ExecutionAddress(data: it.address),
storageKeys: it.storageKeys.mapIt(Eth2Digest(data: it)))),
maxFeePerBlobGas: tx.maxFeePerBlobGas.uint64,
maxFeePerBlobGas: tx.maxFeePerBlobGas,
blobVersionedHashes: tx.versionedHashes,
signature: @rawSig,
bytes: rlpBytes.TypedTransaction)
@ -1946,7 +1946,7 @@ func ETHAccessTupleGetStorageKey(
addr accessTuple[].storageKeys[storageKeyIndex.int]
func ETHTransactionGetMaxFeePerBlobGas(
transaction: ptr ETHTransaction): ptr uint64 {.exported.} =
transaction: ptr ETHTransaction): ptr UInt256 {.exported.} =
## Obtains the max fee per blob gas of a transaction.
##
## * The returned value is allocated in the given transaction.

View File

@ -464,7 +464,7 @@ proc blockToBlockHeader*(blck: ForkyBeaconBlock): ExecutionBlockHeader =
blockNumber : payload.block_number.u256,
gasLimit : cast[GasInt](payload.gas_limit),
gasUsed : cast[GasInt](payload.gas_used),
timestamp : fromUnix(int64.saturate payload.timestamp),
timestamp : EthTime(int64.saturate payload.timestamp),
extraData : payload.extra_data.asSeq,
mixDigest : payload.prev_randao, # EIP-4399 `mixDigest` -> `prevRandao`
nonce : default(BlockNonce),

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit 894ec07d9f977a5ef9487630b71764df9163982f
Subproject commit e34a9c4e5daee654d6ea16f6c4595253548ffb17

2
vendor/nim-web3 vendored

@ -1 +1 @@
Subproject commit 70f22351c44b849a321b78b94dc0f9cd4ac9a5e1
Subproject commit ebf4a12cbaf8d07c2a6c315adf6278a67c1fdc54