diff --git a/README.md b/README.md index 5680e5fdf6..8fb08f2cf5 100644 --- a/README.md +++ b/README.md @@ -81,9 +81,6 @@ nim --version ./env.sh nim --version ``` -Our Wiki provides additional helpful information for [debugging individual test cases][1] -and for [pairing Nimbus with a locally running copy of Geth][2]. - #### Windows _(Experimental support!)_ @@ -124,8 +121,8 @@ make test # run the test suite *Experimental* The code can be compiled on a Raspberry PI: -* Raspberry PI 3b+ -* 64gb SD Card (less might work too, but the default recommended 4-8GB will probably be too small) +* Raspberry Pi 4+ +* 64GB SD Card (less might work too, but the default recommended 4-8GB will probably be too small) * [Rasbian Buster Lite](https://www.raspberrypi.org/downloads/raspbian/) - Lite version is enough to get going and will save some disk space! Assuming you're working with a freshly written image: @@ -375,6 +372,3 @@ or * Apache License, Version 2.0, ([LICENSE-APACHEv2](LICENSE-APACHEv2) or https://www.apache.org/licenses/LICENSE-2.0) at your option. These files may not be copied, modified, or distributed except according to those terms. - -[1]: https://github.com/status-im/nimbus/wiki/Understanding-and-debugging-Nimbus-EVM-JSON-tests -[2]: https://github.com/status-im/nimbus/wiki/Debugging-state-reconstruction diff --git a/fluffy/database/content_db.nim b/fluffy/database/content_db.nim index fd9b0bd5e3..0a3c7fac41 100644 --- a/fluffy/database/content_db.nim +++ b/fluffy/database/content_db.nim @@ -1,5 +1,5 @@ # Fluffy -# Copyright (c) 2021-2024 Status Research & Development GmbH +# Copyright (c) 2021-2025 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -411,7 +411,7 @@ proc putAndPrune*(db: ContentDB, key: ContentId, value: openArray[byte]): PutRes else: # Note: # An approach of a deleting a full fraction is chosen here, in an attempt - # to not continiously require radius updates, which could have a negative + # to not continuously require radius updates, which could have a negative # impact on the network. However this should be further investigated, as # doing a large fraction deletion could cause a temporary node performance # degradation. The `contentDeletionFraction` might need further tuning or diff --git a/fluffy/network/beacon/beacon_db.nim b/fluffy/network/beacon/beacon_db.nim index c70c7a1a5a..405a628771 100644 --- a/fluffy/network/beacon/beacon_db.nim +++ b/fluffy/network/beacon/beacon_db.nim @@ -1,5 +1,5 @@ # fluffy -# Copyright (c) 2022-2024 Status Research & Development GmbH +# Copyright (c) 2022-2025 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -534,7 +534,7 @@ proc createStoreHandler*(db: BeaconDb): DbStoreHandler = return # Lot of assumptions here: - # - that updates are continious i.e there is no period gaps + # - that updates are continuous i.e. there is no period gaps # - that updates start from startPeriod of content key var period = contentKey.lightClientUpdateKey.startPeriod for update in updates.asSeq(): diff --git a/fluffy/network/wire/portal_protocol.nim b/fluffy/network/wire/portal_protocol.nim index e10cd80f31..f7304ca334 100644 --- a/fluffy/network/wire/portal_protocol.nim +++ b/fluffy/network/wire/portal_protocol.nim @@ -831,8 +831,8 @@ proc getContentKeys(o: OfferRequest): ContentKeysList = func getMaxOfferedContentKeys*(protocolIdLen: uint32, maxKeySize: uint32): int = ## Calculates how many ContentKeys will fit in one offer message which - ## will be small enouch to fit into discv5 limit. - ## This is neccesarry as contentKeysLimit (64) is sometimes to big, and even + ## will be small enough to fit into discv5 limit. + ## This is necessary as contentKeysLimit (64) is sometimes too big, and even ## half of this can be too much to fit into discv5 limits. let maxTalkReqPayload = maxDiscv5PacketSize - getTalkReqOverhead(int(protocolIdLen)) diff --git a/hive_integration/nodocker/consensus/consensus_sim.nim b/hive_integration/nodocker/consensus/consensus_sim.nim index 88286c325d..3afcf52a43 100644 --- a/hive_integration/nodocker/consensus/consensus_sim.nim +++ b/hive_integration/nodocker/consensus/consensus_sim.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2021-2024 Status Research & Development GmbH +# Copyright (c) 2021-2025 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) # * MIT license ([LICENSE-MIT](LICENSE-MIT)) @@ -9,7 +9,6 @@ import std/[os, json, strutils, times], - stew/byteutils, results, chronicles, ../../../nimbus/core/chain, diff --git a/nimbus/core/pow/header.nim b/nimbus/core/pow/header.nim index 6b452d706d..003bd3beaa 100644 --- a/nimbus/core/pow/header.nim +++ b/nimbus/core/pow/header.nim @@ -1,57 +1,13 @@ # Nimbus -# Copyright (c) 2018-2024 Status Research & Development GmbH +# Copyright (c) 2018-2025 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) # * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) # at your option. This file may not be copied, modified, or distributed except according to those terms. +{.push raises: [].} -import - std/[strformat], - ./difficulty - -export Header - -proc hasUncles*(header: Header): bool = header.ommersHash != EMPTY_UNCLE_HASH - -proc `$`*(header: Header): string = - result = &"Header(timestamp: {header.timestamp} difficulty: {header.difficulty} blockNumber: {header.number} gasLimit: {header.gasLimit})" - -# CalcGasLimit computes the gas limit of the next block after parent. It aims -# to keep the baseline gas above the provided floor, and increase it towards the -# ceil if the blocks are full. If the ceil is exceeded, it will always decrease -# the gas allowance. -func computeGasLimit*(parentGasUsed, parentGasLimit, gasFloor, gasCeil: GasInt): GasInt = - # contrib = (parentGasUsed * 3 / 2) / 1024 - let contrib = (parentGasUsed + parentGasUsed div 2) div GAS_LIMIT_ADJUSTMENT_FACTOR - - # decay = parentGasLimit / 1024 -1 - let decay = parentGasLimit div GAS_LIMIT_ADJUSTMENT_FACTOR - 1 - - #[ - strategy: gasLimit of block-to-mine is set based on parent's - gasUsed value. if parentGasUsed > parentGasLimit * (2/3) then we - increase it, otherwise lower it (or leave it unchanged if it's right - at that usage) the amount increased/decreased depends on how far away - from parentGasLimit * (2/3) parentGasUsed is. - ]# - - var limit = parentGasLimit - decay + contrib - if limit < GAS_LIMIT_MINIMUM: - limit = GAS_LIMIT_MINIMUM - - # If we're outside our allowed gas range, we try to hone towards them - if limit < gasFloor: - limit = parentGasLimit + decay - if limit > gasFloor: - limit = gasFloor - - elif limit > gasCeil: - limit = parentGasLimit - decay - if limit < gasCeil: - limit = gasCeil - - return limit +from ./difficulty import GAS_LIMIT_ADJUSTMENT_FACTOR, GAS_LIMIT_MINIMUM, GasInt # CalcGasLimit1559 calculates the next block gas limit under 1559 rules. func calcGasLimit1559*(parentGasLimit, desiredLimit: GasInt): GasInt = @@ -74,4 +30,4 @@ func calcGasLimit1559*(parentGasLimit, desiredLimit: GasInt): GasInt = if limit < desiredLimit: limit = desiredLimit - return limit + limit diff --git a/nimbus/core/validate.nim b/nimbus/core/validate.nim index f40e13b9aa..dc600e7b75 100644 --- a/nimbus/core/validate.nim +++ b/nimbus/core/validate.nim @@ -19,7 +19,7 @@ import ../transaction, ../utils/utils, "."/[dao, eip4844, eip7702, eip7691, gaslimit, withdrawals], - ./pow/[difficulty, header], + ./pow/difficulty, stew/objects, results @@ -168,7 +168,7 @@ proc validateUncles(com: CommonRef; header: Header; # Public function, extracted from executor # ------------------------------------------------------------------------------ -proc validateLegacySignatureForm(tx: Transaction, fork: EVMFork): bool = +func validateLegacySignatureForm(tx: Transaction, fork: EVMFork): bool = var vMin = 27'u64 vMax = 28'u64 @@ -190,7 +190,7 @@ proc validateLegacySignatureForm(tx: Transaction, fork: EVMFork): bool = isValid -proc validateEip2930SignatureForm(tx: Transaction): bool = +func validateEip2930SignatureForm(tx: Transaction): bool = var isValid = tx.V == 0'u64 or tx.V == 1'u64 isValid = isValid and tx.S >= UInt256.one isValid = isValid and tx.S < SECPK1_N @@ -205,7 +205,7 @@ func gasCost*(tx: Transaction): UInt256 = else: tx.gasLimit.u256 * tx.gasPrice.u256 -proc validateTxBasic*( +func validateTxBasic*( com: CommonRef, tx: Transaction; ## tx to validate fork: EVMFork,