Skip to content

Commit 9d0c498

Browse files
authored
fix Nim 2.2 warnings (#7121)
1 parent c94e4dd commit 9d0c498

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ _Alternatively, fire up our [experimental Vagrant instance with Nim pre-installe
130130

131131
<!-- TODO: Is this up to date? -->
132132

133-
The [generic instructions from the Nimbus repo](https://github.com/status-im/nimbus/#metric-visualisation) apply here as well.
133+
The [generic instructions from the Nimbus repo](https://github.com/status-im/nimbus-eth1/#metric-visualisation) apply here as well.
134134

135135
Specific steps:
136136

beacon_chain/statediff.nim

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# beacon_chain
2-
# Copyright (c) 2020-2024 Status Research & Development GmbH
2+
# Copyright (c) 2020-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).
@@ -11,19 +11,20 @@ import
1111
stew/assign2,
1212
./spec/forks
1313

14-
func diffModIncEpoch[maxLen, T](hl: HashArray[maxLen, T], startSlot: uint64):
15-
array[SLOTS_PER_EPOCH, T] =
16-
static: doAssert maxLen.uint64 mod SLOTS_PER_EPOCH == 0
14+
func diffModIncEpoch[maxLength, T](
15+
hl: HashArray[maxLength, T], startSlot: uint64): array[SLOTS_PER_EPOCH, T] =
16+
static: doAssert maxLength.uint64 mod SLOTS_PER_EPOCH == 0
1717
doAssert startSlot mod SLOTS_PER_EPOCH == 0
1818
for i in startSlot ..< startSlot + SLOTS_PER_EPOCH:
19-
result[i mod SLOTS_PER_EPOCH] = hl[i mod maxLen.uint64]
19+
result[i mod SLOTS_PER_EPOCH] = hl[i mod maxLength.uint64]
2020

21-
func applyModIncrement[maxLen, T](
22-
ha: var HashArray[maxLen, T], hl: array[SLOTS_PER_EPOCH, T], slot: uint64) =
21+
func applyModIncrement[maxLength, T](
22+
ha: var HashArray[maxLength, T], hl: array[SLOTS_PER_EPOCH, T],
23+
slot: uint64) =
2324
var indexSlot = slot
2425

2526
for item in hl:
26-
ha[indexSlot mod maxLen.uint64] = item
27+
ha[indexSlot mod maxLength.uint64] = item
2728
indexSlot += 1
2829

2930
func applyValidatorIdentities(
@@ -51,9 +52,9 @@ func setValidatorStatusesNoWithdrawals(
5152
validator[].exit_epoch = hl[i].exit_epoch
5253
validator[].withdrawable_epoch = hl[i].withdrawable_epoch
5354

54-
func replaceOrAddEncodeEth1Votes[T, maxLen](
55-
votes0: openArray[T], votes0_len: int, votes1: HashList[T, maxLen]):
56-
(bool, List[T, maxLen]) =
55+
func replaceOrAddEncodeEth1Votes[T, maxLength](
56+
votes0: openArray[T], votes0_len: int, votes1: HashList[T, maxLength]):
57+
(bool, List[T, maxLength]) =
5758
let
5859
num_votes0 = votes0.len
5960
lower_bound =
@@ -67,17 +68,17 @@ func replaceOrAddEncodeEth1Votes[T, maxLen](
6768
else:
6869
num_votes0
6970

70-
var res = (lower_bound == 0, default(List[T, maxLen]))
71+
var res = (lower_bound == 0, default(List[T, maxLength]))
7172
for i in lower_bound ..< votes1.len:
7273
if not result[1].add votes1[i]:
7374
raiseAssert "same limit"
7475
res
7576

76-
func replaceOrAddDecodeEth1Votes[T, maxLen](
77-
votes0: var HashList[T, maxLen], eth1_data_votes_replaced: bool,
78-
votes1: List[T, maxLen]) =
77+
func replaceOrAddDecodeEth1Votes[T, maxLength](
78+
votes0: var HashList[T, maxLength], eth1_data_votes_replaced: bool,
79+
votes1: List[T, maxLength]) =
7980
if eth1_data_votes_replaced:
80-
votes0 = HashList[T, maxLen]()
81+
votes0 = HashList[T, maxLength]()
8182

8283
for item in votes1:
8384
if not votes0.add item:
@@ -209,8 +210,8 @@ func applyDiff*(
209210
state: var capella.BeaconState,
210211
immutableValidators: openArray[ImmutableValidatorData2],
211212
stateDiff: BeaconStateDiff) =
212-
template assign[T, maxLen](
213-
tgt: var HashList[T, maxLen], src: List[T, maxLen]) =
213+
template assign[T, maxLength](
214+
tgt: var HashList[T, maxLength], src: List[T, maxLength]) =
214215
assign(tgt.data, src)
215216
tgt.resetCache()
216217

docs/the_nimbus_book/src/migration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,6 @@ For a quick guide on how to set up a systemd service, see [our systemd guide](./
188188

189189
## Final thoughts
190190

191-
If you are unsure of the safety of a step, please get in touch with us directly on [discord](https://discord.gg/nnNEBvHu3m).
191+
If you are unsure of the safety of a step, please get in touch with us directly on [Discord](https://discord.gg/XRxWahP).
192192
Additionally, we recommend testing the migration works correctly on a testnet before going ahead on mainnet.
193193

0 commit comments

Comments
 (0)