cuprated: Add graceful shutdown, pt2: service error propagation - #586
Open
redsh4de wants to merge 16 commits into
Open
cuprated: Add graceful shutdown, pt2: service error propagation#586redsh4de wants to merge 16 commits into
redsh4de wants to merge 16 commits into
Conversation
redsh4de
marked this pull request as draft
February 28, 2026 14:35
redsh4de
marked this pull request as ready for review
March 1, 2026 14:41
redsh4de
force-pushed
the
feat/graceful-shutdown-pt2
branch
from
March 15, 2026 22:15
aac614a to
1a41630
Compare
redsh4de
marked this pull request as draft
March 17, 2026 18:13
redsh4de
force-pushed
the
feat/graceful-shutdown-pt2
branch
from
March 18, 2026 02:13
91f6723 to
e3d9960
Compare
redsh4de
marked this pull request as ready for review
March 18, 2026 02:25
redsh4de
force-pushed
the
feat/graceful-shutdown-pt2
branch
2 times, most recently
from
March 19, 2026 00:42
0cf53be to
15bc617
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt2
branch
4 times, most recently
from
March 24, 2026 22:43
8adc7f1 to
79e3e61
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt2
branch
7 times, most recently
from
April 26, 2026 19:53
d46811f to
d6c42d4
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt2
branch
2 times, most recently
from
May 5, 2026 17:01
9bffcac to
cc55d00
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt2
branch
from
May 12, 2026 15:58
cc55d00 to
fdcd3c7
Compare
9 tasks
redsh4de
force-pushed
the
feat/graceful-shutdown-pt2
branch
2 times, most recently
from
August 5, 2026 21:44
d699845 to
2910ab2
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt2
branch
from
August 14, 2026 22:18
ef31fa6 to
4e46c1c
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt2
branch
from
August 14, 2026 22:38
4e46c1c to
b422f45
Compare
Move block and transaction specific validation failures into BlockError and TransactionError, leaving ExtendedConsensusError responsible only for distinguishing consensus errors from database failures. Flatten TxValidationError into IncomingTxError to avoid redundancy
return missing alt-chain context as None so consensus handles it as a invalid parent instead of a db error
Contributor
Author
|
fwiw after these changes i kind of want to rename |
redsh4de
force-pushed
the
feat/graceful-shutdown-pt2
branch
from
August 19, 2026 14:44
b1b0410 to
164e9ea
Compare
Boog900
reviewed
Aug 23, 2026
redsh4de
force-pushed
the
feat/graceful-shutdown-pt2
branch
from
August 23, 2026 23:38
7878dcc to
d873658
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Depends on pt1, PR #585
Building on part 1, this replaces the panic-on-error patterns in cuprated's services with error propagation that makes use of the graceful shutdown mechanism
Why
So we dont panic and insta-crash upon a error, shutdown should be graceful. Internal errors still caused panics before this via PANIC_CRITICAL_SERVICE_ERROR
Where
cuprated:blockchain/error.rs(new):BlockValidationErrorHardFork(HardForkError),Other(ExtendedConsensusError)BlockManagerErrorValidation(BlockValidationError),Internal(#[from] tower::BoxError)IncomingBlockErrorValidation(BlockValidationError),Internal(tower::BoxError),Orphan,UnknownTransactions(_, _),TooManyTxs,ChannelClosedtxpool/error.rs(new):TxValidationErrorParse(io::Error),Consensus(ExtendedConsensusError),DuplicateTransaction,RelayRule(RelayRuleError)IncomingTxErrorValidation(#[from] TxValidationError),Internal(#[from] tower::BoxError)monitor.rs- addTaskExecutor::spawn_critical,panic_messagehelper.logging.rs- return the log guard, hold it until shutdown completes.constants.rs- renamePANIC_CRITICAL_SERVICE_ERRORtoCRITICAL_SERVICE_ERRORlib.rs-Node::launchreturnsResult; on init failure it cancels partially spawned subsystems before returning the error.blockchain.rs-check_add_genesisreturnsResult.blockchain/manager.rs- run loop returnsResult,spawn_criticalfor syncer + manager.blockchain/manager/handler.rs-.expect(...)->?throughout, handlers returnResult<_, BlockManagerError>orResult<_, tower::BoxError>,handle_commandroutesInternalvia?andValidationvia response channel. Invariant violations kept as panics.txpool/manager.rs- uniform DB-error escalation: all 6 handlers propagateTxPoolErrorvia?. Reorderpromote_txandremove_tx_from_poolto write to DB first, then apply in memory.txpool/incoming_tx.rs-IncomingTxHandler::initreturnsResult.tor.rs,p2p.rs-transport_*_config/initialize_clearnet_p2p/initialize_tor_p2preturnResult, Tor logs+skips on failure.rpc/server.rs-init_rpc_serversreturnsResult, per-server task usesspawn- If a RPC server fails to start, the error is logged but doesn't initiate shutdown.cuprate-typesTxConversionErrorre-exported.How
1. spawn_critical wraps each subsystem's future:
Ok(())Err(_)panic_message-> trigger shutdown2. Added layered errors.
Per subsystem: a typed
ValidationErrorfor peer-fault paths, plus a union withValidationandInternal(tower::BoxError)arms.Fromimpls route (ExtendedConsensusError::DBErr-> Internal; else -> Validation). The manager matches between the two:Internal(_)?->spawn_criticalValidation(_)