Skip to content

Commit 08efe95

Browse files
authored
Remove unused imports and disable persist performance metrics on bare metal (#3880)
* Remove unused imports. * Disable persist performance metrics when compiling on bare metal.
1 parent 4c3cfc9 commit 08efe95

File tree

5 files changed

+30
-20
lines changed

5 files changed

+30
-20
lines changed

execution_chain/db/aristo/aristo_init/rocks_db/rdb_desc.nim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
{.push raises: [].}
1515

1616
import
17-
std/os,
1817
std/concurrency/atomics,
1918
stew/endians2,
2019
../../../core_db/backend/rocksdb_desc,

execution_chain/db/core_db/base.nim

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@
1313
import
1414
std/typetraits,
1515
chronicles,
16-
chronos/timer,
1716
eth/common/[accounts, base, hashes],
1817
../../constants,
1918
../[kvt, aristo],
2019
../kvt/kvt_init/init_common,
2120
./base/[base_desc, base_helpers]
2221

22+
# Persist performance metrics are disabled on bare metal
23+
when not defined(`any`) and not defined(standalone):
24+
import chronos/timer
25+
2326
export
2427
CoreDbAccount,
2528
CoreDbErrorCode,
@@ -96,22 +99,30 @@ proc persist*(db: CoreDbRef, txFrame: CoreDbTxRef) =
9699
# kvt changes written to memory but not to disk because of an aristo
97100
# error), we have to panic instead.
98101

99-
let kvtTick = Moment.now()
100-
db.kvt.persist(kvtBatch[], txFrame.kTx)
101-
let mptTick = Moment.now()
102-
db.mpt.persist(mptBatch[], txFrame.aTx)
103-
104-
let endTick = Moment.now()
105-
db.kvt.putEndFn(kvtBatch[]).isOkOr:
106-
raiseAssert $error
107-
108-
db.mpt.putEndFn(mptBatch[]).isOkOr:
109-
raiseAssert $error
102+
when not defined(`any`) and not defined(standalone):
103+
let kvtTick = Moment.now()
104+
db.kvt.persist(kvtBatch[], txFrame.kTx)
105+
let mptTick = Moment.now()
106+
db.mpt.persist(mptBatch[], txFrame.aTx)
107+
108+
let endTick = Moment.now()
109+
db.kvt.putEndFn(kvtBatch[]).isOkOr:
110+
raiseAssert $error
111+
db.mpt.putEndFn(mptBatch[]).isOkOr:
112+
raiseAssert $error
113+
114+
debug "Core DB persisted",
115+
kvtDur = mptTick - kvtTick,
116+
mptDur = endTick - mptTick,
117+
endDur = Moment.now() - endTick
118+
else:
119+
db.kvt.persist(kvtBatch[], txFrame.kTx)
120+
db.mpt.persist(mptBatch[], txFrame.aTx)
121+
db.kvt.putEndFn(kvtBatch[]).isOkOr:
122+
raiseAssert $error
123+
db.mpt.putEndFn(mptBatch[]).isOkOr:
124+
raiseAssert $error
110125

111-
debug "Core DB persisted",
112-
kvtDur = mptTick - kvtTick,
113-
mptDur = endTick - mptTick,
114-
endDur = Moment.now() - endTick
115126
else:
116127
discard kvtBatch.expect("should always be able to create batch")
117128
discard mptBatch.expect("should always be able to create batch")

execution_chain/evm/code_stream.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
66
# at your option. This file may not be copied, modified, or distributed except according to those terms.
77

8-
import chronicles, stint, stew/byteutils, ./interpreter/op_codes, ./code_bytes
8+
import stint, stew/byteutils, ./interpreter/op_codes, ./code_bytes
99

1010
export code_bytes
1111

execution_chain/evm/interpreter_dispatch.nim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
import
1414
std/[macros, strformat],
15-
pkg/[chronicles, chronos, stew/byteutils],
15+
chronicles,
16+
stew/byteutils,
1617
".."/[constants, db/ledger],
1718
"."/[code_stream, computation, evm_errors],
1819
"."/[message, precompiles, state, types],

execution_chain/transaction/call_common.nim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import
1212
eth/common/eth_types, stint,
13-
chronos,
1413
results,
1514
../evm/[types, state],
1615
../evm/[message, precompiles, internals, interpreter_dispatch],

0 commit comments

Comments
 (0)