diff --git a/fluffy/network/wire/portal_protocol.nim b/fluffy/network/wire/portal_protocol.nim index c26f8ced4..a3eeb0e32 100644 --- a/fluffy/network/wire/portal_protocol.nim +++ b/fluffy/network/wire/portal_protocol.nim @@ -155,9 +155,9 @@ type PortalProtocolId* = array[2, byte] - RadiusCache* = LRUCache[NodeId, UInt256] + RadiusCache* = LruCache[NodeId, UInt256] - ContentCache = LRUCache[ContentId, seq[byte]] + ContentCache = LruCache[ContentId, seq[byte]] ContentKV* = object contentKey*: ContentKeyByteList diff --git a/fluffy/tools/beacon_lc_bridge/beacon_lc_bridge.nim b/fluffy/tools/beacon_lc_bridge/beacon_lc_bridge.nim index 1a8ada2ba..938880739 100644 --- a/fluffy/tools/beacon_lc_bridge/beacon_lc_bridge.nim +++ b/fluffy/tools/beacon_lc_bridge/beacon_lc_bridge.nim @@ -62,17 +62,17 @@ import from beacon_chain/gossip_processing/block_processor import newExecutionPayload from beacon_chain/gossip_processing/eth2_processor import toValidationResult -template append(w: var RlpWriter, t: TypedTransaction) = - w.appendRawBytes(distinctBase t) +template append(w: var RlpWriter, typedTransaction: TypedTransaction) = + w.appendRawBytes(distinctBase typedTransaction) -template append(w: var RlpWriter, t: WithdrawalV1) = +template append(w: var RlpWriter, withdrawalV1: WithdrawalV1) = # TODO: Since Capella we can also access ExecutionPayloadHeader and thus # could get the Roots through there instead. w.append blocks.Withdrawal( - index: distinctBase(t.index), - validatorIndex: distinctBase(t.validatorIndex), - address: t.address, - amount: distinctBase(t.amount), + index: distinctBase(withdrawalV1.index), + validatorIndex: distinctBase(withdrawalV1.validatorIndex), + address: withdrawalV1.address, + amount: distinctBase(withdrawalV1.amount), ) proc asPortalBlockData*( diff --git a/hive_integration/nodocker/engine/cancun/blobs.nim b/hive_integration/nodocker/engine/cancun/blobs.nim index 9d885f963..7f83069dd 100644 --- a/hive_integration/nodocker/engine/cancun/blobs.nim +++ b/hive_integration/nodocker/engine/cancun/blobs.nim @@ -25,12 +25,12 @@ type BlobCommitment* = object blob*: kzg.KzgBlob - commitment*: kzg.KZGCommitment + commitment*: kzg.KzgCommitment BlobTxWrapData* = object hashes*: seq[Hash32] blobs*: seq[kzg.KzgBlob] - commitments*: seq[kzg.KZGCommitment] + commitments*: seq[kzg.KzgCommitment] proofs*: seq[kzg.KzgProof] func getBlobList*(startId: BlobID, count: int): BlobIDs = @@ -147,7 +147,7 @@ proc getVersionedHash*(blobid: BlobID, commitmentVersion: byte): Hash32 = proc blobDataGenerator*(startBlobId: BlobID, blobCount: int): BlobTxWrapData = result.blobs = newSeq[kzg.KzgBlob](blobCount) - result.commitments = newSeq[kzg.KZGCommitment](blobCount) + result.commitments = newSeq[kzg.KzgCommitment](blobCount) result.hashes = newSeq[Hash32](blobCount) result.proofs = newSeq[kzg.KzgProof](blobCount) diff --git a/hive_integration/nodocker/engine/cancun/customizer.nim b/hive_integration/nodocker/engine/cancun/customizer.nim index 89df2ff50..3c7121854 100644 --- a/hive_integration/nodocker/engine/cancun/customizer.nim +++ b/hive_integration/nodocker/engine/cancun/customizer.nim @@ -539,11 +539,6 @@ func scramble(data: Hash32): Opt[Hash32] = h.data[^1] = byte(255 - h.data[^1]) Opt.some(h) -func scramble(data: Bytes32): Opt[Hash32] = - var h = Hash32 data - h.data[0] = byte(255 - h.data[0]) - Opt.some(h) - # This function generates an invalid payload by taking a base payload and modifying the specified field such that it ends up being invalid. # One small consideration is that the payload needs to contain transactions and specially transactions using the PREVRANDAO opcode for all the fields to be compatible with this function. proc generateInvalidPayload*(sender: TxSender, data: ExecutableData, payloadField: InvalidPayloadBlockField): ExecutableData = diff --git a/hive_integration/nodocker/engine/cancun/helpers.nim b/hive_integration/nodocker/engine/cancun/helpers.nim index 6ab532a93..8ef457898 100644 --- a/hive_integration/nodocker/engine/cancun/helpers.nim +++ b/hive_integration/nodocker/engine/cancun/helpers.nim @@ -134,7 +134,7 @@ type BlobWrapData* = object versionedHash*: Hash32 blob* : kzg.KzgBlob - commitment* : kzg.KZGCommitment + commitment* : kzg.KzgCommitment proof* : kzg.KzgProof BlobData* = ref object @@ -149,7 +149,7 @@ proc getBlobDataInPayload*(pool: TestBlobTxPool, payload: ExecutionPayload): Res # Unmarshal the tx from the payload, which should be the minimal version # of the blob transaction let txData = rlp.decode(distinctBase binaryTx, Transaction) - if txData.txType != TxEIP4844: + if txData.txType != TxEip4844: continue let txHash = rlpHash(txData) diff --git a/hive_integration/nodocker/engine/cancun/step_newpayloads.nim b/hive_integration/nodocker/engine/cancun/step_newpayloads.nim index 7ef124a75..35ea1c7cb 100644 --- a/hive_integration/nodocker/engine/cancun/step_newpayloads.nim +++ b/hive_integration/nodocker/engine/cancun/step_newpayloads.nim @@ -157,9 +157,9 @@ proc verifyBlobBundle(step: NewPayloads, return false for i, blobData in blobDataInPayload: - let bundleCommitment = blobBundle.commitments[i].bytes - let bundleBlob = blobBundle.blobs[i].bytes - let bundleProof = blobBundle.proofs[i].bytes + let bundleCommitment = blobBundle.commitments[i].data + let bundleBlob = blobBundle.blobs[i].data + let bundleProof = blobBundle.proofs[i].data if bundleCommitment != blobData.commitment.bytes: error "KZG mismatch at index of the bundle", index=i @@ -235,8 +235,8 @@ method execute*(step: NewPayloads, ctx: CancunTestContext): bool = r.expectNoError(step.expectationDescription) r.expectPayloadStatus(expectedStatus) - if r.get().payloadID.isSome: - testCond env.clMock.addPayloadID(env.engine, r.get().payloadID.get()) + if r.get().payloadId.isSome: + testCond env.clMock.addPayloadID(env.engine, r.get().payloadId.get()) return true , diff --git a/hive_integration/nodocker/engine/cancun_tests.nim b/hive_integration/nodocker/engine/cancun_tests.nim index 901805856..f50a76bcf 100644 --- a/hive_integration/nodocker/engine/cancun_tests.nim +++ b/hive_integration/nodocker/engine/cancun_tests.nim @@ -1905,7 +1905,7 @@ proc makeCancunTest(): seq[EngineSpec] = result.add InvalidPayloadTestCase( mainFork : ForkCancun, - txType : Opt.some(TxEIP4844), + txType : Opt.some(TxEip4844), invalidField : invalidField, syncing : syncing, invalidDetectedOnSync: invalidDetectedOnSync, @@ -1915,26 +1915,26 @@ proc makeCancunTest(): seq[EngineSpec] = # Invalid Transaction ChainID Tests result.add InvalidTxChainIDTest( mainFork: ForkCancun, - txType : Opt.some(TxEIP4844), + txType : Opt.some(TxEip4844), ) result.add PayloadBuildAfterInvalidPayloadTest( mainFork: ForkCancun, - txType : Opt.some(TxEIP4844), + txType : Opt.some(TxEip4844), invalidField: InvalidParentBeaconBlockRoot, ) # Suggested Fee Recipient Tests (New Transaction Type) result.add SuggestedFeeRecipientTest( mainFork: ForkCancun, - txType : Opt.some(TxEIP4844), + txType : Opt.some(TxEip4844), transactionCount: 1, # Only one blob tx gets through due to blob gas limit ) # Prev Randao Tests (New Transaction Type) result.add PrevRandaoTransactionTest( mainFork: ForkCancun, - txType : Opt.some(TxEIP4844), + txType : Opt.some(TxEip4844), ) proc getGenesisProc(cs: BaseSpec, param: NetworkParams) = diff --git a/hive_integration/nodocker/engine/clmock.nim b/hive_integration/nodocker/engine/clmock.nim index 7a31c4a1c..570eca422 100644 --- a/hive_integration/nodocker/engine/clmock.nim +++ b/hive_integration/nodocker/engine/clmock.nim @@ -275,8 +275,8 @@ proc generatePayloadAttributes(cl: CLMocker) = let timestamp = Quantity cl.getNextBlockTimestamp.uint64 cl.latestPayloadAttributes = PayloadAttributes( timestamp: timestamp, - prevRandao: FixedBytes[32] nextPrevRandao.data, - suggestedFeeRecipient: Address cl.nextFeeRecipient, + prevRandao: nextPrevRandao, + suggestedFeeRecipient: cl.nextFeeRecipient, ) if cl.isShanghai(timestamp): @@ -311,8 +311,8 @@ proc requestNextPayload(cl: CLMocker): bool = head=cl.latestForkchoice.headBlockHash return false - doAssert s.payLoadID.isSome - cl.nextPayloadID = s.payloadID.get() + doAssert s.payloadId.isSome + cl.nextPayloadID = s.payloadId.get() return true proc getPayload(cl: CLMocker, payloadId: Bytes8): Result[GetPayloadResponse, string] = @@ -339,9 +339,9 @@ proc getNextPayload(cl: CLMocker): bool = cl.latestShouldOverrideBuilder = x.shouldOverrideBuilder cl.latestExecutionRequests = x.executionRequests - let parentBeaconblockRoot = cl.latestPayloadAttributes.parentBeaconblockRoot + let parentBeaconBlockRoot = cl.latestPayloadAttributes.parentBeaconBlockRoot let requestsHash = calcRequestsHash(x.executionRequests) - let header = blockHeader(cl.latestPayloadBuilt, parentBeaconblockRoot = parentBeaconblockRoot, requestsHash) + let header = blockHeader(cl.latestPayloadBuilt, parentBeaconBlockRoot, requestsHash) let blockHash = header.blockHash if blockHash != cl.latestPayloadBuilt.blockHash: error "CLMocker: getNextPayload blockHash mismatch", @@ -493,9 +493,9 @@ proc broadcastForkchoiceUpdated*(cl: CLMocker, msg=s.payloadStatus.validationError.get return false - if s.payloadID.isSome: + if s.payloadId.isSome: error "CLMocker: Expected empty PayloadID", - msg=s.payloadID.get.toHex + msg=s.payloadId.get.toHex return false return true diff --git a/hive_integration/nodocker/engine/engine/forkchoice.nim b/hive_integration/nodocker/engine/engine/forkchoice.nim index 1216f6952..6adcb4092 100644 --- a/hive_integration/nodocker/engine/engine/forkchoice.nim +++ b/hive_integration/nodocker/engine/engine/forkchoice.nim @@ -78,11 +78,11 @@ method execute(cs: InconsistentForkchoiceTest, env: TestEnv): bool = case cs.field of HeadBlockHash: - inconsistentFcU.headblockHash = shadow.alt[len(shadow.alt)-1].blockHash + inconsistentFcU.headBlockHash = shadow.alt[len(shadow.alt)-1].blockHash of SafeBlockHash: - inconsistentFcU.safeblockHash = shadow.alt[len(shadow.canon)-2].blockHash + inconsistentFcU.safeBlockHash = shadow.alt[len(shadow.canon)-2].blockHash of FinalizedBlockHash: - inconsistentFcU.finalizedblockHash = shadow.alt[len(shadow.canon)-3].blockHash + inconsistentFcU.finalizedBlockHash = shadow.alt[len(shadow.canon)-3].blockHash let version = env.engine.version(env.clMock.latestPayloadBuilt.timestamp) var r = env.engine.client.forkchoiceUpdated(version, inconsistentFcU) @@ -119,15 +119,15 @@ method execute(cs: ForkchoiceUpdatedUnknownBlockHashTest, env: TestEnv): bool = if cs.field == HeadBlockHash: let fcu = ForkchoiceStateV1( - headblockHash: randomblockHash, - safeblockHash: env.clMock.latestForkchoice.safeblockHash, - finalizedblockHash: env.clMock.latestForkchoice.finalizedblockHash, + headBlockHash: randomblockHash, + safeBlockHash: env.clMock.latestForkchoice.safeBlockHash, + finalizedBlockHash: env.clMock.latestForkchoice.finalizedBlockHash, ) info "forkchoiceStateUnknownHeadHash", - head=fcu.headblockHash.short, - safe=fcu.safeblockHash.short, - final=fcu.finalizedblockHash.short + head=fcu.headBlockHash.short, + safe=fcu.safeBlockHash.short, + final=fcu.finalizedBlockHash.short # Execution specification:: # - (payloadStatus: (status: SYNCING, latestValidHash: null, validationError: null), payloadId: null) @@ -143,21 +143,21 @@ method execute(cs: ForkchoiceUpdatedUnknownBlockHashTest, env: TestEnv): bool = # Test again using PayloadAttributes, should also return SYNCING and no PayloadID r = env.engine.client.forkchoiceUpdated(version, fcu, Opt.some(payloadAttributes)) r.expectPayloadStatus(PayloadExecutionStatus.syncing) - r.expectPayloadID(Opt.none(PayloadID)) + r.expectPayloadID(Opt.none(Bytes8)) else: let pbRes = env.clMock.produceSingleBlock(BlockProcessCallbacks( # Run test after a new payload has been broadcast onNewPayloadBroadcast: proc(): bool = var fcu = ForkchoiceStateV1( - headblockHash: env.clMock.latestExecutedPayload.blockHash, - safeblockHash: env.clMock.latestForkchoice.safeblockHash, - finalizedblockHash: env.clMock.latestForkchoice.finalizedblockHash, + headBlockHash: env.clMock.latestExecutedPayload.blockHash, + safeBlockHash: env.clMock.latestForkchoice.safeBlockHash, + finalizedBlockHash: env.clMock.latestForkchoice.finalizedBlockHash, ) if cs.field == SafeBlockHash: - fcu.safeblockHash = randomblockHash + fcu.safeBlockHash = randomblockHash elif cs.field == FinalizedBlockHash: - fcu.finalizedblockHash = randomblockHash + fcu.finalizedBlockHash = randomblockHash let version = env.engine.version(env.clMock.latestExecutedPayload.timestamp) var r = env.engine.client.forkchoiceUpdated(version, fcu) diff --git a/hive_integration/nodocker/engine/engine/invalid_ancestor.nim b/hive_integration/nodocker/engine/engine/invalid_ancestor.nim index e16bf5f35..38af7896f 100644 --- a/hive_integration/nodocker/engine/engine/invalid_ancestor.nim +++ b/hive_integration/nodocker/engine/engine/invalid_ancestor.nim @@ -192,11 +192,11 @@ method getName(cs: InvalidMissingAncestorReOrgSyncTest): string = "Invalid Missing Ancestor Syncing ReOrg, $1, EmptyTxs=$2, CanonicalReOrg=$3, Invalid P$4" % [ $cs.invalidField, $cs.emptyTransactions, $cs.reOrgFromCanonical, $cs.invalidIndex] -func blockHeader(ex: ExecutableData): common.BlockHeader = +func blockHeader(ex: ExecutableData): Header = let requestsHash = calcRequestsHash(ex.executionRequests) blockHeader(ex.basePayload, ex.beaconRoot, requestsHash) -func blockBody(ex: ExecutableData): common.BlockBody = +func blockBody(ex: ExecutableData): BlockBody = blockBody(ex.basePayload) method execute(cs: InvalidMissingAncestorReOrgSyncTest, env: TestEnv): bool = diff --git a/hive_integration/nodocker/engine/engine/invalid_payload.nim b/hive_integration/nodocker/engine/engine/invalid_payload.nim index 379bdd5d1..5f9933b23 100644 --- a/hive_integration/nodocker/engine/engine/invalid_payload.nim +++ b/hive_integration/nodocker/engine/engine/invalid_payload.nim @@ -346,7 +346,7 @@ method execute(cs: PayloadBuildAfterInvalidPayloadTest, env: TestEnv): bool = let versione = env.engine.version(payloadAttributes.timestamp) - s = invalidPayloadProducer.client.getPayload(r.get.payloadID.get, versione) + s = invalidPayloadProducer.client.getPayload(r.get.payloadId.get, versione) s.expectNoError() let basePayload = s.get.executionPayload @@ -363,11 +363,11 @@ method execute(cs: PayloadBuildAfterInvalidPayloadTest, env: TestEnv): bool = r = env.engine.client.newPayload(version, inv_p) r.expectStatus(PayloadExecutionStatus.invalid) - r.expectLatestValidHash(env.clMock.latestForkchoice.headblockHash) + r.expectLatestValidHash(env.clMock.latestForkchoice.headBlockHash) let s = sec.client.newPayload(version, inv_p) s.expectStatus(PayloadExecutionStatus.invalid) - s.expectLatestValidHash(env.clMock.latestForkchoice.headblockHash) + s.expectLatestValidHash(env.clMock.latestForkchoice.headBlockHash) # Let the block production continue. # At this point the selected payload producer will diff --git a/hive_integration/nodocker/engine/engine/payload_attributes.nim b/hive_integration/nodocker/engine/engine/payload_attributes.nim index b113d3d92..f9b8f014e 100644 --- a/hive_integration/nodocker/engine/engine/payload_attributes.nim +++ b/hive_integration/nodocker/engine/engine/payload_attributes.nim @@ -46,9 +46,9 @@ method execute(cs: InvalidPayloadAttributesTest, env: TestEnv): bool = var fcu = env.clMock.latestForkchoice if cs.syncing: # Setting a random hash will put the client into `SYNCING` - fcu.headblockHash = Hash32.randomBytes() + fcu.headBlockHash = Hash32.randomBytes() else: - fcu.headblockHash = env.clMock.latestPayloadBuilt.blockHash + fcu.headBlockHash = env.clMock.latestPayloadBuilt.blockHash info "Sending EngineForkchoiceUpdated with invalid payload attributes", syncing=cs.syncing, description=cs.description @@ -76,7 +76,7 @@ method execute(cs: InvalidPayloadAttributesTest, env: TestEnv): bool = # Check that the forkchoice was applied, regardless of the error let s = env.engine.client.latestHeader() #s.ExpectationDescription = "Forkchoice is applied even on invalid payload attributes" - s.expectHash(fcu.headblockHash) + s.expectHash(fcu.headBlockHash) return true )) diff --git a/hive_integration/nodocker/engine/engine/payload_execution.nim b/hive_integration/nodocker/engine/engine/payload_execution.nim index 9be438bd4..3a5c1a4bb 100644 --- a/hive_integration/nodocker/engine/engine/payload_execution.nim +++ b/hive_integration/nodocker/engine/engine/payload_execution.nim @@ -169,7 +169,7 @@ method execute(cs: InOrderPayloadExecutionTest, env: TestEnv): bool = version = sec.version(env.clMock.latestExecutedPayload.timestamp) s = sec.client.forkchoiceUpdated(version, fcU) s.expectPayloadStatus(PayloadExecutionStatus.valid) - s.expectLatestValidHash(fcU.headblockHash) + s.expectLatestValidHash(fcU.headBlockHash) s.expectNoValidationError() # At this point we should have our funded account balance equal to the expected value. @@ -460,9 +460,9 @@ method execute(cs: NewPayloadWithMissingFcUTest, env: TestEnv): bool = let version = sec.version(env.clMock.latestHeader.timestamp) let p = sec.client.forkchoiceUpdated(version, fcU) p.expectPayloadStatus(PayloadExecutionStatus.valid) - p.expectLatestValidHash(fcU.headblockHash) + p.expectLatestValidHash(fcU.headBlockHash) # Now the head should've changed to the latest PoS block let s = sec.client.latestHeader() - s.expectHash(fcU.headblockHash) + s.expectHash(fcU.headBlockHash) return true diff --git a/hive_integration/nodocker/engine/engine/payload_id.nim b/hive_integration/nodocker/engine/engine/payload_id.nim index 72d03d43c..a740202e5 100644 --- a/hive_integration/nodocker/engine/engine/payload_id.nim +++ b/hive_integration/nodocker/engine/engine/payload_id.nim @@ -114,7 +114,7 @@ method execute(cs: UniquePayloadIDTest, env: TestEnv): bool = let version = env.engine.version(env.clMock.latestHeader.timestamp) let r = env.engine.client.forkchoiceUpdated(version, env.clMock.latestForkchoice, Opt.some(attr)) r.expectNoError() - testCond env.clMock.addPayloadID(env.engine, r.get.payloadID.get) + testCond env.clMock.addPayloadID(env.engine, r.get.payloadId.get) return true )) testCond pbRes diff --git a/hive_integration/nodocker/engine/engine/reorg.nim b/hive_integration/nodocker/engine/engine/reorg.nim index c4e7689e4..85465332f 100644 --- a/hive_integration/nodocker/engine/engine/reorg.nim +++ b/hive_integration/nodocker/engine/engine/reorg.nim @@ -71,7 +71,7 @@ method execute(cs: SidechainReOrgTest, env: TestEnv): bool = waitFor sleepAsync(period) version = env.engine.version(attr.timestamp) - let g = env.engine.client.getPayload(r.get.payloadID.get, version) + let g = env.engine.client.getPayload(r.get.payloadId.get, version) g.expectNoError() let alternativePayload = g.get.executionPayload @@ -187,11 +187,11 @@ method execute(cs: TransactionReOrgTest, env: TestEnv): bool = var version = env.engine.version(env.clMock.latestHeader.timestamp) let r = env.engine.client.forkchoiceUpdated(version, env.clMock.latestForkchoice, Opt.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) - let g = env.engine.client.getPayload(r.get.payloadID.get, version) + let g = env.engine.client.getPayload(r.get.payloadId.get, version) g.expectNoError() shadow.payload = g.get.executionPayload @@ -252,7 +252,7 @@ method execute(cs: TransactionReOrgTest, env: TestEnv): bool = waitFor sleepAsync(period) version = env.engine.version(env.clMock.latestPayloadAttributes.timestamp) - let g = env.engine.client.getPayload(f.get.payloadID.get, version) + let g = env.engine.client.getPayload(f.get.payloadId.get, version) g.expectNoError() let payload = g.get.executionPayload @@ -428,11 +428,11 @@ 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, Opt.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) - let g = env.engine.client.getPayload(r.get.payloadID.get, version) + let g = env.engine.client.getPayload(r.get.payloadId.get, version) g.expectNoError() shadow.payload = g.get.executionPayload @@ -692,7 +692,7 @@ method execute(cs: ReOrgPrevValidatedPayloadOnSideChainTest, env: TestEnv): bool r.expectLatestValidHash(reOrgPayload.blockHash) version = env.engine.version(newPayloadAttributes.timestamp) - let p = env.engine.client.getPayload(r.get.payloadID.get, version) + let p = env.engine.client.getPayload(r.get.payloadId.get, version) p.expectPayloadParentHash(reOrgPayload.blockHash) let payload = p.get.executionPayload diff --git a/hive_integration/nodocker/engine/engine/rpc.nim b/hive_integration/nodocker/engine/engine/rpc.nim index 93e9012d6..446d2cfb9 100644 --- a/hive_integration/nodocker/engine/engine/rpc.nim +++ b/hive_integration/nodocker/engine/engine/rpc.nim @@ -75,13 +75,13 @@ method execute(cs: BlockStatus, env: TestEnv): bool = of LatestOnNewPayload: callbacks.onGetPayload = proc(): bool = let r = env.engine.client.namedHeader(Head) - r.expectHash(env.clMock.latestForkchoice.headblockHash) + r.expectHash(env.clMock.latestForkchoice.headBlockHash) let s = env.engine.client.blockNumber() s.expectNumber(env.clMock.latestHeadNumber.uint64) let p = env.engine.client.namedHeader(Head) - p.expectHash(env.clMock.latestForkchoice.headblockHash) + p.expectHash(env.clMock.latestForkchoice.headBlockHash) # Check that the receipt for the transaction we just sent is still not available let q = env.engine.client.txReceipt(shadow.txHash) @@ -90,19 +90,19 @@ method execute(cs: BlockStatus, env: TestEnv): bool = of LatestOnHeadBlockHash: callbacks.onForkchoiceBroadcast = proc(): bool = let r = env.engine.client.namedHeader(Head) - r.expectHash(env.clMock.latestForkchoice.headblockHash) + r.expectHash(env.clMock.latestForkchoice.headBlockHash) let s = env.engine.client.txReceipt(shadow.txHash) s.expectTransactionHash(shadow.txHash) return true of SafeOnSafeBlockHash: callbacks.onSafeBlockChange = proc(): bool = let r = env.engine.client.namedHeader(Safe) - r.expectHash(env.clMock.latestForkchoice.safeblockHash) + r.expectHash(env.clMock.latestForkchoice.safeBlockHash) return true of FinalizedOnFinalizedBlockHash: callbacks.onFinalizedBlockChange = proc(): bool = let r = env.engine.client.namedHeader(Finalized) - r.expectHash(env.clMock.latestForkchoice.finalizedblockHash) + r.expectHash(env.clMock.latestForkchoice.finalizedBlockHash) return true # Perform the test diff --git a/hive_integration/nodocker/engine/engine_client.nim b/hive_integration/nodocker/engine/engine_client.nim index ff9189085..05479c549 100644 --- a/hive_integration/nodocker/engine/engine_client.nim +++ b/hive_integration/nodocker/engine/engine_client.nim @@ -660,7 +660,7 @@ proc debugPrevRandaoTransaction*( if stack.len < 1: return err("Invalid stack after PREVRANDAO operation") - let stackHash = Bytes32(hextoByteArray[32](stack[0].getStr)) + let stackHash = Bytes32(hexToByteArray[32](stack[0].getStr)) if stackHash != expectedPrevRandao: return err("Invalid stack after PREVRANDAO operation $1 != $2" % [stackHash.data.toHex, expectedPrevRandao.data.toHex]) diff --git a/hive_integration/nodocker/engine/helper.nim b/hive_integration/nodocker/engine/helper.nim index 0d1a4e614..e66369c9d 100644 --- a/hive_integration/nodocker/engine/helper.nim +++ b/hive_integration/nodocker/engine/helper.nim @@ -18,7 +18,7 @@ import proc txInPayload*(payload: ExecutionPayload, txHash: Hash32): bool = for txBytes in payload.transactions: - let currTx = rlp.decode(common.Blob txBytes, Transaction) + let currTx = rlp.decode(seq[byte](txBytes), Transaction) if rlpHash(currTx) == txHash: return true diff --git a/hive_integration/nodocker/engine/tx_sender.nim b/hive_integration/nodocker/engine/tx_sender.nim index 5efc7b0de..195a4a027 100644 --- a/hive_integration/nodocker/engine/tx_sender.nim +++ b/hive_integration/nodocker/engine/tx_sender.nim @@ -52,10 +52,10 @@ type accounts: seq[TestAccount] nonceMap: Table[Address, uint64] txSent : int - chainId : ChainID + chainId : ChainId MakeTxParams* = object - chainId*: ChainID + chainId*: ChainId key* : PrivateKey nonce* : AccountNonce @@ -128,7 +128,7 @@ proc getTxType(tc: BaseTx, nonce: uint64): TxType = if nonce mod 2 == 0: TxLegacy else: - TxEIP1559 + TxEip1559 else: tc.txType.get @@ -157,7 +157,7 @@ proc makeTxOfType(params: MakeTxParams, tc: BaseTx): PooledTransaction = of TxEip1559: PooledTransaction( tx: Transaction( - txType : TxEIP1559, + txType : TxEip1559, nonce : params.nonce, gasLimit: tc.gasLimit, maxFeePerGas: gasFeeCap, @@ -182,7 +182,7 @@ proc makeTxOfType(params: MakeTxParams, tc: BaseTx): PooledTransaction = PooledTransaction( tx: Transaction( - txType : TxEIP4844, + txType : TxEip4844, nonce : params.nonce, chainId : params.chainId, maxFeePerGas: gasFeeCap, @@ -433,7 +433,7 @@ proc customizeTransaction*(sender: TxSender, if baseTx.txType in {TxEip1559, TxEip4844}: if custTx.gasPriceOrGasFeeCap.isSome: - modTx.maxFeePErGas = custTx.gasPriceOrGasFeeCap.get.GasInt + modTx.maxFeePerGas = custTx.gasPriceOrGasFeeCap.get.GasInt if custTx.gasTipCap.isSome: modTx.maxPriorityFeePerGas = custTx.gasTipCap.get.GasInt diff --git a/hive_integration/nodocker/engine/withdrawals/wd_base_spec.nim b/hive_integration/nodocker/engine/withdrawals/wd_base_spec.nim index 1e8a0ddee..f09700663 100644 --- a/hive_integration/nodocker/engine/withdrawals/wd_base_spec.nim +++ b/hive_integration/nodocker/engine/withdrawals/wd_base_spec.nim @@ -12,7 +12,6 @@ import stint, chronicles, chronos, - stew/byteutils, web3/eth_api_types, ./wd_history, ../test_env, diff --git a/hive_integration/nodocker/engine/withdrawals/wd_reorg_spec.nim b/hive_integration/nodocker/engine/withdrawals/wd_reorg_spec.nim index 5a2e009ac..ba96f93b3 100644 --- a/hive_integration/nodocker/engine/withdrawals/wd_reorg_spec.nim +++ b/hive_integration/nodocker/engine/withdrawals/wd_reorg_spec.nim @@ -40,7 +40,7 @@ type nextIndex : int wdHistory : WDHistory sidechain : Table[uint64, ExecutionPayload] - payloadId : PayloadID + payloadId : Bytes8 height : uint64 attr : Opt[PayloadAttributes] @@ -180,9 +180,9 @@ proc execute*(ws: ReorgSpec, env: TestEnv): bool = let r = sec.client.forkchoiceUpdated(fcState, attr) r.expectNoError() r.expectPayloadStatus(PayloadExecutionStatus.valid) - testCond r.get().payloadID.isSome: + testCond r.get().payloadId.isSome: error "Unable to get a payload ID on the sidechain" - sidechain.payloadId = r.get().payloadID.get() + sidechain.payloadId = r.get().payloadId.get() return true , @@ -247,7 +247,7 @@ proc execute*(ws: ReorgSpec, env: TestEnv): bool = let r = sec.client.forkchoiceUpdatedV2(fcState, Opt.some(attr)) r.expectPayloadStatus(PayloadExecutionStatus.valid) - let p = sec.client.getPayloadV2(r.get().payloadID.get) + let p = sec.client.getPayloadV2(r.get().payloadId.get) p.expectNoError() let z = p.get() diff --git a/hive_integration/nodocker/rpc/test_env.nim b/hive_integration/nodocker/rpc/test_env.nim index 0d5237d4c..519f114d2 100644 --- a/hive_integration/nodocker/rpc/test_env.nim +++ b/hive_integration/nodocker/rpc/test_env.nim @@ -35,7 +35,7 @@ type const initPath = "hive_integration" / "nodocker" / "rpc" / "init" gasPrice* = 30.gwei - chainID* = ChainID(7) + chainID* = ChainId(7) proc manageAccounts(ctx: EthContext, conf: NimbusConf) = if string(conf.importKey).len > 0: diff --git a/hive_integration/nodocker/rpc/vault.nim b/hive_integration/nodocker/rpc/vault.nim index f21198c05..ba09da2a1 100644 --- a/hive_integration/nodocker/rpc/vault.nim +++ b/hive_integration/nodocker/rpc/vault.nim @@ -42,12 +42,12 @@ type accounts: Table[Address, PrivateKey] rng: ref HmacDrbgContext - chainId: ChainID + chainId: ChainId gasPrice: GasInt vaultKey: PrivateKey client: RpcClient -proc newVault*(chainID: ChainID, gasPrice: GasInt, client: RpcClient): Vault = +proc newVault*(chainID: ChainId, gasPrice: GasInt, client: RpcClient): Vault = new(result) result.rng = newRng() result.chainId = chainID diff --git a/nimbus/beacon/payload_conv.nim b/nimbus/beacon/payload_conv.nim index 57991fba8..a41d20761 100644 --- a/nimbus/beacon/payload_conv.nim +++ b/nimbus/beacon/payload_conv.nim @@ -19,15 +19,15 @@ import # Private helpers # ------------------------------------------------------------------------------ -template append(w: var RlpWriter, t: TypedTransaction) = - w.appendRawBytes(distinctBase t) +template append(w: var RlpWriter, typedTransaction: TypedTransaction) = + w.appendRawBytes(distinctBase typedTransaction) -template append(w: var RlpWriter, t: WithdrawalV1) = +template append(w: var RlpWriter, withdrawalV1: WithdrawalV1) = w.append blocks.Withdrawal( - index: distinctBase(t.index), - validatorIndex: distinctBase(t.validatorIndex), - address: t.address, - amount: distinctBase(t.amount), + index: distinctBase(withdrawalV1.index), + validatorIndex: distinctBase(withdrawalV1.validatorIndex), + address: withdrawalV1.address, + amount: distinctBase(withdrawalV1.amount), ) func wdRoot(list: openArray[WithdrawalV1]): Hash32 = diff --git a/nimbus/beacon/web3_eth_conv.nim b/nimbus/beacon/web3_eth_conv.nim index 671b62668..35ba204e5 100644 --- a/nimbus/beacon/web3_eth_conv.nim +++ b/nimbus/beacon/web3_eth_conv.nim @@ -29,8 +29,8 @@ type Web3BlockNumber* = Quantity Web3Tx* = engine_api_types.TypedTransaction Web3Blob* = engine_api_types.Blob - Web3KZGProof* = engine_api_types.KZGProof - Web3KZGCommitment* = engine_api_types.KZGCommitment + Web3KZGProof* = engine_api_types.KzgProof + Web3KZGCommitment* = engine_api_types.KzgCommitment {.push gcsafe, raises:[].} diff --git a/nimbus/config.nim b/nimbus/config.nim index 6a48dcbcc..76e1c2faf 100644 --- a/nimbus/config.nim +++ b/nimbus/config.nim @@ -715,7 +715,7 @@ proc getBootNodes*(conf: NimbusConf): seq[ENode] = # Bootstrap nodes provided as ENRs for enr in conf.bootstrapEnrs: - let enode = Enode.fromEnr(enr).valueOr: + let enode = ENode.fromEnr(enr).valueOr: fatal "Invalid bootstrap ENR provided", error quit 1 @@ -730,7 +730,7 @@ proc getStaticPeers*(conf: NimbusConf): seq[ENode] = # Static peers provided as ENRs for enr in conf.staticPeersEnrs: - let enode = Enode.fromEnr(enr).valueOr: + let enode = ENode.fromEnr(enr).valueOr: fatal "Invalid static peer ENR provided", error quit 1 diff --git a/nimbus/core/tx_pool/tx_tasks/tx_dispose.nim b/nimbus/core/tx_pool/tx_tasks/tx_dispose.nim index 997a9a1a1..3c8295cfb 100644 --- a/nimbus/core/tx_pool/tx_tasks/tx_dispose.nim +++ b/nimbus/core/tx_pool/tx_tasks/tx_dispose.nim @@ -109,7 +109,7 @@ proc disposeById*(xp: TxPoolRef; itemIDs: openArray[Hash32]; reason: TxInfo) ## unusable (e.g. with higher nonces for the same sender.) for itemID in itemIDs: let rcItem = xp.txDB.byItemID.eq(itemID) - if rcItem.isOK: + if rcItem.isOk: discard xp.txDB.dispose(rcItem.value, reason) # ------------------------------------------------------------------------------ diff --git a/nimbus/db/aristo/aristo_api.nim b/nimbus/db/aristo/aristo_api.nim index 4c8bbd8f2..f4fb6b5c7 100644 --- a/nimbus/db/aristo/aristo_api.nim +++ b/nimbus/db/aristo/aristo_api.nim @@ -105,7 +105,7 @@ type proc(db: AristoDbRef; accPath: Hash32; stoPath: Hash32; - ): Result[Uint256,AristoError] + ): Result[UInt256,AristoError] {.noRaise.} ## For a storage tree related to account `accPath`, fetch the data ## record from the database indexed by `stoPath`. @@ -816,7 +816,7 @@ func init*( result = api.mergeAccountRecord(a, b, c) profApi.mergeStorageData = - proc(a: AristoDbRef; b, c: Hash32, d: Uint256): auto = + proc(a: AristoDbRef; b, c: Hash32, d: UInt256): auto = AristoApiProfMergeStorageDataFn.profileRunner: result = api.mergeStorageData(a, b, c, d) diff --git a/nimbus/db/aristo/aristo_init/rocks_db/rdb_get.nim b/nimbus/db/aristo/aristo_init/rocks_db/rdb_get.nim index 119bb2756..31e91f6a1 100644 --- a/nimbus/db/aristo/aristo_init/rocks_db/rdb_get.nim +++ b/nimbus/db/aristo/aristo_init/rocks_db/rdb_get.nim @@ -103,7 +103,7 @@ proc getKey*( ): Result[HashKey,(AristoError,string)] = # Try LRU cache first var rc = rdb.rdKeyLru.get(rvid.vid) - if rc.isOK: + if rc.isOk: rdbKeyLruStats[rvid.to(RdbStateType)].inc(true) return ok(move(rc.value)) @@ -144,7 +144,7 @@ proc getVtx*( else: rdb.rdVtxLru.get(rvid.vid) - if rc.isOK: + if rc.isOk: rdbVtxLruStats[rvid.to(RdbStateType)][rc.value().vType].inc(true) return ok(move(rc.value)) diff --git a/nimbus/db/aristo/aristo_nearby.nim b/nimbus/db/aristo/aristo_nearby.nim index 31defcec3..f109894a5 100644 --- a/nimbus/db/aristo/aristo_nearby.nim +++ b/nimbus/db/aristo/aristo_nearby.nim @@ -65,7 +65,7 @@ proc branchNibbleMax*(vtx: VertexRef; maxInx: int8): int8 = ## Find the greatest index for an argument branch `vtx` link with index ## less or equal the argument `nibble`. if vtx.vType == Branch: - for n in maxInx.countDown 0: + for n in maxInx.countdown 0: if vtx.bVid[n].isValid: return n -1 @@ -400,7 +400,7 @@ iterator rightPairs*( var hike: Hike discard start.hikeUp(db, Opt.none(VertexRef), hike) var rc = hike.right db - while rc.isOK: + while rc.isOk: hike = rc.value let (key, pyl) = hike.toLeafTiePayload yield (key, pyl) @@ -497,7 +497,7 @@ iterator leftPairs*( discard start.hikeUp(db, Opt.none(VertexRef), hike) var rc = hike.left db - while rc.isOK: + while rc.isOk: hike = rc.value let (key, pyl) = hike.toLeafTiePayload yield (key, pyl) diff --git a/nimbus/db/aristo/aristo_profile.nim b/nimbus/db/aristo/aristo_profile.nim index 8d2851c32..76bae0521 100644 --- a/nimbus/db/aristo/aristo_profile.nim +++ b/nimbus/db/aristo/aristo_profile.nim @@ -47,7 +47,7 @@ func toFloat(ela: Duration): float = ## Convert the argument `ela` to a floating point seconds result. let elaS = ela.inSeconds - elaNs = (ela - initDuration(seconds=elaS)).inNanoSeconds + elaNs = (ela - initDuration(seconds=elaS)).inNanoseconds elaS.float + elaNs.float / 1_000_000_000 proc updateTotal(t: AristoDbProfListRef; fnInx: uint) = @@ -107,12 +107,12 @@ func toStr*(elapsed: Duration): string = result = elapsed.ppMins elif 0 < times.inSeconds(elapsed): result = elapsed.ppSecs - elif 0 < times.inMilliSeconds(elapsed): + elif 0 < times.inMilliseconds(elapsed): result = elapsed.ppMs - elif 0 < times.inMicroSeconds(elapsed): + elif 0 < times.inMicroseconds(elapsed): result = elapsed.ppUs else: - result = $elapsed.inNanoSeconds & "ns" + result = $elapsed.inNanoseconds & "ns" except ValueError: result = $elapsed diff --git a/nimbus/db/aristo/aristo_tx/tx_frame.nim b/nimbus/db/aristo/aristo_tx/tx_frame.nim index 744b3d44d..b3e526031 100644 --- a/nimbus/db/aristo/aristo_tx/tx_frame.nim +++ b/nimbus/db/aristo/aristo_tx/tx_frame.nim @@ -178,7 +178,7 @@ iterator txFrameWalk*(tx: AristoTxRef): (int,AristoTxRef,LayerRef,AristoError) = yield (0,tx,db.top,AristoError(0)) # Walk down the transaction stack - for level in (tx.level-1).countDown(1): + for level in (tx.level-1).countdown(1): tx = tx.parent if tx.isNil or tx.level != level: yield (-1,tx,LayerRef(nil),TxStackGarbled) diff --git a/nimbus/db/core_db/backend/aristo_trace.nim b/nimbus/db/core_db/backend/aristo_trace.nim index 84823fb2a..792fbdd4e 100644 --- a/nimbus/db/core_db/backend/aristo_trace.nim +++ b/nimbus/db/core_db/backend/aristo_trace.nim @@ -340,7 +340,7 @@ func logRecord( func logRecord( info: AristoApiProfNames; req: TraceRequest; - sto: Uint256; + sto: UInt256; ): TraceDataItemRef = TraceDataItemRef( pfx: info.to(TracePfx), @@ -507,7 +507,7 @@ proc ariTraceRecorder(tr: TraceRecorderRef) = proc(mpt: AristoDbRef; accPath: Hash32; stoPath: Hash32; - ): Result[Uint256,AristoError] = + ): Result[UInt256,AristoError] = const info = AristoApiProfFetchStorageDataFn when CoreDbNoisyCaptJournal: diff --git a/nimbus/db/core_db/base/base_helpers.nim b/nimbus/db/core_db/base/base_helpers.nim index a1074de4d..01b12e8e6 100644 --- a/nimbus/db/core_db/base/base_helpers.nim +++ b/nimbus/db/core_db/base/base_helpers.nim @@ -58,13 +58,13 @@ template ctx*(kvt: CoreDbKvtRef): CoreDbCtxRef = # --------------- -template call*(api: KvtApiRef; fn: untyped; args: varArgs[untyped]): untyped = +template call*(api: KvtApiRef; fn: untyped; args: varargs[untyped]): untyped = when CoreDbEnableApiJumpTable: api.fn(args) else: fn(args) -template call*(kvt: CoreDbKvtRef; fn: untyped; args: varArgs[untyped]): untyped = +template call*(kvt: CoreDbKvtRef; fn: untyped; args: varargs[untyped]): untyped = CoreDbCtxRef(kvt).parent.kvtApi.call(fn, args) # --------------- @@ -91,7 +91,7 @@ template ctx*(acc: CoreDbAccRef): CoreDbCtxRef = # --------------- -template call*(api: AristoApiRef; fn: untyped; args: varArgs[untyped]): untyped = +template call*(api: AristoApiRef; fn: untyped; args: varargs[untyped]): untyped = when CoreDbEnableApiJumpTable: api.fn(args) else: @@ -100,7 +100,7 @@ template call*(api: AristoApiRef; fn: untyped; args: varArgs[untyped]): untyped template call*( acc: CoreDbAccRef; fn: untyped; - args: varArgs[untyped]; + args: varargs[untyped]; ): untyped = CoreDbCtxRef(acc).parent.ariApi.call(fn, args) diff --git a/nimbus/db/core_db/base_iterators.nim b/nimbus/db/core_db/base_iterators.nim index fb5de00b1..ca2608445 100644 --- a/nimbus/db/core_db/base_iterators.nim +++ b/nimbus/db/core_db/base_iterators.nim @@ -48,13 +48,13 @@ template dbType(dsc: CoreDbKvtRef | CoreDbAccRef): CoreDbType = template kvt(dsc: CoreDbKvtRef): KvtDbRef = dsc.distinctBase.kvt -template call(api: KvtApiRef; fn: untyped; args: varArgs[untyped]): untyped = +template call(api: KvtApiRef; fn: untyped; args: varargs[untyped]): untyped = when CoreDbEnableApiJumpTable: api.fn(args) else: fn(args) -template call(kvt: CoreDbKvtRef; fn: untyped; args: varArgs[untyped]): untyped = +template call(kvt: CoreDbKvtRef; fn: untyped; args: varargs[untyped]): untyped = kvt.distinctBase.parent.kvtApi.call(fn, args) # --------------- @@ -62,7 +62,7 @@ template call(kvt: CoreDbKvtRef; fn: untyped; args: varArgs[untyped]): untyped = template mpt(dsc: CoreDbAccRef): AristoDbRef = dsc.distinctBase.mpt -template call(api: AristoApiRef; fn: untyped; args: varArgs[untyped]): untyped = +template call(api: AristoApiRef; fn: untyped; args: varargs[untyped]): untyped = when CoreDbEnableApiJumpTable: api.fn(args) else: @@ -71,7 +71,7 @@ template call(api: AristoApiRef; fn: untyped; args: varArgs[untyped]): untyped = template call( acc: CoreDbAccRef; fn: untyped; - args: varArgs[untyped]; + args: varargs[untyped]; ): untyped = acc.distinctBase.parent.ariApi.call(fn, args) diff --git a/nimbus/graphql/ethapi.nim b/nimbus/graphql/ethapi.nim index 3401e052c..362b8b73f 100644 --- a/nimbus/graphql/ethapi.nim +++ b/nimbus/graphql/ethapi.nim @@ -783,14 +783,14 @@ proc txAccessList(ud: RootRef, params: Args, parent: Node): RespResult {.apiPrag proc txMaxFeePerBlobGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = let tx = TxNode(parent) - if tx.tx.txType < TxEIP4844: + if tx.tx.txType < TxEip4844: ok(respNull()) else: longNode(tx.tx.maxFeePerBlobGas) proc txVersionedHashes(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = let tx = TxNode(parent) - if tx.tx.txType < TxEIP4844: + if tx.tx.txType < TxEip4844: ok(respNull()) else: var list = respList() diff --git a/nimbus/rpc/rpc_utils.nim b/nimbus/rpc/rpc_utils.nim index d57c88f03..73d275ce9 100644 --- a/nimbus/rpc/rpc_utils.nim +++ b/nimbus/rpc/rpc_utils.nim @@ -160,7 +160,7 @@ proc populateTransactionObject*(tx: Transaction, result.chainId = Opt.some(Quantity(tx.chainId)) result.accessList = Opt.some(tx.accessList) - if tx.txType >= TxEIP4844: + if tx.txType >= TxEip4844: result.maxFeePerBlobGas = Opt.some(tx.maxFeePerBlobGas) result.blobVersionedHashes = Opt.some(tx.versionedHashes) diff --git a/nimbus/rpc/server_api_helpers.nim b/nimbus/rpc/server_api_helpers.nim index 055bc6609..12d7ea26d 100644 --- a/nimbus/rpc/server_api_helpers.nim +++ b/nimbus/rpc/server_api_helpers.nim @@ -65,7 +65,7 @@ proc populateTransactionObject*(tx: Transaction, result.chainId = Opt.some(Quantity(tx.chainId)) result.accessList = Opt.some(tx.accessList) - if tx.txType >= TxEIP4844: + if tx.txType >= TxEip4844: result.maxFeePerBlobGas = Opt.some(tx.maxFeePerBlobGas) result.blobVersionedHashes = Opt.some(tx.versionedHashes) diff --git a/nimbus/sync/beacon/worker/headers_staged.nim b/nimbus/sync/beacon/worker/headers_staged.nim index 7637d9ecc..83b850047 100644 --- a/nimbus/sync/beacon/worker/headers_staged.nim +++ b/nimbus/sync/beacon/worker/headers_staged.nim @@ -70,7 +70,7 @@ proc headerStagedUpdateTarget*( let rc = await buddy.headersFetchReversed(iv, ctx.target.finalHash, info) ctx.target.locked = false - if rc.isOK: + if rc.isOk: let hash = rlp.encode(rc.value[0]).keccak256 if hash != ctx.target.finalHash: # Oops diff --git a/nimbus/transaction/host_call_nested.nim b/nimbus/transaction/host_call_nested.nim index c343a3a64..c00655562 100644 --- a/nimbus/transaction/host_call_nested.nim +++ b/nimbus/transaction/host_call_nested.nim @@ -32,7 +32,7 @@ proc beforeExecCreateEvmcNested(host: TransactionHost, gas: GasInt m.gas, sender: m.sender.fromEvmc, value: m.value.fromEvmc, - data: @(makeOpenArray(m.inputData, m.inputSize.int)) + data: @(makeOpenArray(m.input_data, m.input_size.int)) ) return newComputation(host.vmState, false, childMsg, cast[ContractSalt](m.create2_salt)) @@ -68,7 +68,7 @@ proc beforeExecCallEvmcNested(host: TransactionHost, else: host.computation.msg.contractAddress, value: m.value.fromEvmc, - data: @(makeOpenArray(m.inputData, m.inputSize.int)), + data: @(makeOpenArray(m.input_data, m.input_size.int)), flags: m.flags, ) return newComputation(host.vmState, false, childMsg) diff --git a/tests/macro_assembler.nim b/tests/macro_assembler.nim index 240e697ef..30778c642 100644 --- a/tests/macro_assembler.nim +++ b/tests/macro_assembler.nim @@ -377,7 +377,7 @@ proc verifyAsmResult(vmState: BaseVMState, boa: Assembler, asmResult: CallResult proc createSignedTx(payload: seq[byte], chainId: ChainId): Transaction = let privateKey = PrivateKey.fromHex("7a28b5ba57c53603b0b07b56bba752f7784bf506fa95edc395f5cf6c7514fe9d")[] let unsignedTx = Transaction( - txType: TxEIP4844, + txType: TxEip4844, nonce: 0, gasPrice: 1.GasInt, gasLimit: 500_000_000.GasInt, diff --git a/tests/replay/pp_light.nim b/tests/replay/pp_light.nim index 17d9901a8..8c85ac03b 100644 --- a/tests/replay/pp_light.nim +++ b/tests/replay/pp_light.nim @@ -90,12 +90,12 @@ func pp*(elapsed: Duration): string = result = elapsed.ppMins elif 0 < times.inSeconds(elapsed): result = elapsed.ppSecs - elif 0 < times.inMilliSeconds(elapsed): + elif 0 < times.inMilliseconds(elapsed): result = elapsed.ppMs - elif 0 < times.inMicroSeconds(elapsed): + elif 0 < times.inMicroseconds(elapsed): result = elapsed.ppUs else: - result = $elapsed.inNanoSeconds & "ns" + result = $elapsed.inNanoseconds & "ns" except ValueError: result = $elapsed diff --git a/tests/test_aristo/test_compute.nim b/tests/test_aristo/test_compute.nim index 6da9aa3b4..338e30348 100644 --- a/tests/test_aristo/test_compute.nim +++ b/tests/test_aristo/test_compute.nim @@ -18,11 +18,8 @@ import aristo_check, aristo_compute, aristo_delete, - aristo_get, aristo_merge, aristo_desc, - aristo_utils, - aristo_serialise, aristo_init, aristo_tx/tx_stow, ] diff --git a/tests/test_difficulty.nim b/tests/test_difficulty.nim index c34a49f50..9ea54667c 100644 --- a/tests/test_difficulty.nim +++ b/tests/test_difficulty.nim @@ -20,11 +20,11 @@ import type Tester = object parentTimestamp: int64 - parentDifficulty: Uint256 + parentDifficulty: UInt256 parentUncles: Hash32 currentTimestamp: int64 currentBlockNumber: uint64 - currentDifficulty: Uint256 + currentDifficulty: UInt256 Tests = Table[string, Tester] @@ -37,11 +37,11 @@ proc hexOrInt64(data: JsonNode, key: string, hex: static[bool]): int64 = else: int64(parseInt data[key].getStr) -proc hexOrInt256(data: JsonNode, key: string, hex: static[bool]): Uint256 = +proc hexOrInt256(data: JsonNode, key: string, hex: static[bool]): UInt256 = when hex: UInt256.fromHex data[key].getStr else: - parse(data[key].getStr, Uint256) + parse(data[key].getStr, UInt256) proc parseHash(data: string): Hash32 = case data @@ -50,7 +50,7 @@ proc parseHash(data: string): Hash32 = else: doAssert(false, "invalid uncle hash") -proc parseTests(testData: JSonNode): Tests = +proc parseTests(testData: JsonNode): Tests = const hex = true result = Table[string, Tester]() var t: Tester @@ -115,7 +115,7 @@ template runTest() = for fname in filenames: let filename = fname - test fname.subStr(inputPath.len + 1): + test fname.substr(inputPath.len + 1): let fixtures = parseJson(readFile(filename)) testFixture(fixtures, testStatusIMPL) diff --git a/tests/test_generalstate_json.nim b/tests/test_generalstate_json.nim index fcfb51712..0d7c75c64 100644 --- a/tests/test_generalstate_json.nim +++ b/tests/test_generalstate_json.nim @@ -155,7 +155,7 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus, ctx.chainConfig = getChainConfig(forkName) except ValueError as ex: debugEcho ex.msg - testStatusIMPL = TestStatus.Failed + testStatusIMPL = TestStatus.FAILED return template runSubTest(subTest: JsonNode) = diff --git a/tests/test_genesis.nim b/tests/test_genesis.nim index 59df3a9ce..ae2c28108 100644 --- a/tests/test_genesis.nim +++ b/tests/test_genesis.nim @@ -89,7 +89,7 @@ proc customGenesisTest() = let com = CommonRef.new(newCoreDbRef DefaultDbMemory, params = cg) let stateRoot = hash32"d7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544" let genesisHash = hash32"d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3" - let ttd = "46_089_003_871_917_200_000_000".parse(Uint256) + let ttd = "46_089_003_871_917_200_000_000".parse(UInt256) check com.genesisHeader.stateRoot == stateRoot check com.genesisHeader.blockHash == genesisHash check com.ttd.get == ttd @@ -102,7 +102,7 @@ proc customGenesisTest() = let com = CommonRef.new(newCoreDbRef DefaultDbMemory, params = cg) let stateRoot = hash32"d7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544" let genesisHash = hash32"d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3" - let ttd = "46_089_003_871_917_200_000_000".parse(Uint256) + let ttd = "46_089_003_871_917_200_000_000".parse(UInt256) check com.genesisHeader.stateRoot == stateRoot check com.genesisHeader.blockHash == genesisHash check com.ttd.get == ttd diff --git a/tests/test_helpers.nim b/tests/test_helpers.nim index 084d08749..4fb3443ac 100644 --- a/tests/test_helpers.nim +++ b/tests/test_helpers.nim @@ -68,7 +68,7 @@ proc jsonTestImpl*(inputFolder, outputName: string, handler, skipTest: NimNode): doAssert(filenames.len > 0) for fname in filenames: let filename = fname - test fname.subStr(inputPath.len + 1): + test fname.substr(inputPath.len + 1): {.gcsafe.}: let (folder, name) = filename.splitPath() diff --git a/tests/test_op_memory.nim b/tests/test_op_memory.nim index 692a94056..d8cbb9a60 100644 --- a/tests/test_op_memory.nim +++ b/tests/test_op_memory.nim @@ -306,7 +306,7 @@ proc opMemoryMain*() = var body = newStmtList() var stack = newStmtList() - for x in countDown(i, 0): + for x in countdown(i, 0): let val = newLit("0x" & toHex(x+10, 2)) body.add quote do: `pushIdent` `val` diff --git a/tools/t8n/helpers.nim b/tools/t8n/helpers.nim index 48df379cb..7abb6395a 100644 --- a/tools/t8n/helpers.nim +++ b/tools/t8n/helpers.nim @@ -211,7 +211,7 @@ proc readValue*(r: var JsonReader[T8Conv], val: var TransContext) of "txs" : r.readValue(val.txsJson) of "txsRlp" : r.readValue(val.txsRlp) -proc parseTxJson(txo: TxObject, chainId: ChainID): Result[Transaction, string] = +proc parseTxJson(txo: TxObject, chainId: ChainId): Result[Transaction, string] = template required(field) = const fName = astToStr(oField) if txo.field.isNone: @@ -308,33 +308,31 @@ proc filterGoodTransactions*(ctx: TransContext): seq[Transaction] = if txRes.isOk: result.add txRes.get -template wrapException(procName: string, body) = +template wrapException(body) = try: body except SerializationError as exc: - debugEcho "procName: ", procName raise newError(ErrorJson, exc.msg) except IOError as exc: - debugEcho "procName: ", procName raise newError(ErrorJson, exc.msg) proc parseTxsJson*(ctx: var TransContext, jsonFile: string) {.raises: [T8NError].} = - wrapException("parseTxsJson"): + wrapException: ctx.txsJson = T8Conv.loadFile(jsonFile, seq[TxObject]) proc parseAlloc*(ctx: var TransContext, allocFile: string) {.raises: [T8NError].} = - wrapException("parseAlloc"): + wrapException: ctx.alloc = T8Conv.loadFile(allocFile, GenesisAlloc) proc parseEnv*(ctx: var TransContext, envFile: string) {.raises: [T8NError].} = - wrapException("parseEnv"): + wrapException: ctx.env = T8Conv.loadFile(envFile, EnvStruct) proc parseTxsRlp*(ctx: var TransContext, hexData: string) {.raises: [ValueError].} = ctx.txsRlp = hexToSeqByte(hexData) proc parseInputFromStdin*(ctx: var TransContext) {.raises: [T8NError].} = - wrapException("parseInputFromStdin"): + wrapException: let jsonData = stdin.readAll() ctx = T8Conv.decode(jsonData, TransContext) diff --git a/tools/t8n/transition.nim b/tools/t8n/transition.nim index 587cfdecf..d3bc5b08f 100644 --- a/tools/t8n/transition.nim +++ b/tools/t8n/transition.nim @@ -71,9 +71,7 @@ proc dispatchOutput(ctx: TransContext, conf: T8NConf, res: ExecOutput) = dis.dispatch(conf.outputBaseDir, conf.outputAlloc, "alloc", @@(res.alloc)) dis.dispatch(conf.outputBaseDir, conf.outputResult, "result", @@(res.result)) - let chainId = conf.stateChainId.ChainId let txList = ctx.filterGoodTransactions() - let body = @@(rlp.encode(txList)) dis.dispatch(conf.outputBaseDir, conf.outputBody, "body", body) diff --git a/vendor/nimbus-build-system b/vendor/nimbus-build-system index 4afb05266..8fafcd0ba 160000 --- a/vendor/nimbus-build-system +++ b/vendor/nimbus-build-system @@ -1 +1 @@ -Subproject commit 4afb0526629f51aef4c124368365ebe90a782d37 +Subproject commit 8fafcd0bac9f409091b7bcaee62ab6330f57441e