Skip to content

Commit c525590

Browse files
authored
Fix simulator RPC object: add fields from latest spec (#2859)
1 parent a57a887 commit c525590

File tree

3 files changed

+36
-9
lines changed

3 files changed

+36
-9
lines changed

hive_integration/nodocker/engine/engine_client.nim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,17 @@ proc toBlockHeader*(bc: BlockObject): Header =
269269
blobGasUsed : maybeU64(bc.blobGasUsed),
270270
excessBlobGas : maybeU64(bc.excessBlobGas),
271271
parentBeaconBlockRoot: bc.parentBeaconBlockRoot,
272+
requestsHash : bc.requestsHash,
272273
)
273274

274275
func vHashes(x: Opt[seq[Hash32]]): seq[VersionedHash] =
275276
if x.isNone: return
276277
else: x.get
277278

279+
func authList(x: Opt[seq[AuthorizationObject]]): seq[Authorization] =
280+
if x.isNone: return
281+
else: ethAuthList x.get
282+
278283
proc toTransaction(tx: TransactionObject): Transaction =
279284
Transaction(
280285
txType : tx.`type`.get(0.Web3Quantity).TxType,
@@ -293,6 +298,7 @@ proc toTransaction(tx: TransactionObject): Transaction =
293298
V : tx.v.uint64,
294299
R : tx.r,
295300
S : tx.s,
301+
authorizationList: authList(tx.authorizationList),
296302
)
297303

298304
proc toTransactions*(txs: openArray[TxOrHash]): seq[Transaction] =
@@ -360,6 +366,7 @@ type
360366
accessList*: Opt[seq[AccessPair]]
361367
maxFeePerBlobGas*: Opt[UInt256]
362368
versionedHashes*: Opt[seq[VersionedHash]]
369+
authorizationList*: Opt[seq[Authorization]]
363370

364371
proc toRPCReceipt(rec: ReceiptObject): RPCReceipt =
365372
RPCReceipt(
@@ -408,6 +415,7 @@ proc toRPCTx(tx: eth_api.TransactionObject): RPCTx =
408415
Opt.some(vHashes tx.blobVersionedHashes)
409416
else:
410417
Opt.none(seq[VersionedHash]),
418+
authorizationList: ethAuthList(tx.authorizationList),
411419
)
412420

413421
proc waitForTTD*(client: RpcClient,

nimbus/beacon/web3_eth_conv.nim

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,16 @@ func u256*(x: FixedBytes[32]): UInt256 =
6363
func ethTime*(x: Web3Quantity): EthTime =
6464
EthTime(x)
6565

66-
func ethGasInt*(x: Web3Quantity): GasInt =
67-
GasInt x
68-
6966
func ethBlob*(x: Web3ExtraData): seq[byte] =
7067
distinctBase x
7168

72-
func ethWithdrawal*(x: WithdrawalV1): common.Withdrawal =
73-
result.index = x.index.uint64
74-
result.validatorIndex = x.validatorIndex.uint64
75-
result.address = x.address
76-
result.amount = x.amount.uint64
69+
func ethWithdrawal*(x: WithdrawalV1): Withdrawal =
70+
Withdrawal(
71+
index: x.index.uint64,
72+
validatorIndex: x.validatorIndex.uint64,
73+
address: x.address,
74+
amount: x.amount.uint64,
75+
)
7776

7877
func ethWithdrawals*(list: openArray[WithdrawalV1]):
7978
seq[Withdrawal] =
@@ -95,6 +94,27 @@ func ethTxs*(list: openArray[Web3Tx]):
9594
for x in list:
9695
result.add ethTx(x)
9796

97+
func ethAuth*(x: AuthorizationObject): Authorization =
98+
Authorization(
99+
chainId: ChainId x.chainId,
100+
address: x.address,
101+
nonce: distinctBase x.nonce,
102+
v: distinctBase x.v,
103+
r: x.r,
104+
s: x.s,
105+
)
106+
107+
func ethAuthList*(list: openArray[AuthorizationObject]):
108+
seq[Authorization] =
109+
result = newSeqOfCap[Authorization](list.len)
110+
for x in list:
111+
result.add ethAuth(x)
112+
113+
func ethAuthList*(x: Opt[seq[AuthorizationObject]]):
114+
Opt[seq[Authorization]] =
115+
if x.isNone: Opt.none(seq[Authorization])
116+
else: Opt.some(ethAuthList x.get)
117+
98118
# ------------------------------------------------------------------------------
99119
# Eth types to Web3 types
100120
# ------------------------------------------------------------------------------

nimbus/config.nim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import
1212
std/[
1313
options,
1414
strutils,
15-
times,
1615
os,
1716
uri,
1817
net

0 commit comments

Comments
 (0)