Skip to content

Commit 140416b

Browse files
authored
Change ChainId type to UInt256, bump nim-eth, and nim-web3 (#7005)
* Change ChainId type to UInt256 * Remove TransitionConfigurationV1 usage * Lint
1 parent 65a9643 commit 140416b

File tree

4 files changed

+13
-22
lines changed

4 files changed

+13
-22
lines changed

beacon_chain/libnimbus_lc/libnimbus_lc.nim

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,15 +1421,15 @@ type
14211421
storageKeys: seq[Eth2Digest]
14221422

14231423
ETHAuthorization = object
1424-
chainId: uint64
1424+
chainId: UInt256
14251425
address: ExecutionAddress
14261426
nonce: uint64
14271427
authority: ExecutionAddress
14281428
signature: seq[byte]
14291429

14301430
ETHTransaction = object
14311431
hash: Eth2Digest
1432-
chainId: uint64
1432+
chainId: UInt256
14331433
`from`: ExecutionAddress
14341434
nonce: uint64
14351435
maxPriorityFeePerGas: uint64
@@ -1539,8 +1539,8 @@ proc ETHTransactionsCreateFromJson(
15391539

15401540
# Construct transaction
15411541
static:
1542-
doAssert sizeof(uint64) == sizeof(ChainId)
1543-
doAssert sizeof(uint64) == sizeof(data.chainId.get)
1542+
doAssert sizeof(UInt256) == sizeof(ChainId)
1543+
doAssert sizeof(UInt256) == sizeof(data.chainId.get)
15441544
doAssert sizeof(uint64) == sizeof(data.gas)
15451545
doAssert sizeof(uint64) == sizeof(data.gasPrice)
15461546
doAssert sizeof(uint64) == sizeof(data.maxPriorityFeePerGas.get)
@@ -1556,13 +1556,13 @@ proc ETHTransactionsCreateFromJson(
15561556
return nil
15571557
if data.authorizationList.isSome:
15581558
for authorization in data.authorizationList.get:
1559-
static: doAssert sizeof(uint64) == sizeof(authorization.chainId)
1559+
static: doAssert sizeof(UInt256) == sizeof(authorization.chainId)
15601560
if authorization.v > uint8.high:
15611561
return nil
15621562
let
15631563
tx = eth_types.EthTransaction(
15641564
txType: txType,
1565-
chainId: data.chainId.get(0.Quantity).ChainId,
1565+
chainId: data.chainId.get(0.u256),
15661566
nonce: distinctBase(data.nonce),
15671567
gasPrice: data.gasPrice.GasInt,
15681568
maxPriorityFeePerGas:
@@ -1663,15 +1663,15 @@ proc ETHTransactionsCreateFromJson(
16631663
authority = recoverSignerAddress(sig, auth.rlpHashForSigning).valueOr:
16641664
return nil
16651665
authorizationList.add ETHAuthorization(
1666-
chainId: distinctBase(auth.chainId),
1666+
chainId: auth.chainId,
16671667
address: ExecutionAddress(data: auth.address.data),
16681668
nonce: auth.nonce,
16691669
authority: ExecutionAddress(data: authority),
16701670
signature: @sig)
16711671

16721672
txs.add ETHTransaction(
16731673
hash: keccak256(rlpBytes),
1674-
chainId: distinctBase(tx.chainId),
1674+
chainId: tx.chainId,
16751675
`from`: ExecutionAddress(data: fromAddress),
16761676
nonce: tx.nonce,
16771677
maxPriorityFeePerGas: tx.maxPriorityFeePerGas.uint64,
@@ -1755,7 +1755,7 @@ func ETHTransactionGetHash(
17551755
addr transaction[].hash
17561756

17571757
func ETHTransactionGetChainId(
1758-
transaction: ptr ETHTransaction): ptr uint64 {.exported.} =
1758+
transaction: ptr ETHTransaction): ptr UInt256 {.exported.} =
17591759
## Obtains the chain ID of a transaction.
17601760
##
17611761
## * The returned value is allocated in the given transaction.
@@ -2115,7 +2115,7 @@ func ETHAuthorizationListGet(
21152115
addr authorizationList[][authorizationIndex.int]
21162116

21172117
func ETHAuthorizationGetChainId(
2118-
authorization: ptr ETHAuthorization): ptr uint64 {.exported.} =
2118+
authorization: ptr ETHAuthorization): ptr UInt256 {.exported.} =
21192119
## Obtains the chain ID of an authorization tuple.
21202120
##
21212121
## * The returned value is allocated in the given authorization tuple.

research/fakeee.nim

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# beacon_chain
2-
# Copyright (c) 2022-2024 Status Research & Development GmbH
2+
# Copyright (c) 2022-2025 Status Research & Development GmbH
33
# Licensed and distributed under either of
44
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
55
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@@ -45,15 +45,6 @@ proc setupEngineAPI*(server: RpcServer) =
4545
msg: "Unknown payload"
4646
)
4747

48-
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/paris.md#engine_exchangetransitionconfigurationv1
49-
server.rpc("engine_exchangeTransitionConfigurationV1") do(conf: TransitionConfigurationV1) -> TransitionConfigurationV1:
50-
info "engine_exchangeTransitionConfigurationV1",
51-
ttd = conf.terminalTotalDifficulty,
52-
number = uint64(conf.terminalBlockNumber),
53-
blockHash = conf.terminalBlockHash
54-
55-
return conf
56-
5748
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/paris.md#engine_forkchoiceupdatedv1
5849
server.rpc("engine_forkchoiceUpdatedV1") do(
5950
update: ForkchoiceStateV1,

0 commit comments

Comments
 (0)