Skip to content

Commit

Permalink
Merge branch 'master' into Beacon-sync-maint-update-and-move-headers-…
Browse files Browse the repository at this point in the history
…cache-to-fc-module
  • Loading branch information
mjfh authored Mar 7, 2025
2 parents f7f71f8 + e4610e0 commit 62466bc
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 29 deletions.
21 changes: 7 additions & 14 deletions execution_chain/core/tx_pool/tx_desc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -167,25 +167,13 @@ proc getNonce(xp: TxPoolRef; account: Address): AccountNonce =
xp.vmState.ledger.getNonce(account)

proc classifyValid(xp: TxPoolRef; tx: Transaction, sender: Address): bool =
if tx.tip(xp.baseFee) <= 0.GasInt:
debug "Invalid transaction: No tip"
return false

if tx.gasLimit > xp.gasLimit:
debug "Invalid transaction: Gas limit too high",
txGasLimit = tx.gasLimit,
gasLimit = xp.gasLimit
return false

# Ensure that the user was willing to at least pay the base fee
# And to at least pay the current data gasprice
if tx.txType >= TxEip1559:
if tx.maxFeePerGas < xp.baseFee:
debug "Invalid transaction: maxFeePerGas lower than baseFee",
maxFeePerGas = tx.maxFeePerGas,
baseFee = xp.baseFee
return false

if tx.txType == TxEip4844:
let
excessBlobGas = xp.excessBlobGas
Expand Down Expand Up @@ -226,10 +214,15 @@ proc classifyValid(xp: TxPoolRef; tx: Transaction, sender: Address): bool =
return false

if tx.txType >= TxEip1559:
if tx.tip(xp.baseFee) < 1.GasInt:
debug "Invalid transaction: EIP-1559 transaction with tip lower than 1"
# Ensure that the user was willing to at least pay the base fee
# And to at least pay the current data gasprice
if tx.maxFeePerGas < xp.baseFee:
debug "Invalid transaction: maxFeePerGas lower than baseFee",
maxFeePerGas = tx.maxFeePerGas,
baseFee = xp.baseFee
return false

# No tip checking as tip is optional after EIP-1559
if tx.maxFeePerGas < 1.GasInt:
debug "Invalid transaction: EIP-1559 transaction with maxFeePerGas lower than 1"
return false
Expand Down
4 changes: 2 additions & 2 deletions fluffy/fluffy.nim
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,14 @@ when isMainModule:
raiseAssert exc.msg # shouldn't happen

notice "Shutting down after having received SIGINT"
node.state = PortalNodeState.Stopping
node.status = PortalNodeStatus.Stopping

try:
setControlCHook(controlCHandler)
except Exception as exc: # TODO Exception
warn "Cannot set ctrl-c handler", msg = exc.msg

while node.state == PortalNodeState.Running:
while node.status == PortalNodeStatus.Running:
try:
poll()
except CatchableError as e:
Expand Down
4 changes: 2 additions & 2 deletions fluffy/network/beacon/beacon_network.nim
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,10 @@ proc processContentLoop(n: BeaconNetwork) {.async: (raises: []).} =
proc statusLogLoop(n: BeaconNetwork) {.async: (raises: []).} =
try:
while true:
await sleepAsync(60.seconds)

info "Beacon network status",
routingTableNodes = n.portalProtocol.routingTable.len()

await sleepAsync(60.seconds)
except CancelledError:
trace "statusLogLoop canceled"

Expand Down
4 changes: 2 additions & 2 deletions fluffy/network/history/history_network.nim
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,10 @@ proc processContentLoop(n: HistoryNetwork) {.async: (raises: []).} =
proc statusLogLoop(n: HistoryNetwork) {.async: (raises: []).} =
try:
while true:
await sleepAsync(60.seconds)

info "History network status",
routingTableNodes = n.portalProtocol.routingTable.len()

await sleepAsync(60.seconds)
except CancelledError:
trace "statusLogLoop canceled"

Expand Down
9 changes: 6 additions & 3 deletions fluffy/network/state/state_endpoints.nim
Original file line number Diff line number Diff line change
@@ -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).
Expand Down Expand Up @@ -161,8 +161,11 @@ proc getStorageProof(
doAssert(nibblesIdx <= nibbles.len())
ok((proof, nibblesIdx == nibbles.len()))

proc getAccount(
n: StateNetwork, stateRoot: Hash32, address: Address, maybeBlockHash: Opt[Hash32]
proc getAccount*(
n: StateNetwork,
stateRoot: Hash32,
address: Address,
maybeBlockHash = Opt.none(Hash32),
): Future[Opt[Account]] {.async: (raises: [CancelledError]).} =
let (accountProof, exists) = (
await n.getAccountProof(stateRoot, address, maybeBlockHash)
Expand Down
4 changes: 2 additions & 2 deletions fluffy/network/state/state_network.nim
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ proc processContentLoop(n: StateNetwork) {.async: (raises: []).} =
proc statusLogLoop(n: StateNetwork) {.async: (raises: []).} =
try:
while true:
await sleepAsync(60.seconds)

info "State network status",
routingTableNodes = n.portalProtocol.routingTable.len()

await sleepAsync(60.seconds)
except CancelledError:
trace "statusLogLoop canceled"

Expand Down
6 changes: 3 additions & 3 deletions fluffy/portal_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export
beacon_light_client, history_network, state_network, portal_protocol_config, forks

type
PortalNodeState* = enum
PortalNodeStatus* = enum
Starting
Running
Stopping
Expand All @@ -40,7 +40,7 @@ type
contentRequestRetries*: int

PortalNode* = ref object
state*: PortalNodeState
status*: PortalNodeStatus
discovery: protocol.Protocol
contentDB: ContentDB
streamManager: StreamManager
Expand Down Expand Up @@ -228,7 +228,7 @@ proc start*(n: PortalNode) =

n.statusLogLoop = statusLogLoop(n)

n.state = PortalNodeState.Running
n.status = PortalNodeStatus.Running

proc stop*(n: PortalNode) {.async: (raises: []).} =
debug "Stopping Portal node"
Expand Down

0 comments on commit 62466bc

Please sign in to comment.