diff --git a/beacon_chain/el/el_manager.nim b/beacon_chain/el/el_manager.nim index e4a727a10..937f25591 100644 --- a/beacon_chain/el/el_manager.nim +++ b/beacon_chain/el/el_manager.nim @@ -194,7 +194,7 @@ type depositContractSyncStatus: DepositContractSyncStatus ## Are we sure that this EL has synced the deposit contract? - lastPayloadId: Opt[PayloadID] + lastPayloadId: Opt[Bytes8] FullBlockId* = object number: Eth1BlockNumber @@ -485,7 +485,7 @@ func areSameAs(expectedParams: Option[NextExpectedPayloadParams], expectedParams.get.safeBlockHash == latestSafe and expectedParams.get.finalizedBlockHash == latestFinalized and expectedParams.get.payloadAttributes.timestamp.uint64 == timestamp and - expectedParams.get.payloadAttributes.prevRandao.bytes == randomData.data and + expectedParams.get.payloadAttributes.prevRandao.data == randomData.data and expectedParams.get.payloadAttributes.suggestedFeeRecipient == feeRecipient and expectedParams.get.payloadAttributes.withdrawals == withdrawals diff --git a/beacon_chain/libnimbus_lc/libnimbus_lc.nim b/beacon_chain/libnimbus_lc/libnimbus_lc.nim index 024c3ecb5..f59826252 100644 --- a/beacon_chain/libnimbus_lc/libnimbus_lc.nim +++ b/beacon_chain/libnimbus_lc/libnimbus_lc.nim @@ -1305,18 +1305,13 @@ proc ETHExecutionBlockHeaderCreateFromJson( doAssert data.withdrawalsRoot.isSome # Checked above wds = newSeqOfCap[ETHWithdrawal](data.withdrawals.get.len) - for data in data.withdrawals.get: + for wd in data.withdrawals.get: # Check fork consistency - static: doAssert totalSerializedFields(WithdrawalObject) == 4, + static: doAssert totalSerializedFields(eth_types.EthWithdrawal) == 4, "Only update this number once code is adjusted to check new fields!" # Construct withdrawal let - wd = eth_types.EthWithdrawal( - index: distinctBase(data.index), - validatorIndex: distinctBase(data.validatorIndex), - address: distinctBase(data.address).to(EthAddress), - amount: distinctBase(data.amount)) rlpBytes = try: rlp.encode(wd) @@ -1562,7 +1557,7 @@ proc ETHTransactionsCreateFromJson( if data.authorizationList.isSome: for authorization in data.authorizationList.get: static: doAssert sizeof(uint64) == sizeof(authorization.chainId) - if distinctBase(authorization.v) > uint8.high: + if authorization.v > uint8.high: return nil let tx = eth_types.EthTransaction( @@ -1583,9 +1578,7 @@ proc ETHTransactionsCreateFromJson( payload: data.input, accessList: if data.accessList.isSome: - data.accessList.get.mapIt(AccessPair( - address: distinctBase(it.address).to(EthAddress), - storageKeys: it.storageKeys.mapIt(distinctBase(it).to(Bytes32)))) + data.accessList.get else: @[], maxFeePerBlobGas: @@ -1598,13 +1591,7 @@ proc ETHTransactionsCreateFromJson( @[], authorizationList: if data.authorizationList.isSome: - data.authorizationList.get.mapIt(Authorization( - chainId: it.chainId.ChainId, - address: distinctBase(it.address).to(EthAddress), - nonce: distinctBase(it.nonce), - v: distinctBase(it.v), - r: it.r, - s: it.s)) + data.authorizationList.get else: @[], V: distinctBase(data.v), @@ -1615,7 +1602,7 @@ proc ETHTransactionsCreateFromJson( rlp.encode(tx) except RlpError: raiseAssert "Unreachable" - hash = keccakHash(rlpBytes) + hash = keccak256(rlpBytes) if data.hash.asEth2Digest != hash: return nil @@ -1664,7 +1651,7 @@ proc ETHTransactionsCreateFromJson( of DestinationType.Regular: tx.to.get of DestinationType.Create: - let hash = keccakHash(rlp.encodeList(fromAddress, tx.nonce)) + let hash = keccak256(rlp.encodeList(fromAddress, tx.nonce)) hash.to(EthAddress) # Compute authorizations @@ -1683,7 +1670,7 @@ proc ETHTransactionsCreateFromJson( signature: @sig) txs.add ETHTransaction( - hash: keccakHash(rlpBytes), + hash: keccak256(rlpBytes), chainId: distinctBase(tx.chainId), `from`: ExecutionAddress(data: fromAddress), nonce: tx.nonce, diff --git a/ncli/ncli_testnet.nim b/ncli/ncli_testnet.nim index 36ab4df55..4e33a3180 100644 --- a/ncli/ncli_testnet.nim +++ b/ncli/ncli_testnet.nim @@ -263,7 +263,7 @@ func `as`(blk: BlockObject, T: type bellatrix.ExecutionPayloadHeader): T = gas_limit: uint64 blk.gasLimit, gas_used: uint64 blk.gasUsed, timestamp: uint64 blk.timestamp, - extra_data: List[byte, MAX_EXTRA_DATA_BYTES].init(blk.extraData.bytes), + extra_data: List[byte, MAX_EXTRA_DATA_BYTES].init(blk.extraData.data), base_fee_per_gas: blk.baseFeePerGas.getOrDefault(), block_hash: blk.hash as Eth2Digest, transactions_root: blk.transactionsRoot as Eth2Digest) @@ -279,7 +279,7 @@ func `as`(blk: BlockObject, T: type capella.ExecutionPayloadHeader): T = gas_limit: uint64 blk.gasLimit, gas_used: uint64 blk.gasUsed, timestamp: uint64 blk.timestamp, - extra_data: List[byte, MAX_EXTRA_DATA_BYTES].init(blk.extraData.bytes), + extra_data: List[byte, MAX_EXTRA_DATA_BYTES].init(blk.extraData.data), base_fee_per_gas: blk.baseFeePerGas.getOrDefault(), block_hash: blk.hash as Eth2Digest, transactions_root: blk.transactionsRoot as Eth2Digest, @@ -296,7 +296,7 @@ func `as`(blk: BlockObject, T: type deneb.ExecutionPayloadHeader): T = gas_limit: uint64 blk.gasLimit, gas_used: uint64 blk.gasUsed, timestamp: uint64 blk.timestamp, - extra_data: List[byte, MAX_EXTRA_DATA_BYTES].init(blk.extraData.bytes), + extra_data: List[byte, MAX_EXTRA_DATA_BYTES].init(blk.extraData.data), base_fee_per_gas: blk.baseFeePerGas.getOrDefault(), block_hash: blk.hash as Eth2Digest, transactions_root: blk.transactionsRoot as Eth2Digest, @@ -315,7 +315,7 @@ func `as`(blk: BlockObject, T: type electra.ExecutionPayloadHeader): T = gas_limit: uint64 blk.gasLimit, gas_used: uint64 blk.gasUsed, timestamp: uint64 blk.timestamp, - extra_data: List[byte, MAX_EXTRA_DATA_BYTES].init(blk.extraData.bytes), + extra_data: List[byte, MAX_EXTRA_DATA_BYTES].init(blk.extraData.data), base_fee_per_gas: blk.baseFeePerGas.getOrDefault(), block_hash: blk.hash as Eth2Digest, transactions_root: blk.transactionsRoot as Eth2Digest, @@ -334,7 +334,7 @@ func `as`(blk: BlockObject, T: type fulu.ExecutionPayloadHeader): T = gas_limit: uint64 blk.gasLimit, gas_used: uint64 blk.gasUsed, timestamp: uint64 blk.timestamp, - extra_data: List[byte, MAX_EXTRA_DATA_BYTES].init(blk.extraData.bytes), + extra_data: List[byte, MAX_EXTRA_DATA_BYTES].init(blk.extraData.data), base_fee_per_gas: blk.baseFeePerGas.getOrDefault(), block_hash: blk.hash as Eth2Digest, transactions_root: blk.transactionsRoot as Eth2Digest, @@ -562,7 +562,7 @@ when isMainModule: let r = await web3.send(tr) result = await web3.getMinedTransactionReceipt(r) - proc sendEth(web3: Web3, to: Eth1Address, valueEth: int): Future[TxHash] = + proc sendEth(web3: Web3, to: Eth1Address, valueEth: int): Future[Hash32] = let tr = TransactionArgs( `from`: Opt.some web3.defaultAccount, # TODO: Force json-rpc to generate 'data' field diff --git a/vendor/nim-web3 b/vendor/nim-web3 index ff92d2877..c8f36f59c 160000 --- a/vendor/nim-web3 +++ b/vendor/nim-web3 @@ -1 +1 @@ -Subproject commit ff92d2877985faee5ac6abc3bea805b85f2be1c8 +Subproject commit c8f36f59cb354196cfe117b6866e81d450c8cfd7