Bump nim-eth: Convert GasInt to uint64 (#6415)
* Bump nim-eth: Convert GasInt to uint64 * Fixes * Fix libnimbus_lc
This commit is contained in:
parent
7f59e80aaa
commit
0b276315d2
|
@ -9,7 +9,6 @@
|
|||
|
||||
import
|
||||
std/[json, sequtils, times],
|
||||
stew/saturation_arith,
|
||||
eth/common/[eth_types_rlp, transaction],
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/random2,
|
||||
|
@ -1242,10 +1241,8 @@ proc ETHExecutionBlockHeaderCreateFromJson(
|
|||
|
||||
# Construct block header
|
||||
static: # `GasInt` is signed. We only use it for hashing.
|
||||
doAssert sizeof(int64) == sizeof(data.gasLimit)
|
||||
doAssert sizeof(int64) == sizeof(data.gasUsed)
|
||||
if distinctBase(data.timestamp) > int64.high.uint64:
|
||||
return nil
|
||||
doAssert sizeof(uint64) == sizeof(data.gasLimit)
|
||||
doAssert sizeof(uint64) == sizeof(data.gasUsed)
|
||||
if data.nonce.isNone:
|
||||
return nil
|
||||
let blockHeader = ExecutionBlockHeader(
|
||||
|
@ -1258,8 +1255,8 @@ proc ETHExecutionBlockHeaderCreateFromJson(
|
|||
logsBloom: distinctBase(data.logsBloom),
|
||||
difficulty: data.difficulty,
|
||||
number: distinctBase(data.number),
|
||||
gasLimit: GasInt.saturate distinctBase(data.gasLimit),
|
||||
gasUsed: GasInt.saturate distinctBase(data.gasUsed),
|
||||
gasLimit: distinctBase(data.gasLimit),
|
||||
gasUsed: distinctBase(data.gasUsed),
|
||||
timestamp: EthTime(distinctBase(data.timestamp)),
|
||||
extraData: distinctBase(data.extraData),
|
||||
mixHash: data.mixHash.asEth2Digest,
|
||||
|
@ -1497,25 +1494,15 @@ proc ETHTransactionsCreateFromJson(
|
|||
# Construct transaction
|
||||
static:
|
||||
doAssert sizeof(uint64) == sizeof(ChainId)
|
||||
doAssert sizeof(int64) == sizeof(data.gasPrice)
|
||||
doAssert sizeof(int64) == sizeof(data.maxPriorityFeePerGas.get)
|
||||
doAssert sizeof(uint64) == sizeof(data.gas)
|
||||
doAssert sizeof(uint64) == sizeof(data.gasPrice)
|
||||
doAssert sizeof(uint64) == sizeof(data.maxPriorityFeePerGas.get)
|
||||
doAssert sizeof(UInt256) == sizeof(data.maxFeePerBlobGas.get)
|
||||
if distinctBase(data.chainId.get(0.Quantity)) > distinctBase(ChainId.high):
|
||||
return nil
|
||||
if distinctBase(data.gasPrice) > int64.high.uint64:
|
||||
return nil
|
||||
if distinctBase(data.maxFeePerGas.get(0.Quantity)) > int64.high.uint64:
|
||||
return nil
|
||||
if distinctBase(data.maxPriorityFeePerGas.get(0.Quantity)) >
|
||||
int64.high.uint64:
|
||||
return nil
|
||||
if data.maxFeePerBlobGas.get(0.u256) >
|
||||
uint64.high.u256:
|
||||
return nil
|
||||
if distinctBase(data.gas) > int64.high.uint64:
|
||||
return nil
|
||||
if distinctBase(data.v) > int64.high.uint64:
|
||||
return nil
|
||||
if data.yParity.isSome:
|
||||
# This is not always included, but if it is, make sure it's correct
|
||||
let yParity = data.yParity.get
|
||||
|
@ -1555,7 +1542,7 @@ proc ETHTransactionsCreateFromJson(
|
|||
ExecutionHash256(data: distinctBase(it)))
|
||||
else:
|
||||
@[],
|
||||
V: data.v.uint64,
|
||||
V: distinctBase(data.v),
|
||||
R: data.r,
|
||||
S: data.s)
|
||||
rlpBytes =
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
import
|
||||
# Status libraries
|
||||
stew/[byteutils, endians2, objects, saturation_arith],
|
||||
stew/[byteutils, endians2, objects],
|
||||
chronicles,
|
||||
eth/common/[eth_types, eth_types_rlp],
|
||||
eth/rlp, eth/trie/[db, hexary],
|
||||
|
@ -590,8 +590,8 @@ proc blockToBlockHeader*(blck: ForkyBeaconBlock): ExecutionBlockHeader =
|
|||
logsBloom : payload.logs_bloom.data,
|
||||
difficulty : default(DifficultyInt),
|
||||
number : payload.block_number,
|
||||
gasLimit : GasInt.saturate(payload.gas_limit),
|
||||
gasUsed : GasInt.saturate(payload.gas_used),
|
||||
gasLimit : payload.gas_limit,
|
||||
gasUsed : payload.gas_used,
|
||||
timestamp : EthTime(payload.timestamp),
|
||||
extraData : payload.extra_data.asSeq,
|
||||
mixHash : payload.prev_randao, # EIP-4399 `mixHash` -> `prevRandao`
|
||||
|
|
|
@ -118,8 +118,6 @@ proc build_empty_merge_execution_payload(state: bellatrix.BeaconState):
|
|||
bellatrix.ExecutionPayloadForSigning(executionPayload: payload,
|
||||
blockValue: Wei.zero)
|
||||
|
||||
from stew/saturating_arith import saturate
|
||||
|
||||
proc build_empty_execution_payload(
|
||||
state: bellatrix.BeaconState,
|
||||
feeRecipient: Eth1Address): bellatrix.ExecutionPayloadForSigning =
|
||||
|
@ -129,8 +127,8 @@ proc build_empty_execution_payload(
|
|||
latest = state.latest_execution_payload_header
|
||||
timestamp = compute_timestamp_at_slot(state, state.slot)
|
||||
randao_mix = get_randao_mix(state, get_current_epoch(state))
|
||||
base_fee = calcEip1599BaseFee(GasInt.saturate latest.gas_limit,
|
||||
GasInt.saturate latest.gas_used,
|
||||
base_fee = calcEip1599BaseFee(latest.gas_limit,
|
||||
latest.gas_used,
|
||||
latest.base_fee_per_gas)
|
||||
|
||||
var payload = bellatrix.ExecutionPayloadForSigning(
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d8fda55c79dd48ba564f3cb540b968f4a1c1aae6
|
||||
Subproject commit ebfe63b9b6523a1823e4505f0972d81047a77cf5
|
Loading…
Reference in New Issue