Fix styles and reduce compiler warnings (#2086)

* Fix styles and reduce compiler warnings

* Fix copyright year
This commit is contained in:
andri lim 2024-03-20 14:35:38 +07:00 committed by GitHub
parent 49a199dbc3
commit c41206be39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 1403 additions and 1384 deletions

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2021 Status Research & Development GmbH # Copyright (c) 2021-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -54,7 +54,7 @@ proc extractChainData*(n: JsonNode): ChainData =
result.params = NetworkParams( result.params = NetworkParams(
genesis: parseGenesis(n), genesis: parseGenesis(n),
config : parseChainConfig(n)) config : parseChainConfig(n))
result.lastblockhash = n["lastblockhash"].getStr result.lastBlockHash = n["lastblockhash"].getStr
let blks = n["blocks"] let blks = n["blocks"]
for x in blks: for x in blks:

View File

@ -132,14 +132,14 @@ proc fillBlob(blobId: BlobID): KzgBlob =
currentHashed = sha256.digest(currentHashed.data) currentHashed = sha256.digest(currentHashed.data)
proc generateBlob(blobid: BlobID): BlobCommitment = proc generateBlob(blobid: BlobID): BlobCommitment =
result.blob = blobId.fillBlob() result.blob = blobid.fillBlob()
let res = blobToKzgCommitment(result.blob) let res = blobToKzgCommitment(result.blob)
if res.isErr: if res.isErr:
doAssert(false, res.error) doAssert(false, res.error)
result.commitment = res.get result.commitment = res.get
proc getVersionedHash*(blobid: BlobID, commitmentVersion: byte): Hash256 = proc getVersionedHash*(blobid: BlobID, commitmentVersion: byte): Hash256 =
let res = blobId.generateBlob() let res = blobid.generateBlob()
result = sha256.digest(res.commitment) result = sha256.digest(res.commitment)
result.data[0] = commitmentVersion result.data[0] = commitmentVersion

View File

@ -9,7 +9,7 @@
# according to those terms. # according to those terms.
import import
std/[options, strutils, typetraits, random], std/[options, strutils, typetraits],
stew/byteutils, stew/byteutils,
./blobs, ./blobs,
../types, ../types,
@ -82,17 +82,17 @@ method getExpectedError(cust: BaseGetPayloadCustomizer): int =
cust.expectedError cust.expectedError
type type
UpgradegetPayloadVersion* = ref object of BaseGetPayloadCustomizer UpgradeGetPayloadVersion* = ref object of BaseGetPayloadCustomizer
method getPayloadVersion(cust: UpgradegetPayloadVersion, timestamp: uint64): Version = method getPayloadVersion(cust: UpgradeGetPayloadVersion, timestamp: uint64): Version =
let version = procCall getPayloadVersion(cust.GetPayloadCustomizer, timestamp) let version = procCall getPayloadVersion(cust.GetPayloadCustomizer, timestamp)
doAssert(version != Version.high, "cannot upgrade version " & $Version.high) doAssert(version != Version.high, "cannot upgrade version " & $Version.high)
version.succ version.succ
type type
DowngradegetPayloadVersion* = ref object of BaseGetPayloadCustomizer DowngradeGetPayloadVersion* = ref object of BaseGetPayloadCustomizer
method getPayloadVersion(cust: DowngradegetPayloadVersion, timestamp: uint64): Version = method getPayloadVersion(cust: DowngradeGetPayloadVersion, timestamp: uint64): Version =
let version = procCall getPayloadVersion(cust.GetPayloadCustomizer, timestamp) let version = procCall getPayloadVersion(cust.GetPayloadCustomizer, timestamp)
doAssert(version != Version.V1, "cannot downgrade version 1") doAssert(version != Version.V1, "cannot downgrade version 1")
version.pred version.pred
@ -171,9 +171,9 @@ method getExpectInvalidStatus(cust: BaseForkchoiceUpdatedCustomizer): bool =
# Customizer that upgrades the version of the forkchoice directive call to the next version. # Customizer that upgrades the version of the forkchoice directive call to the next version.
type type
UpgradeforkchoiceUpdatedVersion* = ref object of BaseForkchoiceUpdatedCustomizer UpgradeForkchoiceUpdatedVersion* = ref object of BaseForkchoiceUpdatedCustomizer
method forkchoiceUpdatedVersion(cust: UpgradeforkchoiceUpdatedVersion, headTimestamp: method forkchoiceUpdatedVersion(cust: UpgradeForkchoiceUpdatedVersion, headTimestamp:
uint64, payloadAttributesTimestamp: Option[uint64] = none(uint64)): Version = uint64, payloadAttributesTimestamp: Option[uint64] = none(uint64)): Version =
let version = procCall forkchoiceUpdatedVersion(EngineAPIVersionResolver(cust), headTimestamp, payloadAttributesTimestamp) let version = procCall forkchoiceUpdatedVersion(EngineAPIVersionResolver(cust), headTimestamp, payloadAttributesTimestamp)
doAssert(version != Version.high, "cannot upgrade version " & $Version.high) doAssert(version != Version.high, "cannot upgrade version " & $Version.high)
@ -181,9 +181,9 @@ method forkchoiceUpdatedVersion(cust: UpgradeforkchoiceUpdatedVersion, headTimes
# Customizer that downgrades the version of the forkchoice directive call to the previous version. # Customizer that downgrades the version of the forkchoice directive call to the previous version.
type type
DowngradeforkchoiceUpdatedVersion* = ref object of BaseForkchoiceUpdatedCustomizer DowngradeForkchoiceUpdatedVersion* = ref object of BaseForkchoiceUpdatedCustomizer
method forkchoiceUpdatedVersion(cust: DowngradeforkchoiceUpdatedVersion, headTimestamp: uint64, method forkchoiceUpdatedVersion(cust: DowngradeForkchoiceUpdatedVersion, headTimestamp: uint64,
payloadAttributesTimestamp: Option[uint64] = none(uint64)): Version = payloadAttributesTimestamp: Option[uint64] = none(uint64)): Version =
let version = procCall forkchoiceUpdatedVersion(EngineAPIVersionResolver(cust), headTimestamp, payloadAttributesTimestamp) let version = procCall forkchoiceUpdatedVersion(EngineAPIVersionResolver(cust), headTimestamp, payloadAttributesTimestamp)
doAssert(version != Version.V1, "cannot downgrade version 1") doAssert(version != Version.V1, "cannot downgrade version 1")
@ -686,6 +686,7 @@ proc generateInvalidPayload*(sender: TxSender, data: ExecutableData, payloadFiel
# amounts and accounts, but the order in the list is different, so # amounts and accounts, but the order in the list is different, so
# stateRoot of the resulting payload should be the same. # stateRoot of the resulting payload should be the same.
when false:
proc randomizeWithdrawalsOrder(src: openArray[Withdrawal]): seq[Withdrawal] = proc randomizeWithdrawalsOrder(src: openArray[Withdrawal]): seq[Withdrawal] =
result = @src result = @src
result.shuffle result.shuffle

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2023 Status Research & Development GmbH # Copyright (c) 2023-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -93,7 +93,7 @@ type
proc collectBlobHashes(list: openArray[Web3Tx]): seq[common.Hash256] = proc collectBlobHashes(list: openArray[Web3Tx]): seq[common.Hash256] =
for w3tx in list: for w3tx in list:
let tx = ethTx(w3Tx) let tx = ethTx(w3tx)
for h in tx.versionedHashes: for h in tx.versionedHashes:
result.add h result.add h

View File

@ -23,7 +23,7 @@ method withMainFork(cs: ForkIDSpec, fork: EngineFork): BaseSpec =
return res return res
method getName(cs: ForkIDSpec): string = method getName(cs: ForkIDSpec): string =
var name = "Fork ID: Genesis at $1, $2 at $3" % [$cs.getGenesistimestamp(), $cs.mainFork, $cs.forkTime] var name = "Fork ID: Genesis at $1, $2 at $3" % [$cs.getGenesisTimestamp(), $cs.mainFork, $cs.forkTime]
if cs.previousForkTime != 0: if cs.previousForkTime != 0:
name.add ", $1 at $2" % [$cs.mainFork.pred, $cs.previousForkTime] name.add ", $1 at $2" % [$cs.mainFork.pred, $cs.previousForkTime]
@ -53,4 +53,5 @@ method execute(cs: ForkIDSpec, env: TestEnv): bool =
# Get client index's enode # Get client index's enode
let engine = env.addEngine() let engine = env.addEngine()
discard engine
return true return true

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2023 Status Research & Development GmbH # Copyright (c) 2023-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -16,9 +16,9 @@ import
type type
ForkchoiceStateField* = enum ForkchoiceStateField* = enum
HeadblockHash = "Head" HeadBlockHash = "Head"
SafeblockHash = "Safe" SafeBlockHash = "Safe"
FinalizedblockHash = "Finalized" FinalizedBlockHash = "Finalized"
type type
InconsistentForkchoiceTest* = ref object of EngineSpec InconsistentForkchoiceTest* = ref object of EngineSpec
@ -76,11 +76,11 @@ method execute(cs: InconsistentForkchoiceTest, env: TestEnv): bool =
) )
case cs.field case cs.field
of HeadblockHash: of HeadBlockHash:
inconsistentFcU.headblockHash = shadow.alt[len(shadow.alt)-1].blockHash inconsistentFcU.headblockHash = shadow.alt[len(shadow.alt)-1].blockHash
of SafeblockHash: of SafeBlockHash:
inconsistentFcU.safeblockHash = shadow.alt[len(shadow.canon)-2].blockHash inconsistentFcU.safeblockHash = shadow.alt[len(shadow.canon)-2].blockHash
of FinalizedblockHash: of FinalizedBlockHash:
inconsistentFcU.finalizedblockHash = shadow.alt[len(shadow.canon)-3].blockHash inconsistentFcU.finalizedblockHash = shadow.alt[len(shadow.canon)-3].blockHash
let version = env.engine.version(env.clMock.latestPayloadBuilt.timestamp) let version = env.engine.version(env.clMock.latestPayloadBuilt.timestamp)
@ -93,19 +93,19 @@ method execute(cs: InconsistentForkchoiceTest, env: TestEnv): bool =
return true return true
type type
ForkchoiceUpdatedUnknownblockHashTest* = ref object of EngineSpec ForkchoiceUpdatedUnknownBlockHashTest* = ref object of EngineSpec
field*: ForkchoiceStateField field*: ForkchoiceStateField
method withMainFork(cs: ForkchoiceUpdatedUnknownblockHashTest, fork: EngineFork): BaseSpec = method withMainFork(cs: ForkchoiceUpdatedUnknownBlockHashTest, fork: EngineFork): BaseSpec =
var res = cs.clone() var res = cs.clone()
res.mainFork = fork res.mainFork = fork
return res return res
method getName(cs: ForkchoiceUpdatedUnknownblockHashTest): string = method getName(cs: ForkchoiceUpdatedUnknownBlockHashTest): string =
return "Unknown $1blockHash" % [$cs.field] return "Unknown $1blockHash" % [$cs.field]
# Send an inconsistent ForkchoiceState with a known payload that belongs to a side chain as head, safe or finalized. # Send an inconsistent ForkchoiceState with a known payload that belongs to a side chain as head, safe or finalized.
method execute(cs: ForkchoiceUpdatedUnknownblockHashTest, env: TestEnv): bool = method execute(cs: ForkchoiceUpdatedUnknownBlockHashTest, env: TestEnv): bool =
# Wait until TTD is reached by this client # Wait until TTD is reached by this client
let ok = waitFor env.clMock.waitForTTD() let ok = waitFor env.clMock.waitForTTD()
testCond ok testCond ok
@ -116,7 +116,7 @@ method execute(cs: ForkchoiceUpdatedUnknownblockHashTest, env: TestEnv): bool =
# Generate a random block hash # Generate a random block hash
let randomblockHash = Web3Hash.randomBytes() let randomblockHash = Web3Hash.randomBytes()
if cs.field == HeadblockHash: if cs.field == HeadBlockHash:
let fcu = ForkchoiceStateV1( let fcu = ForkchoiceStateV1(
headblockHash: randomblockHash, headblockHash: randomblockHash,
safeblockHash: env.clMock.latestForkchoice.safeblockHash, safeblockHash: env.clMock.latestForkchoice.safeblockHash,
@ -153,9 +153,9 @@ method execute(cs: ForkchoiceUpdatedUnknownblockHashTest, env: TestEnv): bool =
finalizedblockHash: env.clMock.latestForkchoice.finalizedblockHash, finalizedblockHash: env.clMock.latestForkchoice.finalizedblockHash,
) )
if cs.field == SafeblockHash: if cs.field == SafeBlockHash:
fcu.safeblockHash = randomblockHash fcu.safeblockHash = randomblockHash
elif cs.field == FinalizedblockHash: elif cs.field == FinalizedBlockHash:
fcu.finalizedblockHash = randomblockHash fcu.finalizedblockHash = randomblockHash
let version = env.engine.version(env.clMock.latestExecutedPayload.timestamp) let version = env.engine.version(env.clMock.latestExecutedPayload.timestamp)

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2023 Status Research & Development GmbH # Copyright (c) 2023-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -230,7 +230,7 @@ method execute(cs: InvalidMissingAncestorReOrgSyncTest, env: TestEnv): bool =
if not cs.reOrgFromCanonical: if not cs.reOrgFromCanonical:
# Add back the original client before side chain production # Add back the original client before side chain production
env.cLMock.addEngine(env.engine) env.clMock.addEngine(env.engine)
# Produce blocks but at the same time create an side chain which contains an invalid payload at some point (INV_P) # Produce blocks but at the same time create an side chain which contains an invalid payload at some point (INV_P)
# CommonAncestor◄─▲── P1 ◄─ P2 ◄─ P3 ◄─ ... ◄─ Pn # CommonAncestor◄─▲── P1 ◄─ P2 ◄─ P3 ◄─ ... ◄─ Pn

View File

@ -60,6 +60,8 @@ method execute(cs: InvalidPayloadTestCase, env: TestEnv): bool =
let sec = if cs.syncing: env.addEngine() let sec = if cs.syncing: env.addEngine()
else: EngineEnv(nil) else: EngineEnv(nil)
discard sec
# Wait until TTD is reached by all clients # Wait until TTD is reached by all clients
let ok = waitFor env.clMock.waitForTTD() let ok = waitFor env.clMock.waitForTTD()
testCond ok testCond ok
@ -132,7 +134,7 @@ method execute(cs: InvalidPayloadTestCase, env: TestEnv): bool =
# Depending on the field we modified, we expect a different status # Depending on the field we modified, we expect a different status
var version = env.engine.version(shadow.alteredPayload.timestamp) var version = env.engine.version(shadow.alteredPayload.timestamp)
let r = env.engine.client.newPayload(version, shadow.alteredPayload) let r = env.engine.client.newPayload(version, shadow.alteredPayload)
if cs.syncing or cs.invalidField == InvalidparentHash: if cs.syncing or cs.invalidField == InvalidParentHash:
# Execution specification:: # Execution specification::
# (status: ACCEPTED, latestValidHash: null, validationError: null) if the following conditions are met: # (status: ACCEPTED, latestValidHash: null, validationError: null) if the following conditions are met:
# - the blockHash of the payload is valid # - the blockHash of the payload is valid
@ -199,7 +201,7 @@ method execute(cs: InvalidPayloadTestCase, env: TestEnv): bool =
let q = env.engine.client.newPayload(version, shadow.alteredPayload) let q = env.engine.client.newPayload(version, shadow.alteredPayload)
if cs.invalidField == InvalidparentHash: if cs.invalidField == InvalidParentHash:
# There is no invalid parentHash, if this value is incorrect, # There is no invalid parentHash, if this value is incorrect,
# it is assumed that the block is missing and we need to sync. # it is assumed that the block is missing and we need to sync.
# ACCEPTED also valid since the CLs normally use these interchangeably # ACCEPTED also valid since the CLs normally use these interchangeably
@ -221,7 +223,7 @@ method execute(cs: InvalidPayloadTestCase, env: TestEnv): bool =
# Try sending the fcU again, this time we should get the proper invalid response. # Try sending the fcU again, this time we should get the proper invalid response.
# At this moment the response should be INVALID # At this moment the response should be INVALID
if cs.invalidField != InvalidparentHash: if cs.invalidField != InvalidParentHash:
let version = env.engine.version(shadow.alteredPayload.timestamp) let version = env.engine.version(shadow.alteredPayload.timestamp)
let s = env.engine.client.forkchoiceUpdated(version, fcState) let s = env.engine.client.forkchoiceUpdated(version, fcState)
# Note: syncing is acceptable here as long as the block produced after this test is produced successfully # Note: syncing is acceptable here as long as the block produced after this test is produced successfully
@ -305,6 +307,7 @@ method execute(cs: PayloadBuildAfterInvalidPayloadTest, env: TestEnv): bool =
# Wait until TTD is reached by this client # Wait until TTD is reached by this client
let ok = waitFor env.clMock.waitForTTD() let ok = waitFor env.clMock.waitForTTD()
testCond ok
# Produce blocks before starting the test # Produce blocks before starting the test
testCond env.clMock.produceBlocks(5, BlockProcessCallbacks()) testCond env.clMock.produceBlocks(5, BlockProcessCallbacks())

View File

@ -289,7 +289,7 @@ method execute(cs: NewPayloadOnSyncingClientTest, env: TestEnv): bool =
recipient: EthAddress.randomBytes(), recipient: EthAddress.randomBytes(),
) )
var sec = env.addEngine() discard env.addEngine()
# Wait until TTD is reached by all clients # Wait until TTD is reached by all clients
let ok = waitFor env.clMock.waitForTTD() let ok = waitFor env.clMock.waitForTTD()
@ -327,7 +327,7 @@ method execute(cs: NewPayloadOnSyncingClientTest, env: TestEnv): bool =
let r = env.engine.client.forkchoiceUpdated(version, env.clMock.latestForkchoice) let r = env.engine.client.forkchoiceUpdated(version, env.clMock.latestForkchoice)
r.expectPayloadStatus(PayloadExecutionStatus.syncing) r.expectPayloadStatus(PayloadExecutionStatus.syncing)
pbREs = env.clMock.produceSingleBlock(BlockProcessCallbacks( pbRes = env.clMock.produceSingleBlock(BlockProcessCallbacks(
onPayloadProducerSelected: proc(): bool = onPayloadProducerSelected: proc(): bool =
# Send at least one transaction per payload # Send at least one transaction per payload
let tc = BaseTx( let tc = BaseTx(

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2023 Status Research & Development GmbH # Copyright (c) 2023-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -15,7 +15,7 @@ import
type type
PayloadAttributesFieldChange* = enum PayloadAttributesFieldChange* = enum
PayloadAttributesIncreasetimestamp = "Increase timestamp" PayloadAttributesIncreaseTimestamp = "Increase timestamp"
PayloadAttributesRandom = "Modify Random" PayloadAttributesRandom = "Modify Random"
PayloadAttributesSuggestedFeeRecipient = "Modify SuggestedFeeRecipient" PayloadAttributesSuggestedFeeRecipient = "Modify SuggestedFeeRecipient"
PayloadAttributesAddWithdrawal = "Add Withdrawal" PayloadAttributesAddWithdrawal = "Add Withdrawal"
@ -58,11 +58,11 @@ method execute(cs: UniquePayloadIDTest, env: TestEnv): bool =
onPayloadAttributesGenerated: proc(): bool = onPayloadAttributesGenerated: proc(): bool =
var attr = env.clMock.latestPayloadAttributes var attr = env.clMock.latestPayloadAttributes
case cs.fieldModification case cs.fieldModification
of PayloadAttributesIncreasetimestamp: of PayloadAttributesIncreaseTimestamp:
attr.timestamp = w3Qty(attr.timestamp, 1) attr.timestamp = w3Qty(attr.timestamp, 1)
of PayloadAttributesRandom: of PayloadAttributesRandom:
attr.prevRandao = attr.prevRandao.plusOne attr.prevRandao = attr.prevRandao.plusOne
of PayloadAttributesSuggestedFeerecipient: of PayloadAttributesSuggestedFeeRecipient:
attr.suggestedFeeRecipient = attr.suggestedFeeRecipient.plusOne attr.suggestedFeeRecipient = attr.suggestedFeeRecipient.plusOne
of PayloadAttributesAddWithdrawal: of PayloadAttributesAddWithdrawal:
let newWithdrawal = WithdrawalV1() let newWithdrawal = WithdrawalV1()

View File

@ -428,7 +428,7 @@ method execute(cs: ReOrgBackToCanonicalTest, env: TestEnv): bool =
var version = env.engine.version(env.clMock.latestHeader.timestamp) var version = env.engine.version(env.clMock.latestHeader.timestamp)
let r = env.engine.client.forkchoiceUpdated(version, env.clMock.latestForkchoice, some(attr)) let r = env.engine.client.forkchoiceUpdated(version, env.clMock.latestForkchoice, some(attr))
r.expectNoError() r.expectNoError()
testcond r.get.payloadID.isSome: testCond r.get.payloadID.isSome:
fatal "No payload ID returned by forkchoiceUpdated" fatal "No payload ID returned by forkchoiceUpdated"
version = env.engine.version(attr.timestamp) version = env.engine.version(attr.timestamp)

View File

@ -16,9 +16,9 @@ import
type type
BlockStatusRPCcheckType* = enum BlockStatusRPCcheckType* = enum
LatestOnNewPayload = "Latest Block on NewPayload" LatestOnNewPayload = "Latest Block on NewPayload"
LatestOnHeadblockHash = "Latest Block on HeadblockHash Update" LatestOnHeadBlockHash = "Latest Block on HeadblockHash Update"
SafeOnSafeblockHash = "Safe Block on SafeblockHash Update" SafeOnSafeBlockHash = "Safe Block on SafeblockHash Update"
FinalizedOnFinalizedblockHash = "Finalized Block on FinalizedblockHash Update" FinalizedOnFinalizedBlockHash = "Finalized Block on FinalizedblockHash Update"
type type
BlockStatus* = ref object of EngineSpec BlockStatus* = ref object of EngineSpec
@ -42,9 +42,9 @@ method execute(cs: BlockStatus, env: TestEnv): bool =
let ok = waitFor env.clMock.waitForTTD() let ok = waitFor env.clMock.waitForTTD()
testCond ok testCond ok
if cs.checkType in [SafeOnSafeblockHash, FinalizedOnFinalizedblockHash]: if cs.checkType in [SafeOnSafeBlockHash, FinalizedOnFinalizedBlockHash]:
var number = Finalized var number = Finalized
if cs.checkType == SafeOnSafeblockHash: if cs.checkType == SafeOnSafeBlockHash:
number = Safe number = Safe
let p = env.engine.client.namedHeader(number) let p = env.engine.client.namedHeader(number)
@ -87,19 +87,19 @@ method execute(cs: BlockStatus, env: TestEnv): bool =
let q = env.engine.client.txReceipt(shadow.txHash) let q = env.engine.client.txReceipt(shadow.txHash)
q.expectError() q.expectError()
return true return true
of LatestOnHeadblockHash: of LatestOnHeadBlockHash:
callbacks.onForkchoiceBroadcast = proc(): bool = callbacks.onForkchoiceBroadcast = proc(): bool =
let r = env.engine.client.namedHeader(Head) let r = env.engine.client.namedHeader(Head)
r.expectHash(ethHash env.clMock.latestForkchoice.headblockHash) r.expectHash(ethHash env.clMock.latestForkchoice.headblockHash)
let s = env.engine.client.txReceipt(shadow.txHash) let s = env.engine.client.txReceipt(shadow.txHash)
s.expectTransactionHash(shadow.txHash) s.expectTransactionHash(shadow.txHash)
return true return true
of SafeOnSafeblockHash: of SafeOnSafeBlockHash:
callbacks.onSafeBlockChange = proc(): bool = callbacks.onSafeBlockChange = proc(): bool =
let r = env.engine.client.namedHeader(Safe) let r = env.engine.client.namedHeader(Safe)
r.expectHash(ethHash env.clMock.latestForkchoice.safeblockHash) r.expectHash(ethHash env.clMock.latestForkchoice.safeblockHash)
return true return true
of FinalizedOnFinalizedblockHash: of FinalizedOnFinalizedBlockHash:
callbacks.onFinalizedBlockChange = proc(): bool = callbacks.onFinalizedBlockChange = proc(): bool =
let r = env.engine.client.namedHeader(Finalized) let r = env.engine.client.namedHeader(Finalized)
r.expectHash(ethHash env.clMock.latestForkchoice.finalizedblockHash) r.expectHash(ethHash env.clMock.latestForkchoice.finalizedblockHash)

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2023 Status Research & Development GmbH # Copyright (c) 2023-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -56,7 +56,7 @@ method execute(cs: SuggestedFeeRecipientTest, env: TestEnv): bool =
testCond env.clMock.produceSingleBlock(BlockProcessCallbacks()) testCond env.clMock.produceSingleBlock(BlockProcessCallbacks())
# Calculate the fees and check that they match the balance of the fee recipient # Calculate the fees and check that they match the balance of the fee recipient
let r = env.engine.client.latestblock() let r = env.engine.client.latestBlock()
testCond r.isOk: testCond r.isOk:
error "cannot get latest header", msg=r.error error "cannot get latest header", msg=r.error

View File

@ -211,7 +211,7 @@ proc numTxsInPool*(env: EngineEnv): int =
func version*(env: EngineEnv, time: EthTime): Version = func version*(env: EngineEnv, time: EthTime): Version =
if env.com.isCancunOrLater(time): if env.com.isCancunOrLater(time):
Version.V3 Version.V3
elif env.com.isShanghaiOrlater(time): elif env.com.isShanghaiOrLater(time):
Version.V2 Version.V2
else: else:
Version.V1 Version.V1

View File

@ -91,11 +91,11 @@ func client*(env: TestEnv): RpcHttpClient =
func engine*(env: TestEnv): EngineEnv = func engine*(env: TestEnv): EngineEnv =
env.clients.first env.clients.first
func sender*(env: TesTenv): TxSender = func sender*(env: TestEnv): TxSender =
env.sender env.sender
proc setupCLMock*(env: TestEnv) = proc setupCLMock*(env: TestEnv) =
env.clmock = newCLMocker(env.engine, env.engine.com) env.clMock = newClMocker(env.engine, env.engine.com)
proc addEngine*(env: TestEnv, addToCL: bool = true, connectBootNode: bool = true): EngineEnv = proc addEngine*(env: TestEnv, addToCL: bool = true, connectBootNode: bool = true): EngineEnv =
doAssert(env.clMock.isNil.not) doAssert(env.clMock.isNil.not)

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2023 Status Research & Development GmbH # Copyright (c) 2023-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -116,7 +116,7 @@ proc fillBalance(sender: TxSender, params: NetworkParams) =
) )
proc new*(_: type TxSender, params: NetworkParams): TxSender = proc new*(_: type TxSender, params: NetworkParams): TxSender =
result = TxSender(chainId: params.config.chainID) result = TxSender(chainId: params.config.chainId)
result.createAccounts() result.createAccounts()
result.fillBalance(params) result.fillBalance(params)
@ -157,10 +157,10 @@ proc makeTx(params: MakeTxParams, tc: BaseTx): Transaction =
to : tc.recipient, to : tc.recipient,
value : tc.amount, value : tc.amount,
payload : tc.payload, payload : tc.payload,
chainId : params.chainID chainId : params.chainId
) )
signTransaction(tx, params.key, params.chainID, eip155 = true) signTransaction(tx, params.key, params.chainId, eip155 = true)
proc makeTx(params: MakeTxParams, tc: BigInitcodeTx): Transaction = proc makeTx(params: MakeTxParams, tc: BigInitcodeTx): Transaction =
var tx = tc var tx = tc
@ -179,7 +179,7 @@ proc makeTx(params: MakeTxParams, tc: BigInitcodeTx): Transaction =
proc makeTx*(sender: TxSender, tc: BaseTx, nonce: AccountNonce): Transaction = proc makeTx*(sender: TxSender, tc: BaseTx, nonce: AccountNonce): Transaction =
let acc = sender.getNextAccount() let acc = sender.getNextAccount()
let params = MakeTxParams( let params = MakeTxParams(
chainId: sender.chainID, chainId: sender.chainId,
key: acc.key, key: acc.key,
nonce: nonce nonce: nonce
) )
@ -188,7 +188,7 @@ proc makeTx*(sender: TxSender, tc: BaseTx, nonce: AccountNonce): Transaction =
proc makeTx*(sender: TxSender, tc: BigInitcodeTx, nonce: AccountNonce): Transaction = proc makeTx*(sender: TxSender, tc: BigInitcodeTx, nonce: AccountNonce): Transaction =
let acc = sender.getNextAccount() let acc = sender.getNextAccount()
let params = MakeTxParams( let params = MakeTxParams(
chainId: sender.chainID, chainId: sender.chainId,
key: acc.key, key: acc.key,
nonce: nonce nonce: nonce
) )
@ -199,7 +199,7 @@ proc makeNextTx*(sender: TxSender, tc: BaseTx): Transaction =
acc = sender.getNextAccount() acc = sender.getNextAccount()
nonce = sender.getNextNonce(acc.address) nonce = sender.getNextNonce(acc.address)
params = MakeTxParams( params = MakeTxParams(
chainId: sender.chainID, chainId: sender.chainId,
key: acc.key, key: acc.key,
nonce: nonce nonce: nonce
) )
@ -219,7 +219,7 @@ proc sendTx*(sender: TxSender, client: RpcClient, tc: BaseTx, nonce: AccountNonc
let let
acc = sender.getNextAccount() acc = sender.getNextAccount()
params = MakeTxParams( params = MakeTxParams(
chainId: sender.chainID, chainId: sender.chainId,
key: acc.key, key: acc.key,
nonce: nonce nonce: nonce
) )
@ -237,7 +237,7 @@ proc sendTx*(sender: TxSender, client: RpcClient, tc: BigInitcodeTx, nonce: Acco
let let
acc = sender.getNextAccount() acc = sender.getNextAccount()
params = MakeTxParams( params = MakeTxParams(
chainId: sender.chainID, chainId: sender.chainId,
key: acc.key, key: acc.key,
nonce: nonce nonce: nonce
) )
@ -272,7 +272,7 @@ proc makeTx*(params: MakeTxParams, tc: BlobTx): Transaction =
let unsignedTx = Transaction( let unsignedTx = Transaction(
txType : TxEip4844, txType : TxEip4844,
chainId : params.chainID, chainId : params.chainId,
nonce : params.nonce, nonce : params.nonce,
maxPriorityFee: gasTipCap, maxPriorityFee: gasTipCap,
maxFee : gasFeeCap, maxFee : gasFeeCap,
@ -284,7 +284,7 @@ proc makeTx*(params: MakeTxParams, tc: BlobTx): Transaction =
versionedHashes: data.hashes, versionedHashes: data.hashes,
) )
var tx = signTransaction(unsignedTx, params.key, params.chainID, eip155 = true) var tx = signTransaction(unsignedTx, params.key, params.chainId, eip155 = true)
tx.networkPayload = NetworkPayload( tx.networkPayload = NetworkPayload(
blobs : data.blobs, blobs : data.blobs,
commitments: data.commitments, commitments: data.commitments,
@ -299,7 +299,7 @@ proc getAccount*(sender: TxSender, idx: int): TestAccount =
proc sendTx*(sender: TxSender, acc: TestAccount, client: RpcClient, tc: BlobTx): Result[Transaction, void] = proc sendTx*(sender: TxSender, acc: TestAccount, client: RpcClient, tc: BlobTx): Result[Transaction, void] =
let let
params = MakeTxParams( params = MakeTxParams(
chainId: sender.chainID, chainId: sender.chainId,
key: acc.key, key: acc.key,
nonce: sender.getNextNonce(acc.address), nonce: sender.getNextNonce(acc.address),
) )
@ -316,7 +316,7 @@ proc sendTx*(sender: TxSender, acc: TestAccount, client: RpcClient, tc: BlobTx):
proc replaceTx*(sender: TxSender, acc: TestAccount, client: RpcClient, tc: BlobTx): Result[Transaction, void] = proc replaceTx*(sender: TxSender, acc: TestAccount, client: RpcClient, tc: BlobTx): Result[Transaction, void] =
let let
params = MakeTxParams( params = MakeTxParams(
chainId: sender.chainID, chainId: sender.chainId,
key: acc.key, key: acc.key,
nonce: sender.getLastNonce(acc.address), nonce: sender.getLastNonce(acc.address),
) )
@ -333,7 +333,7 @@ proc replaceTx*(sender: TxSender, acc: TestAccount, client: RpcClient, tc: BlobT
proc makeTx*(sender: TxSender, tc: BaseTx, acc: TestAccount, nonce: AccountNonce): Transaction = proc makeTx*(sender: TxSender, tc: BaseTx, acc: TestAccount, nonce: AccountNonce): Transaction =
let let
params = MakeTxParams( params = MakeTxParams(
chainId: sender.chainID, chainId: sender.chainId,
key: acc.key, key: acc.key,
nonce: nonce, nonce: nonce,
) )
@ -370,8 +370,8 @@ proc customizeTransaction*(sender: TxSender,
modTx.S = signature.S modTx.S = signature.S
if baseTx.txType in {TxEip1559, TxEip4844}: if baseTx.txType in {TxEip1559, TxEip4844}:
if custTx.chainID.isSome: if custTx.chainId.isSome:
modTx.chainID = custTx.chainID.get modTx.chainId = custTx.chainId.get
if custTx.gasPriceOrGasFeeCap.isSome: if custTx.gasPriceOrGasFeeCap.isSome:
modTx.maxFee = custTx.gasPriceOrGasFeeCap.get.GasInt modTx.maxFee = custTx.gasPriceOrGasFeeCap.get.GasInt
@ -385,6 +385,6 @@ proc customizeTransaction*(sender: TxSender,
modTx.to = some(address) modTx.to = some(address)
if custTx.signature.isNone: if custTx.signature.isNone:
return signTransaction(modTx, acc.key, modTx.chainID, eip155 = true) return signTransaction(modTx, acc.key, modTx.chainId, eip155 = true)
return modTx return modTx

View File

@ -45,9 +45,9 @@ proc execute*(ws: BlockValueSpec, env: TestEnv): bool =
totalValue += txTip.uint64.u256 * rec.gasUsed.u256 totalValue += txTip.uint64.u256 * rec.gasUsed.u256
doAssert(env.cLMock.latestBlockValue.isSome) doAssert(env.clMock.latestBlockValue.isSome)
testCond totalValue == env.cLMock.latestBlockValue.get: testCond totalValue == env.clMock.latestBlockValue.get:
error "Unexpected block value returned on GetPayloadV2", error "Unexpected block value returned on GetPayloadV2",
expect=totalValue, expect=totalValue,
get=env.cLMock.latestBlockValue.get get=env.clMock.latestBlockValue.get
return true return true

View File

@ -292,7 +292,7 @@ proc execute*(ws: ReorgSpec, env: TestEnv): bool =
let b = env.client.latestHeader() let b = env.client.latestHeader()
testCond b.isOk testCond b.isOk
let header = b.get let header = b.get
if header.blockHash == ethHash(sidehash): if header.blockHash == ethHash(sideHash):
# sync successful # sync successful
break break

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2021 Status Research & Development GmbH # Copyright (c) 2021-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT)) # * MIT license ([LICENSE-MIT](LICENSE-MIT))
@ -103,7 +103,7 @@ proc main() =
if not fileName.endsWith(".json"): if not fileName.endsWith(".json"):
continue continue
let (folder, name) = fileName.splitPath() let (_, name) = fileName.splitPath()
let node = parseFile(fileName) let node = parseFile(fileName)
let status = ctx.processNode(node, fileName) let status = ctx.processNode(node, fileName)
stat.inc(name, status) stat.inc(name, status)

View File

@ -17,6 +17,7 @@ import
../../../nimbus/transaction, ../../../nimbus/transaction,
./client ./client
when false:
const const
# This is the account that sends vault funding transactions. # This is the account that sends vault funding transactions.
vaultAccountAddr = hextoByteArray[20]("0xcf49fda3be353c69b41ed96333cd24302da4556f") vaultAccountAddr = hextoByteArray[20]("0xcf49fda3be353c69b41ed96333cd24302da4556f")

View File

@ -37,7 +37,6 @@ import
chronicles, chronicles,
eth/common, eth/common,
results, results,
stew/byteutils,
"."/[aristo_desc, aristo_get, aristo_layers, aristo_serialise, aristo_utils] "."/[aristo_desc, aristo_get, aristo_layers, aristo_serialise, aristo_utils]
type type
@ -56,12 +55,14 @@ logScope:
# Private helpers # Private helpers
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
when false:
template logTxt(info: static[string]): static[string] = template logTxt(info: static[string]): static[string] =
"Hashify " & info "Hashify " & info
func getOrVoid(tab: Table[VertexID,VertexID]; vid: VertexID): VertexID = func getOrVoid(tab: Table[VertexID,VertexID]; vid: VertexID): VertexID =
tab.getOrDefault(vid, VertexID(0)) tab.getOrDefault(vid, VertexID(0))
when false:
func contains(wff: WidthFirstForest; vid: VertexID): bool = func contains(wff: WidthFirstForest; vid: VertexID): bool =
vid in wff.base or vid in wff.pool or vid in wff.root vid in wff.base or vid in wff.pool or vid in wff.root

View File

@ -160,7 +160,7 @@ proc insertBranch(
let let
local = db.vidFetch(pristine = true) local = db.vidFetch(pristine = true)
lty = LeafTie(root: hike.root, path: rc.value) # lty = LeafTie(root: hike.root, path: rc.value)
db.setVtxAndKey(hike.root, local, linkVtx) db.setVtxAndKey(hike.root, local, linkVtx)
linkVtx.lPfx = linkVtx.lPfx.slice(1+n) linkVtx.lPfx = linkVtx.lPfx.slice(1+n)

View File

@ -59,9 +59,12 @@ type
const const
VoidTrieID = VertexID(0) VoidTrieID = VertexID(0)
AccountsTrieID = VertexID(AccountsTrie) AccountsTrieID = VertexID(AccountsTrie)
StorageTrieID = VertexID(StorageTrie)
GenericTrieID = VertexID(GenericTrie) GenericTrieID = VertexID(GenericTrie)
when false:
const
StorageTrieID = VertexID(StorageTrie)
logScope: logScope:
topics = "aristo-hdl" topics = "aristo-hdl"

View File

@ -42,9 +42,6 @@ const
extraTraceMessages = false # or true extraTraceMessages = false # or true
## Enabled additional logging noise ## Enabled additional logging noise
estimatedNodeSize = hexaryRangeRlpNodesListSizeMax(1)
## Some expected upper limit for a single node
estimatedProofSize = hexaryRangeRlpNodesListSizeMax(10) estimatedProofSize = hexaryRangeRlpNodesListSizeMax(10)
## Some expected upper limit, typically not mote than 10 proof nodes ## Some expected upper limit, typically not mote than 10 proof nodes
@ -58,6 +55,11 @@ const
defaultDataSizeMax = fetchRequestBytesLimit defaultDataSizeMax = fetchRequestBytesLimit
## Truncate maximum data size ## Truncate maximum data size
when false:
const
estimatedNodeSize = hexaryRangeRlpNodesListSizeMax(1)
## Some expected upper limit for a single node
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Private functions: helpers # Private functions: helpers
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2020-2023 Status Research & Development GmbH # Copyright (c) 2020-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -25,7 +25,6 @@ proc validateBlock(com: CommonRef, blockNumber: BlockNumber): BlockNumber =
parent = com.db.getBlockHeader(parentNumber) parent = com.db.getBlockHeader(parentNumber)
headers = newSeq[BlockHeader](numBlocks) headers = newSeq[BlockHeader](numBlocks)
bodies = newSeq[BlockBody](numBlocks) bodies = newSeq[BlockBody](numBlocks)
lastBlockHash: Hash256
for i in 0 ..< numBlocks: for i in 0 ..< numBlocks:
headers[i] = com.db.getBlockHeader(blockNumber + i.u256) headers[i] = com.db.getBlockHeader(blockNumber + i.u256)

View File

@ -57,7 +57,7 @@ proc walkAllDb(
## Walk over all key-value pairs of the database (`RocksDB` only.) ## Walk over all key-value pairs of the database (`RocksDB` only.)
let let
rop = rocksdb_readoptions_create() rop = rocksdb_readoptions_create()
rit = rocky.rocksdb.cPtr.rocksdb_create_iterator(rop) rit = rocky.rocksDb.cPtr.rocksdb_create_iterator(rop)
rit.rocksdb_iter_seek_to_first() rit.rocksdb_iter_seek_to_first()
while rit.rocksdb_iter_valid() != 0: while rit.rocksdb_iter_valid() != 0:

View File

@ -39,6 +39,7 @@ const
numBlocks: 5500, # unconditionally load blocks numBlocks: 5500, # unconditionally load blocks
numTxs: 10) # txs following (not in block chain) numTxs: 10) # txs following (not in block chain)
when false:
goerliCapture1: CaptureSpecs = ( goerliCapture1: CaptureSpecs = (
GoerliNet, goerliCapture.file, 5500, 10000) GoerliNet, goerliCapture.file, 5500, 10000)
@ -80,6 +81,7 @@ proc pp*(tx: Transaction; vmState: BaseVMState): string =
"," & $vmState.readOnlyStateDB.getBalance(address) & "," & $vmState.readOnlyStateDB.getBalance(address) &
")" ")"
when false:
proc setTraceLevel = proc setTraceLevel =
discard discard
when defined(chronicles_runtime_filtering) and loggingEnabled: when defined(chronicles_runtime_filtering) and loggingEnabled:

View File

@ -221,6 +221,7 @@ proc mergeData(
let rc = db.merge(proof, root) # , noisy=noisy) let rc = db.merge(proof, root) # , noisy=noisy)
xCheckRc rc.error == 0 xCheckRc rc.error == 0
rc.value rc.value
discard nMerged
let merged = db.mergeList(leafs, noisy=noisy) let merged = db.mergeList(leafs, noisy=noisy)
xCheck merged.error in {AristoError(0), MergeLeafPathCachedAlready} xCheck merged.error in {AristoError(0), MergeLeafPathCachedAlready}
@ -328,7 +329,7 @@ proc testBackendConsistency*(
var var
mdbPreSave = "" mdbPreSave = ""
rdbPreSave = "" rdbPreSave {.used.} = ""
when true and false: when true and false:
mdbPreSave = mdb.pp() # backendOk = true) mdbPreSave = mdb.pp() # backendOk = true)
rdbPreSave = rdb.pp() # backendOk = true) rdbPreSave = rdb.pp() # backendOk = true)

View File

@ -64,11 +64,11 @@ proc fifos(be: BackendRef): seq[seq[(QueueID,FilterRef)]] =
discard discard
check be.kind == BackendMemory or be.kind == BackendRocksDB check be.kind == BackendMemory or be.kind == BackendRocksDB
func flatten(a: seq[seq[(QueueID,FilterRef)]]): seq[(QueueID,FilterRef)] = func flatten(a: seq[seq[(QueueID,FilterRef)]]): seq[(QueueID,FilterRef)] {.used.} =
for w in a: for w in a:
result &= w result &= w
proc fList(be: BackendRef): seq[(QueueID,FilterRef)] = proc fList(be: BackendRef): seq[(QueueID,FilterRef)] {.used.} =
case be.kind: case be.kind:
of BackendMemory: of BackendMemory:
return be.MemBackendRef.walkFilBe.toSeq.mapIt((it.qid, it.filter)) return be.MemBackendRef.walkFilBe.toSeq.mapIt((it.qid, it.filter))
@ -128,6 +128,7 @@ proc dump(pfx: string; dx: varargs[AristoDbRef]): string =
if n1 < dx.len: if n1 < dx.len:
result &= " ==========\n " result &= " ==========\n "
when false:
proc dump(dx: varargs[AristoDbRef]): string = proc dump(dx: varargs[AristoDbRef]): string =
"".dump dx "".dump dx
@ -684,7 +685,7 @@ proc testFilterFifo*(
be = db.backend be = db.backend
defer: db.finish(flush=true) defer: db.finish(flush=true)
proc show(serial = 0; exec: seq[QidAction] = @[]) = proc show(serial = 0; exec: seq[QidAction] = @[]) {.used.} =
var s = "" var s = ""
if 0 < serial: if 0 < serial:
s &= " n=" & $serial s &= " n=" & $serial
@ -755,7 +756,7 @@ proc testFilterBacklog*(
be = db.backend be = db.backend
defer: db.finish(flush=true) defer: db.finish(flush=true)
proc show(serial = -42, blurb = "") = proc show(serial = -42, blurb = "") {.used.} =
var s = blurb var s = blurb
if 0 <= serial: if 0 <= serial:
s &= " n=" & $serial s &= " n=" & $serial
@ -799,7 +800,7 @@ proc testFilterBacklog*(
var var
fifoLen = be.filters.len fifoLen = be.filters.len
pivot = (fifoLen * reorgPercent) div 100 pivot = (fifoLen * reorgPercent) div 100
qid = be.filters[pivot] qid {.used.} = be.filters[pivot]
xb = AristoDbRef(nil) xb = AristoDbRef(nil)
for episode in 0 .. pivot: for episode in 0 .. pivot:

View File

@ -257,7 +257,7 @@ proc delTree*(
aristo_delete.delTree(db, root, accPath) aristo_delete.delTree(db, root, accPath)
proc merge( proc merge*(
db: AristoDbRef; db: AristoDbRef;
root: VertexID; root: VertexID;
path: openArray[byte]; path: openArray[byte];

View File

@ -484,6 +484,7 @@ proc testTxMergeAndDeleteSubTree*(
let rc = db.randomisedLeafs(leafsLeft, prng) let rc = db.randomisedLeafs(leafsLeft, prng)
xCheckRc rc.error == (0,0) xCheckRc rc.error == (0,0)
rc.value rc.value
discard leafVidPairs
# === delete sub-tree === # === delete sub-tree ===
block: block:

View File

@ -11,7 +11,7 @@
## Testing `CoreDB` wrapper implementation ## Testing `CoreDB` wrapper implementation
import import
std/[os, strformat, strutils, times], std/[os, strformat, strutils],
chronicles, chronicles,
eth/common, eth/common,
results, results,

View File

@ -125,6 +125,7 @@ proc test_chainSyncProfilingPrint*(
let info = let info =
if 0 < nBlocks and nBlocks < high(int): " (" & $nBlocks & " blocks)" if 0 < nBlocks and nBlocks < high(int): " (" & $nBlocks & " blocks)"
else: "" else: ""
discard info
var blurb: seq[string] var blurb: seq[string]
when LedgerEnableApiProfiling: when LedgerEnableApiProfiling:
blurb.add ldgProfData.profilingPrinter( blurb.add ldgProfData.profilingPrinter(

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2019-2023 Status Research & Development GmbH # Copyright (c) 2019-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -99,7 +99,7 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) =
ommersHash : t.parentUncles ommersHash : t.parentUncles
) )
let timestamp = EthTime(t.currentTimeStamp) let timestamp = EthTime(t.currentTimestamp)
let diff = calculator(revision, timestamp, p) let diff = calculator(revision, timestamp, p)
check diff == t.currentDifficulty check diff == t.currentDifficulty

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2019-2023 Status Research & Development GmbH # Copyright (c) 2019-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -13,454 +13,454 @@ import macro_assembler, unittest2
proc opArithMain*() = proc opArithMain*() =
suite "Arithmetic Opcodes": suite "Arithmetic Opcodes":
assembler: assembler:
title: "ADD_1" title: "Add_1"
code: code:
PUSH1 "0x02" Push1 "0x02"
PUSH1 "0x02" Push1 "0x02"
ADD Add
stack: "0x04" stack: "0x04"
assembler: assembler:
title: "ADD_2" title: "Add_2"
code: code:
PUSH2 "0x1002" Push2 "0x1002"
PUSH1 "0x02" Push1 "0x02"
ADD Add
stack: "0x1004" stack: "0x1004"
assembler: assembler:
title: "ADD_3" title: "Add_3"
code: code:
PUSH2 "0x1002" Push2 "0x1002"
PUSH6 "0x123456789009" Push6 "0x123456789009"
ADD Add
stack: "0x12345678A00B" stack: "0x12345678A00B"
assembler: assembler:
title: "ADD_4" title: "Add_4"
code: code:
PUSH2 "0x1234" Push2 "0x1234"
ADD Add
success: false success: false
stack: "0x1234" stack: "0x1234"
assembler: assembler:
title: "ADDMOD_1" title: "Addmod_1"
code: code:
PUSH1 "0x02" Push1 "0x02"
PUSH1 "0x02" Push1 "0x02"
PUSH1 "0x03" Push1 "0x03"
ADDMOD Addmod
stack: "0x01" stack: "0x01"
assembler: assembler:
title: "ADDMOD_2" title: "Addmod_2"
code: code:
PUSH2 "0x1000" Push2 "0x1000"
PUSH1 "0x02" Push1 "0x02"
PUSH2 "0x1002" Push2 "0x1002"
ADDMOD Addmod
PUSH1 "0x00" Push1 "0x00"
stack: stack:
"0x04" "0x04"
"0x00" "0x00"
assembler: assembler:
title: "ADDMOD_3" title: "Addmod_3"
code: code:
PUSH2 "0x1002" Push2 "0x1002"
PUSH6 "0x123456789009" Push6 "0x123456789009"
PUSH1 "0x02" Push1 "0x02"
ADDMOD Addmod
stack: "0x093B" stack: "0x093B"
assembler: assembler:
title: "ADDMOD_4" title: "Addmod_4"
code: code:
PUSH2 "0x1234" Push2 "0x1234"
ADDMOD Addmod
stack: "0x1234" stack: "0x1234"
success: false success: false
assembler: assembler:
title: "MUL_1" title: "MUL_1"
code: code:
PUSH1 "0x03" Push1 "0x03"
PUSH1 "0x02" Push1 "0x02"
MUL Mul
stack: "0x06" stack: "0x06"
assembler: assembler:
title: "MUL_2" title: "MUL_2"
code: code:
PUSH3 "0x222222" Push3 "0x222222"
PUSH1 "0x03" Push1 "0x03"
MUL Mul
stack: "0x666666" stack: "0x666666"
assembler: assembler:
title: "MUL_3" title: "MUL_3"
code: code:
PUSH3 "0x222222" Push3 "0x222222"
PUSH3 "0x333333" Push3 "0x333333"
MUL Mul
stack: "0x6D3A05F92C6" stack: "0x6D3A05F92C6"
assembler: assembler:
title: "MUL_4" title: "MUL_4"
code: code:
PUSH1 "0x01" Push1 "0x01"
MUL Mul
stack: "0x01" stack: "0x01"
success: false success: false
assembler: # MULMOD OP assembler: # Mulmod OP
title: "MULMOD_2" title: "MULMOD_2"
code: code:
PUSH3 "0x222222" Push3 "0x222222"
PUSH1 "0x03" Push1 "0x03"
PUSH1 "0x04" Push1 "0x04"
MULMOD Mulmod
stack: "0x000000000000000000000000000000000000000000000000000000000000000C" stack: "0x000000000000000000000000000000000000000000000000000000000000000C"
assembler: # MULMOD OP assembler: # Mulmod OP
title: "MULMOD_3" title: "MULMOD_3"
code: code:
PUSH3 "0x222222" Push3 "0x222222"
PUSH3 "0x333333" Push3 "0x333333"
PUSH3 "0x444444" Push3 "0x444444"
MULMOD Mulmod
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # MULMOD OP mal assembler: # Mulmod OP mal
title: "MULMOD_4" title: "MULMOD_4"
code: code:
PUSH1 "0x01" Push1 "0x01"
MULMOD Mulmod
success: false success: false
stack: "0x01" stack: "0x01"
assembler: # DIV OP assembler: # Div OP
title: "DIV_1" title: "DIV_1"
code: code:
PUSH1 "0x02" Push1 "0x02"
PUSH1 "0x04" Push1 "0x04"
DIV Div
stack: "0x0000000000000000000000000000000000000000000000000000000000000002" stack: "0x0000000000000000000000000000000000000000000000000000000000000002"
assembler: # DIV OP assembler: # Div OP
title: "DIV_2" title: "DIV_2"
code: code:
PUSH1 "0x33" Push1 "0x33"
PUSH1 "0x99" Push1 "0x99"
DIV Div
stack: "0x0000000000000000000000000000000000000000000000000000000000000003" stack: "0x0000000000000000000000000000000000000000000000000000000000000003"
assembler: # DIV OP assembler: # Div OP
title: "DIV_3" title: "DIV_3"
code: code:
PUSH1 "0x22" Push1 "0x22"
PUSH1 "0x99" Push1 "0x99"
DIV Div
stack: "0x0000000000000000000000000000000000000000000000000000000000000004" stack: "0x0000000000000000000000000000000000000000000000000000000000000004"
assembler: # DIV OP assembler: # Div OP
title: "DIV_4" title: "DIV_4"
code: code:
PUSH1 "0x15" Push1 "0x15"
PUSH1 "0x99" Push1 "0x99"
DIV Div
stack: "0x0000000000000000000000000000000000000000000000000000000000000007" stack: "0x0000000000000000000000000000000000000000000000000000000000000007"
assembler: # DIV OP assembler: # Div OP
title: "DIV_5" title: "DIV_5"
code: code:
PUSH1 "0x04" Push1 "0x04"
PUSH1 "0x07" Push1 "0x07"
DIV Div
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # DIV OP assembler: # Div OP
title: "DIV_6" title: "DIV_6"
code: code:
PUSH1 "0x07" Push1 "0x07"
DIV Div
success: false success: false
stack: "0x07" stack: "0x07"
assembler: # SDIV OP assembler: # Sdiv OP
title: "SDIV_1" title: "SDIV_1"
code: code:
PUSH2 "0x03E8" Push2 "0x03E8"
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC18" Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC18"
SDIV Sdiv
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
assembler: # SDIV OP assembler: # Sdiv OP
title: "SDIV_2" title: "SDIV_2"
code: code:
PUSH1 "0xFF" Push1 "0xFF"
PUSH1 "0xFF" Push1 "0xFF"
SDIV Sdiv
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # SDIV OP, SDIV by zero should be zero assembler: # Sdiv OP, Sdiv by zero should be zero
title: "SDIV_3" title: "SDIV_3"
code: code:
PUSH1 "0x00" Push1 "0x00"
PUSH1 "0xFF" Push1 "0xFF"
SDIV Sdiv
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SDIV OP mal assembler: # Sdiv OP mal
title: "SDIV_4" title: "SDIV_4"
code: code:
PUSH1 "0xFF" Push1 "0xFF"
SDIV Sdiv
success: false success: false
stack: "0xFF" stack: "0xFF"
assembler: # -2^255 SDIV -1 = -2^255 (special case in yellow paper) assembler: # -2^255 Sdiv -1 = -2^255 (special case in yellow paper)
title: "SDIV_5" title: "SDIV_5"
code: code:
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" # -1 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" # -1
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256) Push32 "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256)
SDIV Sdiv
stack: "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256) stack: "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256)
assembler: # -2^255 SDIV 1 = -2^255 assembler: # -2^255 Sdiv 1 = -2^255
title: "SDIV_6" title: "SDIV_6"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001" # 1 Push32 "0x0000000000000000000000000000000000000000000000000000000000000001" # 1
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256) Push32 "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256)
SDIV Sdiv
stack: "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256) stack: "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256)
assembler: # -2 SDIV 2 = -1 assembler: # -2 Sdiv 2 = -1
title: "SDIV_7" title: "SDIV_7"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000002" # 2 Push32 "0x0000000000000000000000000000000000000000000000000000000000000002" # 2
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2
SDIV Sdiv
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" # -1 stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" # -1
assembler: # 4 SDIV -2 = -2 assembler: # 4 Sdiv -2 = -2
title: "SDIV_8" title: "SDIV_8"
code: code:
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000004" # 4 Push32 "0x0000000000000000000000000000000000000000000000000000000000000004" # 4
SDIV Sdiv
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2 stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2
assembler: # -4 SDIV 2 = -2 assembler: # -4 Sdiv 2 = -2
title: "SDIV_9" title: "SDIV_9"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000002" # -4 Push32 "0x0000000000000000000000000000000000000000000000000000000000000002" # -4
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC" # 2 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC" # 2
SDIV Sdiv
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2 stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2
assembler: # -1 SDIV 2 = 0 assembler: # -1 Sdiv 2 = 0
title: "SDIV_10" title: "SDIV_10"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000002" # 2 Push32 "0x0000000000000000000000000000000000000000000000000000000000000002" # 2
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" # -1 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" # -1
SDIV Sdiv
stack: "0x00" # 0 stack: "0x00" # 0
assembler: # low(int256) SDIV low(int256) = 1 assembler: # low(int256) Sdiv low(int256) = 1
title: "SDIV_11" title: "SDIV_11"
code: code:
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256) Push32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256)
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256) Push32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256)
SDIV Sdiv
stack: "0x01" # 1 stack: "0x01" # 1
assembler: # low(int256) SDIV 2 assembler: # low(int256) Sdiv 2
title: "SDIV_12" title: "SDIV_12"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000002" # 2 Push32 "0x0000000000000000000000000000000000000000000000000000000000000002" # 2
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256) Push32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256)
SDIV Sdiv
stack: "0xC000000000000000000000000000000000000000000000000000000000000000" # negative half low(int256) stack: "0xC000000000000000000000000000000000000000000000000000000000000000" # negative half low(int256)
assembler: # low(int256) SDIV -2 assembler: # low(int256) Sdiv -2
title: "SDIV_13" title: "SDIV_13"
code: code:
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256) Push32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256)
SDIV Sdiv
stack: "0x4000000000000000000000000000000000000000000000000000000000000000" # positive version of SDIV_12 stack: "0x4000000000000000000000000000000000000000000000000000000000000000" # positive version of SDIV_12
assembler: assembler:
title: "SDIV_14" title: "SDIV_14"
code: code:
PUSH1 "0x01" # 1 Push1 "0x01" # 1
PUSH1 "0x7F" # 127 Push1 "0x7F" # 127
SHL # 1 shl 127 (move the bit to the center or 128th position) Shl # 1 shl 127 (move the bit to the center or 128th position)
PUSH1 "0x01" # 1 Push1 "0x01" # 1
PUSH1 "0xFF" # 255 Push1 "0xFF" # 255
SHL # 1 shl 255 (create low(int256)) Shl # 1 shl 255 (create low(int256))
SDIV Sdiv
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000" # half of the hi bits are set stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000" # half of the hi bits are set
fork: Constantinople fork: Constantinople
assembler: # SUB OP assembler: # Sub OP
title: "SUB_1" title: "SUB_1"
code: code:
PUSH1 "0x04" Push1 "0x04"
PUSH1 "0x06" Push1 "0x06"
SUB Sub
stack: "0x0000000000000000000000000000000000000000000000000000000000000002" stack: "0x0000000000000000000000000000000000000000000000000000000000000002"
assembler: # SUB OP assembler: # Sub OP
title: "SUB_2" title: "SUB_2"
code: code:
PUSH2 "0x4444" Push2 "0x4444"
PUSH2 "0x6666" Push2 "0x6666"
SUB Sub
stack: "0x0000000000000000000000000000000000000000000000000000000000002222" stack: "0x0000000000000000000000000000000000000000000000000000000000002222"
assembler: # SUB OP assembler: # Sub OP
title: "SUB_3" title: "SUB_3"
code: code:
PUSH2 "0x4444" Push2 "0x4444"
PUSH4 "0x99996666" Push4 "0x99996666"
SUB Sub
stack: "0x0000000000000000000000000000000000000000000000000000000099992222" stack: "0x0000000000000000000000000000000000000000000000000000000099992222"
assembler: # SUB OP mal assembler: # Sub OP mal
title: "SUB_4" title: "SUB_4"
code: code:
PUSH4 "0x99996666" Push4 "0x99996666"
SUB Sub
success: false success: false
stack: "0x99996666" stack: "0x99996666"
assembler: # EXP OP assembler: # Exp OP
title: "EXP_1" title: "EXP_1"
code: code:
PUSH1 "0x03" Push1 "0x03"
PUSH1 "0x02" Push1 "0x02"
EXP Exp
stack: "0x0000000000000000000000000000000000000000000000000000000000000008" stack: "0x0000000000000000000000000000000000000000000000000000000000000008"
#assertEquals(4, gas); #assertEquals(4, gas);
assembler: # EXP OP assembler: # Exp OP
title: "EXP_2" title: "EXP_2"
code: code:
PUSH1 "0x00" Push1 "0x00"
PUSH3 "0x123456" Push3 "0x123456"
EXP Exp
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
#assertEquals(3, gas); #assertEquals(3, gas);
assembler: # EXP OP assembler: # Exp OP
title: "EXP_3" title: "EXP_3"
code: code:
PUSH2 "0x1122" Push2 "0x1122"
PUSH1 "0x01" Push1 "0x01"
EXP Exp
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
#assertEquals(5, gas); #assertEquals(5, gas);
assembler: # EXP OP mal assembler: # Exp OP mal
title: "EXP_4" title: "EXP_4"
code: code:
PUSH3 "0x123456" Push3 "0x123456"
EXP Exp
success: false success: false
stack: "0x123456" stack: "0x123456"
assembler: # MOD OP assembler: # Mod OP
title: "MOD_1" title: "MOD_1"
code: code:
PUSH1 "0x03" Push1 "0x03"
PUSH1 "0x04" Push1 "0x04"
MOD Mod
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # MOD OP assembler: # Mod OP
title: "MOD_2" title: "MOD_2"
code: code:
PUSH2 "0x012C" Push2 "0x012C"
PUSH2 "0x01F4" Push2 "0x01F4"
MOD Mod
stack: "0x00000000000000000000000000000000000000000000000000000000000000C8" stack: "0x00000000000000000000000000000000000000000000000000000000000000C8"
assembler: # MOD OP assembler: # Mod OP
title: "MOD_3" title: "MOD_3"
code: code:
PUSH1 "0x04" Push1 "0x04"
PUSH1 "0x02" Push1 "0x02"
MOD Mod
stack: "0x0000000000000000000000000000000000000000000000000000000000000002" stack: "0x0000000000000000000000000000000000000000000000000000000000000002"
assembler: # MOD OP mal assembler: # Mod OP mal
title: "MOD_4" title: "MOD_4"
code: code:
PUSH1 "0x04" Push1 "0x04"
MOD Mod
success: false success: false
stack: "0x04" stack: "0x04"
assembler: # SMOD OP assembler: # Smod OP
title: "SMOD_1" title: "SMOD_1"
code: code:
PUSH1 "0x03" Push1 "0x03"
PUSH1 "0x04" Push1 "0x04"
SMOD Smod
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # SMOD OP assembler: # Smod OP
title: "SMOD_2" title: "SMOD_2"
code: code:
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE2" # -30 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE2" # -30
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
SMOD Smod
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC"
assembler: # SMOD OP assembler: # Smod OP
title: "SMOD_3" title: "SMOD_3"
code: code:
PUSH32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30 Push32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
SMOD Smod
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC"
assembler: # SMOD OP mal assembler: # Smod OP mal
title: "SMOD_4" title: "SMOD_4"
code: code:
PUSH32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30 Push32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30
SMOD Smod
success: false success: false
stack: "0x000000000000000000000000000000000000000000000000000000000000001E" stack: "0x000000000000000000000000000000000000000000000000000000000000001E"
# real case, EVM bug, integer over flow # real case, EVM bug, integer over flow
assembler: # SIGNEXTEND OP assembler: # SignExtend OP
title: "SIGNEXTEND_1" title: "SIGNEXTEND_1"
code: code:
PUSH32 "0x000000000000000000000000000000003f9b347132d29b62d161117bca8c7307" Push32 "0x000000000000000000000000000000003f9b347132d29b62d161117bca8c7307"
PUSH1 "0x0F" Push1 "0x0F"
SIGNEXTEND SignExtend
stack: "0x000000000000000000000000000000003f9b347132d29b62d161117bca8c7307" stack: "0x000000000000000000000000000000003f9b347132d29b62d161117bca8c7307"
assembler: assembler:
title: "BYTE with overflow pos 1" title: "Byte with overflow pos 1"
code: code:
PUSH32 "0x77676767676760000000000000001002e000000000000040000000e000000000" Push32 "0x77676767676760000000000000001002e000000000000040000000e000000000"
PUSH32 "0x0000000000000000000000000000000000000000000000010000000000000000" Push32 "0x0000000000000000000000000000000000000000000000010000000000000000"
BYTE Byte
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: assembler:
title: "BYTE with overflow pos 2" title: "Byte with overflow pos 2"
code: code:
PUSH32 "0x001f000000000000000000000000000000200000000100000000000000000000" Push32 "0x001f000000000000000000000000000000200000000100000000000000000000"
PUSH32 "0x0000000000000000000000000000000080000000000000000000000000000001" Push32 "0x0000000000000000000000000000000080000000000000000000000000000001"
BYTE Byte
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
when isMainModule: when isMainModule:

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2019-2023 Status Research & Development GmbH # Copyright (c) 2019-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -12,655 +12,655 @@ import macro_assembler, unittest2
proc opBitMain*() = proc opBitMain*() =
suite "Bitwise Opcodes": suite "Bitwise Opcodes":
assembler: # AND OP assembler: # And OP
title: "AND_1" title: "AND_1"
code: code:
PUSH1 "0x0A" Push1 "0x0A"
PUSH1 "0x0A" Push1 "0x0A"
AND And
stack: "0x000000000000000000000000000000000000000000000000000000000000000A" stack: "0x000000000000000000000000000000000000000000000000000000000000000A"
assembler: # AND OP assembler: # And OP
title: "AND_2" title: "AND_2"
code: code:
PUSH1 "0xC0" Push1 "0xC0"
PUSH1 "0x0A" Push1 "0x0A"
AND And
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # AND OP mal data assembler: # And OP mal data
title: "AND_3" title: "AND_3"
code: code:
PUSH1 "0xC0" Push1 "0xC0"
AND And
success: false success: false
stack: "0xC0" stack: "0xC0"
assembler: # OR OP assembler: # Or OP
title: "OR_1" title: "OR_1"
code: code:
PUSH1 "0xF0" Push1 "0xF0"
PUSH1 "0x0F" Push1 "0x0F"
OR Or
stack: "0x00000000000000000000000000000000000000000000000000000000000000FF" stack: "0x00000000000000000000000000000000000000000000000000000000000000FF"
assembler: # OR OP assembler: # Or OP
title: "OR_2" title: "OR_2"
code: code:
PUSH1 "0xC3" Push1 "0xC3"
PUSH1 "0x3C" Push1 "0x3C"
OR Or
stack: "0x00000000000000000000000000000000000000000000000000000000000000FF" stack: "0x00000000000000000000000000000000000000000000000000000000000000FF"
assembler: # OR OP mal data assembler: # Or OP mal data
title: "OR_3" title: "OR_3"
code: code:
PUSH1 "0xC0" Push1 "0xC0"
OR Or
success: false success: false
stack: "0xC0" stack: "0xC0"
assembler: # XOR OP assembler: # Xor OP
title: "XOR_1" title: "XOR_1"
code: code:
PUSH1 "0xFF" Push1 "0xFF"
PUSH1 "0xFF" Push1 "0xFF"
XOR Xor
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # XOR OP assembler: # Xor OP
title: "XOR_2" title: "XOR_2"
code: code:
PUSH1 "0x0F" Push1 "0x0F"
PUSH1 "0xF0" Push1 "0xF0"
XOR Xor
stack: "0x00000000000000000000000000000000000000000000000000000000000000FF" stack: "0x00000000000000000000000000000000000000000000000000000000000000FF"
assembler: # XOR OP mal data assembler: # Xor OP mal data
title: "XOR_3" title: "XOR_3"
code: code:
PUSH1 "0xC0" Push1 "0xC0"
XOR Xor
success: false success: false
stack: "0xC0" stack: "0xC0"
assembler: # BYTE OP assembler: # Byte OP
title: "BYTE_1" title: "BYTE_1"
code: code:
PUSH6 "0xAABBCCDDEEFF" Push6 "0xAABBCCDDEEFF"
PUSH1 "0x1E" Push1 "0x1E"
BYTE Byte
stack: "0x00000000000000000000000000000000000000000000000000000000000000EE" stack: "0x00000000000000000000000000000000000000000000000000000000000000EE"
assembler: # BYTE OP assembler: # Byte OP
title: "BYTE_2" title: "BYTE_2"
code: code:
PUSH6 "0xAABBCCDDEEFF" Push6 "0xAABBCCDDEEFF"
PUSH1 "0x20" Push1 "0x20"
BYTE Byte
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # BYTE OP assembler: # Byte OP
title: "BYTE_3" title: "BYTE_3"
code: code:
PUSH6 "0xAABBCCDDEE3A" Push6 "0xAABBCCDDEE3A"
PUSH1 "0x1F" Push1 "0x1F"
BYTE Byte
stack: "0x000000000000000000000000000000000000000000000000000000000000003A" stack: "0x000000000000000000000000000000000000000000000000000000000000003A"
assembler: # BYTE OP mal data assembler: # Byte OP mal data
title: "BYTE_4" title: "BYTE_4"
code: code:
PUSH6 "0xAABBCCDDEE3A" Push6 "0xAABBCCDDEE3A"
BYTE Byte
success: false success: false
stack: "0xAABBCCDDEE3A" stack: "0xAABBCCDDEE3A"
assembler: # SHL OP assembler: # Shl OP
title: "SHL_1" title: "SHL_1"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001" Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
PUSH1 "0x00" Push1 "0x00"
SHL Shl
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # SHL OP assembler: # Shl OP
title: "SHL_2" title: "SHL_2"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001" Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
PUSH1 "0x01" Push1 "0x01"
SHL Shl
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000002" stack: "0x0000000000000000000000000000000000000000000000000000000000000002"
assembler: # SHL OP assembler: # Shl OP
title: "SHL_3" title: "SHL_3"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001" Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
PUSH1 "0xff" Push1 "0xff"
SHL Shl
fork: Constantinople fork: Constantinople
stack: "0x8000000000000000000000000000000000000000000000000000000000000000" stack: "0x8000000000000000000000000000000000000000000000000000000000000000"
assembler: # SHL OP assembler: # Shl OP
title: "SHL_4" title: "SHL_4"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001" Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
PUSH2 "0x0100" Push2 "0x0100"
SHL Shl
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SHL OP assembler: # Shl OP
title: "SHL_5" title: "SHL_5"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001" Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
PUSH2 "0x0101" Push2 "0x0101"
SHL Shl
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SHL OP assembler: # Shl OP
title: "SHL_6" title: "SHL_6"
code: code:
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH1 "0x00" Push1 "0x00"
SHL Shl
fork: Constantinople fork: Constantinople
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
assembler: # SHL OP assembler: # Shl OP
title: "SHL_7" title: "SHL_7"
code: code:
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH1 "0x01" Push1 "0x01"
SHL Shl
fork: Constantinople fork: Constantinople
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"
assembler: # SHL OP assembler: # Shl OP
title: "SHL_8" title: "SHL_8"
code: code:
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH1 "0xff" Push1 "0xff"
SHL Shl
fork: Constantinople fork: Constantinople
stack: "0x8000000000000000000000000000000000000000000000000000000000000000" stack: "0x8000000000000000000000000000000000000000000000000000000000000000"
assembler: # SHL OP assembler: # Shl OP
title: "SHL_9" title: "SHL_9"
code: code:
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH2 "0x0100" Push2 "0x0100"
SHL Shl
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SHL OP assembler: # Shl OP
title: "SHL_10" title: "SHL_10"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000000" Push32 "0x0000000000000000000000000000000000000000000000000000000000000000"
PUSH1 "0x01" Push1 "0x01"
SHL Shl
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SHL OP assembler: # Shl OP
title: "SHL_11" title: "SHL_11"
code: code:
PUSH32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH1 "0x01" Push1 "0x01"
SHL Shl
fork: Constantinople fork: Constantinople
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"
assembler: # SHR OP assembler: # Shr OP
title: "SHR_1" title: "SHR_1"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001" Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
PUSH1 "0x00" Push1 "0x00"
SHR Shr
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # SHR OP assembler: # Shr OP
title: "SHR_2" title: "SHR_2"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001" Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
PUSH1 "0x01" Push1 "0x01"
SHR Shr
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SHR OP assembler: # Shr OP
title: "SHR_3" title: "SHR_3"
code: code:
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
PUSH1 "0x01" Push1 "0x01"
SHR Shr
fork: Constantinople fork: Constantinople
stack: "0x4000000000000000000000000000000000000000000000000000000000000000" stack: "0x4000000000000000000000000000000000000000000000000000000000000000"
assembler: # SHR OP assembler: # Shr OP
title: "SHR_4" title: "SHR_4"
code: code:
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
PUSH1 "0xff" Push1 "0xff"
SHR Shr
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # SHR OP assembler: # Shr OP
title: "SHR_5" title: "SHR_5"
code: code:
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
PUSH2 "0x0100" Push2 "0x0100"
SHR Shr
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SHR OP assembler: # Shr OP
title: "SHR_6" title: "SHR_6"
code: code:
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
PUSH2 "0x0101" Push2 "0x0101"
SHR Shr
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SHR OP assembler: # Shr OP
title: "SHR_7" title: "SHR_7"
code: code:
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH1 "0x00" Push1 "0x00"
SHR Shr
fork: Constantinople fork: Constantinople
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
assembler: # SHR OP assembler: # Shr OP
title: "SHR_8" title: "SHR_8"
code: code:
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH1 "0x01" Push1 "0x01"
SHR Shr
fork: Constantinople fork: Constantinople
stack: "0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" stack: "0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
assembler: # SHR OP assembler: # Shr OP
title: "SHR_9" title: "SHR_9"
code: code:
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH1 "0xff" Push1 "0xff"
SHR Shr
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # SHR OP assembler: # Shr OP
title: "SHR_10" title: "SHR_10"
code: code:
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH2 "0x0100" Push2 "0x0100"
SHR Shr
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SHR OP assembler: # Shr OP
title: "SHR_11" title: "SHR_11"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000000" Push32 "0x0000000000000000000000000000000000000000000000000000000000000000"
PUSH1 "0x01" Push1 "0x01"
SHR Shr
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_1" title: "SAR_1"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001" Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
PUSH1 "0x00" Push1 "0x00"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_2" title: "SAR_2"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001" Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
PUSH1 "0x01" Push1 "0x01"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_3" title: "SAR_3"
code: code:
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
PUSH1 "0x01" Push1 "0x01"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0xC000000000000000000000000000000000000000000000000000000000000000" stack: "0xC000000000000000000000000000000000000000000000000000000000000000"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_4" title: "SAR_4"
code: code:
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
PUSH1 "0xff" Push1 "0xff"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_5" title: "SAR_5"
code: code:
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
PUSH2 "0x0100" Push2 "0x0100"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_6" title: "SAR_6"
code: code:
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
PUSH2 "0x0101" Push2 "0x0101"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_7" title: "SAR_7"
code: code:
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH1 "0x00" Push1 "0x00"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_8" title: "SAR_8"
code: code:
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH1 "0x01" Push1 "0x01"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_9" title: "SAR_9"
code: code:
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH1 "0xff" Push1 "0xff"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_10" title: "SAR_10"
code: code:
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH2 "0x0100" Push2 "0x0100"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_11" title: "SAR_11"
code: code:
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000000" Push32 "0x0000000000000000000000000000000000000000000000000000000000000000"
PUSH1 "0x01" Push1 "0x01"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_12" title: "SAR_12"
code: code:
PUSH32 "0x4000000000000000000000000000000000000000000000000000000000000000" Push32 "0x4000000000000000000000000000000000000000000000000000000000000000"
PUSH1 "0xfe" Push1 "0xfe"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_13" title: "SAR_13"
code: code:
PUSH32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH1 "0xf8" Push1 "0xf8"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0x000000000000000000000000000000000000000000000000000000000000007F" stack: "0x000000000000000000000000000000000000000000000000000000000000007F"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_14" title: "SAR_14"
code: code:
PUSH32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH1 "0xfe" Push1 "0xfe"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_15" title: "SAR_15"
code: code:
PUSH32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH1 "0xff" Push1 "0xff"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SAR OP assembler: # Sar OP
title: "SAR_16" title: "SAR_16"
code: code:
PUSH32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
PUSH2 "0x0100" Push2 "0x0100"
SAR Sar
fork: Constantinople fork: Constantinople
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # ISZERO OP assembler: # IsZero OP
title: "ISZERO_1" title: "ISZERO_1"
code: code:
PUSH1 "0x00" Push1 "0x00"
ISZERO IsZero
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # ISZERO OP assembler: # IsZero OP
title: "ISZERO_2" title: "ISZERO_2"
code: code:
PUSH1 "0x2A" Push1 "0x2A"
ISZERO IsZero
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # ISZERO OP mal data assembler: # IsZero OP mal data
title: "ISZERO_3" title: "ISZERO_3"
code: ISZERO code: IsZero
success: false success: false
assembler: # EQ OP assembler: # Eq OP
title: "EQ_1" title: "EQ_1"
code: code:
PUSH1 "0x2A" Push1 "0x2A"
PUSH1 "0x2A" Push1 "0x2A"
EQ Eq
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # EQ OP assembler: # Eq OP
title: "EQ_2" title: "EQ_2"
code: code:
PUSH3 "0x2A3B4C" Push3 "0x2A3B4C"
PUSH3 "0x2A3B4C" Push3 "0x2A3B4C"
EQ Eq
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # EQ OP assembler: # Eq OP
title: "EQ_3" title: "EQ_3"
code: code:
PUSH3 "0x2A3B5C" Push3 "0x2A3B5C"
PUSH3 "0x2A3B4C" Push3 "0x2A3B4C"
EQ Eq
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # EQ OP mal data assembler: # Eq OP mal data
title: "EQ_4" title: "EQ_4"
code: code:
PUSH3 "0x2A3B4C" Push3 "0x2A3B4C"
EQ Eq
success: false success: false
stack: "0x2A3B4C" stack: "0x2A3B4C"
assembler: # GT OP assembler: # Gt OP
title: "GT_1" title: "GT_1"
code: code:
PUSH1 "0x01" Push1 "0x01"
PUSH1 "0x02" Push1 "0x02"
GT Gt
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # GT OP assembler: # Gt OP
title: "GT_2" title: "GT_2"
code: code:
PUSH1 "0x01" Push1 "0x01"
PUSH2 "0x0F00" Push2 "0x0F00"
GT Gt
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # GT OP assembler: # Gt OP
title: "GT_3" title: "GT_3"
code: code:
PUSH4 "0x01020304" Push4 "0x01020304"
PUSH2 "0x0F00" Push2 "0x0F00"
GT Gt
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # GT OP mal data assembler: # Gt OP mal data
title: "GT_4" title: "GT_4"
code: code:
PUSH3 "0x2A3B4C" Push3 "0x2A3B4C"
GT Gt
success: false success: false
stack: "0x2A3B4C" stack: "0x2A3B4C"
assembler: # SGT OP assembler: # Sgt OP
title: "SGT_1" title: "SGT_1"
code: code:
PUSH1 "0x01" Push1 "0x01"
PUSH1 "0x02" Push1 "0x02"
SGT Sgt
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # SGT OP assembler: # Sgt OP
title: "SGT_2" title: "SGT_2"
code: code:
PUSH32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30 Push32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
SGT Sgt
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SGT OP assembler: # Sgt OP
title: "SGT_3" title: "SGT_3"
code: code:
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF57" # -169 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF57" # -169
SGT Sgt
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # SGT OP mal assembler: # Sgt OP mal
title: "SGT_4" title: "SGT_4"
code: code:
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
SGT Sgt
success: false success: false
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56"
assembler: # LT OP assembler: # Lt OP
title: "LT_1" title: "LT_1"
code: code:
PUSH1 "0x01" Push1 "0x01"
PUSH1 "0x02" Push1 "0x02"
LT Lt
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # LT OP assembler: # Lt OP
title: "LT_2" title: "LT_2"
code: code:
PUSH1 "0x01" Push1 "0x01"
PUSH2 "0x0F00" Push2 "0x0F00"
LT Lt
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # LT OP assembler: # Lt OP
title: "LT_3" title: "LT_3"
code: code:
PUSH4 "0x01020304" Push4 "0x01020304"
PUSH2 "0x0F00" Push2 "0x0F00"
LT Lt
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # LT OP mal data assembler: # Lt OP mal data
title: "LT_4" title: "LT_4"
code: code:
PUSH3 "0x2A3B4C" Push3 "0x2A3B4C"
LT Lt
success: false success: false
stack: "0x2A3B4C" stack: "0x2A3B4C"
assembler: # SLT OP assembler: # Slt OP
title: "SLT_1" title: "SLT_1"
code: code:
PUSH1 "0x01" Push1 "0x01"
PUSH1 "0x02" Push1 "0x02"
SLT Slt
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SLT OP assembler: # Slt OP
title: "SLT_2" title: "SLT_2"
code: code:
PUSH32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30 Push32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
SLT Slt
stack: "0x0000000000000000000000000000000000000000000000000000000000000001" stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # SLT OP assembler: # Slt OP
title: "SLT_3" title: "SLT_3"
code: code:
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF57" # -169 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF57" # -169
SLT Slt
stack: "0x0000000000000000000000000000000000000000000000000000000000000000" stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # SLT OP mal assembler: # Slt OP mal
title: "SLT_4" title: "SLT_4"
code: code:
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170 Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
SLT Slt
success: false success: false
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56"
assembler: # NOT OP assembler: # Not OP
title: "NOT_1" title: "NOT_1"
code: code:
PUSH1 "0x01" Push1 "0x01"
NOT Not
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"
assembler: # NOT OP assembler: # Not OP
title: "NOT_2" title: "NOT_2"
code: code:
PUSH2 "0xA003" Push2 "0xA003"
NOT Not
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5FFC" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5FFC"
assembler: # BNOT OP assembler: # BNOT OP
title: "BNOT_4" title: "BNOT_4"
code: NOT code: Not
success: false success: false
assembler: # NOT OP assembler: # Not OP
title: "NOT_5" title: "NOT_5"
code: code:
PUSH1 "0x00" Push1 "0x00"
NOT Not
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
when isMainModule: when isMainModule:

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2019-2023 Status Research & Development GmbH # Copyright (c) 2019-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -276,7 +276,7 @@ proc opCustomMain*() =
assembler: # TIMESTAMP OP assembler: # TIMESTAMP OP
title: "TIMESTAMP_1" title: "TIMESTAMP_1"
code: code:
TimeStamp Timestamp
stack: "0x0000000000000000000000000000000000000000000000000000000000001234" stack: "0x0000000000000000000000000000000000000000000000000000000000001234"
# current block number # current block number

View File

@ -19,108 +19,108 @@ proc opEnvMain*() =
assembler: # EVM bug reported in discord assembler: # EVM bug reported in discord
title: "stack's operator [] bug" title: "stack's operator [] bug"
code: code:
PUSH1 "0x0A" Push1 "0x0A"
DUP1 Dup1
RETURNDATASIZE ReturnDataSize
MSIZE Msize
ADDRESS Address
GAS Gas
STATICCALL StaticCall
CALL Call
fork: London fork: London
success: false success: false
memory: "0x0000000000000000000000000000000000000000000000000000000000000000" memory: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # CODECOPY OP assembler: # CodeCopy OP
title: "CODECOPY_1" title: "CODECOPY_1"
code: code:
PUSH1 "0x03" # size Push1 "0x03" # size
PUSH1 "0x08" # copy start pos Push1 "0x08" # copy start pos
PUSH1 "0x00" # mem start pos Push1 "0x00" # mem start pos
CODECOPY CodeCopy
STOP Stop
SLT Slt
CALLVALUE CallValue
JUMP Jump
memory: "0x1234560000000000000000000000000000000000000000000000000000000000" memory: "0x1234560000000000000000000000000000000000000000000000000000000000"
# assertEquals(6, gas); ?? gasused: 18
assembler: # CODECOPY OP assembler: # CodeCopy OP
title: "CODECOPY_2" title: "CODECOPY_2"
code: code:
PUSH1 "0x5E" # size Push1 "0x5E" # size
PUSH1 "0x08" # copy start pos Push1 "0x08" # copy start pos
PUSH1 "0x00" # mem start pos Push1 "0x00" # mem start pos
CODECOPY CodeCopy
STOP Stop
PUSH1 "0x00" Push1 "0x00"
PUSH1 "0x5f" Push1 "0x5f"
SSTORE Sstore
PUSH1 "0x14" Push1 "0x14"
PUSH1 "0x00" Push1 "0x00"
SLOAD Sload
PUSH1 "0x1e" Push1 "0x1e"
PUSH1 "0x20" Push1 "0x20"
SLOAD Sload
PUSH4 "0xabcddcba" Push4 "0xabcddcba"
PUSH1 "0x40" Push1 "0x40"
SLOAD Sload
JUMPDEST JumpDest
MLOAD Mload
PUSH1 "0x20" Push1 "0x20"
ADD Add
PUSH1 "0x0a" Push1 "0x0a"
MSTORE Mstore
SLOAD Sload
MLOAD Mload
PUSH1 "0x40" Push1 "0x40"
ADD Add
PUSH1 "0x14" Push1 "0x14"
MSTORE Mstore
SLOAD Sload
MLOAD Mload
PUSH1 "0x60" Push1 "0x60"
ADD Add
PUSH1 "0x1e" Push1 "0x1e"
MSTORE Mstore
SLOAD Sload
MLOAD Mload
PUSH1 "0x80" Push1 "0x80"
ADD Add
PUSH1 "0x28" Push1 "0x28"
MSTORE Mstore
SLOAD Sload
PUSH1 "0xa0" Push1 "0xa0"
MSTORE Mstore
SLOAD Sload
PUSH1 "0x16" Push1 "0x16"
PUSH1 "0x48" Push1 "0x48"
PUSH1 "0x00" Push1 "0x00"
CODECOPY CodeCopy
PUSH1 "0x16" Push1 "0x16"
PUSH1 "0x00" Push1 "0x00"
CALLCODE CallCode
PUSH1 "0x00" Push1 "0x00"
PUSH1 "0x3f" Push1 "0x3f"
SSTORE Sstore
PUSH2 "0x03e7" Push2 "0x03e7"
JUMP Jump
PUSH1 "0x00" Push1 "0x00"
SLOAD Sload
PUSH1 "0x00" Push1 "0x00"
MSTORE8 Mstore8
PUSH1 "0x20" Push1 "0x20"
MUL Mul
CALLDATALOAD CallDataLoad
PUSH1 "0x20" Push1 "0x20"
SLOAD Sload
memory: memory:
"0x6000605F556014600054601E60205463ABCDDCBA6040545B51602001600A5254" "0x6000605F556014600054601E60205463ABCDDCBA6040545B51602001600A5254"
"0x516040016014525451606001601E5254516080016028525460A0525460166048" "0x516040016014525451606001601E5254516080016028525460A0525460166048"
"0x60003960166000F26000603F556103E756600054600053602002356020540000" "0x60003960166000F26000603F556103E756600054600053602002356020540000"
#assertEquals(10, gas); ?? gasUsed: 30
assembler: # CODECOPY OP assembler: # CodeCopy OP
title: "CODECOPY_3" title: "CODECOPY_3"
# cost for that: # cost for that:
# 94 - data copied # 94 - data copied
@ -130,7 +130,7 @@ proc opEnvMain*() =
Push1 "0x08" Push1 "0x08"
Push1 "0x00" Push1 "0x00"
CodeCopy CodeCopy
STOP Stop
"0x6000605f556014600054601e60205463abcddcba6040545b" "0x6000605f556014600054601e60205463abcddcba6040545b"
"0x51602001600a5254516040016014525451606001601e52545160800160285254" "0x51602001600a5254516040016014525451606001601e52545160800160285254"
"0x60a052546016604860003960166000f26000603f556103e75660005460005360" "0x60a052546016604860003960166000f26000603f556103e75660005460005360"
@ -141,14 +141,14 @@ proc opEnvMain*() =
"0x60003960166000F26000603F556103E756600054600053602002350000000000" "0x60003960166000F26000603F556103E756600054600053602002350000000000"
#assertEquals(10, program.getResult().getGasUsed()); #assertEquals(10, program.getResult().getGasUsed());
assembler: # CODECOPY OP assembler: # CodeCopy OP
title: "CODECOPY_4" title: "CODECOPY_4"
code: code:
Push1 "0x5E" Push1 "0x5E"
Push1 "0x07" Push1 "0x07"
Push1 "0x00" Push1 "0x00"
CodeCopy CodeCopy
STOP Stop
"0x6000605f556014600054601e60205463abcddcba6040545b51" "0x6000605f556014600054601e60205463abcddcba6040545b51"
"0x602001600a5254516040016014525451606001601e5254516080016028525460" "0x602001600a5254516040016014525451606001601e5254516080016028525460"
"0xa052546016604860003960166000f26000603f556103e756600054600053602002351234" "0xa052546016604860003960166000f26000603f556103e756600054600053602002351234"
@ -158,7 +158,7 @@ proc opEnvMain*() =
"0x4860003960166000F26000603F556103E7566000546000536020023512340000" "0x4860003960166000F26000603F556103E7566000546000536020023512340000"
#assertEquals(10, program.getResult().getGasUsed()); #assertEquals(10, program.getResult().getGasUsed());
assembler: # CODECOPY OP assembler: # CodeCopy OP
title: "CODECOPY_5" title: "CODECOPY_5"
code: code:
Push2 "0x1234" Push2 "0x1234"
@ -171,7 +171,7 @@ proc opEnvMain*() =
Push1 "0x00" Push1 "0x00"
Push1 "0x20" Push1 "0x20"
CodeCopy CodeCopy
STOP Stop
"0x6000605f55601460" "0x6000605f55601460"
"0x0054601e60205463abcddcba6040545b51602001600a525451604001" "0x0054601e60205463abcddcba6040545b51602001600a525451604001"
"0x6014525451606001601e5254516080016028525460a0525460166048" "0x6014525451606001601e5254516080016028525460a0525460166048"
@ -188,7 +188,7 @@ proc opEnvMain*() =
"0x601e5254516080016028525460a052546016604860003960166000f26000603f" "0x601e5254516080016028525460a052546016604860003960166000f26000603f"
"0x556103e756600054600053602002351200000000000000000000000000000000" "0x556103e756600054600053602002351200000000000000000000000000000000"
assembler: # CODECOPY OP mal assembler: # CodeCopy OP mal
title: "CODECOPY_6" title: "CODECOPY_6"
code: code:
"0x605E6007396000605f556014600054601e60205463abcddcba604054" "0x605E6007396000605f556014600054601e60205463abcddcba604054"
@ -220,7 +220,7 @@ proc opEnvMain*() =
Push1 "0x00" # mem pos Push1 "0x00" # mem pos
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73" Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
ExtCodeCopy ExtCodeCopy
STOP Stop
Slt Slt
CallValue CallValue
Jump Jump
@ -238,7 +238,7 @@ proc opEnvMain*() =
Push1 "0x00" Push1 "0x00"
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73" Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
ExtCodeCopy ExtCodeCopy
STOP Stop
"0x6000605f" "0x6000605f"
"0x556014600054601e60205463abcddcba6040545b51602001600a525451604001" "0x556014600054601e60205463abcddcba6040545b51602001600a525451604001"
"0x6014525451606001601e5254516080016028525460a052546016604860003960" "0x6014525451606001601e5254516080016028525460a052546016604860003960"
@ -258,7 +258,7 @@ proc opEnvMain*() =
Push1 "0x00" Push1 "0x00"
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73" Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
ExtCodeCopy ExtCodeCopy
STOP Stop
"0x6000605f" "0x6000605f"
"0x556014600054601e60205463abcddcba6040545b51602001600a525451604001" "0x556014600054601e60205463abcddcba6040545b51602001600a525451604001"
"0x6014525451606001601e5254516080016028525460a052546016604860003960" "0x6014525451606001601e5254516080016028525460a052546016604860003960"
@ -285,7 +285,7 @@ proc opEnvMain*() =
Push1 "0x20" Push1 "0x20"
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73" Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
ExtCodeCopy ExtCodeCopy
STOP Stop
"0x6000605f556014600054601e60205463abcddcba6040545b" "0x6000605f556014600054601e60205463abcddcba6040545b"
"0x51602001600a5254516040016014525451606001601e52545160800160285254" "0x51602001600a5254516040016014525451606001601e52545160800160285254"
"0x60a052546016604860003960166000f26000603f556103e756600054600053602002351234" "0x60a052546016604860003960166000f26000603f556103e756600054600053602002351234"
@ -330,7 +330,7 @@ proc opEnvMain*() =
code: code:
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73" Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
ExtCodeSize ExtCodeSize
STOP Stop
"0x5E60076000396000605f" "0x5E60076000396000605f"
"0x556014600054601e60205463abcddcba6040545b51602001600a525451604001" "0x556014600054601e60205463abcddcba6040545b51602001600a525451604001"
"0x6014525451606001601e5254516080016028525460a052546016604860003960" "0x6014525451606001601e5254516080016028525460a052546016604860003960"
@ -345,7 +345,7 @@ proc opEnvMain*() =
code: code:
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73" Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
ExtCodeSize ExtCodeSize
STOP Stop
stack: "0x94" stack: "0x94"
fork: Berlin fork: Berlin
gasused: 2603 gasused: 2603
@ -358,7 +358,7 @@ proc opEnvMain*() =
code: code:
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73" Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
ExtCodeHash ExtCodeHash
STOP Stop
stack: stack:
"0xc862129bffb73168481c6a51fd36afb8342887fbc5314c763ac731c732d7310c" "0xc862129bffb73168481c6a51fd36afb8342887fbc5314c763ac731c732d7310c"
fork: Berlin fork: Berlin
@ -368,7 +368,7 @@ proc opEnvMain*() =
title: "EIP-4399 PrevRandao 0" title: "EIP-4399 PrevRandao 0"
code: code:
PrevRandao PrevRandao
STOP Stop
stack: stack:
"0x0000000000000000000000000000000000000000000000000000000000000000" "0x0000000000000000000000000000000000000000000000000000000000000000"
fork: Paris fork: Paris
@ -379,7 +379,7 @@ proc opEnvMain*() =
vmState.blockCtx.prevRandao = EMPTY_UNCLE_HASH vmState.blockCtx.prevRandao = EMPTY_UNCLE_HASH
code: code:
PrevRandao PrevRandao
STOP Stop
stack: stack:
"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
fork: Paris fork: Paris
@ -387,9 +387,9 @@ proc opEnvMain*() =
assembler: assembler:
title: "EIP-4844: BlobHash 1" title: "EIP-4844: BlobHash 1"
code: code:
PUSH1 "0x01" Push1 "0x01"
BlobHash BlobHash
STOP Stop
stack: stack:
"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
fork: Cancun fork: Cancun
@ -397,9 +397,9 @@ proc opEnvMain*() =
assembler: assembler:
title: "EIP-4844: BlobHash 0" title: "EIP-4844: BlobHash 0"
code: code:
PUSH1 "0x00" Push1 "0x00"
BlobHash BlobHash
STOP Stop
stack: stack:
"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
fork: Cancun fork: Cancun
@ -407,9 +407,9 @@ proc opEnvMain*() =
assembler: assembler:
title: "EIP-4844: BlobHash 2" title: "EIP-4844: BlobHash 2"
code: code:
PUSH1 "0x02" Push1 "0x02"
BlobHash BlobHash
STOP Stop
stack: stack:
"0x0000000000000000000000000000000000000000000000000000000000000000" "0x0000000000000000000000000000000000000000000000000000000000000000"
fork: Cancun fork: Cancun
@ -417,9 +417,9 @@ proc opEnvMain*() =
assembler: assembler:
title: "EIP-4844: BlobHash 32 Bit high" title: "EIP-4844: BlobHash 32 Bit high"
code: code:
PUSH4 "0xffffffff" Push4 "0xffffffff"
BlobHash BlobHash
STOP Stop
stack: stack:
"0x0000000000000000000000000000000000000000000000000000000000000000" "0x0000000000000000000000000000000000000000000000000000000000000000"
fork: Cancun fork: Cancun
@ -427,9 +427,9 @@ proc opEnvMain*() =
assembler: assembler:
title: "EIP-4844: BlobHash 64 Bit high" title: "EIP-4844: BlobHash 64 Bit high"
code: code:
PUSH8 "0xffffffffffffffff" Push8 "0xffffffffffffffff"
BlobHash BlobHash
STOP Stop
stack: stack:
"0x0000000000000000000000000000000000000000000000000000000000000000" "0x0000000000000000000000000000000000000000000000000000000000000000"
fork: Cancun fork: Cancun
@ -437,9 +437,9 @@ proc opEnvMain*() =
assembler: assembler:
title: "EIP-4844: BlobHash 128 Bit high" title: "EIP-4844: BlobHash 128 Bit high"
code: code:
PUSH16 "0xffffffffffffffffffffffffffffffff" Push16 "0xffffffffffffffffffffffffffffffff"
BlobHash BlobHash
STOP Stop
stack: stack:
"0x0000000000000000000000000000000000000000000000000000000000000000" "0x0000000000000000000000000000000000000000000000000000000000000000"
fork: Cancun fork: Cancun
@ -447,9 +447,9 @@ proc opEnvMain*() =
assembler: assembler:
title: "EIP-4844: BlobHash 256 Bit high" title: "EIP-4844: BlobHash 256 Bit high"
code: code:
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
BlobHash BlobHash
STOP Stop
stack: stack:
"0x0000000000000000000000000000000000000000000000000000000000000000" "0x0000000000000000000000000000000000000000000000000000000000000000"
fork: Cancun fork: Cancun
@ -458,7 +458,7 @@ proc opEnvMain*() =
title: "EIP-7516: BlobBaseFee" title: "EIP-7516: BlobBaseFee"
code: code:
BlobBaseFee BlobBaseFee
STOP Stop
stack: stack:
"0x0000000000000000000000000000000000000000000000000000000000000001" "0x0000000000000000000000000000000000000000000000000000000000000001"
gasused: 2 gasused: 2

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2019-2023 Status Research & Development GmbH # Copyright (c) 2019-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -15,15 +15,15 @@ import
proc opMiscMain*() = proc opMiscMain*() =
suite "Misc Opcodes": suite "Misc Opcodes":
assembler: # LOG0 OP assembler: # Log0 OP
title: "Log0" title: "Log0"
code: code:
PUSH2 "0x1234" Push2 "0x1234"
PUSH1 "0x00" Push1 "0x00"
MSTORE Mstore
PUSH1 "0x20" Push1 "0x20"
PUSH1 "0x00" Push1 "0x00"
LOG0 Log0
memory: memory:
"0x1234" "0x1234"
logs: logs:
@ -32,16 +32,16 @@ proc opMiscMain*() =
data: "0x0000000000000000000000000000000000000000000000000000000000001234" data: "0x0000000000000000000000000000000000000000000000000000000000001234"
) )
assembler: # LOG1 OP assembler: # Log1 OP
title: "Log1" title: "Log1"
code: code:
PUSH2 "0x1234" Push2 "0x1234"
PUSH1 "0x00" Push1 "0x00"
MSTORE Mstore
PUSH2 "0x9999" Push2 "0x9999"
PUSH1 "0x20" Push1 "0x20"
PUSH1 "0x00" Push1 "0x00"
LOG1 Log1
memory: memory:
"0x1234" "0x1234"
logs: logs:
@ -51,17 +51,17 @@ proc opMiscMain*() =
data: "0x0000000000000000000000000000000000000000000000000000000000001234" data: "0x0000000000000000000000000000000000000000000000000000000000001234"
) )
assembler: # LOG2 OP assembler: # Log2 OP
title: "Log2" title: "Log2"
code: code:
PUSH2 "0x1234" Push2 "0x1234"
PUSH1 "0x00" Push1 "0x00"
MSTORE Mstore
PUSH2 "0x9999" Push2 "0x9999"
PUSH2 "0x6666" Push2 "0x6666"
PUSH1 "0x20" Push1 "0x20"
PUSH1 "0x00" Push1 "0x00"
LOG2 Log2
memory: memory:
"0x1234" "0x1234"
logs: logs:
@ -71,18 +71,18 @@ proc opMiscMain*() =
data: "0x0000000000000000000000000000000000000000000000000000000000001234" data: "0x0000000000000000000000000000000000000000000000000000000000001234"
) )
assembler: # LOG3 OP assembler: # Log3 OP
title: "Log3" title: "Log3"
code: code:
PUSH2 "0x1234" Push2 "0x1234"
PUSH1 "0x00" Push1 "0x00"
MSTORE Mstore
PUSH2 "0x9999" Push2 "0x9999"
PUSH2 "0x6666" Push2 "0x6666"
PUSH2 "0x3333" Push2 "0x3333"
PUSH1 "0x20" Push1 "0x20"
PUSH1 "0x00" Push1 "0x00"
LOG3 Log3
memory: memory:
"0x1234" "0x1234"
logs: logs:
@ -92,19 +92,19 @@ proc opMiscMain*() =
data: "0x0000000000000000000000000000000000000000000000000000000000001234" data: "0x0000000000000000000000000000000000000000000000000000000000001234"
) )
assembler: # LOG4 OP assembler: # Log4 OP
title: "Log4" title: "Log4"
code: code:
PUSH2 "0x1234" Push2 "0x1234"
PUSH1 "0x00" Push1 "0x00"
MSTORE Mstore
PUSH2 "0x9999" Push2 "0x9999"
PUSH2 "0x6666" Push2 "0x6666"
PUSH2 "0x3333" Push2 "0x3333"
PUSH2 "0x5555" Push2 "0x5555"
PUSH1 "0x20" Push1 "0x20"
PUSH1 "0x00" Push1 "0x00"
LOG4 Log4
memory: memory:
"0x1234" "0x1234"
logs: logs:
@ -114,16 +114,16 @@ proc opMiscMain*() =
data: "0x0000000000000000000000000000000000000000000000000000000000001234" data: "0x0000000000000000000000000000000000000000000000000000000000001234"
) )
assembler: # STOP OP assembler: # Stop OP
title: "STOP_1" title: "Stop_1"
code: code:
PUSH1 "0x20" Push1 "0x20"
PUSH1 "0x30" Push1 "0x30"
PUSH1 "0x10" Push1 "0x10"
PUSH1 "0x30" Push1 "0x30"
PUSH1 "0x11" Push1 "0x11"
PUSH1 "0x23" Push1 "0x23"
STOP Stop
stack: stack:
"0x20" "0x20"
"0x30" "0x30"
@ -132,53 +132,53 @@ proc opMiscMain*() =
"0x11" "0x11"
"0x23" "0x23"
assembler: # RETURN OP assembler: # Return OP
title: "RETURN_1" title: "Return_1"
code: code:
PUSH2 "0x1234" Push2 "0x1234"
PUSH1 "0x00" Push1 "0x00"
MSTORE Mstore
PUSH1 "0x20" Push1 "0x20"
PUSH1 "0x00" Push1 "0x00"
RETURN Return
memory: "0x1234" memory: "0x1234"
output: "0x0000000000000000000000000000000000000000000000000000000000001234" output: "0x0000000000000000000000000000000000000000000000000000000000001234"
assembler: # RETURN OP assembler: # Return OP
title: "RETURN_2" title: "Return_2"
code: code:
PUSH2 "0x1234" Push2 "0x1234"
PUSH1 "0x00" Push1 "0x00"
MSTORE Mstore
PUSH1 "0x20" Push1 "0x20"
PUSH1 "0x1F" Push1 "0x1F"
RETURN Return
memory: memory:
"0x1234" "0x1234"
"0x00" "0x00"
output: "0x3400000000000000000000000000000000000000000000000000000000000000" output: "0x3400000000000000000000000000000000000000000000000000000000000000"
assembler: # RETURN OP assembler: # Return OP
title: "RETURN_3" title: "Return_3"
code: code:
PUSH32 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1" Push32 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
PUSH1 "0x00" Push1 "0x00"
MSTORE Mstore
PUSH1 "0x20" Push1 "0x20"
PUSH1 "0x00" Push1 "0x00"
RETURN Return
memory: "0xa0b0c0d0e0f0a1b1c1d1e1f1a2b2c2d2e2f2a3b3c3d3e3f3a4b4c4d4e4f4a1b1" memory: "0xa0b0c0d0e0f0a1b1c1d1e1f1a2b2c2d2e2f2a3b3c3d3e3f3a4b4c4d4e4f4a1b1"
output: "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1" output: "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
assembler: # RETURN OP assembler: # Return OP
title: "RETURN_4" title: "Return_4"
code: code:
PUSH32 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1" Push32 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
PUSH1 "0x00" Push1 "0x00"
MSTORE Mstore
PUSH1 "0x20" Push1 "0x20"
PUSH1 "0x10" Push1 "0x10"
RETURN Return
output: "0xE2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B100000000000000000000000000000000" output: "0xE2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B100000000000000000000000000000000"
memory: memory:
"0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1" "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
@ -189,48 +189,48 @@ proc opMiscMain*() =
assembler: assembler:
title: "Simple routine" title: "Simple routine"
code: code:
PUSH1 "0x04" Push1 "0x04"
JUMPSUB JUMPSUB
STOP Stop
BEGINSUB BEGINSUB
RETURNSUB ReturnSUB
gasUsed: 18 gasUsed: 18
fork: berlin fork: berlin
assembler: assembler:
title: "Two levels of subroutines" title: "Two levels of subroutines"
code: code:
PUSH9 "0x00000000000000000C" Push9 "0x00000000000000000C"
JUMPSUB JUMPSUB
STOP Stop
BEGINSUB BEGINSUB
PUSH1 "0x11" Push1 "0x11"
JUMPSUB JUMPSUB
RETURNSUB ReturnSUB
BEGINSUB BEGINSUB
RETURNSUB ReturnSUB
gasUsed: 36 gasUsed: 36
fork: berlin fork: berlin
assembler: assembler:
title: "Failure 1: invalid jump" title: "Failure 1: invalid jump"
code: code:
PUSH9 "0x01000000000000000C" Push9 "0x01000000000000000C"
JUMPSUB JUMPSUB
STOP Stop
BEGINSUB BEGINSUB
PUSH1 "0x11" Push1 "0x11"
JUMPSUB JUMPSUB
RETURNSUB ReturnSUB
BEGINSUB BEGINSUB
RETURNSUB ReturnSUB
success: false success: false
fork: berlin fork: berlin
assembler: assembler:
title: "Failure 2: shallow return stack" title: "Failure 2: shallow return stack"
code: code:
RETURNSUB ReturnSUB
PC PC
PC PC
success: false success: false
@ -239,12 +239,12 @@ proc opMiscMain*() =
assembler: assembler:
title: "Subroutine at end of code" title: "Subroutine at end of code"
code: code:
PUSH1 "0x05" Push1 "0x05"
JUMP JUMP
BEGINSUB BEGINSUB
RETURNSUB ReturnSUB
JUMPDEST JUMPDEST
PUSH1 "0x03" Push1 "0x03"
JUMPSUB JUMPSUB
gasUsed: 30 gasUsed: 30
fork: berlin fork: berlin
@ -253,30 +253,30 @@ proc opMiscMain*() =
title: "Error on 'walk-into-subroutine'" title: "Error on 'walk-into-subroutine'"
code: code:
BEGINSUB BEGINSUB
RETURNSUB ReturnSUB
STOP Stop
success: false success: false
fork: berlin fork: berlin
assembler: assembler:
title: "sol test" title: "sol test"
code: code:
PUSH1 "0x02" Push1 "0x02"
PUSH1 "0x03" Push1 "0x03"
PUSH1 "0x08" # jumpdest Push1 "0x08" # jumpdest
JUMPSUB JUMPSUB
STOP Stop
# 0x08 # 0x08
BEGINSUB BEGINSUB
PUSH1 "0x0D" # jumpdest Push1 "0x0D" # jumpdest
JUMPSUB JUMPSUB
RETURNSUB ReturnSUB
# 0x0D # 0x0D
BEGINSUB BEGINSUB
MUL MUL
RETURNSUB ReturnSUB
gasUsed: 47 gasUsed: 47
fork: berlin fork: berlin
stack: stack:

View File

@ -380,7 +380,7 @@ proc snapRunner(noisy = true; specs: SnapSyncSpecs) {.used.} =
let let
tailInfo = specs.tailBlocks.splitPath.tail.replace(".txt.gz","") tailInfo = specs.tailBlocks.splitPath.tail.replace(".txt.gz","")
tailPath = specs.tailBlocks.findFilePath.value tailPath = specs.tailBlocks.findFilePath.value
allFile = "mainnet332160.txt.gz".findFilePath.value # allFile = "mainnet332160.txt.gz".findFilePath.value
pivot = specs.pivotBlock pivot = specs.pivotBlock
updateSize = specs.nItems updateSize = specs.nItems

View File

@ -98,6 +98,7 @@ proc writeResultToStdout(stateRes: seq[StateResult]) =
stdout.write(n.pretty) stdout.write(n.pretty)
stdout.write("\n") stdout.write("\n")
when false:
proc dumpAccounts(db: LedgerRef): Table[EthAddress, DumpAccount] = proc dumpAccounts(db: LedgerRef): Table[EthAddress, DumpAccount] =
for accAddr in db.addresses(): for accAddr in db.addresses():
let acc = DumpAccount( let acc = DumpAccount(
@ -112,6 +113,7 @@ proc dumpAccounts(db: LedgerRef): Table[EthAddress, DumpAccount] =
acc.storage[k] = v acc.storage[k] = v
result[accAddr] = acc result[accAddr] = acc
proc dumpState(vmState: BaseVMState): StateDump = proc dumpState(vmState: BaseVMState): StateDump =
StateDump( StateDump(
root: vmState.readOnlyStateDB.rootHash, root: vmState.readOnlyStateDB.rootHash,

View File

@ -1,5 +1,5 @@
# Nimbus # Nimbus
# Copyright (c) 2022 Status Research & Development GmbH # Copyright (c) 2022-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0) # http://www.apache.org/licenses/LICENSE-2.0)
@ -39,7 +39,7 @@ template skipTest(folder, name: untyped): bool =
skipNewGSTTests(folder, name) skipNewGSTTests(folder, name)
proc collectFileNames(inputPath: string, map: var StatusMap, fileNames: var seq[TestFile]) = proc collectFileNames(inputPath: string, map: var StatusMap, fileNames: var seq[TestFile]) =
for filename in walkDirRec(inputPath): for fileName in walkDirRec(inputPath):
if not fileName.endsWith(".json"): if not fileName.endsWith(".json"):
continue continue
@ -52,8 +52,8 @@ proc collectFileNames(inputPath: string, map: var StatusMap, fileNames: var seq[
continue continue
fileNames.add TestFile( fileNames.add TestFile(
fullPath: filename, fullPath: fileName,
dispName: substr(filename, inputPath.len+1) dispName: substr(fileName, inputPath.len+1)
) )
proc main() = proc main() =