Skip to content

Commit

Permalink
Merge branch 'master' into snapshot-mem-cap
Browse files Browse the repository at this point in the history
  • Loading branch information
arnetheduck authored Mar 10, 2025
2 parents cda348e + 3fda343 commit 5f97621
Show file tree
Hide file tree
Showing 25 changed files with 586 additions and 127 deletions.
14 changes: 10 additions & 4 deletions execution_chain/common/common.nim
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ proc init(com : CommonRef,
taskpool : Taskpool,
networkId : NetworkId,
config : ChainConfig,
genesis : Genesis) =
genesis : Genesis,
initializeDb: bool) =

config.daoCheck()

Expand Down Expand Up @@ -204,7 +205,8 @@ proc init(com : CommonRef,
# By default, history begins at genesis.
com.startOfHistory = GENESIS_PARENT_HASH

com.initializeDb()
if initializeDb:
com.initializeDb()

proc isBlockAfterTtd(com: CommonRef, header: Header, txFrame: CoreDbTxRef): bool =
if com.config.terminalTotalDifficulty.isNone:
Expand All @@ -227,6 +229,7 @@ proc new*(
taskpool: Taskpool;
networkId: NetworkId = MainNet;
params = networkParams(MainNet);
initializeDb = true;
): CommonRef =

## If genesis data is present, the forkIds will be initialized
Expand All @@ -237,14 +240,16 @@ proc new*(
taskpool,
networkId,
params.config,
params.genesis)
params.genesis,
initializeDb)

proc new*(
_: type CommonRef;
db: CoreDbRef;
taskpool: Taskpool;
config: ChainConfig;
networkId: NetworkId = MainNet;
initializeDb = true;
): CommonRef =

## There is no genesis data present
Expand All @@ -255,7 +260,8 @@ proc new*(
taskpool,
networkId,
config,
nil)
nil,
initializeDb)

func clone*(com: CommonRef, db: CoreDbRef): CommonRef =
## clone but replace the db
Expand Down
18 changes: 1 addition & 17 deletions execution_chain/core/eip4844.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
# according to those terms.

import
std/[os, strutils],
stew/arrayops,
nimcrypto/sha2,
kzg4844/kzg,
results,
stint,
./eip7691,
./lazy_kzg as kzg,
../constants,
../common/common

Expand Down Expand Up @@ -217,18 +216,3 @@ proc validateBlobTransactionWrapper*(tx: PooledTransaction):
return err("tx versioned hash not match commitments at index " & $i)

ok()

proc loadKzgTrustedSetup*(): Result[void, string] =
const
vendorDir = currentSourcePath.parentDir.replace('\\', '/') & "/../../vendor"
trustedSetupDir = vendorDir & "/nim-kzg4844/kzg4844/csources/src"
trustedSetup = staticRead trustedSetupDir & "/trusted_setup.txt"

# If the baked-in trusted setup was loaded successfully, it's harmless to
# try again (which happpens in tests)
var loaded {.global.}: bool
if not loaded:
?loadTrustedSetupFromString(trustedSetup, 0)
loaded = true
ok()

Loading

0 comments on commit 5f97621

Please sign in to comment.