mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-23 02:29:26 +00:00
bump nim-eth and accompanying fixes
This commit is contained in:
parent
742759e607
commit
cbd593f514
@ -305,6 +305,10 @@ func isLondon*(com: CommonRef, number: BlockNumber): bool =
|
||||
# TODO: Fixme, use only London comparator
|
||||
com.toHardFork(number.blockNumberToForkDeterminationInfo) >= London
|
||||
|
||||
func isLondon*(com: CommonRef, number: BlockNumber, timestamp: EthTime): bool =
|
||||
# TODO: Fixme, use only London comparator
|
||||
com.toHardFork(forkDeterminationInfo(number, timestamp)) >= London
|
||||
|
||||
func forkGTE*(com: CommonRef, fork: HardFork): bool =
|
||||
com.currentFork >= fork
|
||||
|
||||
|
@ -12,13 +12,8 @@ import
|
||||
eth/rlp, stew/io2,
|
||||
./chain,
|
||||
../db/select_backend,
|
||||
../common/common
|
||||
|
||||
type
|
||||
# trick the rlp decoder
|
||||
# so we can separate the body and header
|
||||
EthHeader = object
|
||||
header: BlockHeader
|
||||
../common/common,
|
||||
../utils/utils
|
||||
|
||||
proc importRlpBlock*(blocksRlp: openArray[byte]; com: CommonRef; importFile: string = ""): bool =
|
||||
var
|
||||
@ -26,14 +21,14 @@ proc importRlpBlock*(blocksRlp: openArray[byte]; com: CommonRef; importFile: str
|
||||
rlp = rlpFromBytes(blocksRlp)
|
||||
chain = newChain(com, extraValidation = true)
|
||||
errorCount = 0
|
||||
header: BlockHeader
|
||||
body: BlockBody
|
||||
let
|
||||
head = com.db.getCanonicalHead()
|
||||
|
||||
while rlp.hasData:
|
||||
try:
|
||||
let
|
||||
header = rlp.read(EthHeader).header
|
||||
body = rlp.readRecordType(BlockBody, false)
|
||||
rlp.decompose(header, body)
|
||||
if header.blockNumber > head.blockNumber:
|
||||
if chain.persistBlocks([header], [body]) == ValidationResult.Error:
|
||||
# register one more error and continue
|
||||
|
@ -144,9 +144,10 @@ proc update(dh: TxChainRef; parent: BlockHeader)
|
||||
{.gcsafe,raises: [CatchableError].} =
|
||||
|
||||
let
|
||||
timestamp = dh.getTimestamp(parent)
|
||||
db = dh.com.db
|
||||
acc = AccountsCache.init(db.db, parent.stateRoot, dh.com.pruneTrie)
|
||||
fee = if dh.com.isLondon(parent.blockNumber + 1):
|
||||
fee = if dh.com.isLondon(parent.blockNumber + 1, timestamp):
|
||||
some(dh.com.baseFeeGet(parent).uint64.u256)
|
||||
else:
|
||||
UInt256.none()
|
||||
|
@ -63,3 +63,19 @@ proc short*(h: Hash256): string =
|
||||
bytes[0..2] = h.data[0..2]
|
||||
bytes[^3..^1] = h.data[^3..^1]
|
||||
bytes.toHex
|
||||
|
||||
proc decompose*(rlp: var Rlp,
|
||||
header: var BlockHeader,
|
||||
body: var BlockBody) {.gcsafe, raises: [RlpError].} =
|
||||
var blk = rlp.read(EthBlock)
|
||||
header = system.move(blk.header)
|
||||
body.transactions = system.move(blk.txs)
|
||||
body.uncles = system.move(blk.uncles)
|
||||
body.withdrawals = system.move(blk.withdrawals)
|
||||
|
||||
proc decompose*(rlpBytes: openArray[byte],
|
||||
header: var BlockHeader,
|
||||
body: var BlockBody) {.gcsafe, raises: [RlpError].} =
|
||||
var rlp = rlpFromBytes(rlpBytes)
|
||||
rlp.decompose(header, body)
|
||||
|
@ -25,11 +25,6 @@ import
|
||||
../nimbus/common/common
|
||||
|
||||
type
|
||||
# trick the rlp decoder
|
||||
# so we can separate the body and header
|
||||
EthHeader = object
|
||||
header: BlockHeader
|
||||
|
||||
SealEngine = enum
|
||||
NoProof
|
||||
Ethash
|
||||
@ -229,9 +224,7 @@ proc importBlock(tester: var Tester, com: CommonRef,
|
||||
|
||||
proc applyFixtureBlockToChain(tester: var Tester, tb: var TestBlock,
|
||||
com: CommonRef, checkSeal, validation: bool) =
|
||||
var rlp = rlpFromBytes(tb.blockRLP)
|
||||
tb.header = rlp.read(EthHeader).header
|
||||
tb.body = rlp.readRecordType(BlockBody, false)
|
||||
decompose(tb.blockRLP, tb.header, tb.body)
|
||||
tester.importBlock(com, tb, checkSeal, validation)
|
||||
|
||||
func shouldCheckSeal(tester: Tester): bool =
|
||||
|
2
vendor/nim-eth
vendored
2
vendor/nim-eth
vendored
@ -1 +1 @@
|
||||
Subproject commit e639dc1e145722ec137639ee040eddc524f853dd
|
||||
Subproject commit 91b2b9d2ed6daa14107c9ee84ffac71c2ccd5dd4
|
Loading…
x
Reference in New Issue
Block a user