mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-03 07:45:18 +00:00
Prepare source code for nim v2 CI (#2028)
* Prepare source code for nim v2 CI * Fix copyright year
This commit is contained in:
parent
1b4a43c140
commit
966adcb124
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -15,7 +15,7 @@ import
|
||||
stew/endians2,
|
||||
nimcrypto/sha2,
|
||||
stew/results,
|
||||
../../../nimbus/core/eip4844
|
||||
../../../../nimbus/core/eip4844
|
||||
|
||||
type
|
||||
BlobID* = uint64
|
||||
@ -41,7 +41,7 @@ func getBlobList*(startId: BlobID, count: int, addition: BlobID): BlobIDs =
|
||||
for i in 0..<count:
|
||||
result[i] = startId + BlobID(i)
|
||||
result[^1] = addition
|
||||
|
||||
|
||||
func getBlobListByIndex*(startIndex: BlobID, endIndex: BlobID): BlobIDs =
|
||||
var count = uint64(0)
|
||||
if endIndex > startIndex:
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -25,11 +25,11 @@ type
|
||||
EngineAPIVersionResolver* = ref object of RootRef
|
||||
com: CommonRef
|
||||
|
||||
method setEngineAPIVersionResolver*(cust: EngineAPIVersionResolver, v: CommonRef) {.base.} =
|
||||
method setEngineAPIVersionResolver*(cust: EngineAPIVersionResolver, v: CommonRef) {.base, gcsafe.} =
|
||||
cust.com = v
|
||||
|
||||
method forkchoiceUpdatedVersion*(cust: EngineAPIVersionResolver,
|
||||
headTimestamp: uint64, payloadAttributesTimestamp: Option[uint64] = none(uint64)): Version {.base.} =
|
||||
headTimestamp: uint64, payloadAttributesTimestamp: Option[uint64] = none(uint64)): Version {.base, gcsafe.} =
|
||||
let ts = if payloadAttributesTimestamp.isNone: headTimestamp.EthTime
|
||||
else: payloadAttributesTimestamp.get().EthTime
|
||||
if cust.com.isCancunOrLater(ts):
|
||||
@ -39,7 +39,7 @@ method forkchoiceUpdatedVersion*(cust: EngineAPIVersionResolver,
|
||||
else:
|
||||
Version.V1
|
||||
|
||||
method newPayloadVersion*(cust: EngineAPIVersionResolver, timestamp: uint64): Version {.base.} =
|
||||
method newPayloadVersion*(cust: EngineAPIVersionResolver, timestamp: uint64): Version {.base, gcsafe.} =
|
||||
let ts = timestamp.EthTime
|
||||
if cust.com.isCancunOrLater(ts):
|
||||
Version.V3
|
||||
@ -48,7 +48,7 @@ method newPayloadVersion*(cust: EngineAPIVersionResolver, timestamp: uint64): Ve
|
||||
else:
|
||||
Version.V1
|
||||
|
||||
method getPayloadVersion*(cust: EngineAPIVersionResolver, timestamp: uint64): Version {.base.} =
|
||||
method getPayloadVersion*(cust: EngineAPIVersionResolver, timestamp: uint64): Version {.base, gcsafe.} =
|
||||
let ts = timestamp.EthTime
|
||||
if cust.com.isCancunOrLater(ts):
|
||||
Version.V3
|
||||
@ -61,10 +61,10 @@ type
|
||||
GetPayloadCustomizer* = ref object of EngineAPIVersionResolver
|
||||
|
||||
method getPayloadID*(cust: GetPayloadCustomizer,
|
||||
basePayloadID: PayloadID): PayloadID {.base.} =
|
||||
basePayloadID: PayloadID): PayloadID {.base, gcsafe.} =
|
||||
doAssert(false, "getPayloadID unimplemented")
|
||||
|
||||
method getExpectedError*(cust: GetPayloadCustomizer): int {.base.} =
|
||||
method getExpectedError*(cust: GetPayloadCustomizer): int {.base, gcsafe.} =
|
||||
doAssert(false, "getExpectedError unimplemented")
|
||||
|
||||
type
|
||||
@ -100,7 +100,7 @@ method getPayloadVersion(cust: DowngradegetPayloadVersion, timestamp: uint64): V
|
||||
type
|
||||
PayloadAttributesCustomizer* = ref object of BaseGetPayloadCustomizer
|
||||
|
||||
method getPayloadAttributes*(cust: PayloadAttributesCustomizer, basePayloadAttributes: PayloadAttributes): PayloadAttributes {.base.} =
|
||||
method getPayloadAttributes*(cust: PayloadAttributesCustomizer, basePayloadAttributes: PayloadAttributes): PayloadAttributes {.base, gcsafe.} =
|
||||
doAssert(false, "getPayloadAttributes unimplemented")
|
||||
|
||||
type
|
||||
@ -147,10 +147,10 @@ type
|
||||
ForkchoiceUpdatedCustomizer* = ref object of BasePayloadAttributesCustomizer
|
||||
|
||||
method getForkchoiceState*(cust: ForkchoiceUpdatedCustomizer,
|
||||
baseForkchoiceUpdate: ForkchoiceStateV1): ForkchoiceStateV1 {.base.} =
|
||||
baseForkchoiceUpdate: ForkchoiceStateV1): ForkchoiceStateV1 {.base, gcsafe.} =
|
||||
doAssert(false, "getForkchoiceState unimplemented")
|
||||
|
||||
method getExpectInvalidStatus*(cust: ForkchoiceUpdatedCustomizer): bool {.base.} =
|
||||
method getExpectInvalidStatus*(cust: ForkchoiceUpdatedCustomizer): bool {.base, gcsafe.} =
|
||||
doAssert(false, "getExpectInvalidStatus unimplemented")
|
||||
|
||||
# Customizer that makes no modifications to the forkchoice directive call.
|
||||
@ -204,7 +204,7 @@ type
|
||||
hashVersions*: seq[byte]
|
||||
|
||||
method getVersionedHashes*(cust: VersionedHashesCustomizer,
|
||||
baseVersionedHashes: openArray[common.Hash256]): Option[seq[common.Hash256]] {.base.} =
|
||||
baseVersionedHashes: openArray[common.Hash256]): Option[seq[common.Hash256]] {.base, gcsafe.} =
|
||||
if cust.blobs.isNone:
|
||||
return none(seq[common.Hash256])
|
||||
|
||||
@ -218,7 +218,7 @@ method getVersionedHashes*(cust: VersionedHashesCustomizer,
|
||||
v[i] = blobID.getVersionedHash(version)
|
||||
some(v)
|
||||
|
||||
method description*(cust: VersionedHashesCustomizer): string {.base.} =
|
||||
method description*(cust: VersionedHashesCustomizer): string {.base, gcsafe.} =
|
||||
result = "VersionedHashes: "
|
||||
if cust.blobs.isSome:
|
||||
for x in cust.blobs.get:
|
||||
@ -285,10 +285,10 @@ method getVersionedHashes(cust: ExtraVersionedHash,
|
||||
type
|
||||
PayloadCustomizer* = ref object of EngineAPIVersionResolver
|
||||
|
||||
method customizePayload*(cust: PayloadCustomizer, data: ExecutableData): ExecutableData {.base.} =
|
||||
method customizePayload*(cust: PayloadCustomizer, data: ExecutableData): ExecutableData {.base, gcsafe.} =
|
||||
doAssert(false, "customizePayload unimplemented")
|
||||
|
||||
method getTimestamp(cust: PayloadCustomizer, basePayload: ExecutionPayload): uint64 {.base.} =
|
||||
method getTimestamp(cust: PayloadCustomizer, basePayload: ExecutionPayload): uint64 {.base, gcsafe.} =
|
||||
doAssert(false, "getTimestamp unimplemented")
|
||||
|
||||
type
|
||||
@ -296,10 +296,10 @@ type
|
||||
expectedError* : int
|
||||
expectInvalidStatus*: bool
|
||||
|
||||
method getExpectedError*(cust: NewPayloadCustomizer): int {.base.} =
|
||||
method getExpectedError*(cust: NewPayloadCustomizer): int {.base, gcsafe.} =
|
||||
cust.expectedError
|
||||
|
||||
method getExpectInvalidStatus*(cust: NewPayloadCustomizer): bool {.base.}=
|
||||
method getExpectInvalidStatus*(cust: NewPayloadCustomizer): bool {.base, gcsafe.}=
|
||||
cust.expectInvalidStatus
|
||||
|
||||
type
|
||||
@ -335,7 +335,7 @@ func getTimestamp*(cust: CustomPayloadData, basePayload: ExecutionPayload): uint
|
||||
|
||||
# Construct a customized payload by taking an existing payload as base and mixing it CustomPayloadData
|
||||
# blockHash is calculated automatically.
|
||||
proc customizePayload*(cust: CustomPayloadData, data: ExecutableData): ExecutableData =
|
||||
proc customizePayload*(cust: CustomPayloadData, data: ExecutableData): ExecutableData {.gcsafe.} =
|
||||
var customHeader = blockHeader(data.basePayload, data.beaconRoot)
|
||||
|
||||
if cust.transactions.isSome:
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -22,8 +22,8 @@ import
|
||||
./cancun/helpers,
|
||||
./cancun/blobs,
|
||||
./cancun/customizer,
|
||||
../../nimbus/constants,
|
||||
../../nimbus/common/chain_config
|
||||
../../../nimbus/constants,
|
||||
../../../nimbus/common/chain_config
|
||||
|
||||
import
|
||||
./cancun/step_newpayloads,
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -42,7 +42,7 @@ method execute(cs: InvalidPayloadAttributesTest, env: TestEnv): bool =
|
||||
|
||||
# Send a forkchoiceUpdated with invalid PayloadAttributes
|
||||
let pbRes = env.clMock.produceSingleBlock(BlockProcessCallbacks(
|
||||
onNewPayloadBroadcast: proc(): bool =
|
||||
onNewPayloadBroadcast: proc(): bool {.gcsafe.} =
|
||||
# Try to apply the new payload with invalid attributes
|
||||
var fcu = env.clMock.latestForkchoice
|
||||
if cs.syncing:
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -230,7 +230,7 @@ method execute(cs: MultiplePayloadsExtendingCanonicalChainTest, env: TestEnv): b
|
||||
return true
|
||||
)
|
||||
|
||||
let reExecFunc = proc(): bool =
|
||||
let reExecFunc = proc(): bool {.gcsafe.} =
|
||||
var payloadCount = 80
|
||||
if cs.payloadCount > 0:
|
||||
payloadCount = cs.payloadCount
|
||||
@ -238,7 +238,7 @@ method execute(cs: MultiplePayloadsExtendingCanonicalChainTest, env: TestEnv): b
|
||||
let basePayload = env.clMock.latestExecutableData
|
||||
|
||||
# Check that the transaction was included
|
||||
testCond len(basePayload.basePayload.transactions)> 0:
|
||||
testCond len(basePayload.basePayload.transactions) > 0:
|
||||
fatal "Client failed to include the expected transaction in payload built"
|
||||
|
||||
# Fabricate and send multiple new payloads by changing the PrevRandao field
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -46,7 +46,7 @@ method execute(cs: ForkchoiceUpdatedOnPayloadRequestTest, env: TestEnv): bool =
|
||||
testCond ok
|
||||
|
||||
let pbRes = env.clMock.produceSingleBlock(clmock.BlockProcessCallbacks(
|
||||
onPayloadAttributesGenerated: proc(): bool =
|
||||
onPayloadAttributesGenerated: proc(): bool {.gcsafe.} =
|
||||
var
|
||||
attr = env.clMock.latestPayloadAttributes
|
||||
expectedStatus = PayloadExecutionStatus.valid
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -15,7 +15,7 @@ import
|
||||
./test_env,
|
||||
./base_spec,
|
||||
./cancun/customizer,
|
||||
../../nimbus/common/chain_config
|
||||
../../../nimbus/common/chain_config
|
||||
|
||||
import
|
||||
./engine/suggested_fee_recipient,
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -14,9 +14,9 @@ import
|
||||
./test_env,
|
||||
./types,
|
||||
chronicles,
|
||||
../../nimbus/common/hardforks
|
||||
../../../nimbus/common/hardforks
|
||||
|
||||
import ../../tools/common/helpers except LogLevel
|
||||
import ../../../tools/common/helpers except LogLevel
|
||||
|
||||
type
|
||||
ECSpec* = ref object of BaseSpec
|
||||
|
@ -251,12 +251,6 @@ template expectStorageEqual*(res: untyped, expectedValue: FixedBytes[32]) =
|
||||
testCond res.get == expectedValue:
|
||||
error "invalid storage", get=res.get, expect=expectedValue
|
||||
|
||||
template expectBalanceEqual*(res: untyped, expectedBalance: UInt256) =
|
||||
testCond res.isOk:
|
||||
error "expectBalanceEqual", msg=res.error
|
||||
testCond res.get == expectedBalance:
|
||||
error "invalid balance", expect=expectedBalance, get=res.get
|
||||
|
||||
template expectBlobGasUsed*(res: untyped, expected: uint64) =
|
||||
testCond res.isOk:
|
||||
error "expectBlobGasUsed", msg=res.error
|
||||
|
@ -21,11 +21,11 @@ import
|
||||
../types,
|
||||
../base_spec,
|
||||
../cancun/customizer,
|
||||
../../../nimbus/common/common,
|
||||
../../../nimbus/utils/utils,
|
||||
../../../nimbus/common/chain_config,
|
||||
../../../../nimbus/common/common,
|
||||
../../../../nimbus/utils/utils,
|
||||
../../../../nimbus/common/chain_config,
|
||||
web3/execution_types,
|
||||
../../../nimbus/beacon/web3_eth_conv
|
||||
../../../../nimbus/beacon/web3_eth_conv
|
||||
|
||||
type
|
||||
WDBaseSpec* = ref object of BaseSpec
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -16,7 +16,7 @@ import
|
||||
../test_env,
|
||||
../engine_client,
|
||||
../types,
|
||||
../../../nimbus/transaction
|
||||
../../../../nimbus/transaction
|
||||
|
||||
type
|
||||
BlockValueSpec* = ref object of WDBaseSpec
|
||||
|
@ -14,8 +14,8 @@ import
|
||||
json_rpc/[rpcclient],
|
||||
stew/[byteutils, results],
|
||||
../engine_client,
|
||||
../../../nimbus/utils/utils,
|
||||
../../../nimbus/beacon/web3_eth_conv
|
||||
../../../../nimbus/utils/utils,
|
||||
../../../../nimbus/beacon/web3_eth_conv
|
||||
|
||||
type
|
||||
Withdrawals* = ref object
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -18,9 +18,9 @@ import
|
||||
../engine_client,
|
||||
../types,
|
||||
../cancun/customizer,
|
||||
../../../nimbus/constants,
|
||||
../../../../nimbus/constants,
|
||||
web3/execution_types,
|
||||
../../../nimbus/beacon/web3_eth_conv
|
||||
../../../../nimbus/beacon/web3_eth_conv
|
||||
|
||||
# EIP-3860 Shanghai Tests:
|
||||
# Send transactions overflowing the MAX_INITCODE_SIZE
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -20,7 +20,7 @@ import
|
||||
../engine_client,
|
||||
../types,
|
||||
../base_spec,
|
||||
../../../nimbus/beacon/web3_eth_conv
|
||||
../../../../nimbus/beacon/web3_eth_conv
|
||||
|
||||
# Withdrawals re-org spec:
|
||||
# Specifies a withdrawals test where the withdrawals re-org can happen
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2018 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -49,8 +49,10 @@ type
|
||||
start: LocalPivot ## start here searching for checkpoints
|
||||
trail: LocalPath ## snapshot location
|
||||
subChn: LocalSubChain ## chain[] sub-range
|
||||
parents: seq[BlockHeader] ## explicit parents
|
||||
parents: HeadersHolderRef ## explicit parents
|
||||
|
||||
HeadersHolderRef* = ref object
|
||||
headers*: seq[BlockHeader]
|
||||
|
||||
{.push raises: [].}
|
||||
|
||||
@ -150,6 +152,15 @@ proc isSnapshotPosition(d: var LocalSnaps; number: BlockNumber): bool =
|
||||
# Private functions
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
func len*(list: HeadersHolderRef): int =
|
||||
list.headers.len
|
||||
|
||||
func `[]`*(list: HeadersHolderRef, idx: int): BlockHeader =
|
||||
list.headers[idx]
|
||||
|
||||
func `[]`*(list: HeadersHolderRef, idx: BackwardsIndex): BlockHeader =
|
||||
list.headers[list.headers.len - int(idx)]
|
||||
|
||||
proc findSnapshot(d: var LocalSnaps): bool =
|
||||
## Search for a snapshot starting at current header starting at the pivot
|
||||
## value `d.start`. The snapshot returned in `trail` is a clone of the
|
||||
@ -324,7 +335,7 @@ proc updateSnapshot(d: var LocalSnaps): SnapshotResult
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
proc cliqueSnapshotSeq*(c: Clique; header: BlockHeader;
|
||||
parents: var seq[BlockHeader]): SnapshotResult
|
||||
parents: HeadersHolderRef): SnapshotResult
|
||||
{.gcsafe, raises: [CatchableError].} =
|
||||
## Create authorisation state snapshot of a given point in the block chain
|
||||
## and store it in the `Clique` descriptor to be retrievable as `c.snapshot`
|
||||
@ -343,7 +354,6 @@ proc cliqueSnapshotSeq*(c: Clique; header: BlockHeader;
|
||||
return ok(rc.value)
|
||||
|
||||
# Avoid deep copy, sequence will not be changed by `updateSnapshot()`
|
||||
parents.shallow
|
||||
|
||||
var snaps = LocalSnaps(
|
||||
c: c,
|
||||
@ -360,7 +370,7 @@ proc cliqueSnapshotSeq*(c: Clique; header: BlockHeader;
|
||||
|
||||
|
||||
proc cliqueSnapshotSeq*(c: Clique; hash: Hash256;
|
||||
parents: var seq[BlockHeader]): SnapshotResult
|
||||
parents: HeadersHolderRef): SnapshotResult
|
||||
{.gcsafe,raises: [CatchableError].} =
|
||||
## Create authorisation state snapshot of a given point in the block chain
|
||||
## and store it in the `Clique` descriptor to be retrievable as `c.snapshot`
|
||||
@ -383,7 +393,6 @@ proc cliqueSnapshotSeq*(c: Clique; hash: Hash256;
|
||||
return err((errUnknownHash,""))
|
||||
|
||||
# Avoid deep copy, sequence will not be changed by `updateSnapshot()`
|
||||
parents.shallow
|
||||
|
||||
var snaps = LocalSnaps(
|
||||
c: c,
|
||||
@ -403,26 +412,30 @@ proc cliqueSnapshotSeq*(c: Clique; hash: Hash256;
|
||||
proc cliqueSnapshot*(c: Clique; header: BlockHeader;
|
||||
parents: var seq[BlockHeader]): SnapshotResult
|
||||
{.gcsafe, raises: [CatchableError].} =
|
||||
var list = toSeq(parents)
|
||||
let list = HeadersHolderRef(
|
||||
headers: toSeq(parents)
|
||||
)
|
||||
c.cliqueSnapshotSeq(header,list)
|
||||
|
||||
proc cliqueSnapshot*(c: Clique;hash: Hash256;
|
||||
parents: openArray[BlockHeader]): SnapshotResult
|
||||
{.gcsafe, raises: [CatchableError].} =
|
||||
var list = toSeq(parents)
|
||||
let list = HeadersHolderRef(
|
||||
headers: toSeq(parents)
|
||||
)
|
||||
c.cliqueSnapshotSeq(hash,list)
|
||||
|
||||
proc cliqueSnapshot*(c: Clique; header: BlockHeader): SnapshotResult
|
||||
{.gcsafe,raises: [CatchableError].} =
|
||||
## Short for `cliqueSnapshot(c,header,@[])`
|
||||
var blind: seq[BlockHeader]
|
||||
let blind = HeadersHolderRef()
|
||||
c.cliqueSnapshotSeq(header, blind)
|
||||
|
||||
proc cliqueSnapshot*(c: Clique; hash: Hash256): SnapshotResult
|
||||
{.gcsafe,raises: [CatchableError].} =
|
||||
## Short for `cliqueSnapshot(c,hash,@[])`
|
||||
var blind: seq[BlockHeader]
|
||||
c.cliqueSnapshot(hash, blind)
|
||||
let blind = HeadersHolderRef()
|
||||
c.cliqueSnapshotSeq(hash, blind)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# End
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -139,7 +139,7 @@ proc verifySeal(c: Clique; header: BlockHeader): CliqueOkResult =
|
||||
|
||||
# clique/clique.go(314): func (c *Clique) verifyCascadingFields(chain [..]
|
||||
proc verifyCascadingFields(c: Clique; com: CommonRef; header: BlockHeader;
|
||||
parents: var seq[BlockHeader]): CliqueOkResult
|
||||
parents: HeadersHolderRef): CliqueOkResult
|
||||
{.gcsafe, raises: [CatchableError].} =
|
||||
## Verify all the header fields that are not standalone, rather depend on a
|
||||
## batch of previous headers. The caller may optionally pass in a batch of
|
||||
@ -264,7 +264,7 @@ proc verifyHeaderFields(c: Clique; header: BlockHeader): CliqueOkResult =
|
||||
|
||||
# clique/clique.go(246): func (c *Clique) verifyHeader(chain [..]
|
||||
proc cliqueVerifyImpl(c: Clique; com: CommonRef; header: BlockHeader;
|
||||
parents: var seq[BlockHeader]): CliqueOkResult
|
||||
parents: HeadersHolderRef): CliqueOkResult
|
||||
{.gcsafe, raises: [CatchableError].} =
|
||||
## Check whether a header conforms to the consensus rules. The caller may
|
||||
## optionally pass in a batch of parents (ascending order) to avoid looking
|
||||
@ -292,7 +292,7 @@ proc cliqueVerifyImpl(c: Clique; com: CommonRef; header: BlockHeader;
|
||||
c.failed = (header.blockHash, result.error)
|
||||
|
||||
proc cliqueVerifySeq*(c: Clique; com: CommonRef; header: BlockHeader;
|
||||
parents: var seq[BlockHeader]): CliqueOkResult
|
||||
parents: HeadersHolderRef): CliqueOkResult
|
||||
{.gcsafe, raises: [CatchableError].} =
|
||||
## Check whether a header conforms to the consensus rules. The caller may
|
||||
## optionally pass in a batch of parents (ascending order) to avoid looking
|
||||
@ -321,7 +321,7 @@ proc cliqueVerifySeq*(c: Clique; com: CommonRef; header: BlockHeader;
|
||||
ok()
|
||||
|
||||
proc cliqueVerifySeq(c: Clique; com: CommonRef;
|
||||
headers: var seq[BlockHeader]): CliqueOkResult
|
||||
headers: HeadersHolderRef): CliqueOkResult
|
||||
{.gcsafe, raises: [CatchableError].} =
|
||||
## This function verifies a batch of headers checking each header for
|
||||
## consensus rules conformance. The `headers` list is supposed to
|
||||
@ -338,16 +338,17 @@ proc cliqueVerifySeq(c: Clique; com: CommonRef;
|
||||
## Note that the sequence argument must be write-accessible, even though it
|
||||
## will be left untouched by this function.
|
||||
if 0 < headers.len:
|
||||
headers.shallow
|
||||
|
||||
block:
|
||||
var blind: seq[BlockHeader]
|
||||
let blind = HeadersHolderRef()
|
||||
let rc = c.cliqueVerifyImpl(com, headers[0],blind)
|
||||
if rc.isErr:
|
||||
return rc
|
||||
|
||||
for n in 1 ..< headers.len:
|
||||
var parent = headers[n-1 .. n-1] # is actually a single item squence
|
||||
let parent = HeadersHolderRef(
|
||||
headers: headers.headers[n-1 .. n-1] # is actually a single item squence
|
||||
)
|
||||
let rc = c.cliqueVerifyImpl(com, headers[n],parent)
|
||||
if rc.isErr:
|
||||
return rc
|
||||
@ -384,14 +385,16 @@ proc cliqueVerify*(c: Clique; com: CommonRef; header: BlockHeader;
|
||||
##
|
||||
## Use the directives `cliqueSave()`, `cliqueDispose()`, and/or
|
||||
## `cliqueRestore()` for transaction.
|
||||
var list = toSeq(parents)
|
||||
let list = HeadersHolderRef(
|
||||
headers: toSeq(parents)
|
||||
)
|
||||
c.cliqueVerifySeq(com, header, list)
|
||||
|
||||
# clique/clique.go(217): func (c *Clique) VerifyHeader(chain [..]
|
||||
proc cliqueVerify*(c: Clique; com: CommonRef; header: BlockHeader): CliqueOkResult
|
||||
{.gcsafe, raises: [CatchableError].} =
|
||||
## Consensus rules verifier without optional parents list.
|
||||
var blind: seq[BlockHeader]
|
||||
let blind = HeadersHolderRef()
|
||||
c.cliqueVerifySeq(com, header, blind)
|
||||
|
||||
proc cliqueVerify*(c: Clique; com: CommonRef;
|
||||
@ -413,7 +416,9 @@ proc cliqueVerify*(c: Clique; com: CommonRef;
|
||||
##
|
||||
## Use the directives `cliqueSave()`, `cliqueDispose()`, and/or
|
||||
## `cliqueRestore()` for transaction.
|
||||
var list = toSeq(headers)
|
||||
let list = HeadersHolderRef(
|
||||
headers: toSeq(headers)
|
||||
)
|
||||
c.cliqueVerifySeq(com, list)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2018 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -175,7 +175,15 @@ proc effectiveGasTip*(tx: Transaction; baseFee: UInt256): GasPriceEx =
|
||||
|
||||
proc dup*(item: TxItemRef): TxItemRef =
|
||||
## Getter, provide contents copy
|
||||
item.deepCopy
|
||||
TxItemRef(
|
||||
tx: item.tx,
|
||||
itemID: item.itemID,
|
||||
timeStamp: item.timeStamp,
|
||||
sender: item.sender,
|
||||
info: item.info,
|
||||
status: item.status,
|
||||
reject: item.reject
|
||||
)
|
||||
|
||||
proc info*(item: TxItemRef): string =
|
||||
## Getter
|
||||
|
@ -110,6 +110,38 @@ func to(vid: CoreDbTrieRef; T: type VertexID): T =
|
||||
func to(address: EthAddress; T: type PathID): T =
|
||||
HashKey.fromBytes(address.keccakHash.data).value.to(T)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Auto destructor should appear before constructor
|
||||
# to prevent cannot bind another `=destroy` error
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
proc `=destroy`(cMpt: var AristoChildDbObj) =
|
||||
## Auto destructor
|
||||
let mpt = cMpt.mpt
|
||||
if not mpt.isNil:
|
||||
let base = cMpt.base
|
||||
if mpt != base.adb: # Not the shared descriptor?
|
||||
#
|
||||
# The argument `cMpt` will be deleted, so provide another one. The
|
||||
# `mpt` descriptor must be added to the GC queue which will be
|
||||
# destructed later on a clean environment.
|
||||
#
|
||||
base.gq.add AristoChildDbRef(
|
||||
base: base,
|
||||
mpt: mpt,
|
||||
saveMode: cMpt.saveMode)
|
||||
elif cMpt.saveMode == AutoSave: # Otherwise there is nothing to do
|
||||
#
|
||||
# Prepend cached entry. There is only one needed as it refers to
|
||||
# the same shared `mpt` descriptor.
|
||||
#
|
||||
if base.gq.len == 0 or
|
||||
base.gq[0].saveMode != AutoSave:
|
||||
base.gq = AristoChildDbRef(
|
||||
base: base,
|
||||
mpt: mpt,
|
||||
saveMode: cMpt.saveMode) & base.gq
|
||||
|
||||
# -------------------------------
|
||||
|
||||
func toCoreDbAccount(
|
||||
@ -202,7 +234,7 @@ func toVoidRc[T](
|
||||
err rc.error.toError(db, info, error)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Private constructor and auto destructor
|
||||
# Private constructor
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
proc newTrieCtx(
|
||||
@ -280,34 +312,6 @@ proc newTrieCtx(
|
||||
|
||||
ok((db.bless trie).AristoCoreDbTrie)
|
||||
|
||||
|
||||
proc `=destroy`(cMpt: var AristoChildDbObj) =
|
||||
## Auto destructor
|
||||
let mpt = cMpt.mpt
|
||||
if not mpt.isNil:
|
||||
let base = cMpt.base
|
||||
if mpt != base.adb: # Not the shared descriptor?
|
||||
#
|
||||
# The argument `cMpt` will be deleted, so provide another one. The
|
||||
# `mpt` descriptor must be added to the GC queue which will be
|
||||
# destructed later on a clean environment.
|
||||
#
|
||||
base.gq.add AristoChildDbRef(
|
||||
base: base,
|
||||
mpt: mpt,
|
||||
saveMode: cMpt.saveMode)
|
||||
elif cMpt.saveMode == AutoSave: # Otherwise there is nothing to do
|
||||
#
|
||||
# Prepend cached entry. There is only one needed as it refers to
|
||||
# the same shared `mpt` descriptor.
|
||||
#
|
||||
if base.gq.len == 0 or
|
||||
base.gq[0].saveMode != AutoSave:
|
||||
base.gq = AristoChildDbRef(
|
||||
base: base,
|
||||
mpt: mpt,
|
||||
saveMode: cMpt.saveMode) & base.gq
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Private `MPT` or account call back functions
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2018 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
@ -24,9 +24,9 @@ type
|
||||
proc `$`*(b: byte): string =
|
||||
$(b.int)
|
||||
|
||||
proc newCodeStream*(codeBytes: seq[byte]): CodeStream =
|
||||
proc newCodeStream*(codeBytes: sink seq[byte]): CodeStream =
|
||||
new(result)
|
||||
shallowCopy(result.bytes, codeBytes)
|
||||
result.bytes = system.move(codeBytes)
|
||||
result.pc = 0
|
||||
result.invalidPositions = initHashSet[int]()
|
||||
result.depthProcessed = 0
|
||||
|
@ -555,7 +555,7 @@ proc setupEthRpc*(
|
||||
|
||||
getProof(accDB, address, slots)
|
||||
|
||||
server.rpc("eth_getBlockReceipts") do(quantityTag: BlockTag) -> Option[seq[ReceiptObject]]:
|
||||
server.rpc("eth_getBlockReceipts") do(quantityTag: BlockTag) -> Opt[seq[ReceiptObject]]:
|
||||
try:
|
||||
let header = chainDB.headerFromTag(quantityTag)
|
||||
var
|
||||
@ -573,9 +573,9 @@ proc setupEthRpc*(
|
||||
recs.add populateReceipt(receipt, gasUsed, txs[index], index, header)
|
||||
inc index
|
||||
|
||||
return some(recs)
|
||||
return Opt.some(recs)
|
||||
except CatchableError:
|
||||
return none(seq[ReceiptObject])
|
||||
return Opt.none(seq[ReceiptObject])
|
||||
#[
|
||||
server.rpc("eth_newFilter") do(filterOptions: FilterOptions) -> int:
|
||||
## Creates a filter object, based on filter options, to notify when the state changes (logs).
|
||||
|
@ -696,11 +696,11 @@ proc obtainBlocksFromPeer(ctx: LegacySyncRef, peer: Peer) {.async.} =
|
||||
trace trEthSendSendingGetBlockHeaders, peer,
|
||||
startBlock=request.startBlock.number, max=request.maxResults,
|
||||
step=traceStep(request)
|
||||
let results = await peer.getBlockHeaders(request)
|
||||
var results = await peer.getBlockHeaders(request)
|
||||
if results.isSome:
|
||||
trace trEthRecvReceivedBlockHeaders, peer,
|
||||
count=results.get.headers.len, requested=request.maxResults
|
||||
shallowCopy(workItem.headers, results.get.headers)
|
||||
workItem.headers = system.move(results.get.headers)
|
||||
|
||||
var
|
||||
reqBodies = newSeqOfCap[bool](workItem.headers.len)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at
|
||||
# https://opensource.org/licenses/MIT).
|
||||
@ -370,7 +370,7 @@ proc fetchHeaders(
|
||||
|
||||
# Import into `wi.headers`
|
||||
else:
|
||||
wi.headers.shallowCopy(hdrResp.get.headers)
|
||||
wi.headers = system.move(hdrResp.get.headers)
|
||||
|
||||
# Calculate block header hashes and verify it against parent links. If
|
||||
# necessary, cut off some offending block headers tail.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2018 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -57,7 +57,7 @@ method getReceipts*(ctx: EthWireBase, hashes: openArray[Hash256]): seq[seq[Recei
|
||||
{.base, gcsafe, raises: [CatchableError].} =
|
||||
notImplemented("getReceipts")
|
||||
|
||||
method getPooledTxs*(ctx: EthWireBase, hashes: openArray[Hash256]): seq[Transaction] {.base.} =
|
||||
method getPooledTxs*(ctx: EthWireBase, hashes: openArray[Hash256]): seq[Transaction] {.base, gcsafe.} =
|
||||
notImplemented("getPooledTxs")
|
||||
|
||||
method getBlockBodies*(ctx: EthWireBase, hashes: openArray[Hash256]): seq[BlockBody] {.base, gcsafe, raises: [CatchableError].} =
|
||||
@ -75,7 +75,8 @@ method handleAnnouncedTxs*(ctx: EthWireBase, peer: Peer, txs: openArray[Transact
|
||||
{.base, gcsafe, raises: [CatchableError].} =
|
||||
notImplemented("handleAnnouncedTxs")
|
||||
|
||||
method handleAnnouncedTxsHashes*(ctx: EthWireBase, peer: Peer, txHashes: openArray[Hash256]) {.base.} =
|
||||
method handleAnnouncedTxsHashes*(ctx: EthWireBase, peer: Peer, txHashes: openArray[Hash256])
|
||||
{.base, gcsafe.} =
|
||||
notImplemented("handleAnnouncedTxsHashes")
|
||||
|
||||
method handleNewBlockHashes*(ctx: EthWireBase, peer: Peer, hashes: openArray[NewBlockHashesAnnounce])
|
||||
@ -83,8 +84,8 @@ method handleNewBlockHashes*(ctx: EthWireBase, peer: Peer, hashes: openArray[New
|
||||
notImplemented("handleNewBlockHashes")
|
||||
|
||||
when defined(legacy_eth66_enabled):
|
||||
method getStorageNodes*(ctx: EthWireBase, hashes: openArray[Hash256]): seq[Blob] {.base.} =
|
||||
method getStorageNodes*(ctx: EthWireBase, hashes: openArray[Hash256]): seq[Blob] {.base, gcsafe.} =
|
||||
notImplemented("getStorageNodes")
|
||||
|
||||
method handleNodeData*(ctx: EthWireBase, peer: Peer, data: openArray[Blob]) {.base.} =
|
||||
method handleNodeData*(ctx: EthWireBase, peer: Peer, data: openArray[Blob]) {.base, gcsafe.} =
|
||||
notImplemented("handleNodeData")
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -321,13 +321,13 @@ p2pProtocol les(version = lesVersion,
|
||||
if announceType == AnnounceType.Signed:
|
||||
let signature = values.getValue(keyAnnounceSignature, Blob)
|
||||
if signature.isNone:
|
||||
error "missing announce signature"
|
||||
chronicles.error "missing announce signature"
|
||||
return
|
||||
let sig = Signature.fromRaw(signature.get).tryGet()
|
||||
let sigMsg = rlp.encodeList(headHash, headNumber, headTotalDifficulty)
|
||||
let signerKey = recover(sig, sigMsg).tryGet()
|
||||
if signerKey.toNodeId != peer.remote.id:
|
||||
error "invalid announce signature"
|
||||
chronicles.error "invalid announce signature"
|
||||
# TODO: should we disconnect this peer?
|
||||
return
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -188,7 +188,7 @@ method getAccountRange*(
|
||||
limit: openArray[byte];
|
||||
replySizeMax: uint64;
|
||||
): (seq[SnapAccount], SnapProofNodes)
|
||||
{.base, raises: [CatchableError].} =
|
||||
{.base, gcsafe, raises: [CatchableError].} =
|
||||
notImplemented("getAccountRange")
|
||||
|
||||
method getStorageRanges*(
|
||||
@ -199,7 +199,7 @@ method getStorageRanges*(
|
||||
limit: openArray[byte];
|
||||
replySizeMax: uint64;
|
||||
): (seq[seq[SnapStorage]], SnapProofNodes)
|
||||
{.base, raises: [CatchableError].} =
|
||||
{.base, gcsafe, raises: [CatchableError].} =
|
||||
notImplemented("getStorageRanges")
|
||||
|
||||
method getByteCodes*(
|
||||
@ -207,7 +207,7 @@ method getByteCodes*(
|
||||
nodes: openArray[Hash256];
|
||||
replySizeMax: uint64;
|
||||
): seq[Blob]
|
||||
{.base, raises: [CatchableError].} =
|
||||
{.base, gcsafe, raises: [CatchableError].} =
|
||||
notImplemented("getByteCodes")
|
||||
|
||||
method getTrieNodes*(
|
||||
@ -216,7 +216,7 @@ method getTrieNodes*(
|
||||
pathGroups: openArray[SnapTriePaths];
|
||||
replySizeMax: uint64;
|
||||
): seq[Blob]
|
||||
{.base, raises: [CatchableError].} =
|
||||
{.base, gcsafe, raises: [CatchableError].} =
|
||||
notImplemented("getTrieNodes")
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -395,7 +395,7 @@ proc fullPC3*(w: openArray[NodeTagRangeSet]): string =
|
||||
|
||||
proc dump*(
|
||||
ranges: openArray[NodeTagRangeSet];
|
||||
moan: proc(overlap: UInt256; iv: NodeTagRange) {.gcsafe.};
|
||||
moan: proc(overlap: UInt256; iv: NodeTagRange) {.gcsafe, raises: [].};
|
||||
printRangesMax = high(int);
|
||||
): string =
|
||||
## Dump/anlalyse range sets
|
||||
|
@ -132,7 +132,7 @@ proc dup*(
|
||||
): SnapDbAccountsRef =
|
||||
## Resume an accounts session with different `root` key and `peer`.
|
||||
new result
|
||||
result[].shallowCopy(ps[])
|
||||
result.copyWithoutRoot(ps)
|
||||
result.root = root.to(NodeKey)
|
||||
result.peer = peer
|
||||
|
||||
@ -142,7 +142,7 @@ proc dup*(
|
||||
): SnapDbAccountsRef =
|
||||
## Variant of `dup()` without the `peer` argument.
|
||||
new result
|
||||
result[].shallowCopy(ps[])
|
||||
result.copyWithoutRoot(ps)
|
||||
result.root = root.to(NodeKey)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -126,6 +126,10 @@ proc init*(
|
||||
new result
|
||||
result.init(ps.base, root)
|
||||
|
||||
proc copyWithoutRoot*(a, b: SnapDbBaseRef) =
|
||||
a.xDb = b.xDb
|
||||
a.base = b.base
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Public getters
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2018 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
@ -120,7 +120,7 @@ proc validateTxLegacy(tx: Transaction, fork: EVMFork) =
|
||||
raise newException(ValidationError, "Invalid legacy transaction")
|
||||
|
||||
proc validateTxEip2930(tx: Transaction) =
|
||||
var isValid = tx.V in {0'i64, 1'i64}
|
||||
var isValid = tx.V == 0'i64 or tx.V == 1'i64
|
||||
isValid = isValid and tx.S >= UInt256.one
|
||||
isValid = isValid and tx.S < SECPK1_N
|
||||
isValid = isValid and tx.R < SECPK1_N
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Nimbus - Various ways of calling the EVM
|
||||
#
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
@ -204,7 +204,7 @@ proc callParamsForTx(tx: Transaction, sender: EthAddress, vmState: BaseVMState,
|
||||
input: tx.payload
|
||||
)
|
||||
if tx.txType > TxLegacy:
|
||||
shallowCopy(result.accessList, tx.accessList)
|
||||
result.accessList = tx.accessList
|
||||
|
||||
if tx.txType >= TxEip4844:
|
||||
result.versionedHashes = tx.versionedHashes
|
||||
@ -225,7 +225,7 @@ proc callParamsForTest(tx: Transaction, sender: EthAddress, vmState: BaseVMState
|
||||
noRefund: true, # Don't apply gas refund/burn rule.
|
||||
)
|
||||
if tx.txType > TxLegacy:
|
||||
shallowCopy(result.accessList, tx.accessList)
|
||||
result.accessList = tx.accessList
|
||||
|
||||
if tx.txType >= TxEip4844:
|
||||
result.versionedHashes = tx.versionedHashes
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
import
|
||||
eth/common, json, os, unittest2,
|
||||
../../nimbus/db/core_db,
|
||||
../nimbus/db/core_db,
|
||||
./tree_from_witness, parseopt,
|
||||
./witness_types, stew/byteutils
|
||||
|
||||
|
@ -12,8 +12,8 @@ import
|
||||
unittest2,
|
||||
stew/results,
|
||||
eth/[common, trie/trie_defs],
|
||||
../../nimbus/db/[ledger, core_db],
|
||||
../../nimbus/common/chain_config,
|
||||
../nimbus/db/[ledger, core_db],
|
||||
../nimbus/common/chain_config,
|
||||
./[witness_from_tree, multi_keys, witness_types, witness_verification]
|
||||
|
||||
proc getGenesisAlloc(filePath: string): GenesisAlloc =
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2022-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2022-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -78,7 +78,7 @@ proc setErrorLevel =
|
||||
|
||||
# clique/snapshot_test.go(99): func TestClique(t *testing.T) {
|
||||
proc runCliqueSnapshot(noisy = true; postProcessOk = false;
|
||||
testIds = {0 .. 999}; skipIds = {0}-{0}) =
|
||||
testIds = {0'u16 .. 999'u16}; skipIds = {0'u16}-{0'u16}) =
|
||||
## Clique PoA Snapshot
|
||||
## ::
|
||||
## Tests that Clique signer voting is evaluated correctly for various
|
||||
@ -96,13 +96,13 @@ proc runCliqueSnapshot(noisy = true; postProcessOk = false;
|
||||
setTraceLevel()
|
||||
|
||||
# clique/snapshot_test.go(379): for i, tt := range tests {
|
||||
for voterSample in voterSamples.filterIt(it.id in testIds):
|
||||
for voterSample in voterSamples.filterIt(it.id.uint16 in testIds):
|
||||
let tt = voterSample
|
||||
test &"Snapshots {tt.id:2}: {tt.info.substr(0,50)}...":
|
||||
pool.say "\n"
|
||||
|
||||
# Noisily skip this test
|
||||
if tt.id in skipIds:
|
||||
if tt.id.uint16 in skipIds:
|
||||
skip()
|
||||
|
||||
else:
|
||||
@ -133,7 +133,7 @@ proc runCliqueSnapshot(noisy = true; postProcessOk = false;
|
||||
# Verify the final list of signers against the expected ones
|
||||
check snapResult == expected
|
||||
|
||||
proc runCliqueSnapshot(noisy = true; postProcessOk = false; testId: int) =
|
||||
proc runCliqueSnapshot(noisy = true; postProcessOk = false; testId: uint16) =
|
||||
noisy.runCliqueSnapshot(postProcessOk, testIds = {testId})
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2021-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2021-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@ -410,7 +410,7 @@ proc appendVoter*(ap: TesterPool;
|
||||
checkPoint = voter.checkpoint.mapIt(ap.address(it)).sorted(EthAscending))
|
||||
|
||||
if 0 < voter.checkpoint.len:
|
||||
doAssert (header.blockNumber mod ap.clique.cfg.epoch) == 0
|
||||
doAssert (header.blockNumber mod ap.clique.cfg.epoch).isZero
|
||||
|
||||
# Register for debugging
|
||||
let
|
||||
|
@ -16,8 +16,9 @@ import
|
||||
eth/common,
|
||||
results,
|
||||
unittest2,
|
||||
../../nimbus/db/[core_db/persistent, ledger],
|
||||
../../nimbus/core/chain,
|
||||
../nimbus/db/core_db/persistent,
|
||||
../nimbus/db/ledger,
|
||||
../nimbus/core/chain,
|
||||
./replay/pp,
|
||||
./test_coredb/[coredb_test_xx, test_chainsync, test_helpers]
|
||||
|
||||
|
@ -13,7 +13,7 @@ import
|
||||
../nimbus/core/chain,
|
||||
../nimbus/common/common,
|
||||
../nimbus/rpc,
|
||||
../../nimbus/db/[ledger, core_db],
|
||||
../nimbus/db/[ledger, core_db],
|
||||
../stateless/[witness_verification, witness_types],
|
||||
./rpc/experimental_rpc_client
|
||||
|
||||
|
@ -31,7 +31,9 @@ import
|
||||
../nimbus/core/chain,
|
||||
../nimbus/common/common,
|
||||
../nimbus/rpc,
|
||||
../../nimbus/db/[core_db, core_db/persistent, state_db/base],
|
||||
../nimbus/db/core_db,
|
||||
../nimbus/db/core_db/persistent,
|
||||
../nimbus/db/state_db/base,
|
||||
../stateless/[witness_verification, witness_types],
|
||||
./rpc/experimental_rpc_client
|
||||
|
||||
|
2
vendor/ethash
vendored
2
vendor/ethash
vendored
@ -1 +1 @@
|
||||
Subproject commit c1d640184bffa38714974e883f9a9f856779fefa
|
||||
Subproject commit 0306443c52db0bffb59650ad10bcb119477ce9b1
|
2
vendor/nim-eth
vendored
2
vendor/nim-eth
vendored
@ -1 +1 @@
|
||||
Subproject commit 2ad07a60109a4609d672f9f147eeee987e43a15d
|
||||
Subproject commit b9c40e1380e328d25210bad9bd15da3801df32fe
|
2
vendor/nim-metrics
vendored
2
vendor/nim-metrics
vendored
@ -1 +1 @@
|
||||
Subproject commit a2293e8a34f2a6cf264aec47e4becf2f53a0e467
|
||||
Subproject commit 0e768ca7fb7df4798649145a403e7db65cae1f8b
|
2
vendor/nim-rocksdb
vendored
2
vendor/nim-rocksdb
vendored
@ -1 +1 @@
|
||||
Subproject commit 724b72fe104bd0af5e1520326e68e9cee0890ec8
|
||||
Subproject commit 5e2b026f841fa57b10e669a2ab1d88a0e40f6bbe
|
2
vendor/nim-web3
vendored
2
vendor/nim-web3
vendored
@ -1 +1 @@
|
||||
Subproject commit ce47cde31c9b08e4b702766d4d788cc83fa55cf0
|
||||
Subproject commit 10538c667a0a29c7692cce3679ff3bb002624086
|
Loading…
x
Reference in New Issue
Block a user