Skip to content

Commit

Permalink
Fix styles (#2046)
Browse files Browse the repository at this point in the history
* Fix styles

* Fix copyright year
  • Loading branch information
jangko authored Feb 21, 2024
1 parent 3a4da2c commit 6ff2edc
Show file tree
Hide file tree
Showing 33 changed files with 113 additions and 113 deletions.
4 changes: 2 additions & 2 deletions nimbus/core/clique/clique_genvote.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2018 Status Research & Development GmbH
# Copyright (c) 2018-2024 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0)
Expand Down Expand Up @@ -196,7 +196,7 @@ proc cliqueGenvote*(
##
## [..]
##
c.clique_genvote(voter, seal,
c.cliqueGenvote(voter, seal,
parent = c.cfg.db.getCanonicalHead,
elapsed = elapsed,
voteInOk = voteInOk,
Expand Down
6 changes: 3 additions & 3 deletions nimbus/db/aristo/aristo_check/check_be.nim
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ proc checkBE*[T: RdbBackendRef|MemBackendRef|VoidBackendRef](
discard vids.merge Interval[VertexID,uint64].new(
VertexID(LEAST_FREE_VID),high(VertexID))

for (vid,vtx) in T.walkVtxBE db:
for (vid,vtx) in T.walkVtxBe db:
if not vtx.isValid:
return err((vid,CheckBeVtxInvalid))
let rc = db.getKeyBE vid
Expand All @@ -115,8 +115,8 @@ proc checkBE*[T: RdbBackendRef|MemBackendRef|VoidBackendRef](
if vtx.ePfx.len == 0:
return err((vid,CheckBeVtxExtPfxMissing))

for (vid,key) in T.walkKeyBE db:
if not key.isvalid:
for (vid,key) in T.walkKeyBe db:
if not key.isValid:
return err((vid,CheckBeKeyInvalid))
let vtx = db.getVtxBE(vid).valueOr:
return err((vid,CheckBeVtxMissing))
Expand Down
14 changes: 7 additions & 7 deletions nimbus/db/aristo/aristo_debug.nim
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ proc del(xMap: var VidsByKeyTab; key: HashKey; vids: HashSet[VertexID]) =
for vid in vids:
xMap.del(key, vid)

proc add(xMap: var VidsByKeyTab; key: Hashkey; vid: VertexID) =
proc add(xMap: var VidsByKeyTab; key: HashKey; vid: VertexID) =
xMap.withValue(key,value):
value[].incl vid
do: # else if not found
Expand Down Expand Up @@ -354,7 +354,7 @@ proc ppXMap*(
# Extra reverse lookups
if 0 < revKeys.len:
proc ppRevKey(vid: VertexID): string =
"(ø," & revOnly.getOrVoid(vid).ppkey(db) & ")"
"(ø," & revOnly.getOrVoid(vid).ppKey(db) & ")"
var (i, r) = (0, revKeys[0])
result &= revKeys[0].ppRevKey
for n in 1 ..< revKeys.len:
Expand Down Expand Up @@ -517,14 +517,14 @@ proc ppLayer(
result &= info.doPrefix(0 < tLen) & layer.delta.sTab.ppSTab(db,indent+2)
if lTabOk:
let
tlen = layer.final.lTab.len
tLen = layer.final.lTab.len
info = "lTab(" & $tLen & ")"
result &= info.doPrefix(0 < tLen) & layer.final.lTab.ppLTab(db,indent+2)
if kMapOk:
let
tLen = layer.delta.kMap.len
ulen = layer.delta.pAmk.len
lInf = if tLen == uLen: $tLen else: $tLen & "," & $ulen
uLen = layer.delta.pAmk.len
lInf = if tLen == uLen: $tLen else: $tLen & "," & $uLen
info = "kMap(" & lInf & ")"
result &= info.doPrefix(0 < tLen + uLen)
result &= db.ppXMap(layer.delta.kMap, layer.delta.pAmk, indent+2)
Expand Down Expand Up @@ -691,14 +691,14 @@ proc pp*(
indent = 4;
): string =
let db = db.orDefault
"{" & pAmk.sortedkeys
"{" & pAmk.sortedKeys
.mapIt((it, pAmk.getOrVoid it))
.mapIt("(" & it[0].ppKey(db) & "," & it[1].ppVid & ")")
.join("," & indent.toPfx(1)) & "}"

proc pp*(pAmk: VidsByKeyTab; db = AristoDbRef(nil); indent = 4): string =
let db = db.orDefault
"{" & pAmk.sortedkeys
"{" & pAmk.sortedKeys
.mapIt((it, pAmk.getOrVoid it))
.mapIt("(" & it[0].ppKey(db) & "," & it[1].ppVids & ")")
.join("," & indent.toPfx(1)) & "}"
Expand Down
4 changes: 2 additions & 2 deletions nimbus/db/ledger/accounts_cache.nim
Original file line number Diff line number Diff line change
Expand Up @@ -680,14 +680,14 @@ proc collectWitnessData*(ac: AccountsCache) =
do:
ac.witnessCache[address] = witnessData(acc)

func multiKeys(slots: HashSet[UInt256]): MultikeysRef =
func multiKeys(slots: HashSet[UInt256]): MultiKeysRef =
if slots.len == 0: return
new result
for x in slots:
result.add x.toBytesBE
result.sort()

proc makeMultiKeys*(ac: AccountsCache): MultikeysRef =
proc makeMultiKeys*(ac: AccountsCache): MultiKeysRef =
# this proc is called after we done executing a block
new result
for k, v in ac.witnessCache:
Expand Down
4 changes: 2 additions & 2 deletions nimbus/db/ledger/accounts_ledger.nim
Original file line number Diff line number Diff line change
Expand Up @@ -715,14 +715,14 @@ proc collectWitnessData*(ac: AccountsLedgerRef) =
do:
ac.witnessCache[address] = witnessData(acc)

func multiKeys(slots: HashSet[UInt256]): MultikeysRef =
func multiKeys(slots: HashSet[UInt256]): MultiKeysRef =
if slots.len == 0: return
new result
for x in slots:
result.add x.toBytesBE
result.sort()

proc makeMultiKeys*(ac: AccountsLedgerRef): MultikeysRef =
proc makeMultiKeys*(ac: AccountsLedgerRef): MultiKeysRef =
# this proc is called after we done executing a block
new result
for k, v in ac.witnessCache:
Expand Down
4 changes: 2 additions & 2 deletions nimbus/db/ledger/backend/accounts_cache.nim
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -129,7 +129,7 @@ proc ledgerMethods(lc: impl.AccountsCache): LedgerFns =
logEntriesFn: proc(): seq[Log] =
lc.logEntries(),

makeMultiKeysFn: proc(): MultikeysRef =
makeMultiKeysFn: proc(): MultiKeysRef =
lc.makeMultiKeys(),

persistFn: proc(clearEmptyAccount: bool, clearCache: bool) =
Expand Down
8 changes: 4 additions & 4 deletions nimbus/db/ledger/backend/accounts_ledger.nim
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -27,7 +27,7 @@ func savePoint(sp: LedgerSpRef): impl.LedgerSavePoint =
wrp.LedgerSavePoint(sp).sp

# ----------------

proc ledgerMethods(lc: impl.AccountsLedgerRef): LedgerFns =
LedgerFns(
accessListFn: proc(eAddr: EthAddress) =
Expand All @@ -47,7 +47,7 @@ proc ledgerMethods(lc: impl.AccountsLedgerRef): LedgerFns =

beginSavepointFn: proc(): LedgerSpRef =
wrp.LedgerSavePoint(sp: lc.beginSavepoint()),

clearStorageFn: proc(eAddr: EthAddress) =
lc.clearStorage(eAddr),

Expand Down Expand Up @@ -120,7 +120,7 @@ proc ledgerMethods(lc: impl.AccountsLedgerRef): LedgerFns =
logEntriesFn: proc(): seq[Log] =
lc.logEntries(),

makeMultiKeysFn: proc(): MultikeysRef =
makeMultiKeysFn: proc(): MultiKeysRef =
lc.makeMultiKeys(),

persistFn: proc(clearEmptyAccount: bool, clearCache: bool) =
Expand Down
4 changes: 2 additions & 2 deletions nimbus/db/ledger/base.nim
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -266,7 +266,7 @@ proc logEntries*(ldg: LedgerRef): seq[Log] =
result = ldg.methods.logEntriesFn()
ldg.ifTrackApi: debug apiTxt, ctx, elapsed, result

proc makeMultiKeys*(ldg: LedgerRef): MultikeysRef =
proc makeMultiKeys*(ldg: LedgerRef): MultiKeysRef =
ldg.beginTrackApi LdgMakeMultiKeysFn
result = ldg.methods.makeMultiKeysFn()
ldg.ifTrackApi: debug apiTxt, ctx, elapsed
Expand Down
2 changes: 1 addition & 1 deletion nimbus/db/ledger/base/base_desc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type
IsEmptyAccountFn* = proc(eAddr: EthAddress): bool {.noRaise.}
IsTopLevelCleanFn* = proc(): bool {.noRaise.}
LogEntriesFn* = proc(): seq[Log] {.noRaise.}
MakeMultiKeysFn* = proc(): MultikeysRef {.noRaise.}
MakeMultiKeysFn* = proc(): MultiKeysRef {.noRaise.}
PersistFn* = proc(clearEmptyAccount: bool, clearCache: bool) {.noRaise.}
RipemdSpecialFn* = proc() {.noRaise.}
RollbackFn* = proc(sp: LedgerSpRef) {.noRaise.}
Expand Down
2 changes: 1 addition & 1 deletion nimbus/evm/state.nim
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ proc `generateWitness=`*(vmState: BaseVMState, status: bool) =

proc buildWitness*(
vmState: BaseVMState,
mkeys: MultikeysRef): seq[byte] {.raises: [CatchableError].} =
mkeys: MultiKeysRef): seq[byte] {.raises: [CatchableError].} =
let rootHash = vmState.stateDB.rootHash
let flags = if vmState.fork >= FkSpurious: {wfEIP170} else: {}

Expand Down
4 changes: 2 additions & 2 deletions nimbus/rpc/experimental.nim
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type
proc getBlockWitness*(
com: CommonRef,
blockHeader: BlockHeader,
statePostExecution: bool): (MultikeysRef, BlockWitness)
statePostExecution: bool): (MultiKeysRef, BlockWitness)
{.raises: [RlpError, BlockNotFound, ValueError, CatchableError].} =

let
Expand Down Expand Up @@ -67,7 +67,7 @@ proc getBlockWitness*(

proc getBlockProofs*(
accDB: ReadOnlyStateDB,
mkeys: MultikeysRef): seq[ProofResponse] {.raises: [RlpError].} =
mkeys: MultiKeysRef): seq[ProofResponse] {.raises: [RlpError].} =

var blockProofs = newSeq[ProofResponse]()

Expand Down
8 changes: 4 additions & 4 deletions nimbus/sync/snap/worker/db/hexary_debug.nim
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ proc ppImpl(s: string; hex = false): string =
proc ppImpl(key: RepairKey; db: HexaryTreeDbRef): string =
if key.isZero:
return "ø"
if not key.isNodekey:
if not key.isNodeKey:
var num: uint64
(addr num).copyMem(unsafeAddr key.ByteArray33[25], 8)
return "%" & $num
Expand Down Expand Up @@ -146,7 +146,7 @@ proc ppImpl(db: HexaryTreeDbRef; root: NodeKey): seq[string] =
accu.add @[(0u64, "($0" & "," & root.ppImpl(db) & ")")]
for key,node in db.tab.pairs:
accu.add (
key.ppImpl(db).tokey,
key.ppImpl(db).toKey,
"(" & key.ppImpl(db) & "," & node.ppImpl(db) & ")")

accu.sorted(cmpIt).mapIt(it[1])
Expand Down Expand Up @@ -420,7 +420,7 @@ proc fillFromLeft(

# Find first least path
var
here = XPath(root: rootKey).pathLeast(rootkey.to(Blob), getFn)
here = XPath(root: rootKey).pathLeast(rootKey.to(Blob), getFn)
countSteps = 0

if 0 < here.path.len:
Expand Down Expand Up @@ -456,7 +456,7 @@ proc fillFromRight(

# Find first least path
var
here = XPath(root: rootKey).pathMost(rootkey.to(Blob), getFn)
here = XPath(root: rootKey).pathMost(rootKey.to(Blob), getFn)
countSteps = 0

if 0 < here.path.len:
Expand Down
6 changes: 3 additions & 3 deletions stateless/does-not-compile/json_from_tree.nim
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -28,7 +28,7 @@ type
StackElem = object
node: seq[byte]
parentGroup: Group
keys: MultikeysRef
keys: MultiKeysRef
depth: int
storageMode: bool

Expand Down Expand Up @@ -333,7 +333,7 @@ proc getBranchRecurse(wb: var WitnessBuilder, z: var StackElem) =
raise newException(CorruptedTrieDatabase,
"HexaryTrie node with an unexpected number of children")

proc buildWitness*(wb: var WitnessBuilder, keys: MultikeysRef): string =
proc buildWitness*(wb: var WitnessBuilder, keys: MultiKeysRef): string =

# witness version
wb.writeByte(BlockWitnessVersion, "version")
Expand Down
8 changes: 4 additions & 4 deletions stateless/does-not-compile/json_witness_gen.nim
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -18,7 +18,7 @@ import
type
DB = TrieDatabaseRef

StorageKeys = tuple[storageRoot: Hash256, keys: MultikeysRef]
StorageKeys = tuple[storageRoot: Hash256, keys: MultiKeysRef]

AccountDef = object
storageKeys: MultiKeysRef
Expand Down Expand Up @@ -47,7 +47,7 @@ proc randCode(db: DB): Hash256 =

proc randStorage(db: DB, numSlots: int): StorageKeys =
if rand(0..1) == 0 or numSlots == 0:
result = (emptyRlpHash, MultikeysRef(nil))
result = (emptyRlpHash, MultiKeysRef(nil))
else:
var trie = initStorageTrie(db)
var keys = newSeq[StorageSlot](numSlots)
Expand All @@ -57,7 +57,7 @@ proc randStorage(db: DB, numSlots: int): StorageKeys =
trie.putSlotBytes(keys[i], rlp.encode(randU256()))

if rand(0..1) == 0:
result = (trie.rootHash, MultikeysRef(nil))
result = (trie.rootHash, MultiKeysRef(nil))
else:
var m = newMultikeys(keys)
result = (trie.rootHash, m)
Expand Down
Loading

0 comments on commit 6ff2edc

Please sign in to comment.