Skip to content

Commit 95625a0

Browse files
authored
stop using nimOldCaseObjects and make CaseTransition warnings errors (#3853)
1 parent 6af24b8 commit 95625a0

File tree

3 files changed

+43
-46
lines changed

3 files changed

+43
-46
lines changed

GeneralStateTestsDevnet.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,6 @@ OK: 5/5 Fail: 0/5 Skip: 0/5
139139
+ valid_multi_inf.json OK
140140
```
141141
OK: 6/6 Fail: 0/6 Skip: 0/6
142-
## bls12_precompiles_before_fork
143-
```diff
144-
+ precompile_before_fork.json OK
145-
```
146-
OK: 1/1 Fail: 0/1 Skip: 0/1
147142
## bls12_variable_length_input_contracts
148143
```diff
149144
+ invalid_gas_g1msm.json OK
@@ -471,10 +466,9 @@ OK: 50/50 Fail: 0/50 Skip: 0/50
471466
+ pointer_to_precompile.json OK
472467
+ pointer_to_static.json OK
473468
+ pointer_to_static_reentry.json OK
474-
+ set_code_type_tx_pre_fork.json OK
475469
+ static_to_pointer.json OK
476470
```
477-
OK: 16/16 Fail: 0/16 Skip: 0/16
471+
OK: 15/15 Fail: 0/15 Skip: 0/15
478472
## shift_combinations
479473
```diff
480474
+ combinations.json OK
@@ -562,4 +556,4 @@ OK: 2/2 Fail: 0/2 Skip: 0/2
562556
OK: 1/1 Fail: 0/1 Skip: 0/1
563557

564558
---TOTAL---
565-
OK: 268/268 Fail: 0/268 Skip: 0/268
559+
OK: 266/266 Fail: 0/266 Skip: 0/266

config.nims

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,13 @@ if defined(windows):
8383
#
8484
if defined(disableMarchNative):
8585
if defined(i386) or defined(amd64):
86-
if defined(macosx):
87-
# https://support.apple.com/en-us/105113
88-
# "macOS Sonoma is compatible with these computers" lists current oldest
89-
# supported x86 models, all of which have Kaby Lake or newer CPUs.
90-
switch("passC", "-march=skylake -mtune=generic")
91-
switch("passL", "-march=skylake -mtune=generic")
86+
if defined(marchOptimized):
87+
# https://github.com/status-im/nimbus-eth2/blob/stable/docs/cpu_features.md#bmi2--adx
88+
switch("passC", "-march=broadwell -mtune=generic")
89+
switch("passL", "-march=broadwell -mtune=generic")
9290
else:
93-
if defined(marchOptimized):
94-
# https://github.com/status-im/nimbus-eth2/blob/stable/docs/cpu_features.md#bmi2--adx
95-
switch("passC", "-march=broadwell -mtune=generic")
96-
switch("passL", "-march=broadwell -mtune=generic")
97-
else:
98-
switch("passC", "-mssse3")
99-
switch("passL", "-mssse3")
91+
switch("passC", "-mssse3")
92+
switch("passL", "-mssse3")
10093
elif defined(macosx) and defined(arm64):
10194
# Apple's Clang can't handle "-march=native" on M1: https://github.com/status-im/nimbus-eth2/issues/2758
10295
switch("passC", "-mcpu=apple-m1")
@@ -169,16 +162,12 @@ if canEnableDebuggingSymbols:
169162
# add debugging symbols and original files and line numbers
170163
--debugger:native
171164

172-
--define:nimOldCaseObjects # https://github.com/status-im/nim-confutils/issues/9
173-
174165
switch("warningAsError", "BareExcept:on")
166+
switch("warningAsError", "CaseTransition:on")
175167
switch("warningAsError", "UnusedImport:on")
176168
switch("hintAsError", "ConvFromXtoItselfNotNeeded:on")
177169
switch("hintAsError", "DuplicateModuleImport:on")
178170

179-
# `switch("warning[CaseTransition]", "off")` fails with "Error: invalid command line option: '--warning[CaseTransition]'"
180-
switch("warning", "CaseTransition:off")
181-
182171
# nim-kzg shipping their own blst, nimbus-eth1 too.
183172
# disable nim-kzg's blst
184173
switch("define", "kzgExternalBlst")

tests/test_coredb/coredb_test_xx.nim

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
# at your option. This file may not be copied, modified, or
99
# distributed except according to those terms.
1010

11+
{.push raises: [], gcsafe.}
12+
1113
import
1214
eth/common,
1315
../../execution_chain/db/core_db,
@@ -36,36 +38,48 @@ func cloneWith(
3638
dbType = CoreDbType(0);
3739
dbName = "";
3840
): CaptureSpecs =
39-
result = dsc
40-
if network != 0.u256:
41-
result.builtIn = true
42-
result.network = network
43-
elif 0 < genesis.len:
44-
result.builtIn = false
45-
result.genesis = genesis
41+
var res =
42+
if network != 0.u256:
43+
CaptureSpecs(
44+
name: dsc.name,
45+
builtIn: true,
46+
network: network,
47+
files: dsc.files,
48+
numBlocks: dsc.numBlocks,
49+
dbType: dsc.dbType,
50+
dbName: dsc.dbName)
51+
elif 0 < genesis.len:
52+
CaptureSpecs(
53+
name: dsc.name,
54+
builtIn: false,
55+
genesis: genesis,
56+
files: dsc.files,
57+
numBlocks: dsc.numBlocks,
58+
dbType: dsc.dbType,
59+
dbName: dsc.dbName)
60+
else:
61+
dsc
4662
if 0 < name.len:
4763
if name[0] == '-':
48-
result.name &= name
64+
res.name &= name
4965
elif name[0] == '+' and 1 < name.len:
50-
result.name &= name[1 .. ^1]
66+
res.name &= name[1 .. ^1]
5167
else:
52-
result.name = name
68+
res.name = name
5369
if 0 < files.len:
54-
result.files = files
70+
res.files = files
5571
if 0 < numBlocks:
56-
result.numBlocks = numBlocks
72+
res.numBlocks = numBlocks
5773
if dbType != CoreDbType(0):
58-
result.dbType = dbType
74+
res.dbType = dbType
5975
if dbName == "":
60-
result.dbName = result.name
76+
res.dbName = res.name
6177
else:
62-
result.dbName = dbName
78+
res.dbName = dbName
79+
res
6380

6481

65-
# Must not use `const` here, see `//github.com/nim-lang/Nim/issues/23295`
66-
# Waiting for fix `//github.com/nim-lang/Nim/pull/23297` (or similar) to
67-
# appear on local `Nim` compiler version.
68-
let
82+
const
6983
mainSample = CaptureSpecs(
7084
builtIn: true,
7185
name: "main",
@@ -78,7 +92,7 @@ let
7892
builtIn: true,
7993
name: "main",
8094
network: MainNet,
81-
# The extren repo is identified by a tag file
95+
# The extern repo is identified by a tag file
8296
files: @["mainnet-extern.era1"]) # on external repo
8397

8498
# ------------------

0 commit comments

Comments
 (0)