Misc updates (#2513)
* Update config for Ledger and CoreDb why: Prepare for tracer which depends on the API jump table (as well as the profiler.) The API jump table is now enabled in unit/integration test mode piggybacking on the `unittest2DisableParamFiltering` compiler flag or on an extra compiler flag `dbjapi_enabled`. * No deed for error field in `NodeRef` why: Was opnly needed by proof nodes pre-loader which will be re-implemented * Cosmetics
This commit is contained in:
parent
45d85aa3b5
commit
1452e7b1c0
|
@ -8,6 +8,10 @@
|
||||||
# at your option. This file may not be copied, modified, or distributed except
|
# at your option. This file may not be copied, modified, or distributed except
|
||||||
# according to those terms.
|
# according to those terms.
|
||||||
|
|
||||||
|
import
|
||||||
|
./db/core_db/base/base_config,
|
||||||
|
./db/ledger/base/base_config
|
||||||
|
|
||||||
func vmName(): string =
|
func vmName(): string =
|
||||||
when defined(evmc_enabled):
|
when defined(evmc_enabled):
|
||||||
"evmc"
|
"evmc"
|
||||||
|
@ -23,6 +27,10 @@ const
|
||||||
rc &= ", chunked-rlpx"
|
rc &= ", chunked-rlpx"
|
||||||
when defined(boehmgc):
|
when defined(boehmgc):
|
||||||
rc &= ", boehm/gc"
|
rc &= ", boehm/gc"
|
||||||
|
when 0 < coreDbBaseConfigExtras.len:
|
||||||
|
rc &= ", " & coreDbBaseConfigExtras
|
||||||
|
when 0 < ledgerBaseConfigExtras.len:
|
||||||
|
rc &= ", " & ledgerBaseConfigExtras
|
||||||
rc &= " enabled"
|
rc &= " enabled"
|
||||||
rc
|
rc
|
||||||
|
|
||||||
|
|
|
@ -851,9 +851,9 @@ func init*(
|
||||||
result = api.pathAsBlob(a)
|
result = api.pathAsBlob(a)
|
||||||
|
|
||||||
profApi.persist =
|
profApi.persist =
|
||||||
proc(a: AristoDbRef; b = 0u64; c = false): auto =
|
proc(a: AristoDbRef; b = 0u64): auto =
|
||||||
AristoApiProfPersistFn.profileRunner:
|
AristoApiProfPersistFn.profileRunner:
|
||||||
result = api.persist(a, b, c)
|
result = api.persist(a, b)
|
||||||
|
|
||||||
profApi.reCentre =
|
profApi.reCentre =
|
||||||
proc(a: AristoDbRef): auto =
|
proc(a: AristoDbRef): auto =
|
||||||
|
|
|
@ -18,7 +18,7 @@ import
|
||||||
std/[hashes, tables],
|
std/[hashes, tables],
|
||||||
stint,
|
stint,
|
||||||
eth/common,
|
eth/common,
|
||||||
"."/[desc_error, desc_identifiers]
|
./desc_identifiers
|
||||||
|
|
||||||
export stint
|
export stint
|
||||||
|
|
||||||
|
@ -74,7 +74,6 @@ type
|
||||||
NodeRef* = ref object of VertexRef
|
NodeRef* = ref object of VertexRef
|
||||||
## Combined record for a *traditional* ``Merkle Patricia Tree` node merged
|
## Combined record for a *traditional* ``Merkle Patricia Tree` node merged
|
||||||
## with a structural `VertexRef` type object.
|
## with a structural `VertexRef` type object.
|
||||||
error*: AristoError ## Used for error signalling in RLP decoder
|
|
||||||
key*: array[16,HashKey] ## Merkle hash/es for vertices
|
key*: array[16,HashKey] ## Merkle hash/es for vertices
|
||||||
|
|
||||||
# ----------------------
|
# ----------------------
|
||||||
|
|
|
@ -15,14 +15,13 @@ import
|
||||||
eth/common,
|
eth/common,
|
||||||
"../.."/[constants, errors],
|
"../.."/[constants, errors],
|
||||||
".."/[kvt, aristo],
|
".."/[kvt, aristo],
|
||||||
|
./backend/aristo_db,
|
||||||
./base/[api_tracking, base_config, base_desc, base_helpers]
|
./base/[api_tracking, base_config, base_desc, base_helpers]
|
||||||
|
|
||||||
export
|
export
|
||||||
CoreDbAccRef,
|
CoreDbAccRef,
|
||||||
CoreDbAccount,
|
CoreDbAccount,
|
||||||
CoreDbApiError,
|
CoreDbApiError,
|
||||||
#CoreDbCaptFlags,
|
|
||||||
#CoreDbCaptRef,
|
|
||||||
CoreDbCtxRef,
|
CoreDbCtxRef,
|
||||||
CoreDbErrorCode,
|
CoreDbErrorCode,
|
||||||
CoreDbError,
|
CoreDbError,
|
||||||
|
@ -34,7 +33,6 @@ export
|
||||||
CoreDbType
|
CoreDbType
|
||||||
|
|
||||||
when CoreDbEnableApiTracking:
|
when CoreDbEnableApiTracking:
|
||||||
{.warning: "*** Provided API logging for CoreDB (disabled by default)".}
|
|
||||||
import
|
import
|
||||||
chronicles
|
chronicles
|
||||||
logScope:
|
logScope:
|
||||||
|
@ -42,16 +40,18 @@ when CoreDbEnableApiTracking:
|
||||||
const
|
const
|
||||||
logTxt = "API"
|
logTxt = "API"
|
||||||
|
|
||||||
|
|
||||||
when CoreDbEnableProfiling:
|
when CoreDbEnableProfiling:
|
||||||
{.warning: "*** Enabled profiling for CoreDB (also tracer API available)".}
|
|
||||||
export
|
export
|
||||||
CoreDbFnInx,
|
CoreDbFnInx,
|
||||||
CoreDbProfListRef
|
CoreDbProfListRef
|
||||||
|
|
||||||
|
when CoreDbEnableCaptJournal and false:
|
||||||
when CoreDbEnableApiJumpTable:
|
import
|
||||||
discard
|
./backend/aristo_trace
|
||||||
|
type
|
||||||
|
CoreDbCaptRef* = distinct TraceLogInstRef
|
||||||
|
func `$`(p: CoreDbCaptRef): string =
|
||||||
|
if p.distinctBase.isNil: "<nil>" else: "<capt>"
|
||||||
else:
|
else:
|
||||||
import
|
import
|
||||||
../aristo/[
|
../aristo/[
|
||||||
|
@ -714,7 +714,7 @@ proc dispose*(tx: CoreDbTxRef) =
|
||||||
# Public tracer methods
|
# Public tracer methods
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
when false: # currently disabled
|
when CoreDbEnableCaptJournal and false: # currently disabled
|
||||||
proc newCapture*(
|
proc newCapture*(
|
||||||
db: CoreDbRef;
|
db: CoreDbRef;
|
||||||
): CoreDbRc[CoreDbCaptRef] =
|
): CoreDbRc[CoreDbCaptRef] =
|
||||||
|
|
|
@ -20,38 +20,78 @@ const
|
||||||
## Tracking noise is then enabled by setting the flag `trackCoreDbApi` to
|
## Tracking noise is then enabled by setting the flag `trackCoreDbApi` to
|
||||||
## `true` in the `CoreDbRef` descriptor.
|
## `true` in the `CoreDbRef` descriptor.
|
||||||
|
|
||||||
EnableProfiling = false
|
AutoValidateDescriptors = defined(release).not or
|
||||||
## Enables profiling of the backend. If the flag `EnableApiTracking` is
|
defined(unittest2DisableParamFiltering)
|
||||||
## also set the API will also be subject to profiling.
|
## No validatinon needed for production suite.
|
||||||
|
##
|
||||||
|
## The `unittest2DisableParamFiltering` flag is coincidentally used by
|
||||||
|
## unit/integration tests which makes it convenient to piggyback on that
|
||||||
|
## for enabling debugging checks.
|
||||||
|
|
||||||
EnableCaptJournal = defined(release).not
|
EnableApiJumpTable = defined(dbjapi_enabled) or
|
||||||
## Enables the tracer facility. If set `true` capture journal directives
|
defined(unittest2DisableParamFiltering)
|
||||||
## like `newCapture()` will be available.
|
## This flag enables the functions jump table even if `EnableApiProfiling`
|
||||||
|
## and `EnableCaptJournal` is set `false` in realease mode. This setting
|
||||||
|
## should be used for debugging, only.
|
||||||
|
##
|
||||||
|
## The `unittest2DisableParamFiltering` flag is coincidentally used by
|
||||||
|
## unit/integration tests which makes it convenient to piggyback on that
|
||||||
|
## for providing API jump tables.
|
||||||
|
|
||||||
|
EnableProfiling = false
|
||||||
|
## Enables profiling of the backend if the flags ` EnableApiJumpTable`
|
||||||
|
## and `EnableApiTracking` are also set. Profiling will then be enabled
|
||||||
|
## with the flag `trackCoreDbApi` (which also enables extra logging.)
|
||||||
|
|
||||||
|
EnableCaptJournal = true
|
||||||
|
## Enables the tracer facility if the flag ` EnableApiJumpTable` is
|
||||||
|
## also set. In that case the capture journal directives like
|
||||||
|
## `newCapture()` will be available.
|
||||||
|
|
||||||
NoisyCaptJournal = true
|
NoisyCaptJournal = true
|
||||||
## Provide extra logging with the tracer facility if available.
|
## Provide extra logging with the tracer facility if available.
|
||||||
|
|
||||||
EnableApiJumpTable = false
|
|
||||||
## This flag enables the functions jump table even if `EnableApiProfiling`
|
|
||||||
## and `EnableCaptJournal` is set `false` in realease mode. This setting
|
|
||||||
## should be used for debugging, only.
|
|
||||||
|
|
||||||
AutoValidateDescriptors = defined(release).not
|
|
||||||
## No validatinon needed for production suite.
|
|
||||||
|
|
||||||
# Exportable constants (leave alone this section)
|
# Exportable constants (leave alone this section)
|
||||||
const
|
const
|
||||||
CoreDbEnableApiTracking* = EnableApiTracking
|
CoreDbEnableApiTracking* = EnableApiTracking
|
||||||
|
|
||||||
CoreDbEnableProfiling* = EnableProfiling
|
|
||||||
|
|
||||||
CoreDbEnableCaptJournal* = EnableCaptJournal
|
|
||||||
|
|
||||||
CoreDbNoisyCaptJournal* = CoreDbEnableCaptJournal and NoisyCaptJournal
|
|
||||||
|
|
||||||
CoreDbEnableApiJumpTable* =
|
|
||||||
CoreDbEnableProfiling or CoreDbEnableCaptJournal or EnableApiJumpTable
|
|
||||||
|
|
||||||
CoreDbAutoValidateDescriptors* = AutoValidateDescriptors
|
CoreDbAutoValidateDescriptors* = AutoValidateDescriptors
|
||||||
|
|
||||||
|
# Api jump table dependent settings:
|
||||||
|
|
||||||
|
CoreDbEnableApiJumpTable* = EnableApiJumpTable
|
||||||
|
|
||||||
|
CoreDbEnableProfiling* = EnableProfiling and CoreDbEnableApiJumpTable
|
||||||
|
|
||||||
|
CoreDbEnableCaptJournal* = EnableCaptJournal and CoreDbEnableApiJumpTable
|
||||||
|
|
||||||
|
CoreDbNoisyCaptJournal* = NoisyCaptJournal and CoreDbEnableCaptJournal
|
||||||
|
|
||||||
|
|
||||||
|
# Support warning about extra compile time options. For production, non of
|
||||||
|
# the above features should be enabled.
|
||||||
|
import strutils
|
||||||
|
const coreDbBaseConfigExtras* = block:
|
||||||
|
var s: seq[string]
|
||||||
|
when CoreDbEnableApiTracking:
|
||||||
|
s.add "logging"
|
||||||
|
when CoreDbAutoValidateDescriptors:
|
||||||
|
s.add "validate"
|
||||||
|
when CoreDbEnableProfiling:
|
||||||
|
s.add "profiling"
|
||||||
|
when CoreDbEnableCaptJournal:
|
||||||
|
when CoreDbNoisyCaptJournal:
|
||||||
|
s.add "noisy tracer"
|
||||||
|
else:
|
||||||
|
s.add "tracer"
|
||||||
|
when CoreDbEnableApiJumpTable and
|
||||||
|
not CoreDbEnableProfiling and
|
||||||
|
not CoreDbEnableCaptJournal:
|
||||||
|
s.add "Api jump table"
|
||||||
|
if s.len == 0:
|
||||||
|
""
|
||||||
|
else:
|
||||||
|
"CoreDb(" & s.join(", ") & ")"
|
||||||
|
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -33,7 +33,6 @@ export
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
when LedgerEnableApiTracking:
|
when LedgerEnableApiTracking:
|
||||||
{.warning: "*** Provided API logging for Ledger (disabled by default)".}
|
|
||||||
import
|
import
|
||||||
std/times,
|
std/times,
|
||||||
chronicles
|
chronicles
|
||||||
|
@ -43,7 +42,6 @@ when LedgerEnableApiTracking:
|
||||||
apiTxt = "API"
|
apiTxt = "API"
|
||||||
|
|
||||||
when LedgerEnableApiProfiling:
|
when LedgerEnableApiProfiling:
|
||||||
{.warning: "*** Provided API profiling for Ledger (disabled by default)".}
|
|
||||||
export
|
export
|
||||||
LedgerFnInx,
|
LedgerFnInx,
|
||||||
LedgerProfListRef
|
LedgerProfListRef
|
||||||
|
|
|
@ -30,4 +30,19 @@ const
|
||||||
LedgerEnableApiTracking* = EnableApiTracking and CoreDbEnableApiTracking
|
LedgerEnableApiTracking* = EnableApiTracking and CoreDbEnableApiTracking
|
||||||
LedgerEnableApiProfiling* = EnableApiProfiling and CoreDbEnableApiJumpTable
|
LedgerEnableApiProfiling* = EnableApiProfiling and CoreDbEnableApiJumpTable
|
||||||
|
|
||||||
|
|
||||||
|
# Support warning about extra compile time options. For production, non of
|
||||||
|
# the above features should be enabled.
|
||||||
|
import strutils
|
||||||
|
const ledgerBaseConfigExtras* = block:
|
||||||
|
var s: seq[string]
|
||||||
|
when LedgerEnableApiTracking:
|
||||||
|
s.add "logging"
|
||||||
|
when LedgerEnableApiProfiling:
|
||||||
|
s.add "profiling"
|
||||||
|
if s.len == 0:
|
||||||
|
""
|
||||||
|
else:
|
||||||
|
"Ledger(" & s.join(", ") & ")"
|
||||||
|
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -17,6 +17,8 @@ import
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
when LedgerEnableApiProfiling:
|
when LedgerEnableApiProfiling:
|
||||||
|
import api_tracking
|
||||||
|
|
||||||
proc ldgProfData*(db: CoreDbRef): LedgerProfListRef =
|
proc ldgProfData*(db: CoreDbRef): LedgerProfListRef =
|
||||||
## Return profiling data table (only available in profiling mode). If
|
## Return profiling data table (only available in profiling mode). If
|
||||||
## available (i.e. non-nil), result data can be organised by the functions
|
## available (i.e. non-nil), result data can be organised by the functions
|
||||||
|
|
Loading…
Reference in New Issue