Fix styles and reduce compiler warnings (#2086)
* Fix styles and reduce compiler warnings * Fix copyright year
This commit is contained in:
parent
49a199dbc3
commit
c41206be39
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2021-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -54,7 +54,7 @@ proc extractChainData*(n: JsonNode): ChainData =
|
|||
result.params = NetworkParams(
|
||||
genesis: parseGenesis(n),
|
||||
config : parseChainConfig(n))
|
||||
result.lastblockhash = n["lastblockhash"].getStr
|
||||
result.lastBlockHash = n["lastblockhash"].getStr
|
||||
|
||||
let blks = n["blocks"]
|
||||
for x in blks:
|
||||
|
|
|
@ -132,14 +132,14 @@ proc fillBlob(blobId: BlobID): KzgBlob =
|
|||
currentHashed = sha256.digest(currentHashed.data)
|
||||
|
||||
proc generateBlob(blobid: BlobID): BlobCommitment =
|
||||
result.blob = blobId.fillBlob()
|
||||
result.blob = blobid.fillBlob()
|
||||
let res = blobToKzgCommitment(result.blob)
|
||||
if res.isErr:
|
||||
doAssert(false, res.error)
|
||||
result.commitment = res.get
|
||||
|
||||
proc getVersionedHash*(blobid: BlobID, commitmentVersion: byte): Hash256 =
|
||||
let res = blobId.generateBlob()
|
||||
let res = blobid.generateBlob()
|
||||
result = sha256.digest(res.commitment)
|
||||
result.data[0] = commitmentVersion
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# according to those terms.
|
||||
|
||||
import
|
||||
std/[options, strutils, typetraits, random],
|
||||
std/[options, strutils, typetraits],
|
||||
stew/byteutils,
|
||||
./blobs,
|
||||
../types,
|
||||
|
@ -82,17 +82,17 @@ method getExpectedError(cust: BaseGetPayloadCustomizer): int =
|
|||
cust.expectedError
|
||||
|
||||
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)
|
||||
doAssert(version != Version.high, "cannot upgrade version " & $Version.high)
|
||||
version.succ
|
||||
|
||||
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)
|
||||
doAssert(version != Version.V1, "cannot downgrade version 1")
|
||||
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.
|
||||
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 =
|
||||
let version = procCall forkchoiceUpdatedVersion(EngineAPIVersionResolver(cust), headTimestamp, payloadAttributesTimestamp)
|
||||
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.
|
||||
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 =
|
||||
let version = procCall forkchoiceUpdatedVersion(EngineAPIVersionResolver(cust), headTimestamp, payloadAttributesTimestamp)
|
||||
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
|
||||
# stateRoot of the resulting payload should be the same.
|
||||
|
||||
proc randomizeWithdrawalsOrder(src: openArray[Withdrawal]): seq[Withdrawal] =
|
||||
result = @src
|
||||
result.shuffle
|
||||
when false:
|
||||
proc randomizeWithdrawalsOrder(src: openArray[Withdrawal]): seq[Withdrawal] =
|
||||
result = @src
|
||||
result.shuffle
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -93,7 +93,7 @@ type
|
|||
|
||||
proc collectBlobHashes(list: openArray[Web3Tx]): seq[common.Hash256] =
|
||||
for w3tx in list:
|
||||
let tx = ethTx(w3Tx)
|
||||
let tx = ethTx(w3tx)
|
||||
for h in tx.versionedHashes:
|
||||
result.add h
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ method withMainFork(cs: ForkIDSpec, fork: EngineFork): BaseSpec =
|
|||
return res
|
||||
|
||||
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:
|
||||
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
|
||||
let engine = env.addEngine()
|
||||
discard engine
|
||||
return true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -16,9 +16,9 @@ import
|
|||
|
||||
type
|
||||
ForkchoiceStateField* = enum
|
||||
HeadblockHash = "Head"
|
||||
SafeblockHash = "Safe"
|
||||
FinalizedblockHash = "Finalized"
|
||||
HeadBlockHash = "Head"
|
||||
SafeBlockHash = "Safe"
|
||||
FinalizedBlockHash = "Finalized"
|
||||
|
||||
type
|
||||
InconsistentForkchoiceTest* = ref object of EngineSpec
|
||||
|
@ -76,11 +76,11 @@ method execute(cs: InconsistentForkchoiceTest, env: TestEnv): bool =
|
|||
)
|
||||
|
||||
case cs.field
|
||||
of HeadblockHash:
|
||||
of HeadBlockHash:
|
||||
inconsistentFcU.headblockHash = shadow.alt[len(shadow.alt)-1].blockHash
|
||||
of SafeblockHash:
|
||||
of SafeBlockHash:
|
||||
inconsistentFcU.safeblockHash = shadow.alt[len(shadow.canon)-2].blockHash
|
||||
of FinalizedblockHash:
|
||||
of FinalizedBlockHash:
|
||||
inconsistentFcU.finalizedblockHash = shadow.alt[len(shadow.canon)-3].blockHash
|
||||
|
||||
let version = env.engine.version(env.clMock.latestPayloadBuilt.timestamp)
|
||||
|
@ -93,19 +93,19 @@ method execute(cs: InconsistentForkchoiceTest, env: TestEnv): bool =
|
|||
return true
|
||||
|
||||
type
|
||||
ForkchoiceUpdatedUnknownblockHashTest* = ref object of EngineSpec
|
||||
ForkchoiceUpdatedUnknownBlockHashTest* = ref object of EngineSpec
|
||||
field*: ForkchoiceStateField
|
||||
|
||||
method withMainFork(cs: ForkchoiceUpdatedUnknownblockHashTest, fork: EngineFork): BaseSpec =
|
||||
method withMainFork(cs: ForkchoiceUpdatedUnknownBlockHashTest, fork: EngineFork): BaseSpec =
|
||||
var res = cs.clone()
|
||||
res.mainFork = fork
|
||||
return res
|
||||
|
||||
method getName(cs: ForkchoiceUpdatedUnknownblockHashTest): string =
|
||||
method getName(cs: ForkchoiceUpdatedUnknownBlockHashTest): string =
|
||||
return "Unknown $1blockHash" % [$cs.field]
|
||||
|
||||
# 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
|
||||
let ok = waitFor env.clMock.waitForTTD()
|
||||
testCond ok
|
||||
|
@ -116,7 +116,7 @@ method execute(cs: ForkchoiceUpdatedUnknownblockHashTest, env: TestEnv): bool =
|
|||
# Generate a random block hash
|
||||
let randomblockHash = Web3Hash.randomBytes()
|
||||
|
||||
if cs.field == HeadblockHash:
|
||||
if cs.field == HeadBlockHash:
|
||||
let fcu = ForkchoiceStateV1(
|
||||
headblockHash: randomblockHash,
|
||||
safeblockHash: env.clMock.latestForkchoice.safeblockHash,
|
||||
|
@ -153,9 +153,9 @@ method execute(cs: ForkchoiceUpdatedUnknownblockHashTest, env: TestEnv): bool =
|
|||
finalizedblockHash: env.clMock.latestForkchoice.finalizedblockHash,
|
||||
)
|
||||
|
||||
if cs.field == SafeblockHash:
|
||||
if cs.field == SafeBlockHash:
|
||||
fcu.safeblockHash = randomblockHash
|
||||
elif cs.field == FinalizedblockHash:
|
||||
elif cs.field == FinalizedBlockHash:
|
||||
fcu.finalizedblockHash = randomblockHash
|
||||
|
||||
let version = env.engine.version(env.clMock.latestExecutedPayload.timestamp)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -230,7 +230,7 @@ method execute(cs: InvalidMissingAncestorReOrgSyncTest, env: TestEnv): bool =
|
|||
|
||||
if not cs.reOrgFromCanonical:
|
||||
# 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)
|
||||
# CommonAncestor◄─▲── P1 ◄─ P2 ◄─ P3 ◄─ ... ◄─ Pn
|
||||
|
|
|
@ -60,6 +60,8 @@ method execute(cs: InvalidPayloadTestCase, env: TestEnv): bool =
|
|||
let sec = if cs.syncing: env.addEngine()
|
||||
else: EngineEnv(nil)
|
||||
|
||||
discard sec
|
||||
|
||||
# Wait until TTD is reached by all clients
|
||||
let ok = waitFor env.clMock.waitForTTD()
|
||||
testCond ok
|
||||
|
@ -132,7 +134,7 @@ method execute(cs: InvalidPayloadTestCase, env: TestEnv): bool =
|
|||
# Depending on the field we modified, we expect a different status
|
||||
var version = env.engine.version(shadow.alteredPayload.timestamp)
|
||||
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::
|
||||
# (status: ACCEPTED, latestValidHash: null, validationError: null) if the following conditions are met:
|
||||
# - 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)
|
||||
if cs.invalidField == InvalidparentHash:
|
||||
if cs.invalidField == InvalidParentHash:
|
||||
# There is no invalid parentHash, if this value is incorrect,
|
||||
# it is assumed that the block is missing and we need to sync.
|
||||
# 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.
|
||||
# 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 s = env.engine.client.forkchoiceUpdated(version, fcState)
|
||||
# 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
|
||||
let ok = waitFor env.clMock.waitForTTD()
|
||||
testCond ok
|
||||
|
||||
# Produce blocks before starting the test
|
||||
testCond env.clMock.produceBlocks(5, BlockProcessCallbacks())
|
||||
|
|
|
@ -289,7 +289,7 @@ method execute(cs: NewPayloadOnSyncingClientTest, env: TestEnv): bool =
|
|||
recipient: EthAddress.randomBytes(),
|
||||
)
|
||||
|
||||
var sec = env.addEngine()
|
||||
discard env.addEngine()
|
||||
|
||||
# Wait until TTD is reached by all clients
|
||||
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)
|
||||
r.expectPayloadStatus(PayloadExecutionStatus.syncing)
|
||||
|
||||
pbREs = env.clMock.produceSingleBlock(BlockProcessCallbacks(
|
||||
pbRes = env.clMock.produceSingleBlock(BlockProcessCallbacks(
|
||||
onPayloadProducerSelected: proc(): bool =
|
||||
# Send at least one transaction per payload
|
||||
let tc = BaseTx(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -15,7 +15,7 @@ import
|
|||
|
||||
type
|
||||
PayloadAttributesFieldChange* = enum
|
||||
PayloadAttributesIncreasetimestamp = "Increase timestamp"
|
||||
PayloadAttributesIncreaseTimestamp = "Increase timestamp"
|
||||
PayloadAttributesRandom = "Modify Random"
|
||||
PayloadAttributesSuggestedFeeRecipient = "Modify SuggestedFeeRecipient"
|
||||
PayloadAttributesAddWithdrawal = "Add Withdrawal"
|
||||
|
@ -58,11 +58,11 @@ method execute(cs: UniquePayloadIDTest, env: TestEnv): bool =
|
|||
onPayloadAttributesGenerated: proc(): bool =
|
||||
var attr = env.clMock.latestPayloadAttributes
|
||||
case cs.fieldModification
|
||||
of PayloadAttributesIncreasetimestamp:
|
||||
of PayloadAttributesIncreaseTimestamp:
|
||||
attr.timestamp = w3Qty(attr.timestamp, 1)
|
||||
of PayloadAttributesRandom:
|
||||
attr.prevRandao = attr.prevRandao.plusOne
|
||||
of PayloadAttributesSuggestedFeerecipient:
|
||||
of PayloadAttributesSuggestedFeeRecipient:
|
||||
attr.suggestedFeeRecipient = attr.suggestedFeeRecipient.plusOne
|
||||
of PayloadAttributesAddWithdrawal:
|
||||
let newWithdrawal = WithdrawalV1()
|
||||
|
|
|
@ -428,7 +428,7 @@ method execute(cs: ReOrgBackToCanonicalTest, env: TestEnv): bool =
|
|||
var version = env.engine.version(env.clMock.latestHeader.timestamp)
|
||||
let r = env.engine.client.forkchoiceUpdated(version, env.clMock.latestForkchoice, some(attr))
|
||||
r.expectNoError()
|
||||
testcond r.get.payloadID.isSome:
|
||||
testCond r.get.payloadID.isSome:
|
||||
fatal "No payload ID returned by forkchoiceUpdated"
|
||||
|
||||
version = env.engine.version(attr.timestamp)
|
||||
|
|
|
@ -16,9 +16,9 @@ import
|
|||
type
|
||||
BlockStatusRPCcheckType* = enum
|
||||
LatestOnNewPayload = "Latest Block on NewPayload"
|
||||
LatestOnHeadblockHash = "Latest Block on HeadblockHash Update"
|
||||
SafeOnSafeblockHash = "Safe Block on SafeblockHash Update"
|
||||
FinalizedOnFinalizedblockHash = "Finalized Block on FinalizedblockHash Update"
|
||||
LatestOnHeadBlockHash = "Latest Block on HeadblockHash Update"
|
||||
SafeOnSafeBlockHash = "Safe Block on SafeblockHash Update"
|
||||
FinalizedOnFinalizedBlockHash = "Finalized Block on FinalizedblockHash Update"
|
||||
|
||||
type
|
||||
BlockStatus* = ref object of EngineSpec
|
||||
|
@ -42,9 +42,9 @@ method execute(cs: BlockStatus, env: TestEnv): bool =
|
|||
let ok = waitFor env.clMock.waitForTTD()
|
||||
testCond ok
|
||||
|
||||
if cs.checkType in [SafeOnSafeblockHash, FinalizedOnFinalizedblockHash]:
|
||||
if cs.checkType in [SafeOnSafeBlockHash, FinalizedOnFinalizedBlockHash]:
|
||||
var number = Finalized
|
||||
if cs.checkType == SafeOnSafeblockHash:
|
||||
if cs.checkType == SafeOnSafeBlockHash:
|
||||
number = Safe
|
||||
|
||||
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)
|
||||
q.expectError()
|
||||
return true
|
||||
of LatestOnHeadblockHash:
|
||||
of LatestOnHeadBlockHash:
|
||||
callbacks.onForkchoiceBroadcast = proc(): bool =
|
||||
let r = env.engine.client.namedHeader(Head)
|
||||
r.expectHash(ethHash env.clMock.latestForkchoice.headblockHash)
|
||||
let s = env.engine.client.txReceipt(shadow.txHash)
|
||||
s.expectTransactionHash(shadow.txHash)
|
||||
return true
|
||||
of SafeOnSafeblockHash:
|
||||
of SafeOnSafeBlockHash:
|
||||
callbacks.onSafeBlockChange = proc(): bool =
|
||||
let r = env.engine.client.namedHeader(Safe)
|
||||
r.expectHash(ethHash env.clMock.latestForkchoice.safeblockHash)
|
||||
return true
|
||||
of FinalizedOnFinalizedblockHash:
|
||||
of FinalizedOnFinalizedBlockHash:
|
||||
callbacks.onFinalizedBlockChange = proc(): bool =
|
||||
let r = env.engine.client.namedHeader(Finalized)
|
||||
r.expectHash(ethHash env.clMock.latestForkchoice.finalizedblockHash)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -56,7 +56,7 @@ method execute(cs: SuggestedFeeRecipientTest, env: TestEnv): bool =
|
|||
testCond env.clMock.produceSingleBlock(BlockProcessCallbacks())
|
||||
|
||||
# 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:
|
||||
error "cannot get latest header", msg=r.error
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ proc numTxsInPool*(env: EngineEnv): int =
|
|||
func version*(env: EngineEnv, time: EthTime): Version =
|
||||
if env.com.isCancunOrLater(time):
|
||||
Version.V3
|
||||
elif env.com.isShanghaiOrlater(time):
|
||||
elif env.com.isShanghaiOrLater(time):
|
||||
Version.V2
|
||||
else:
|
||||
Version.V1
|
||||
|
|
|
@ -91,11 +91,11 @@ func client*(env: TestEnv): RpcHttpClient =
|
|||
func engine*(env: TestEnv): EngineEnv =
|
||||
env.clients.first
|
||||
|
||||
func sender*(env: TesTenv): TxSender =
|
||||
func sender*(env: TestEnv): TxSender =
|
||||
env.sender
|
||||
|
||||
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 =
|
||||
doAssert(env.clMock.isNil.not)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -116,7 +116,7 @@ proc fillBalance(sender: TxSender, params: NetworkParams) =
|
|||
)
|
||||
|
||||
proc new*(_: type TxSender, params: NetworkParams): TxSender =
|
||||
result = TxSender(chainId: params.config.chainID)
|
||||
result = TxSender(chainId: params.config.chainId)
|
||||
result.createAccounts()
|
||||
result.fillBalance(params)
|
||||
|
||||
|
@ -157,10 +157,10 @@ proc makeTx(params: MakeTxParams, tc: BaseTx): Transaction =
|
|||
to : tc.recipient,
|
||||
value : tc.amount,
|
||||
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 =
|
||||
var tx = tc
|
||||
|
@ -179,7 +179,7 @@ proc makeTx(params: MakeTxParams, tc: BigInitcodeTx): Transaction =
|
|||
proc makeTx*(sender: TxSender, tc: BaseTx, nonce: AccountNonce): Transaction =
|
||||
let acc = sender.getNextAccount()
|
||||
let params = MakeTxParams(
|
||||
chainId: sender.chainID,
|
||||
chainId: sender.chainId,
|
||||
key: acc.key,
|
||||
nonce: nonce
|
||||
)
|
||||
|
@ -188,7 +188,7 @@ proc makeTx*(sender: TxSender, tc: BaseTx, nonce: AccountNonce): Transaction =
|
|||
proc makeTx*(sender: TxSender, tc: BigInitcodeTx, nonce: AccountNonce): Transaction =
|
||||
let acc = sender.getNextAccount()
|
||||
let params = MakeTxParams(
|
||||
chainId: sender.chainID,
|
||||
chainId: sender.chainId,
|
||||
key: acc.key,
|
||||
nonce: nonce
|
||||
)
|
||||
|
@ -199,7 +199,7 @@ proc makeNextTx*(sender: TxSender, tc: BaseTx): Transaction =
|
|||
acc = sender.getNextAccount()
|
||||
nonce = sender.getNextNonce(acc.address)
|
||||
params = MakeTxParams(
|
||||
chainId: sender.chainID,
|
||||
chainId: sender.chainId,
|
||||
key: acc.key,
|
||||
nonce: nonce
|
||||
)
|
||||
|
@ -219,7 +219,7 @@ proc sendTx*(sender: TxSender, client: RpcClient, tc: BaseTx, nonce: AccountNonc
|
|||
let
|
||||
acc = sender.getNextAccount()
|
||||
params = MakeTxParams(
|
||||
chainId: sender.chainID,
|
||||
chainId: sender.chainId,
|
||||
key: acc.key,
|
||||
nonce: nonce
|
||||
)
|
||||
|
@ -237,7 +237,7 @@ proc sendTx*(sender: TxSender, client: RpcClient, tc: BigInitcodeTx, nonce: Acco
|
|||
let
|
||||
acc = sender.getNextAccount()
|
||||
params = MakeTxParams(
|
||||
chainId: sender.chainID,
|
||||
chainId: sender.chainId,
|
||||
key: acc.key,
|
||||
nonce: nonce
|
||||
)
|
||||
|
@ -272,7 +272,7 @@ proc makeTx*(params: MakeTxParams, tc: BlobTx): Transaction =
|
|||
|
||||
let unsignedTx = Transaction(
|
||||
txType : TxEip4844,
|
||||
chainId : params.chainID,
|
||||
chainId : params.chainId,
|
||||
nonce : params.nonce,
|
||||
maxPriorityFee: gasTipCap,
|
||||
maxFee : gasFeeCap,
|
||||
|
@ -284,7 +284,7 @@ proc makeTx*(params: MakeTxParams, tc: BlobTx): Transaction =
|
|||
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(
|
||||
blobs : data.blobs,
|
||||
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] =
|
||||
let
|
||||
params = MakeTxParams(
|
||||
chainId: sender.chainID,
|
||||
chainId: sender.chainId,
|
||||
key: acc.key,
|
||||
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] =
|
||||
let
|
||||
params = MakeTxParams(
|
||||
chainId: sender.chainID,
|
||||
chainId: sender.chainId,
|
||||
key: acc.key,
|
||||
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 =
|
||||
let
|
||||
params = MakeTxParams(
|
||||
chainId: sender.chainID,
|
||||
chainId: sender.chainId,
|
||||
key: acc.key,
|
||||
nonce: nonce,
|
||||
)
|
||||
|
@ -370,8 +370,8 @@ proc customizeTransaction*(sender: TxSender,
|
|||
modTx.S = signature.S
|
||||
|
||||
if baseTx.txType in {TxEip1559, TxEip4844}:
|
||||
if custTx.chainID.isSome:
|
||||
modTx.chainID = custTx.chainID.get
|
||||
if custTx.chainId.isSome:
|
||||
modTx.chainId = custTx.chainId.get
|
||||
|
||||
if custTx.gasPriceOrGasFeeCap.isSome:
|
||||
modTx.maxFee = custTx.gasPriceOrGasFeeCap.get.GasInt
|
||||
|
@ -385,6 +385,6 @@ proc customizeTransaction*(sender: TxSender,
|
|||
modTx.to = some(address)
|
||||
|
||||
if custTx.signature.isNone:
|
||||
return signTransaction(modTx, acc.key, modTx.chainID, eip155 = true)
|
||||
return signTransaction(modTx, acc.key, modTx.chainId, eip155 = true)
|
||||
|
||||
return modTx
|
||||
|
|
|
@ -45,9 +45,9 @@ proc execute*(ws: BlockValueSpec, env: TestEnv): bool =
|
|||
|
||||
totalValue += txTip.uint64.u256 * rec.gasUsed.u256
|
||||
|
||||
doAssert(env.cLMock.latestBlockValue.isSome)
|
||||
testCond totalValue == env.cLMock.latestBlockValue.get:
|
||||
doAssert(env.clMock.latestBlockValue.isSome)
|
||||
testCond totalValue == env.clMock.latestBlockValue.get:
|
||||
error "Unexpected block value returned on GetPayloadV2",
|
||||
expect=totalValue,
|
||||
get=env.cLMock.latestBlockValue.get
|
||||
get=env.clMock.latestBlockValue.get
|
||||
return true
|
||||
|
|
|
@ -292,7 +292,7 @@ proc execute*(ws: ReorgSpec, env: TestEnv): bool =
|
|||
let b = env.client.latestHeader()
|
||||
testCond b.isOk
|
||||
let header = b.get
|
||||
if header.blockHash == ethHash(sidehash):
|
||||
if header.blockHash == ethHash(sideHash):
|
||||
# sync successful
|
||||
break
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2021-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||
|
@ -103,7 +103,7 @@ proc main() =
|
|||
if not fileName.endsWith(".json"):
|
||||
continue
|
||||
|
||||
let (folder, name) = fileName.splitPath()
|
||||
let (_, name) = fileName.splitPath()
|
||||
let node = parseFile(fileName)
|
||||
let status = ctx.processNode(node, fileName)
|
||||
stat.inc(name, status)
|
||||
|
|
|
@ -17,9 +17,10 @@ import
|
|||
../../../nimbus/transaction,
|
||||
./client
|
||||
|
||||
const
|
||||
# This is the account that sends vault funding transactions.
|
||||
vaultAccountAddr = hextoByteArray[20]("0xcf49fda3be353c69b41ed96333cd24302da4556f")
|
||||
when false:
|
||||
const
|
||||
# This is the account that sends vault funding transactions.
|
||||
vaultAccountAddr = hextoByteArray[20]("0xcf49fda3be353c69b41ed96333cd24302da4556f")
|
||||
|
||||
const
|
||||
# Address of the vault in genesis.
|
||||
|
|
|
@ -37,7 +37,6 @@ import
|
|||
chronicles,
|
||||
eth/common,
|
||||
results,
|
||||
stew/byteutils,
|
||||
"."/[aristo_desc, aristo_get, aristo_layers, aristo_serialise, aristo_utils]
|
||||
|
||||
type
|
||||
|
@ -56,14 +55,16 @@ logScope:
|
|||
# Private helpers
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
template logTxt(info: static[string]): static[string] =
|
||||
"Hashify " & info
|
||||
when false:
|
||||
template logTxt(info: static[string]): static[string] =
|
||||
"Hashify " & info
|
||||
|
||||
func getOrVoid(tab: Table[VertexID,VertexID]; vid: VertexID): VertexID =
|
||||
tab.getOrDefault(vid, VertexID(0))
|
||||
|
||||
func contains(wff: WidthFirstForest; vid: VertexID): bool =
|
||||
vid in wff.base or vid in wff.pool or vid in wff.root
|
||||
when false:
|
||||
func contains(wff: WidthFirstForest; vid: VertexID): bool =
|
||||
vid in wff.base or vid in wff.pool or vid in wff.root
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Private functions
|
||||
|
|
|
@ -160,7 +160,7 @@ proc insertBranch(
|
|||
|
||||
let
|
||||
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)
|
||||
linkVtx.lPfx = linkVtx.lPfx.slice(1+n)
|
||||
|
|
|
@ -59,9 +59,12 @@ type
|
|||
const
|
||||
VoidTrieID = VertexID(0)
|
||||
AccountsTrieID = VertexID(AccountsTrie)
|
||||
StorageTrieID = VertexID(StorageTrie)
|
||||
GenericTrieID = VertexID(GenericTrie)
|
||||
|
||||
when false:
|
||||
const
|
||||
StorageTrieID = VertexID(StorageTrie)
|
||||
|
||||
logScope:
|
||||
topics = "aristo-hdl"
|
||||
|
||||
|
|
|
@ -42,9 +42,6 @@ const
|
|||
extraTraceMessages = false # or true
|
||||
## Enabled additional logging noise
|
||||
|
||||
estimatedNodeSize = hexaryRangeRlpNodesListSizeMax(1)
|
||||
## Some expected upper limit for a single node
|
||||
|
||||
estimatedProofSize = hexaryRangeRlpNodesListSizeMax(10)
|
||||
## Some expected upper limit, typically not mote than 10 proof nodes
|
||||
|
||||
|
@ -58,6 +55,11 @@ const
|
|||
defaultDataSizeMax = fetchRequestBytesLimit
|
||||
## Truncate maximum data size
|
||||
|
||||
when false:
|
||||
const
|
||||
estimatedNodeSize = hexaryRangeRlpNodesListSizeMax(1)
|
||||
## Some expected upper limit for a single node
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Private functions: helpers
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2020-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2020-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -25,7 +25,6 @@ proc validateBlock(com: CommonRef, blockNumber: BlockNumber): BlockNumber =
|
|||
parent = com.db.getBlockHeader(parentNumber)
|
||||
headers = newSeq[BlockHeader](numBlocks)
|
||||
bodies = newSeq[BlockBody](numBlocks)
|
||||
lastBlockHash: Hash256
|
||||
|
||||
for i in 0 ..< numBlocks:
|
||||
headers[i] = com.db.getBlockHeader(blockNumber + i.u256)
|
||||
|
|
|
@ -57,7 +57,7 @@ proc walkAllDb(
|
|||
## Walk over all key-value pairs of the database (`RocksDB` only.)
|
||||
let
|
||||
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()
|
||||
while rit.rocksdb_iter_valid() != 0:
|
||||
|
|
|
@ -39,6 +39,7 @@ const
|
|||
numBlocks: 5500, # unconditionally load blocks
|
||||
numTxs: 10) # txs following (not in block chain)
|
||||
|
||||
when false:
|
||||
goerliCapture1: CaptureSpecs = (
|
||||
GoerliNet, goerliCapture.file, 5500, 10000)
|
||||
|
||||
|
@ -80,15 +81,16 @@ proc pp*(tx: Transaction; vmState: BaseVMState): string =
|
|||
"," & $vmState.readOnlyStateDB.getBalance(address) &
|
||||
")"
|
||||
|
||||
proc setTraceLevel =
|
||||
discard
|
||||
when defined(chronicles_runtime_filtering) and loggingEnabled:
|
||||
setLogLevel(LogLevel.TRACE)
|
||||
when false:
|
||||
proc setTraceLevel =
|
||||
discard
|
||||
when defined(chronicles_runtime_filtering) and loggingEnabled:
|
||||
setLogLevel(LogLevel.TRACE)
|
||||
|
||||
proc setErrorLevel =
|
||||
discard
|
||||
when defined(chronicles_runtime_filtering) and loggingEnabled:
|
||||
setLogLevel(LogLevel.ERROR)
|
||||
proc setErrorLevel =
|
||||
discard
|
||||
when defined(chronicles_runtime_filtering) and loggingEnabled:
|
||||
setLogLevel(LogLevel.ERROR)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Private functions
|
||||
|
|
|
@ -221,6 +221,7 @@ proc mergeData(
|
|||
let rc = db.merge(proof, root) # , noisy=noisy)
|
||||
xCheckRc rc.error == 0
|
||||
rc.value
|
||||
discard nMerged
|
||||
|
||||
let merged = db.mergeList(leafs, noisy=noisy)
|
||||
xCheck merged.error in {AristoError(0), MergeLeafPathCachedAlready}
|
||||
|
@ -328,7 +329,7 @@ proc testBackendConsistency*(
|
|||
|
||||
var
|
||||
mdbPreSave = ""
|
||||
rdbPreSave = ""
|
||||
rdbPreSave {.used.} = ""
|
||||
when true and false:
|
||||
mdbPreSave = mdb.pp() # backendOk = true)
|
||||
rdbPreSave = rdb.pp() # backendOk = true)
|
||||
|
|
|
@ -64,11 +64,11 @@ proc fifos(be: BackendRef): seq[seq[(QueueID,FilterRef)]] =
|
|||
discard
|
||||
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:
|
||||
result &= w
|
||||
|
||||
proc fList(be: BackendRef): seq[(QueueID,FilterRef)] =
|
||||
proc fList(be: BackendRef): seq[(QueueID,FilterRef)] {.used.} =
|
||||
case be.kind:
|
||||
of BackendMemory:
|
||||
return be.MemBackendRef.walkFilBe.toSeq.mapIt((it.qid, it.filter))
|
||||
|
@ -128,11 +128,12 @@ proc dump(pfx: string; dx: varargs[AristoDbRef]): string =
|
|||
if n1 < dx.len:
|
||||
result &= " ==========\n "
|
||||
|
||||
proc dump(dx: varargs[AristoDbRef]): string =
|
||||
"".dump dx
|
||||
when false:
|
||||
proc dump(dx: varargs[AristoDbRef]): string =
|
||||
"".dump dx
|
||||
|
||||
proc dump(w: DbTriplet): string =
|
||||
"db".dump(w[0], w[1], w[2])
|
||||
proc dump(w: DbTriplet): string =
|
||||
"db".dump(w[0], w[1], w[2])
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Private helpers
|
||||
|
@ -684,7 +685,7 @@ proc testFilterFifo*(
|
|||
be = db.backend
|
||||
defer: db.finish(flush=true)
|
||||
|
||||
proc show(serial = 0; exec: seq[QidAction] = @[]) =
|
||||
proc show(serial = 0; exec: seq[QidAction] = @[]) {.used.} =
|
||||
var s = ""
|
||||
if 0 < serial:
|
||||
s &= " n=" & $serial
|
||||
|
@ -755,7 +756,7 @@ proc testFilterBacklog*(
|
|||
be = db.backend
|
||||
defer: db.finish(flush=true)
|
||||
|
||||
proc show(serial = -42, blurb = "") =
|
||||
proc show(serial = -42, blurb = "") {.used.} =
|
||||
var s = blurb
|
||||
if 0 <= serial:
|
||||
s &= " n=" & $serial
|
||||
|
@ -799,7 +800,7 @@ proc testFilterBacklog*(
|
|||
var
|
||||
fifoLen = be.filters.len
|
||||
pivot = (fifoLen * reorgPercent) div 100
|
||||
qid = be.filters[pivot]
|
||||
qid {.used.} = be.filters[pivot]
|
||||
xb = AristoDbRef(nil)
|
||||
|
||||
for episode in 0 .. pivot:
|
||||
|
|
|
@ -257,7 +257,7 @@ proc delTree*(
|
|||
aristo_delete.delTree(db, root, accPath)
|
||||
|
||||
|
||||
proc merge(
|
||||
proc merge*(
|
||||
db: AristoDbRef;
|
||||
root: VertexID;
|
||||
path: openArray[byte];
|
||||
|
|
|
@ -484,6 +484,7 @@ proc testTxMergeAndDeleteSubTree*(
|
|||
let rc = db.randomisedLeafs(leafsLeft, prng)
|
||||
xCheckRc rc.error == (0,0)
|
||||
rc.value
|
||||
discard leafVidPairs
|
||||
|
||||
# === delete sub-tree ===
|
||||
block:
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
## Testing `CoreDB` wrapper implementation
|
||||
|
||||
import
|
||||
std/[os, strformat, strutils, times],
|
||||
std/[os, strformat, strutils],
|
||||
chronicles,
|
||||
eth/common,
|
||||
results,
|
||||
|
|
|
@ -125,6 +125,7 @@ proc test_chainSyncProfilingPrint*(
|
|||
let info =
|
||||
if 0 < nBlocks and nBlocks < high(int): " (" & $nBlocks & " blocks)"
|
||||
else: ""
|
||||
discard info
|
||||
var blurb: seq[string]
|
||||
when LedgerEnableApiProfiling:
|
||||
blurb.add ldgProfData.profilingPrinter(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2019-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -99,7 +99,7 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) =
|
|||
ommersHash : t.parentUncles
|
||||
)
|
||||
|
||||
let timestamp = EthTime(t.currentTimeStamp)
|
||||
let timestamp = EthTime(t.currentTimestamp)
|
||||
|
||||
let diff = calculator(revision, timestamp, p)
|
||||
check diff == t.currentDifficulty
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2019-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -13,454 +13,454 @@ import macro_assembler, unittest2
|
|||
proc opArithMain*() =
|
||||
suite "Arithmetic Opcodes":
|
||||
assembler:
|
||||
title: "ADD_1"
|
||||
title: "Add_1"
|
||||
code:
|
||||
PUSH1 "0x02"
|
||||
PUSH1 "0x02"
|
||||
ADD
|
||||
Push1 "0x02"
|
||||
Push1 "0x02"
|
||||
Add
|
||||
stack: "0x04"
|
||||
|
||||
assembler:
|
||||
title: "ADD_2"
|
||||
title: "Add_2"
|
||||
code:
|
||||
PUSH2 "0x1002"
|
||||
PUSH1 "0x02"
|
||||
ADD
|
||||
Push2 "0x1002"
|
||||
Push1 "0x02"
|
||||
Add
|
||||
stack: "0x1004"
|
||||
|
||||
assembler:
|
||||
title: "ADD_3"
|
||||
title: "Add_3"
|
||||
code:
|
||||
PUSH2 "0x1002"
|
||||
PUSH6 "0x123456789009"
|
||||
ADD
|
||||
Push2 "0x1002"
|
||||
Push6 "0x123456789009"
|
||||
Add
|
||||
stack: "0x12345678A00B"
|
||||
|
||||
assembler:
|
||||
title: "ADD_4"
|
||||
title: "Add_4"
|
||||
code:
|
||||
PUSH2 "0x1234"
|
||||
ADD
|
||||
Push2 "0x1234"
|
||||
Add
|
||||
success: false
|
||||
stack: "0x1234"
|
||||
|
||||
assembler:
|
||||
title: "ADDMOD_1"
|
||||
title: "Addmod_1"
|
||||
code:
|
||||
PUSH1 "0x02"
|
||||
PUSH1 "0x02"
|
||||
PUSH1 "0x03"
|
||||
ADDMOD
|
||||
Push1 "0x02"
|
||||
Push1 "0x02"
|
||||
Push1 "0x03"
|
||||
Addmod
|
||||
stack: "0x01"
|
||||
|
||||
assembler:
|
||||
title: "ADDMOD_2"
|
||||
title: "Addmod_2"
|
||||
code:
|
||||
PUSH2 "0x1000"
|
||||
PUSH1 "0x02"
|
||||
PUSH2 "0x1002"
|
||||
ADDMOD
|
||||
PUSH1 "0x00"
|
||||
Push2 "0x1000"
|
||||
Push1 "0x02"
|
||||
Push2 "0x1002"
|
||||
Addmod
|
||||
Push1 "0x00"
|
||||
stack:
|
||||
"0x04"
|
||||
"0x00"
|
||||
|
||||
assembler:
|
||||
title: "ADDMOD_3"
|
||||
title: "Addmod_3"
|
||||
code:
|
||||
PUSH2 "0x1002"
|
||||
PUSH6 "0x123456789009"
|
||||
PUSH1 "0x02"
|
||||
ADDMOD
|
||||
Push2 "0x1002"
|
||||
Push6 "0x123456789009"
|
||||
Push1 "0x02"
|
||||
Addmod
|
||||
stack: "0x093B"
|
||||
|
||||
assembler:
|
||||
title: "ADDMOD_4"
|
||||
title: "Addmod_4"
|
||||
code:
|
||||
PUSH2 "0x1234"
|
||||
ADDMOD
|
||||
Push2 "0x1234"
|
||||
Addmod
|
||||
stack: "0x1234"
|
||||
success: false
|
||||
|
||||
assembler:
|
||||
title: "MUL_1"
|
||||
code:
|
||||
PUSH1 "0x03"
|
||||
PUSH1 "0x02"
|
||||
MUL
|
||||
Push1 "0x03"
|
||||
Push1 "0x02"
|
||||
Mul
|
||||
stack: "0x06"
|
||||
|
||||
assembler:
|
||||
title: "MUL_2"
|
||||
code:
|
||||
PUSH3 "0x222222"
|
||||
PUSH1 "0x03"
|
||||
MUL
|
||||
Push3 "0x222222"
|
||||
Push1 "0x03"
|
||||
Mul
|
||||
stack: "0x666666"
|
||||
|
||||
assembler:
|
||||
title: "MUL_3"
|
||||
code:
|
||||
PUSH3 "0x222222"
|
||||
PUSH3 "0x333333"
|
||||
MUL
|
||||
Push3 "0x222222"
|
||||
Push3 "0x333333"
|
||||
Mul
|
||||
stack: "0x6D3A05F92C6"
|
||||
|
||||
assembler:
|
||||
title: "MUL_4"
|
||||
code:
|
||||
PUSH1 "0x01"
|
||||
MUL
|
||||
Push1 "0x01"
|
||||
Mul
|
||||
stack: "0x01"
|
||||
success: false
|
||||
|
||||
assembler: # MULMOD OP
|
||||
assembler: # Mulmod OP
|
||||
title: "MULMOD_2"
|
||||
code:
|
||||
PUSH3 "0x222222"
|
||||
PUSH1 "0x03"
|
||||
PUSH1 "0x04"
|
||||
MULMOD
|
||||
Push3 "0x222222"
|
||||
Push1 "0x03"
|
||||
Push1 "0x04"
|
||||
Mulmod
|
||||
stack: "0x000000000000000000000000000000000000000000000000000000000000000C"
|
||||
|
||||
assembler: # MULMOD OP
|
||||
assembler: # Mulmod OP
|
||||
title: "MULMOD_3"
|
||||
code:
|
||||
PUSH3 "0x222222"
|
||||
PUSH3 "0x333333"
|
||||
PUSH3 "0x444444"
|
||||
MULMOD
|
||||
Push3 "0x222222"
|
||||
Push3 "0x333333"
|
||||
Push3 "0x444444"
|
||||
Mulmod
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # MULMOD OP mal
|
||||
assembler: # Mulmod OP mal
|
||||
title: "MULMOD_4"
|
||||
code:
|
||||
PUSH1 "0x01"
|
||||
MULMOD
|
||||
Push1 "0x01"
|
||||
Mulmod
|
||||
success: false
|
||||
stack: "0x01"
|
||||
|
||||
assembler: # DIV OP
|
||||
assembler: # Div OP
|
||||
title: "DIV_1"
|
||||
code:
|
||||
PUSH1 "0x02"
|
||||
PUSH1 "0x04"
|
||||
DIV
|
||||
Push1 "0x02"
|
||||
Push1 "0x04"
|
||||
Div
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000002"
|
||||
|
||||
assembler: # DIV OP
|
||||
assembler: # Div OP
|
||||
title: "DIV_2"
|
||||
code:
|
||||
PUSH1 "0x33"
|
||||
PUSH1 "0x99"
|
||||
DIV
|
||||
Push1 "0x33"
|
||||
Push1 "0x99"
|
||||
Div
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000003"
|
||||
|
||||
assembler: # DIV OP
|
||||
assembler: # Div OP
|
||||
title: "DIV_3"
|
||||
code:
|
||||
PUSH1 "0x22"
|
||||
PUSH1 "0x99"
|
||||
DIV
|
||||
Push1 "0x22"
|
||||
Push1 "0x99"
|
||||
Div
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000004"
|
||||
|
||||
assembler: # DIV OP
|
||||
assembler: # Div OP
|
||||
title: "DIV_4"
|
||||
code:
|
||||
PUSH1 "0x15"
|
||||
PUSH1 "0x99"
|
||||
DIV
|
||||
Push1 "0x15"
|
||||
Push1 "0x99"
|
||||
Div
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000007"
|
||||
|
||||
assembler: # DIV OP
|
||||
assembler: # Div OP
|
||||
title: "DIV_5"
|
||||
code:
|
||||
PUSH1 "0x04"
|
||||
PUSH1 "0x07"
|
||||
DIV
|
||||
Push1 "0x04"
|
||||
Push1 "0x07"
|
||||
Div
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # DIV OP
|
||||
assembler: # Div OP
|
||||
title: "DIV_6"
|
||||
code:
|
||||
PUSH1 "0x07"
|
||||
DIV
|
||||
Push1 "0x07"
|
||||
Div
|
||||
success: false
|
||||
stack: "0x07"
|
||||
|
||||
assembler: # SDIV OP
|
||||
assembler: # Sdiv OP
|
||||
title: "SDIV_1"
|
||||
code:
|
||||
PUSH2 "0x03E8"
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC18"
|
||||
SDIV
|
||||
Push2 "0x03E8"
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC18"
|
||||
Sdiv
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
|
||||
assembler: # SDIV OP
|
||||
assembler: # Sdiv OP
|
||||
title: "SDIV_2"
|
||||
code:
|
||||
PUSH1 "0xFF"
|
||||
PUSH1 "0xFF"
|
||||
SDIV
|
||||
Push1 "0xFF"
|
||||
Push1 "0xFF"
|
||||
Sdiv
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # SDIV OP, SDIV by zero should be zero
|
||||
assembler: # Sdiv OP, Sdiv by zero should be zero
|
||||
title: "SDIV_3"
|
||||
code:
|
||||
PUSH1 "0x00"
|
||||
PUSH1 "0xFF"
|
||||
SDIV
|
||||
Push1 "0x00"
|
||||
Push1 "0xFF"
|
||||
Sdiv
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SDIV OP mal
|
||||
assembler: # Sdiv OP mal
|
||||
title: "SDIV_4"
|
||||
code:
|
||||
PUSH1 "0xFF"
|
||||
SDIV
|
||||
Push1 "0xFF"
|
||||
Sdiv
|
||||
success: false
|
||||
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"
|
||||
code:
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" # -1
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256)
|
||||
SDIV
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" # -1
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256)
|
||||
Sdiv
|
||||
stack: "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256)
|
||||
|
||||
assembler: # -2^255 SDIV 1 = -2^255
|
||||
assembler: # -2^255 Sdiv 1 = -2^255
|
||||
title: "SDIV_6"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001" # 1
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256)
|
||||
SDIV
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000001" # 1
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256)
|
||||
Sdiv
|
||||
stack: "0x8000000000000000000000000000000000000000000000000000000000000000" # -2^255 == low(int256)
|
||||
|
||||
assembler: # -2 SDIV 2 = -1
|
||||
assembler: # -2 Sdiv 2 = -1
|
||||
title: "SDIV_7"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000002" # 2
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2
|
||||
SDIV
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000002" # 2
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2
|
||||
Sdiv
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" # -1
|
||||
|
||||
assembler: # 4 SDIV -2 = -2
|
||||
assembler: # 4 Sdiv -2 = -2
|
||||
title: "SDIV_8"
|
||||
code:
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000004" # 4
|
||||
SDIV
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000004" # 4
|
||||
Sdiv
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2
|
||||
|
||||
assembler: # -4 SDIV 2 = -2
|
||||
assembler: # -4 Sdiv 2 = -2
|
||||
title: "SDIV_9"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000002" # -4
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC" # 2
|
||||
SDIV
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000002" # -4
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC" # 2
|
||||
Sdiv
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2
|
||||
|
||||
assembler: # -1 SDIV 2 = 0
|
||||
assembler: # -1 Sdiv 2 = 0
|
||||
title: "SDIV_10"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000002" # 2
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" # -1
|
||||
SDIV
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000002" # 2
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" # -1
|
||||
Sdiv
|
||||
stack: "0x00" # 0
|
||||
|
||||
assembler: # low(int256) SDIV low(int256) = 1
|
||||
assembler: # low(int256) Sdiv low(int256) = 1
|
||||
title: "SDIV_11"
|
||||
code:
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256)
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256)
|
||||
SDIV
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256)
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256)
|
||||
Sdiv
|
||||
stack: "0x01" # 1
|
||||
|
||||
assembler: # low(int256) SDIV 2
|
||||
assembler: # low(int256) Sdiv 2
|
||||
title: "SDIV_12"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000002" # 2
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256)
|
||||
SDIV
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000002" # 2
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256)
|
||||
Sdiv
|
||||
stack: "0xC000000000000000000000000000000000000000000000000000000000000000" # negative half low(int256)
|
||||
|
||||
assembler: # low(int256) SDIV -2
|
||||
assembler: # low(int256) Sdiv -2
|
||||
title: "SDIV_13"
|
||||
code:
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256)
|
||||
SDIV
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" # -2
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000" # low(int256)
|
||||
Sdiv
|
||||
stack: "0x4000000000000000000000000000000000000000000000000000000000000000" # positive version of SDIV_12
|
||||
|
||||
assembler:
|
||||
title: "SDIV_14"
|
||||
code:
|
||||
PUSH1 "0x01" # 1
|
||||
PUSH1 "0x7F" # 127
|
||||
SHL # 1 shl 127 (move the bit to the center or 128th position)
|
||||
Push1 "0x01" # 1
|
||||
Push1 "0x7F" # 127
|
||||
Shl # 1 shl 127 (move the bit to the center or 128th position)
|
||||
|
||||
PUSH1 "0x01" # 1
|
||||
PUSH1 "0xFF" # 255
|
||||
SHL # 1 shl 255 (create low(int256))
|
||||
Push1 "0x01" # 1
|
||||
Push1 "0xFF" # 255
|
||||
Shl # 1 shl 255 (create low(int256))
|
||||
|
||||
SDIV
|
||||
Sdiv
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000" # half of the hi bits are set
|
||||
fork: Constantinople
|
||||
|
||||
assembler: # SUB OP
|
||||
assembler: # Sub OP
|
||||
title: "SUB_1"
|
||||
code:
|
||||
PUSH1 "0x04"
|
||||
PUSH1 "0x06"
|
||||
SUB
|
||||
Push1 "0x04"
|
||||
Push1 "0x06"
|
||||
Sub
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000002"
|
||||
|
||||
assembler: # SUB OP
|
||||
assembler: # Sub OP
|
||||
title: "SUB_2"
|
||||
code:
|
||||
PUSH2 "0x4444"
|
||||
PUSH2 "0x6666"
|
||||
SUB
|
||||
Push2 "0x4444"
|
||||
Push2 "0x6666"
|
||||
Sub
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000002222"
|
||||
|
||||
assembler: # SUB OP
|
||||
assembler: # Sub OP
|
||||
title: "SUB_3"
|
||||
code:
|
||||
PUSH2 "0x4444"
|
||||
PUSH4 "0x99996666"
|
||||
SUB
|
||||
Push2 "0x4444"
|
||||
Push4 "0x99996666"
|
||||
Sub
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000099992222"
|
||||
|
||||
assembler: # SUB OP mal
|
||||
assembler: # Sub OP mal
|
||||
title: "SUB_4"
|
||||
code:
|
||||
PUSH4 "0x99996666"
|
||||
SUB
|
||||
Push4 "0x99996666"
|
||||
Sub
|
||||
success: false
|
||||
stack: "0x99996666"
|
||||
|
||||
assembler: # EXP OP
|
||||
assembler: # Exp OP
|
||||
title: "EXP_1"
|
||||
code:
|
||||
PUSH1 "0x03"
|
||||
PUSH1 "0x02"
|
||||
EXP
|
||||
Push1 "0x03"
|
||||
Push1 "0x02"
|
||||
Exp
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000008"
|
||||
#assertEquals(4, gas);
|
||||
|
||||
assembler: # EXP OP
|
||||
assembler: # Exp OP
|
||||
title: "EXP_2"
|
||||
code:
|
||||
PUSH1 "0x00"
|
||||
PUSH3 "0x123456"
|
||||
EXP
|
||||
Push1 "0x00"
|
||||
Push3 "0x123456"
|
||||
Exp
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
#assertEquals(3, gas);
|
||||
|
||||
assembler: # EXP OP
|
||||
assembler: # Exp OP
|
||||
title: "EXP_3"
|
||||
code:
|
||||
PUSH2 "0x1122"
|
||||
PUSH1 "0x01"
|
||||
EXP
|
||||
Push2 "0x1122"
|
||||
Push1 "0x01"
|
||||
Exp
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
#assertEquals(5, gas);
|
||||
|
||||
assembler: # EXP OP mal
|
||||
assembler: # Exp OP mal
|
||||
title: "EXP_4"
|
||||
code:
|
||||
PUSH3 "0x123456"
|
||||
EXP
|
||||
Push3 "0x123456"
|
||||
Exp
|
||||
success: false
|
||||
stack: "0x123456"
|
||||
|
||||
assembler: # MOD OP
|
||||
assembler: # Mod OP
|
||||
title: "MOD_1"
|
||||
code:
|
||||
PUSH1 "0x03"
|
||||
PUSH1 "0x04"
|
||||
MOD
|
||||
Push1 "0x03"
|
||||
Push1 "0x04"
|
||||
Mod
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # MOD OP
|
||||
assembler: # Mod OP
|
||||
title: "MOD_2"
|
||||
code:
|
||||
PUSH2 "0x012C"
|
||||
PUSH2 "0x01F4"
|
||||
MOD
|
||||
Push2 "0x012C"
|
||||
Push2 "0x01F4"
|
||||
Mod
|
||||
stack: "0x00000000000000000000000000000000000000000000000000000000000000C8"
|
||||
|
||||
assembler: # MOD OP
|
||||
assembler: # Mod OP
|
||||
title: "MOD_3"
|
||||
code:
|
||||
PUSH1 "0x04"
|
||||
PUSH1 "0x02"
|
||||
MOD
|
||||
Push1 "0x04"
|
||||
Push1 "0x02"
|
||||
Mod
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000002"
|
||||
|
||||
assembler: # MOD OP mal
|
||||
assembler: # Mod OP mal
|
||||
title: "MOD_4"
|
||||
code:
|
||||
PUSH1 "0x04"
|
||||
MOD
|
||||
Push1 "0x04"
|
||||
Mod
|
||||
success: false
|
||||
stack: "0x04"
|
||||
|
||||
assembler: # SMOD OP
|
||||
assembler: # Smod OP
|
||||
title: "SMOD_1"
|
||||
code:
|
||||
PUSH1 "0x03"
|
||||
PUSH1 "0x04"
|
||||
SMOD
|
||||
Push1 "0x03"
|
||||
Push1 "0x04"
|
||||
Smod
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # SMOD OP
|
||||
assembler: # Smod OP
|
||||
title: "SMOD_2"
|
||||
code:
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE2" # -30
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
SMOD
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE2" # -30
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
Smod
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC"
|
||||
|
||||
assembler: # SMOD OP
|
||||
assembler: # Smod OP
|
||||
title: "SMOD_3"
|
||||
code:
|
||||
PUSH32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
SMOD
|
||||
Push32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
Smod
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC"
|
||||
|
||||
assembler: # SMOD OP mal
|
||||
assembler: # Smod OP mal
|
||||
title: "SMOD_4"
|
||||
code:
|
||||
PUSH32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30
|
||||
SMOD
|
||||
Push32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30
|
||||
Smod
|
||||
success: false
|
||||
stack: "0x000000000000000000000000000000000000000000000000000000000000001E"
|
||||
|
||||
# real case, EVM bug, integer over flow
|
||||
assembler: # SIGNEXTEND OP
|
||||
assembler: # SignExtend OP
|
||||
title: "SIGNEXTEND_1"
|
||||
code:
|
||||
PUSH32 "0x000000000000000000000000000000003f9b347132d29b62d161117bca8c7307"
|
||||
PUSH1 "0x0F"
|
||||
SIGNEXTEND
|
||||
Push32 "0x000000000000000000000000000000003f9b347132d29b62d161117bca8c7307"
|
||||
Push1 "0x0F"
|
||||
SignExtend
|
||||
stack: "0x000000000000000000000000000000003f9b347132d29b62d161117bca8c7307"
|
||||
|
||||
assembler:
|
||||
title: "BYTE with overflow pos 1"
|
||||
title: "Byte with overflow pos 1"
|
||||
code:
|
||||
PUSH32 "0x77676767676760000000000000001002e000000000000040000000e000000000"
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000010000000000000000"
|
||||
BYTE
|
||||
Push32 "0x77676767676760000000000000001002e000000000000040000000e000000000"
|
||||
Push32 "0x0000000000000000000000000000000000000000000000010000000000000000"
|
||||
Byte
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler:
|
||||
title: "BYTE with overflow pos 2"
|
||||
title: "Byte with overflow pos 2"
|
||||
code:
|
||||
PUSH32 "0x001f000000000000000000000000000000200000000100000000000000000000"
|
||||
PUSH32 "0x0000000000000000000000000000000080000000000000000000000000000001"
|
||||
BYTE
|
||||
Push32 "0x001f000000000000000000000000000000200000000100000000000000000000"
|
||||
Push32 "0x0000000000000000000000000000000080000000000000000000000000000001"
|
||||
Byte
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
when isMainModule:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2019-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -12,655 +12,655 @@ import macro_assembler, unittest2
|
|||
|
||||
proc opBitMain*() =
|
||||
suite "Bitwise Opcodes":
|
||||
assembler: # AND OP
|
||||
assembler: # And OP
|
||||
title: "AND_1"
|
||||
code:
|
||||
PUSH1 "0x0A"
|
||||
PUSH1 "0x0A"
|
||||
AND
|
||||
Push1 "0x0A"
|
||||
Push1 "0x0A"
|
||||
And
|
||||
stack: "0x000000000000000000000000000000000000000000000000000000000000000A"
|
||||
|
||||
assembler: # AND OP
|
||||
assembler: # And OP
|
||||
title: "AND_2"
|
||||
code:
|
||||
PUSH1 "0xC0"
|
||||
PUSH1 "0x0A"
|
||||
AND
|
||||
Push1 "0xC0"
|
||||
Push1 "0x0A"
|
||||
And
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # AND OP mal data
|
||||
assembler: # And OP mal data
|
||||
title: "AND_3"
|
||||
code:
|
||||
PUSH1 "0xC0"
|
||||
AND
|
||||
Push1 "0xC0"
|
||||
And
|
||||
success: false
|
||||
stack: "0xC0"
|
||||
|
||||
assembler: # OR OP
|
||||
assembler: # Or OP
|
||||
title: "OR_1"
|
||||
code:
|
||||
PUSH1 "0xF0"
|
||||
PUSH1 "0x0F"
|
||||
OR
|
||||
Push1 "0xF0"
|
||||
Push1 "0x0F"
|
||||
Or
|
||||
stack: "0x00000000000000000000000000000000000000000000000000000000000000FF"
|
||||
|
||||
assembler: # OR OP
|
||||
assembler: # Or OP
|
||||
title: "OR_2"
|
||||
code:
|
||||
PUSH1 "0xC3"
|
||||
PUSH1 "0x3C"
|
||||
OR
|
||||
Push1 "0xC3"
|
||||
Push1 "0x3C"
|
||||
Or
|
||||
stack: "0x00000000000000000000000000000000000000000000000000000000000000FF"
|
||||
|
||||
assembler: # OR OP mal data
|
||||
assembler: # Or OP mal data
|
||||
title: "OR_3"
|
||||
code:
|
||||
PUSH1 "0xC0"
|
||||
OR
|
||||
Push1 "0xC0"
|
||||
Or
|
||||
success: false
|
||||
stack: "0xC0"
|
||||
|
||||
assembler: # XOR OP
|
||||
assembler: # Xor OP
|
||||
title: "XOR_1"
|
||||
code:
|
||||
PUSH1 "0xFF"
|
||||
PUSH1 "0xFF"
|
||||
XOR
|
||||
Push1 "0xFF"
|
||||
Push1 "0xFF"
|
||||
Xor
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # XOR OP
|
||||
assembler: # Xor OP
|
||||
title: "XOR_2"
|
||||
code:
|
||||
PUSH1 "0x0F"
|
||||
PUSH1 "0xF0"
|
||||
XOR
|
||||
Push1 "0x0F"
|
||||
Push1 "0xF0"
|
||||
Xor
|
||||
stack: "0x00000000000000000000000000000000000000000000000000000000000000FF"
|
||||
|
||||
assembler: # XOR OP mal data
|
||||
assembler: # Xor OP mal data
|
||||
title: "XOR_3"
|
||||
code:
|
||||
PUSH1 "0xC0"
|
||||
XOR
|
||||
Push1 "0xC0"
|
||||
Xor
|
||||
success: false
|
||||
stack: "0xC0"
|
||||
|
||||
assembler: # BYTE OP
|
||||
assembler: # Byte OP
|
||||
title: "BYTE_1"
|
||||
code:
|
||||
PUSH6 "0xAABBCCDDEEFF"
|
||||
PUSH1 "0x1E"
|
||||
BYTE
|
||||
Push6 "0xAABBCCDDEEFF"
|
||||
Push1 "0x1E"
|
||||
Byte
|
||||
stack: "0x00000000000000000000000000000000000000000000000000000000000000EE"
|
||||
|
||||
assembler: # BYTE OP
|
||||
assembler: # Byte OP
|
||||
title: "BYTE_2"
|
||||
code:
|
||||
PUSH6 "0xAABBCCDDEEFF"
|
||||
PUSH1 "0x20"
|
||||
BYTE
|
||||
Push6 "0xAABBCCDDEEFF"
|
||||
Push1 "0x20"
|
||||
Byte
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # BYTE OP
|
||||
assembler: # Byte OP
|
||||
title: "BYTE_3"
|
||||
code:
|
||||
PUSH6 "0xAABBCCDDEE3A"
|
||||
PUSH1 "0x1F"
|
||||
BYTE
|
||||
Push6 "0xAABBCCDDEE3A"
|
||||
Push1 "0x1F"
|
||||
Byte
|
||||
stack: "0x000000000000000000000000000000000000000000000000000000000000003A"
|
||||
|
||||
assembler: # BYTE OP mal data
|
||||
assembler: # Byte OP mal data
|
||||
title: "BYTE_4"
|
||||
code:
|
||||
PUSH6 "0xAABBCCDDEE3A"
|
||||
BYTE
|
||||
Push6 "0xAABBCCDDEE3A"
|
||||
Byte
|
||||
success: false
|
||||
stack: "0xAABBCCDDEE3A"
|
||||
|
||||
assembler: # SHL OP
|
||||
assembler: # Shl OP
|
||||
title: "SHL_1"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
PUSH1 "0x00"
|
||||
SHL
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
Push1 "0x00"
|
||||
Shl
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # SHL OP
|
||||
assembler: # Shl OP
|
||||
title: "SHL_2"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
PUSH1 "0x01"
|
||||
SHL
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
Push1 "0x01"
|
||||
Shl
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000002"
|
||||
|
||||
assembler: # SHL OP
|
||||
assembler: # Shl OP
|
||||
title: "SHL_3"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
PUSH1 "0xff"
|
||||
SHL
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
Push1 "0xff"
|
||||
Shl
|
||||
fork: Constantinople
|
||||
stack: "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SHL OP
|
||||
assembler: # Shl OP
|
||||
title: "SHL_4"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
PUSH2 "0x0100"
|
||||
SHL
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
Push2 "0x0100"
|
||||
Shl
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SHL OP
|
||||
assembler: # Shl OP
|
||||
title: "SHL_5"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
PUSH2 "0x0101"
|
||||
SHL
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
Push2 "0x0101"
|
||||
Shl
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SHL OP
|
||||
assembler: # Shl OP
|
||||
title: "SHL_6"
|
||||
code:
|
||||
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH1 "0x00"
|
||||
SHL
|
||||
Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push1 "0x00"
|
||||
Shl
|
||||
fork: Constantinople
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
|
||||
assembler: # SHL OP
|
||||
assembler: # Shl OP
|
||||
title: "SHL_7"
|
||||
code:
|
||||
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH1 "0x01"
|
||||
SHL
|
||||
Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push1 "0x01"
|
||||
Shl
|
||||
fork: Constantinople
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"
|
||||
|
||||
assembler: # SHL OP
|
||||
assembler: # Shl OP
|
||||
title: "SHL_8"
|
||||
code:
|
||||
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH1 "0xff"
|
||||
SHL
|
||||
Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push1 "0xff"
|
||||
Shl
|
||||
fork: Constantinople
|
||||
stack: "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SHL OP
|
||||
assembler: # Shl OP
|
||||
title: "SHL_9"
|
||||
code:
|
||||
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH2 "0x0100"
|
||||
SHL
|
||||
Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push2 "0x0100"
|
||||
Shl
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SHL OP
|
||||
assembler: # Shl OP
|
||||
title: "SHL_10"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
PUSH1 "0x01"
|
||||
SHL
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
Push1 "0x01"
|
||||
Shl
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SHL OP
|
||||
assembler: # Shl OP
|
||||
title: "SHL_11"
|
||||
code:
|
||||
PUSH32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH1 "0x01"
|
||||
SHL
|
||||
Push32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push1 "0x01"
|
||||
Shl
|
||||
fork: Constantinople
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"
|
||||
|
||||
assembler: # SHR OP
|
||||
assembler: # Shr OP
|
||||
title: "SHR_1"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
PUSH1 "0x00"
|
||||
SHR
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
Push1 "0x00"
|
||||
Shr
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # SHR OP
|
||||
assembler: # Shr OP
|
||||
title: "SHR_2"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
PUSH1 "0x01"
|
||||
SHR
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
Push1 "0x01"
|
||||
Shr
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SHR OP
|
||||
assembler: # Shr OP
|
||||
title: "SHR_3"
|
||||
code:
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
PUSH1 "0x01"
|
||||
SHR
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
Push1 "0x01"
|
||||
Shr
|
||||
fork: Constantinople
|
||||
stack: "0x4000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SHR OP
|
||||
assembler: # Shr OP
|
||||
title: "SHR_4"
|
||||
code:
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
PUSH1 "0xff"
|
||||
SHR
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
Push1 "0xff"
|
||||
Shr
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # SHR OP
|
||||
assembler: # Shr OP
|
||||
title: "SHR_5"
|
||||
code:
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
PUSH2 "0x0100"
|
||||
SHR
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
Push2 "0x0100"
|
||||
Shr
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SHR OP
|
||||
assembler: # Shr OP
|
||||
title: "SHR_6"
|
||||
code:
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
PUSH2 "0x0101"
|
||||
SHR
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
Push2 "0x0101"
|
||||
Shr
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SHR OP
|
||||
assembler: # Shr OP
|
||||
title: "SHR_7"
|
||||
code:
|
||||
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH1 "0x00"
|
||||
SHR
|
||||
Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push1 "0x00"
|
||||
Shr
|
||||
fork: Constantinople
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
|
||||
assembler: # SHR OP
|
||||
assembler: # Shr OP
|
||||
title: "SHR_8"
|
||||
code:
|
||||
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH1 "0x01"
|
||||
SHR
|
||||
Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push1 "0x01"
|
||||
Shr
|
||||
fork: Constantinople
|
||||
stack: "0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
|
||||
assembler: # SHR OP
|
||||
assembler: # Shr OP
|
||||
title: "SHR_9"
|
||||
code:
|
||||
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH1 "0xff"
|
||||
SHR
|
||||
Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push1 "0xff"
|
||||
Shr
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # SHR OP
|
||||
assembler: # Shr OP
|
||||
title: "SHR_10"
|
||||
code:
|
||||
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH2 "0x0100"
|
||||
SHR
|
||||
Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push2 "0x0100"
|
||||
Shr
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SHR OP
|
||||
assembler: # Shr OP
|
||||
title: "SHR_11"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
PUSH1 "0x01"
|
||||
SHR
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
Push1 "0x01"
|
||||
Shr
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_1"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
PUSH1 "0x00"
|
||||
SAR
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
Push1 "0x00"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_2"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
PUSH1 "0x01"
|
||||
SAR
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
Push1 "0x01"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_3"
|
||||
code:
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
PUSH1 "0x01"
|
||||
SAR
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
Push1 "0x01"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0xC000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_4"
|
||||
code:
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
PUSH1 "0xff"
|
||||
SAR
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
Push1 "0xff"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_5"
|
||||
code:
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
PUSH2 "0x0100"
|
||||
SAR
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
Push2 "0x0100"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_6"
|
||||
code:
|
||||
PUSH32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
PUSH2 "0x0101"
|
||||
SAR
|
||||
Push32 "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
Push2 "0x0101"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_7"
|
||||
code:
|
||||
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH1 "0x00"
|
||||
SAR
|
||||
Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push1 "0x00"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_8"
|
||||
code:
|
||||
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH1 "0x01"
|
||||
SAR
|
||||
Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push1 "0x01"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_9"
|
||||
code:
|
||||
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH1 "0xff"
|
||||
SAR
|
||||
Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push1 "0xff"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_10"
|
||||
code:
|
||||
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH2 "0x0100"
|
||||
SAR
|
||||
Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push2 "0x0100"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_11"
|
||||
code:
|
||||
PUSH32 "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
PUSH1 "0x01"
|
||||
SAR
|
||||
Push32 "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
Push1 "0x01"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_12"
|
||||
code:
|
||||
PUSH32 "0x4000000000000000000000000000000000000000000000000000000000000000"
|
||||
PUSH1 "0xfe"
|
||||
SAR
|
||||
Push32 "0x4000000000000000000000000000000000000000000000000000000000000000"
|
||||
Push1 "0xfe"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_13"
|
||||
code:
|
||||
PUSH32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH1 "0xf8"
|
||||
SAR
|
||||
Push32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push1 "0xf8"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0x000000000000000000000000000000000000000000000000000000000000007F"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_14"
|
||||
code:
|
||||
PUSH32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH1 "0xfe"
|
||||
SAR
|
||||
Push32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push1 "0xfe"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_15"
|
||||
code:
|
||||
PUSH32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH1 "0xff"
|
||||
SAR
|
||||
Push32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push1 "0xff"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SAR OP
|
||||
assembler: # Sar OP
|
||||
title: "SAR_16"
|
||||
code:
|
||||
PUSH32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
PUSH2 "0x0100"
|
||||
SAR
|
||||
Push32 "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push2 "0x0100"
|
||||
Sar
|
||||
fork: Constantinople
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # ISZERO OP
|
||||
assembler: # IsZero OP
|
||||
title: "ISZERO_1"
|
||||
code:
|
||||
PUSH1 "0x00"
|
||||
ISZERO
|
||||
Push1 "0x00"
|
||||
IsZero
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # ISZERO OP
|
||||
assembler: # IsZero OP
|
||||
title: "ISZERO_2"
|
||||
code:
|
||||
PUSH1 "0x2A"
|
||||
ISZERO
|
||||
Push1 "0x2A"
|
||||
IsZero
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # ISZERO OP mal data
|
||||
assembler: # IsZero OP mal data
|
||||
title: "ISZERO_3"
|
||||
code: ISZERO
|
||||
code: IsZero
|
||||
success: false
|
||||
|
||||
assembler: # EQ OP
|
||||
assembler: # Eq OP
|
||||
title: "EQ_1"
|
||||
code:
|
||||
PUSH1 "0x2A"
|
||||
PUSH1 "0x2A"
|
||||
EQ
|
||||
Push1 "0x2A"
|
||||
Push1 "0x2A"
|
||||
Eq
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # EQ OP
|
||||
assembler: # Eq OP
|
||||
title: "EQ_2"
|
||||
code:
|
||||
PUSH3 "0x2A3B4C"
|
||||
PUSH3 "0x2A3B4C"
|
||||
EQ
|
||||
Push3 "0x2A3B4C"
|
||||
Push3 "0x2A3B4C"
|
||||
Eq
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # EQ OP
|
||||
assembler: # Eq OP
|
||||
title: "EQ_3"
|
||||
code:
|
||||
PUSH3 "0x2A3B5C"
|
||||
PUSH3 "0x2A3B4C"
|
||||
EQ
|
||||
Push3 "0x2A3B5C"
|
||||
Push3 "0x2A3B4C"
|
||||
Eq
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # EQ OP mal data
|
||||
assembler: # Eq OP mal data
|
||||
title: "EQ_4"
|
||||
code:
|
||||
PUSH3 "0x2A3B4C"
|
||||
EQ
|
||||
Push3 "0x2A3B4C"
|
||||
Eq
|
||||
success: false
|
||||
stack: "0x2A3B4C"
|
||||
|
||||
assembler: # GT OP
|
||||
assembler: # Gt OP
|
||||
title: "GT_1"
|
||||
code:
|
||||
PUSH1 "0x01"
|
||||
PUSH1 "0x02"
|
||||
GT
|
||||
Push1 "0x01"
|
||||
Push1 "0x02"
|
||||
Gt
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # GT OP
|
||||
assembler: # Gt OP
|
||||
title: "GT_2"
|
||||
code:
|
||||
PUSH1 "0x01"
|
||||
PUSH2 "0x0F00"
|
||||
GT
|
||||
Push1 "0x01"
|
||||
Push2 "0x0F00"
|
||||
Gt
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # GT OP
|
||||
assembler: # Gt OP
|
||||
title: "GT_3"
|
||||
code:
|
||||
PUSH4 "0x01020304"
|
||||
PUSH2 "0x0F00"
|
||||
GT
|
||||
Push4 "0x01020304"
|
||||
Push2 "0x0F00"
|
||||
Gt
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # GT OP mal data
|
||||
assembler: # Gt OP mal data
|
||||
title: "GT_4"
|
||||
code:
|
||||
PUSH3 "0x2A3B4C"
|
||||
GT
|
||||
Push3 "0x2A3B4C"
|
||||
Gt
|
||||
success: false
|
||||
stack: "0x2A3B4C"
|
||||
|
||||
assembler: # SGT OP
|
||||
assembler: # Sgt OP
|
||||
title: "SGT_1"
|
||||
code:
|
||||
PUSH1 "0x01"
|
||||
PUSH1 "0x02"
|
||||
SGT
|
||||
Push1 "0x01"
|
||||
Push1 "0x02"
|
||||
Sgt
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # SGT OP
|
||||
assembler: # Sgt OP
|
||||
title: "SGT_2"
|
||||
code:
|
||||
PUSH32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
SGT
|
||||
Push32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
Sgt
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SGT OP
|
||||
assembler: # Sgt OP
|
||||
title: "SGT_3"
|
||||
code:
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF57" # -169
|
||||
SGT
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF57" # -169
|
||||
Sgt
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # SGT OP mal
|
||||
assembler: # Sgt OP mal
|
||||
title: "SGT_4"
|
||||
code:
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
SGT
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
Sgt
|
||||
success: false
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56"
|
||||
|
||||
assembler: # LT OP
|
||||
assembler: # Lt OP
|
||||
title: "LT_1"
|
||||
code:
|
||||
PUSH1 "0x01"
|
||||
PUSH1 "0x02"
|
||||
LT
|
||||
Push1 "0x01"
|
||||
Push1 "0x02"
|
||||
Lt
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # LT OP
|
||||
assembler: # Lt OP
|
||||
title: "LT_2"
|
||||
code:
|
||||
PUSH1 "0x01"
|
||||
PUSH2 "0x0F00"
|
||||
LT
|
||||
Push1 "0x01"
|
||||
Push2 "0x0F00"
|
||||
Lt
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # LT OP
|
||||
assembler: # Lt OP
|
||||
title: "LT_3"
|
||||
code:
|
||||
PUSH4 "0x01020304"
|
||||
PUSH2 "0x0F00"
|
||||
LT
|
||||
Push4 "0x01020304"
|
||||
Push2 "0x0F00"
|
||||
Lt
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # LT OP mal data
|
||||
assembler: # Lt OP mal data
|
||||
title: "LT_4"
|
||||
code:
|
||||
PUSH3 "0x2A3B4C"
|
||||
LT
|
||||
Push3 "0x2A3B4C"
|
||||
Lt
|
||||
success: false
|
||||
stack: "0x2A3B4C"
|
||||
|
||||
assembler: # SLT OP
|
||||
assembler: # Slt OP
|
||||
title: "SLT_1"
|
||||
code:
|
||||
PUSH1 "0x01"
|
||||
PUSH1 "0x02"
|
||||
SLT
|
||||
Push1 "0x01"
|
||||
Push1 "0x02"
|
||||
Slt
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SLT OP
|
||||
assembler: # Slt OP
|
||||
title: "SLT_2"
|
||||
code:
|
||||
PUSH32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
SLT
|
||||
Push32 "0x000000000000000000000000000000000000000000000000000000000000001E" # 30
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
Slt
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
|
||||
assembler: # SLT OP
|
||||
assembler: # Slt OP
|
||||
title: "SLT_3"
|
||||
code:
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF57" # -169
|
||||
SLT
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF57" # -169
|
||||
Slt
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # SLT OP mal
|
||||
assembler: # Slt OP mal
|
||||
title: "SLT_4"
|
||||
code:
|
||||
PUSH32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
SLT
|
||||
Push32 "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56" # -170
|
||||
Slt
|
||||
success: false
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56"
|
||||
|
||||
assembler: # NOT OP
|
||||
assembler: # Not OP
|
||||
title: "NOT_1"
|
||||
code:
|
||||
PUSH1 "0x01"
|
||||
NOT
|
||||
Push1 "0x01"
|
||||
Not
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"
|
||||
|
||||
assembler: # NOT OP
|
||||
assembler: # Not OP
|
||||
title: "NOT_2"
|
||||
code:
|
||||
PUSH2 "0xA003"
|
||||
NOT
|
||||
Push2 "0xA003"
|
||||
Not
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5FFC"
|
||||
|
||||
assembler: # BNOT OP
|
||||
title: "BNOT_4"
|
||||
code: NOT
|
||||
code: Not
|
||||
success: false
|
||||
|
||||
assembler: # NOT OP
|
||||
assembler: # Not OP
|
||||
title: "NOT_5"
|
||||
code:
|
||||
PUSH1 "0x00"
|
||||
NOT
|
||||
Push1 "0x00"
|
||||
Not
|
||||
stack: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
|
||||
when isMainModule:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2019-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -276,7 +276,7 @@ proc opCustomMain*() =
|
|||
assembler: # TIMESTAMP OP
|
||||
title: "TIMESTAMP_1"
|
||||
code:
|
||||
TimeStamp
|
||||
Timestamp
|
||||
stack: "0x0000000000000000000000000000000000000000000000000000000000001234"
|
||||
|
||||
# current block number
|
||||
|
|
|
@ -19,108 +19,108 @@ proc opEnvMain*() =
|
|||
assembler: # EVM bug reported in discord
|
||||
title: "stack's operator [] bug"
|
||||
code:
|
||||
PUSH1 "0x0A"
|
||||
DUP1
|
||||
RETURNDATASIZE
|
||||
MSIZE
|
||||
ADDRESS
|
||||
GAS
|
||||
STATICCALL
|
||||
CALL
|
||||
Push1 "0x0A"
|
||||
Dup1
|
||||
ReturnDataSize
|
||||
Msize
|
||||
Address
|
||||
Gas
|
||||
StaticCall
|
||||
Call
|
||||
fork: London
|
||||
success: false
|
||||
memory: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # CODECOPY OP
|
||||
assembler: # CodeCopy OP
|
||||
title: "CODECOPY_1"
|
||||
code:
|
||||
PUSH1 "0x03" # size
|
||||
PUSH1 "0x08" # copy start pos
|
||||
PUSH1 "0x00" # mem start pos
|
||||
CODECOPY
|
||||
STOP
|
||||
SLT
|
||||
CALLVALUE
|
||||
JUMP
|
||||
Push1 "0x03" # size
|
||||
Push1 "0x08" # copy start pos
|
||||
Push1 "0x00" # mem start pos
|
||||
CodeCopy
|
||||
Stop
|
||||
Slt
|
||||
CallValue
|
||||
Jump
|
||||
memory: "0x1234560000000000000000000000000000000000000000000000000000000000"
|
||||
# assertEquals(6, gas); ??
|
||||
gasused: 18
|
||||
|
||||
assembler: # CODECOPY OP
|
||||
assembler: # CodeCopy OP
|
||||
title: "CODECOPY_2"
|
||||
code:
|
||||
PUSH1 "0x5E" # size
|
||||
PUSH1 "0x08" # copy start pos
|
||||
PUSH1 "0x00" # mem start pos
|
||||
CODECOPY
|
||||
STOP
|
||||
PUSH1 "0x00"
|
||||
PUSH1 "0x5f"
|
||||
SSTORE
|
||||
PUSH1 "0x14"
|
||||
PUSH1 "0x00"
|
||||
SLOAD
|
||||
PUSH1 "0x1e"
|
||||
PUSH1 "0x20"
|
||||
SLOAD
|
||||
PUSH4 "0xabcddcba"
|
||||
PUSH1 "0x40"
|
||||
SLOAD
|
||||
JUMPDEST
|
||||
MLOAD
|
||||
PUSH1 "0x20"
|
||||
ADD
|
||||
PUSH1 "0x0a"
|
||||
MSTORE
|
||||
SLOAD
|
||||
MLOAD
|
||||
PUSH1 "0x40"
|
||||
ADD
|
||||
PUSH1 "0x14"
|
||||
MSTORE
|
||||
SLOAD
|
||||
MLOAD
|
||||
PUSH1 "0x60"
|
||||
ADD
|
||||
PUSH1 "0x1e"
|
||||
MSTORE
|
||||
SLOAD
|
||||
MLOAD
|
||||
PUSH1 "0x80"
|
||||
ADD
|
||||
PUSH1 "0x28"
|
||||
MSTORE
|
||||
SLOAD
|
||||
PUSH1 "0xa0"
|
||||
MSTORE
|
||||
SLOAD
|
||||
PUSH1 "0x16"
|
||||
PUSH1 "0x48"
|
||||
PUSH1 "0x00"
|
||||
CODECOPY
|
||||
PUSH1 "0x16"
|
||||
PUSH1 "0x00"
|
||||
CALLCODE
|
||||
PUSH1 "0x00"
|
||||
PUSH1 "0x3f"
|
||||
SSTORE
|
||||
PUSH2 "0x03e7"
|
||||
JUMP
|
||||
PUSH1 "0x00"
|
||||
SLOAD
|
||||
PUSH1 "0x00"
|
||||
MSTORE8
|
||||
PUSH1 "0x20"
|
||||
MUL
|
||||
CALLDATALOAD
|
||||
PUSH1 "0x20"
|
||||
SLOAD
|
||||
Push1 "0x5E" # size
|
||||
Push1 "0x08" # copy start pos
|
||||
Push1 "0x00" # mem start pos
|
||||
CodeCopy
|
||||
Stop
|
||||
Push1 "0x00"
|
||||
Push1 "0x5f"
|
||||
Sstore
|
||||
Push1 "0x14"
|
||||
Push1 "0x00"
|
||||
Sload
|
||||
Push1 "0x1e"
|
||||
Push1 "0x20"
|
||||
Sload
|
||||
Push4 "0xabcddcba"
|
||||
Push1 "0x40"
|
||||
Sload
|
||||
JumpDest
|
||||
Mload
|
||||
Push1 "0x20"
|
||||
Add
|
||||
Push1 "0x0a"
|
||||
Mstore
|
||||
Sload
|
||||
Mload
|
||||
Push1 "0x40"
|
||||
Add
|
||||
Push1 "0x14"
|
||||
Mstore
|
||||
Sload
|
||||
Mload
|
||||
Push1 "0x60"
|
||||
Add
|
||||
Push1 "0x1e"
|
||||
Mstore
|
||||
Sload
|
||||
Mload
|
||||
Push1 "0x80"
|
||||
Add
|
||||
Push1 "0x28"
|
||||
Mstore
|
||||
Sload
|
||||
Push1 "0xa0"
|
||||
Mstore
|
||||
Sload
|
||||
Push1 "0x16"
|
||||
Push1 "0x48"
|
||||
Push1 "0x00"
|
||||
CodeCopy
|
||||
Push1 "0x16"
|
||||
Push1 "0x00"
|
||||
CallCode
|
||||
Push1 "0x00"
|
||||
Push1 "0x3f"
|
||||
Sstore
|
||||
Push2 "0x03e7"
|
||||
Jump
|
||||
Push1 "0x00"
|
||||
Sload
|
||||
Push1 "0x00"
|
||||
Mstore8
|
||||
Push1 "0x20"
|
||||
Mul
|
||||
CallDataLoad
|
||||
Push1 "0x20"
|
||||
Sload
|
||||
memory:
|
||||
"0x6000605F556014600054601E60205463ABCDDCBA6040545B51602001600A5254"
|
||||
"0x516040016014525451606001601E5254516080016028525460A0525460166048"
|
||||
"0x60003960166000F26000603F556103E756600054600053602002356020540000"
|
||||
#assertEquals(10, gas); ??
|
||||
gasUsed: 30
|
||||
|
||||
assembler: # CODECOPY OP
|
||||
assembler: # CodeCopy OP
|
||||
title: "CODECOPY_3"
|
||||
# cost for that:
|
||||
# 94 - data copied
|
||||
|
@ -130,7 +130,7 @@ proc opEnvMain*() =
|
|||
Push1 "0x08"
|
||||
Push1 "0x00"
|
||||
CodeCopy
|
||||
STOP
|
||||
Stop
|
||||
"0x6000605f556014600054601e60205463abcddcba6040545b"
|
||||
"0x51602001600a5254516040016014525451606001601e52545160800160285254"
|
||||
"0x60a052546016604860003960166000f26000603f556103e75660005460005360"
|
||||
|
@ -141,14 +141,14 @@ proc opEnvMain*() =
|
|||
"0x60003960166000F26000603F556103E756600054600053602002350000000000"
|
||||
#assertEquals(10, program.getResult().getGasUsed());
|
||||
|
||||
assembler: # CODECOPY OP
|
||||
assembler: # CodeCopy OP
|
||||
title: "CODECOPY_4"
|
||||
code:
|
||||
Push1 "0x5E"
|
||||
Push1 "0x07"
|
||||
Push1 "0x00"
|
||||
CodeCopy
|
||||
STOP
|
||||
Stop
|
||||
"0x6000605f556014600054601e60205463abcddcba6040545b51"
|
||||
"0x602001600a5254516040016014525451606001601e5254516080016028525460"
|
||||
"0xa052546016604860003960166000f26000603f556103e756600054600053602002351234"
|
||||
|
@ -158,7 +158,7 @@ proc opEnvMain*() =
|
|||
"0x4860003960166000F26000603F556103E7566000546000536020023512340000"
|
||||
#assertEquals(10, program.getResult().getGasUsed());
|
||||
|
||||
assembler: # CODECOPY OP
|
||||
assembler: # CodeCopy OP
|
||||
title: "CODECOPY_5"
|
||||
code:
|
||||
Push2 "0x1234"
|
||||
|
@ -171,7 +171,7 @@ proc opEnvMain*() =
|
|||
Push1 "0x00"
|
||||
Push1 "0x20"
|
||||
CodeCopy
|
||||
STOP
|
||||
Stop
|
||||
"0x6000605f55601460"
|
||||
"0x0054601e60205463abcddcba6040545b51602001600a525451604001"
|
||||
"0x6014525451606001601e5254516080016028525460a0525460166048"
|
||||
|
@ -188,7 +188,7 @@ proc opEnvMain*() =
|
|||
"0x601e5254516080016028525460a052546016604860003960166000f26000603f"
|
||||
"0x556103e756600054600053602002351200000000000000000000000000000000"
|
||||
|
||||
assembler: # CODECOPY OP mal
|
||||
assembler: # CodeCopy OP mal
|
||||
title: "CODECOPY_6"
|
||||
code:
|
||||
"0x605E6007396000605f556014600054601e60205463abcddcba604054"
|
||||
|
@ -220,7 +220,7 @@ proc opEnvMain*() =
|
|||
Push1 "0x00" # mem pos
|
||||
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
|
||||
ExtCodeCopy
|
||||
STOP
|
||||
Stop
|
||||
Slt
|
||||
CallValue
|
||||
Jump
|
||||
|
@ -238,7 +238,7 @@ proc opEnvMain*() =
|
|||
Push1 "0x00"
|
||||
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
|
||||
ExtCodeCopy
|
||||
STOP
|
||||
Stop
|
||||
"0x6000605f"
|
||||
"0x556014600054601e60205463abcddcba6040545b51602001600a525451604001"
|
||||
"0x6014525451606001601e5254516080016028525460a052546016604860003960"
|
||||
|
@ -258,7 +258,7 @@ proc opEnvMain*() =
|
|||
Push1 "0x00"
|
||||
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
|
||||
ExtCodeCopy
|
||||
STOP
|
||||
Stop
|
||||
"0x6000605f"
|
||||
"0x556014600054601e60205463abcddcba6040545b51602001600a525451604001"
|
||||
"0x6014525451606001601e5254516080016028525460a052546016604860003960"
|
||||
|
@ -285,7 +285,7 @@ proc opEnvMain*() =
|
|||
Push1 "0x20"
|
||||
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
|
||||
ExtCodeCopy
|
||||
STOP
|
||||
Stop
|
||||
"0x6000605f556014600054601e60205463abcddcba6040545b"
|
||||
"0x51602001600a5254516040016014525451606001601e52545160800160285254"
|
||||
"0x60a052546016604860003960166000f26000603f556103e756600054600053602002351234"
|
||||
|
@ -330,7 +330,7 @@ proc opEnvMain*() =
|
|||
code:
|
||||
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
|
||||
ExtCodeSize
|
||||
STOP
|
||||
Stop
|
||||
"0x5E60076000396000605f"
|
||||
"0x556014600054601e60205463abcddcba6040545b51602001600a525451604001"
|
||||
"0x6014525451606001601e5254516080016028525460a052546016604860003960"
|
||||
|
@ -345,7 +345,7 @@ proc opEnvMain*() =
|
|||
code:
|
||||
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
|
||||
ExtCodeSize
|
||||
STOP
|
||||
Stop
|
||||
stack: "0x94"
|
||||
fork: Berlin
|
||||
gasused: 2603
|
||||
|
@ -358,7 +358,7 @@ proc opEnvMain*() =
|
|||
code:
|
||||
Push20 "0xfbe0afcd7658ba86be41922059dd879c192d4c73"
|
||||
ExtCodeHash
|
||||
STOP
|
||||
Stop
|
||||
stack:
|
||||
"0xc862129bffb73168481c6a51fd36afb8342887fbc5314c763ac731c732d7310c"
|
||||
fork: Berlin
|
||||
|
@ -368,7 +368,7 @@ proc opEnvMain*() =
|
|||
title: "EIP-4399 PrevRandao 0"
|
||||
code:
|
||||
PrevRandao
|
||||
STOP
|
||||
Stop
|
||||
stack:
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
fork: Paris
|
||||
|
@ -379,7 +379,7 @@ proc opEnvMain*() =
|
|||
vmState.blockCtx.prevRandao = EMPTY_UNCLE_HASH
|
||||
code:
|
||||
PrevRandao
|
||||
STOP
|
||||
Stop
|
||||
stack:
|
||||
"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
fork: Paris
|
||||
|
@ -387,9 +387,9 @@ proc opEnvMain*() =
|
|||
assembler:
|
||||
title: "EIP-4844: BlobHash 1"
|
||||
code:
|
||||
PUSH1 "0x01"
|
||||
Push1 "0x01"
|
||||
BlobHash
|
||||
STOP
|
||||
Stop
|
||||
stack:
|
||||
"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
|
||||
fork: Cancun
|
||||
|
@ -397,9 +397,9 @@ proc opEnvMain*() =
|
|||
assembler:
|
||||
title: "EIP-4844: BlobHash 0"
|
||||
code:
|
||||
PUSH1 "0x00"
|
||||
Push1 "0x00"
|
||||
BlobHash
|
||||
STOP
|
||||
Stop
|
||||
stack:
|
||||
"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
|
||||
fork: Cancun
|
||||
|
@ -407,9 +407,9 @@ proc opEnvMain*() =
|
|||
assembler:
|
||||
title: "EIP-4844: BlobHash 2"
|
||||
code:
|
||||
PUSH1 "0x02"
|
||||
Push1 "0x02"
|
||||
BlobHash
|
||||
STOP
|
||||
Stop
|
||||
stack:
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
fork: Cancun
|
||||
|
@ -417,9 +417,9 @@ proc opEnvMain*() =
|
|||
assembler:
|
||||
title: "EIP-4844: BlobHash 32 Bit high"
|
||||
code:
|
||||
PUSH4 "0xffffffff"
|
||||
Push4 "0xffffffff"
|
||||
BlobHash
|
||||
STOP
|
||||
Stop
|
||||
stack:
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
fork: Cancun
|
||||
|
@ -427,9 +427,9 @@ proc opEnvMain*() =
|
|||
assembler:
|
||||
title: "EIP-4844: BlobHash 64 Bit high"
|
||||
code:
|
||||
PUSH8 "0xffffffffffffffff"
|
||||
Push8 "0xffffffffffffffff"
|
||||
BlobHash
|
||||
STOP
|
||||
Stop
|
||||
stack:
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
fork: Cancun
|
||||
|
@ -437,9 +437,9 @@ proc opEnvMain*() =
|
|||
assembler:
|
||||
title: "EIP-4844: BlobHash 128 Bit high"
|
||||
code:
|
||||
PUSH16 "0xffffffffffffffffffffffffffffffff"
|
||||
Push16 "0xffffffffffffffffffffffffffffffff"
|
||||
BlobHash
|
||||
STOP
|
||||
Stop
|
||||
stack:
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
fork: Cancun
|
||||
|
@ -447,9 +447,9 @@ proc opEnvMain*() =
|
|||
assembler:
|
||||
title: "EIP-4844: BlobHash 256 Bit high"
|
||||
code:
|
||||
PUSH32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
Push32 "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
BlobHash
|
||||
STOP
|
||||
Stop
|
||||
stack:
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
fork: Cancun
|
||||
|
@ -458,7 +458,7 @@ proc opEnvMain*() =
|
|||
title: "EIP-7516: BlobBaseFee"
|
||||
code:
|
||||
BlobBaseFee
|
||||
STOP
|
||||
Stop
|
||||
stack:
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
gasused: 2
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2019-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -15,15 +15,15 @@ import
|
|||
|
||||
proc opMiscMain*() =
|
||||
suite "Misc Opcodes":
|
||||
assembler: # LOG0 OP
|
||||
assembler: # Log0 OP
|
||||
title: "Log0"
|
||||
code:
|
||||
PUSH2 "0x1234"
|
||||
PUSH1 "0x00"
|
||||
MSTORE
|
||||
PUSH1 "0x20"
|
||||
PUSH1 "0x00"
|
||||
LOG0
|
||||
Push2 "0x1234"
|
||||
Push1 "0x00"
|
||||
Mstore
|
||||
Push1 "0x20"
|
||||
Push1 "0x00"
|
||||
Log0
|
||||
memory:
|
||||
"0x1234"
|
||||
logs:
|
||||
|
@ -32,16 +32,16 @@ proc opMiscMain*() =
|
|||
data: "0x0000000000000000000000000000000000000000000000000000000000001234"
|
||||
)
|
||||
|
||||
assembler: # LOG1 OP
|
||||
assembler: # Log1 OP
|
||||
title: "Log1"
|
||||
code:
|
||||
PUSH2 "0x1234"
|
||||
PUSH1 "0x00"
|
||||
MSTORE
|
||||
PUSH2 "0x9999"
|
||||
PUSH1 "0x20"
|
||||
PUSH1 "0x00"
|
||||
LOG1
|
||||
Push2 "0x1234"
|
||||
Push1 "0x00"
|
||||
Mstore
|
||||
Push2 "0x9999"
|
||||
Push1 "0x20"
|
||||
Push1 "0x00"
|
||||
Log1
|
||||
memory:
|
||||
"0x1234"
|
||||
logs:
|
||||
|
@ -51,17 +51,17 @@ proc opMiscMain*() =
|
|||
data: "0x0000000000000000000000000000000000000000000000000000000000001234"
|
||||
)
|
||||
|
||||
assembler: # LOG2 OP
|
||||
assembler: # Log2 OP
|
||||
title: "Log2"
|
||||
code:
|
||||
PUSH2 "0x1234"
|
||||
PUSH1 "0x00"
|
||||
MSTORE
|
||||
PUSH2 "0x9999"
|
||||
PUSH2 "0x6666"
|
||||
PUSH1 "0x20"
|
||||
PUSH1 "0x00"
|
||||
LOG2
|
||||
Push2 "0x1234"
|
||||
Push1 "0x00"
|
||||
Mstore
|
||||
Push2 "0x9999"
|
||||
Push2 "0x6666"
|
||||
Push1 "0x20"
|
||||
Push1 "0x00"
|
||||
Log2
|
||||
memory:
|
||||
"0x1234"
|
||||
logs:
|
||||
|
@ -71,18 +71,18 @@ proc opMiscMain*() =
|
|||
data: "0x0000000000000000000000000000000000000000000000000000000000001234"
|
||||
)
|
||||
|
||||
assembler: # LOG3 OP
|
||||
assembler: # Log3 OP
|
||||
title: "Log3"
|
||||
code:
|
||||
PUSH2 "0x1234"
|
||||
PUSH1 "0x00"
|
||||
MSTORE
|
||||
PUSH2 "0x9999"
|
||||
PUSH2 "0x6666"
|
||||
PUSH2 "0x3333"
|
||||
PUSH1 "0x20"
|
||||
PUSH1 "0x00"
|
||||
LOG3
|
||||
Push2 "0x1234"
|
||||
Push1 "0x00"
|
||||
Mstore
|
||||
Push2 "0x9999"
|
||||
Push2 "0x6666"
|
||||
Push2 "0x3333"
|
||||
Push1 "0x20"
|
||||
Push1 "0x00"
|
||||
Log3
|
||||
memory:
|
||||
"0x1234"
|
||||
logs:
|
||||
|
@ -92,19 +92,19 @@ proc opMiscMain*() =
|
|||
data: "0x0000000000000000000000000000000000000000000000000000000000001234"
|
||||
)
|
||||
|
||||
assembler: # LOG4 OP
|
||||
assembler: # Log4 OP
|
||||
title: "Log4"
|
||||
code:
|
||||
PUSH2 "0x1234"
|
||||
PUSH1 "0x00"
|
||||
MSTORE
|
||||
PUSH2 "0x9999"
|
||||
PUSH2 "0x6666"
|
||||
PUSH2 "0x3333"
|
||||
PUSH2 "0x5555"
|
||||
PUSH1 "0x20"
|
||||
PUSH1 "0x00"
|
||||
LOG4
|
||||
Push2 "0x1234"
|
||||
Push1 "0x00"
|
||||
Mstore
|
||||
Push2 "0x9999"
|
||||
Push2 "0x6666"
|
||||
Push2 "0x3333"
|
||||
Push2 "0x5555"
|
||||
Push1 "0x20"
|
||||
Push1 "0x00"
|
||||
Log4
|
||||
memory:
|
||||
"0x1234"
|
||||
logs:
|
||||
|
@ -114,16 +114,16 @@ proc opMiscMain*() =
|
|||
data: "0x0000000000000000000000000000000000000000000000000000000000001234"
|
||||
)
|
||||
|
||||
assembler: # STOP OP
|
||||
title: "STOP_1"
|
||||
assembler: # Stop OP
|
||||
title: "Stop_1"
|
||||
code:
|
||||
PUSH1 "0x20"
|
||||
PUSH1 "0x30"
|
||||
PUSH1 "0x10"
|
||||
PUSH1 "0x30"
|
||||
PUSH1 "0x11"
|
||||
PUSH1 "0x23"
|
||||
STOP
|
||||
Push1 "0x20"
|
||||
Push1 "0x30"
|
||||
Push1 "0x10"
|
||||
Push1 "0x30"
|
||||
Push1 "0x11"
|
||||
Push1 "0x23"
|
||||
Stop
|
||||
stack:
|
||||
"0x20"
|
||||
"0x30"
|
||||
|
@ -132,53 +132,53 @@ proc opMiscMain*() =
|
|||
"0x11"
|
||||
"0x23"
|
||||
|
||||
assembler: # RETURN OP
|
||||
title: "RETURN_1"
|
||||
assembler: # Return OP
|
||||
title: "Return_1"
|
||||
code:
|
||||
PUSH2 "0x1234"
|
||||
PUSH1 "0x00"
|
||||
MSTORE
|
||||
PUSH1 "0x20"
|
||||
PUSH1 "0x00"
|
||||
RETURN
|
||||
Push2 "0x1234"
|
||||
Push1 "0x00"
|
||||
Mstore
|
||||
Push1 "0x20"
|
||||
Push1 "0x00"
|
||||
Return
|
||||
memory: "0x1234"
|
||||
output: "0x0000000000000000000000000000000000000000000000000000000000001234"
|
||||
|
||||
assembler: # RETURN OP
|
||||
title: "RETURN_2"
|
||||
assembler: # Return OP
|
||||
title: "Return_2"
|
||||
code:
|
||||
PUSH2 "0x1234"
|
||||
PUSH1 "0x00"
|
||||
MSTORE
|
||||
PUSH1 "0x20"
|
||||
PUSH1 "0x1F"
|
||||
RETURN
|
||||
Push2 "0x1234"
|
||||
Push1 "0x00"
|
||||
Mstore
|
||||
Push1 "0x20"
|
||||
Push1 "0x1F"
|
||||
Return
|
||||
memory:
|
||||
"0x1234"
|
||||
"0x00"
|
||||
output: "0x3400000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
assembler: # RETURN OP
|
||||
title: "RETURN_3"
|
||||
assembler: # Return OP
|
||||
title: "Return_3"
|
||||
code:
|
||||
PUSH32 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
|
||||
PUSH1 "0x00"
|
||||
MSTORE
|
||||
PUSH1 "0x20"
|
||||
PUSH1 "0x00"
|
||||
RETURN
|
||||
Push32 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
|
||||
Push1 "0x00"
|
||||
Mstore
|
||||
Push1 "0x20"
|
||||
Push1 "0x00"
|
||||
Return
|
||||
memory: "0xa0b0c0d0e0f0a1b1c1d1e1f1a2b2c2d2e2f2a3b3c3d3e3f3a4b4c4d4e4f4a1b1"
|
||||
output: "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
|
||||
|
||||
assembler: # RETURN OP
|
||||
title: "RETURN_4"
|
||||
assembler: # Return OP
|
||||
title: "Return_4"
|
||||
code:
|
||||
PUSH32 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
|
||||
PUSH1 "0x00"
|
||||
MSTORE
|
||||
PUSH1 "0x20"
|
||||
PUSH1 "0x10"
|
||||
RETURN
|
||||
Push32 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
|
||||
Push1 "0x00"
|
||||
Mstore
|
||||
Push1 "0x20"
|
||||
Push1 "0x10"
|
||||
Return
|
||||
output: "0xE2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B100000000000000000000000000000000"
|
||||
memory:
|
||||
"0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
|
||||
|
@ -189,48 +189,48 @@ proc opMiscMain*() =
|
|||
assembler:
|
||||
title: "Simple routine"
|
||||
code:
|
||||
PUSH1 "0x04"
|
||||
Push1 "0x04"
|
||||
JUMPSUB
|
||||
STOP
|
||||
Stop
|
||||
BEGINSUB
|
||||
RETURNSUB
|
||||
ReturnSUB
|
||||
gasUsed: 18
|
||||
fork: berlin
|
||||
|
||||
assembler:
|
||||
title: "Two levels of subroutines"
|
||||
code:
|
||||
PUSH9 "0x00000000000000000C"
|
||||
Push9 "0x00000000000000000C"
|
||||
JUMPSUB
|
||||
STOP
|
||||
Stop
|
||||
BEGINSUB
|
||||
PUSH1 "0x11"
|
||||
Push1 "0x11"
|
||||
JUMPSUB
|
||||
RETURNSUB
|
||||
ReturnSUB
|
||||
BEGINSUB
|
||||
RETURNSUB
|
||||
ReturnSUB
|
||||
gasUsed: 36
|
||||
fork: berlin
|
||||
|
||||
assembler:
|
||||
title: "Failure 1: invalid jump"
|
||||
code:
|
||||
PUSH9 "0x01000000000000000C"
|
||||
Push9 "0x01000000000000000C"
|
||||
JUMPSUB
|
||||
STOP
|
||||
Stop
|
||||
BEGINSUB
|
||||
PUSH1 "0x11"
|
||||
Push1 "0x11"
|
||||
JUMPSUB
|
||||
RETURNSUB
|
||||
ReturnSUB
|
||||
BEGINSUB
|
||||
RETURNSUB
|
||||
ReturnSUB
|
||||
success: false
|
||||
fork: berlin
|
||||
|
||||
assembler:
|
||||
title: "Failure 2: shallow return stack"
|
||||
code:
|
||||
RETURNSUB
|
||||
ReturnSUB
|
||||
PC
|
||||
PC
|
||||
success: false
|
||||
|
@ -239,12 +239,12 @@ proc opMiscMain*() =
|
|||
assembler:
|
||||
title: "Subroutine at end of code"
|
||||
code:
|
||||
PUSH1 "0x05"
|
||||
Push1 "0x05"
|
||||
JUMP
|
||||
BEGINSUB
|
||||
RETURNSUB
|
||||
ReturnSUB
|
||||
JUMPDEST
|
||||
PUSH1 "0x03"
|
||||
Push1 "0x03"
|
||||
JUMPSUB
|
||||
gasUsed: 30
|
||||
fork: berlin
|
||||
|
@ -253,30 +253,30 @@ proc opMiscMain*() =
|
|||
title: "Error on 'walk-into-subroutine'"
|
||||
code:
|
||||
BEGINSUB
|
||||
RETURNSUB
|
||||
STOP
|
||||
ReturnSUB
|
||||
Stop
|
||||
success: false
|
||||
fork: berlin
|
||||
|
||||
assembler:
|
||||
title: "sol test"
|
||||
code:
|
||||
PUSH1 "0x02"
|
||||
PUSH1 "0x03"
|
||||
PUSH1 "0x08" # jumpdest
|
||||
Push1 "0x02"
|
||||
Push1 "0x03"
|
||||
Push1 "0x08" # jumpdest
|
||||
JUMPSUB
|
||||
STOP
|
||||
Stop
|
||||
|
||||
# 0x08
|
||||
BEGINSUB
|
||||
PUSH1 "0x0D" # jumpdest
|
||||
Push1 "0x0D" # jumpdest
|
||||
JUMPSUB
|
||||
RETURNSUB
|
||||
ReturnSUB
|
||||
|
||||
# 0x0D
|
||||
BEGINSUB
|
||||
MUL
|
||||
RETURNSUB
|
||||
ReturnSUB
|
||||
gasUsed: 47
|
||||
fork: berlin
|
||||
stack:
|
||||
|
|
|
@ -380,7 +380,7 @@ proc snapRunner(noisy = true; specs: SnapSyncSpecs) {.used.} =
|
|||
let
|
||||
tailInfo = specs.tailBlocks.splitPath.tail.replace(".txt.gz","")
|
||||
tailPath = specs.tailBlocks.findFilePath.value
|
||||
allFile = "mainnet332160.txt.gz".findFilePath.value
|
||||
# allFile = "mainnet332160.txt.gz".findFilePath.value
|
||||
|
||||
pivot = specs.pivotBlock
|
||||
updateSize = specs.nItems
|
||||
|
|
|
@ -98,25 +98,27 @@ proc writeResultToStdout(stateRes: seq[StateResult]) =
|
|||
stdout.write(n.pretty)
|
||||
stdout.write("\n")
|
||||
|
||||
proc dumpAccounts(db: LedgerRef): Table[EthAddress, DumpAccount] =
|
||||
for accAddr in db.addresses():
|
||||
let acc = DumpAccount(
|
||||
balance : db.getBalance(accAddr),
|
||||
nonce : db.getNonce(accAddr),
|
||||
root : db.getStorageRoot(accAddr),
|
||||
codeHash: db.getCodeHash(accAddr),
|
||||
code : db.getCode(accAddr),
|
||||
key : keccakHash(accAddr)
|
||||
)
|
||||
for k, v in db.storage(accAddr):
|
||||
acc.storage[k] = v
|
||||
result[accAddr] = acc
|
||||
when false:
|
||||
proc dumpAccounts(db: LedgerRef): Table[EthAddress, DumpAccount] =
|
||||
for accAddr in db.addresses():
|
||||
let acc = DumpAccount(
|
||||
balance : db.getBalance(accAddr),
|
||||
nonce : db.getNonce(accAddr),
|
||||
root : db.getStorageRoot(accAddr),
|
||||
codeHash: db.getCodeHash(accAddr),
|
||||
code : db.getCode(accAddr),
|
||||
key : keccakHash(accAddr)
|
||||
)
|
||||
for k, v in db.storage(accAddr):
|
||||
acc.storage[k] = v
|
||||
result[accAddr] = acc
|
||||
|
||||
proc dumpState(vmState: BaseVMState): StateDump =
|
||||
StateDump(
|
||||
root: vmState.readOnlyStateDB.rootHash,
|
||||
accounts: dumpAccounts(vmState.stateDB)
|
||||
)
|
||||
|
||||
proc dumpState(vmState: BaseVMState): StateDump =
|
||||
StateDump(
|
||||
root: vmState.readOnlyStateDB.rootHash,
|
||||
accounts: dumpAccounts(vmState.stateDB)
|
||||
)
|
||||
|
||||
proc writeRootHashToStderr(vmState: BaseVMState) =
|
||||
let stateRoot = %{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2022-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -39,7 +39,7 @@ template skipTest(folder, name: untyped): bool =
|
|||
skipNewGSTTests(folder, name)
|
||||
|
||||
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"):
|
||||
continue
|
||||
|
||||
|
@ -52,8 +52,8 @@ proc collectFileNames(inputPath: string, map: var StatusMap, fileNames: var seq[
|
|||
continue
|
||||
|
||||
fileNames.add TestFile(
|
||||
fullPath: filename,
|
||||
dispName: substr(filename, inputPath.len+1)
|
||||
fullPath: fileName,
|
||||
dispName: substr(fileName, inputPath.len+1)
|
||||
)
|
||||
|
||||
proc main() =
|
||||
|
|
Loading…
Reference in New Issue