web: bump to new nim-eth types (#6590)

This commit is contained in:
Jacek Sieka 2024-10-02 15:26:11 +02:00 committed by GitHub
parent ce9e377ebe
commit 8f0d910422
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 18 additions and 18 deletions

View File

@ -388,7 +388,7 @@ proc runProposalForkchoiceUpdated*(
suggestedFeeRecipient: feeRecipient,
withdrawals:
toEngineWithdrawals get_expected_withdrawals(forkyState.data),
parentBeaconBlockRoot: beaconHead.blck.bid.root.asBlockHash))
parentBeaconBlockRoot: beaconHead.blck.bid.root.to(Hash32)))
elif consensusFork >= ConsensusFork.Capella:
callForkchoiceUpdated(PayloadAttributesV2(
timestamp: Quantity timestamp,

View File

@ -534,7 +534,7 @@ proc getPayloadFromSingleEL(
prevRandao: FixedBytes[32] randomData.data,
suggestedFeeRecipient: suggestedFeeRecipient,
withdrawals: withdrawals,
parentBeaconBlockRoot: consensusHead.asBlockHash))
parentBeaconBlockRoot: consensusHead.to(Hash32)))
else:
static: doAssert false
@ -817,7 +817,7 @@ proc sendNewPayloadToSingleEL(
): Future[PayloadStatusV1] {.async: (raises: [CatchableError]).} =
let rpcClient = await connection.connectedRpcClient()
await rpcClient.engine_newPayloadV3(
payload, versioned_hashes, parent_beacon_block_root)
payload, versioned_hashes, Hash32 parent_beacon_block_root)
proc sendNewPayloadToSingleEL(
connection: ELConnection,
@ -827,7 +827,7 @@ proc sendNewPayloadToSingleEL(
): Future[PayloadStatusV1] {.async: (raises: [CatchableError]).} =
let rpcClient = await connection.connectedRpcClient()
await rpcClient.engine_newPayloadV4(
payload, versioned_hashes, parent_beacon_block_root)
payload, versioned_hashes, Hash32 parent_beacon_block_root)
type
StatusRelation = enum
@ -1096,7 +1096,7 @@ proc forkchoiceUpdated*(
prevRandao: payloadAttributes.get.prevRandao,
suggestedFeeRecipient: payloadAttributes.get.suggestedFeeRecipient,
withdrawals: payloadAttributes.get.withdrawals,
parentBeaconBlockRoot: static(default(FixedBytes[32])))
parentBeaconBlockRoot: default(Hash32))
else:
# As timestamp and prevRandao are both 0, won't false-positive match
(static(default(PayloadAttributesV3)))
@ -1108,7 +1108,7 @@ proc forkchoiceUpdated*(
prevRandao: payloadAttributes.get.prevRandao,
suggestedFeeRecipient: payloadAttributes.get.suggestedFeeRecipient,
withdrawals: @[],
parentBeaconBlockRoot: static(default(FixedBytes[32])))
parentBeaconBlockRoot: default(Hash32))
else:
# As timestamp and prevRandao are both 0, won't false-positive match
(static(default(PayloadAttributesV3)))

View File

@ -19,7 +19,7 @@ type
executionPayload*: ExecutionPayloadV1
blockValue*: UInt256
func asEth2Digest*(x: BlockHash): Eth2Digest =
func asEth2Digest*(x: BlockHash|Bytes32): Eth2Digest =
Eth2Digest(data: array[32, byte](x))
template asBlockHash*(x: Eth2Digest): BlockHash =
@ -232,7 +232,7 @@ func asEngineExecutionPayload*(blockBody: bellatrix.BeaconBlockBody):
receiptsRoot: executionPayload.receipts_root.asBlockHash,
logsBloom:
FixedBytes[BYTES_PER_LOGS_BLOOM](executionPayload.logs_bloom.data),
prevRandao: executionPayload.prev_randao.asBlockHash,
prevRandao: executionPayload.prev_randao.data.to(Bytes32),
blockNumber: Quantity(executionPayload.block_number),
gasLimit: Quantity(executionPayload.gas_limit),
gasUsed: Quantity(executionPayload.gas_used),
@ -262,7 +262,7 @@ func asEngineExecutionPayload*(blockBody: capella.BeaconBlockBody):
receiptsRoot: executionPayload.receipts_root.asBlockHash,
logsBloom:
FixedBytes[BYTES_PER_LOGS_BLOOM](executionPayload.logs_bloom.data),
prevRandao: executionPayload.prev_randao.asBlockHash,
prevRandao: executionPayload.prev_randao.data.to(Bytes32),
blockNumber: Quantity(executionPayload.block_number),
gasLimit: Quantity(executionPayload.gas_limit),
gasUsed: Quantity(executionPayload.gas_used),
@ -287,7 +287,7 @@ func asEngineExecutionPayload*(blockBody: deneb.BeaconBlockBody):
receiptsRoot: executionPayload.receipts_root.asBlockHash,
logsBloom:
FixedBytes[BYTES_PER_LOGS_BLOOM](executionPayload.logs_bloom.data),
prevRandao: executionPayload.prev_randao.asBlockHash,
prevRandao: executionPayload.prev_randao.data.to(Bytes32),
blockNumber: Quantity(executionPayload.block_number),
gasLimit: Quantity(executionPayload.gas_limit),
gasUsed: Quantity(executionPayload.gas_used),
@ -337,7 +337,7 @@ func asEngineExecutionPayload*(blockBody: electra.BeaconBlockBody):
receiptsRoot: executionPayload.receipts_root.asBlockHash,
logsBloom:
FixedBytes[BYTES_PER_LOGS_BLOOM](executionPayload.logs_bloom.data),
prevRandao: executionPayload.prev_randao.asBlockHash,
prevRandao: executionPayload.prev_randao.data.to(Bytes32),
blockNumber: Quantity(executionPayload.block_number),
gasLimit: Quantity(executionPayload.gas_limit),
gasUsed: Quantity(executionPayload.gas_used),

View File

@ -1295,7 +1295,7 @@ proc ETHExecutionBlockHeaderCreateFromJson(
gasUsed: distinctBase(data.gasUsed),
timestamp: EthTime(distinctBase(data.timestamp)),
extraData: distinctBase(data.extraData),
mixHash: data.mixHash.asEth2Digest.to(Hash32),
mixHash: Bytes32 data.mixHash,
nonce: distinctBase(data.nonce.get).to(Bytes8),
baseFeePerGas: data.baseFeePerGas,
withdrawalsRoot:
@ -1793,7 +1793,7 @@ proc ETHTransactionsCreateFromJson(
versionedHashes:
if data.blobVersionedHashes.isSome:
data.blobVersionedHashes.get.mapIt(
Bytes32(distinctBase(it)))
Hash32(distinctBase(it)))
else:
@[],
authorizationList:

View File

@ -599,7 +599,7 @@ proc blockToBlockHeader*(blck: ForkyBeaconBlock): ExecutionBlockHeader =
gasUsed : payload.gas_used,
timestamp : EthTime(payload.timestamp),
extraData : payload.extra_data.asSeq,
mixHash : payload.prev_randao.to(Hash32), # EIP-4399 `mixHash` -> `prevRandao`
mixHash : Bytes32 payload.prev_randao.data, # EIP-4399 `mixHash` -> `prevRandao`
nonce : default(BlockNonce),
baseFeePerGas : Opt.some payload.base_fee_per_gas,
withdrawalsRoot : withdrawalsRoot,

View File

@ -81,7 +81,7 @@ type
blck*: ForkedBeaconBlock
executionPayloadValue*: Wei
consensusBlockValue*: UInt256
blobsBundleOpt*: Opt[BlobsBundle]
blobsBundleOpt*: Opt[deneb.BlobsBundle]
BuilderBid[SBBB] = object
blindedBlckPart*: SBBB

View File

@ -256,7 +256,7 @@ cli do(validatorsDir: string, secretsDir: string,
when consensusFork >= ConsensusFork.Capella:
get_expected_withdrawals(forkyState.data)
else:
newSeq[Withdrawal]()
newSeq[capella.Withdrawal]()
var pl: consensusFork.ExecutionPayloadForSigning
while true:

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit 6bd6bae86c437a61bcd6426571204dd7cdb88123
Subproject commit 5ce3c4557fc78ee425fcb8f30f80cb336bbe0b7c

2
vendor/nim-web3 vendored

@ -1 +1 @@
Subproject commit 0cc03e67dda6c4d9be0f9d9abde7508e46156fd9
Subproject commit b41316b25c77c525a2d33192a52958a6972b839d