Handle BCS serialization failure gracefully in the bridge burn monitor#6584
Closed
ma2bd wants to merge 1 commit into
Closed
Handle BCS serialization failure gracefully in the bridge burn monitor#6584ma2bd wants to merge 1 commit into
ma2bd wants to merge 1 commit into
Conversation
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.
Motivation
Part of #147 (make sure the code handles
bcs::to_bytesfailures gracefully). BCSserialization is fallible — it errors on containers nested deeper than
MAX_CONTAINER_DEPTH(500) or sequences longer thanMAX_SEQUENCE_LENGTH(2³¹−1) — soproduction code should not
.expect()on it.persist_cert_bytesin the bridge's Linera burn monitor serialized aConfirmedBlockCertificatewith.expect("BCS-serialize cert"). It runs in thelong-lived burn-processor loop, so a serialization failure would panic and abort the
whole monitor task — even though the very next thing the function does (and the
certificate read in its caller) already logs and skips on error. This makes the
serialization failure path consistent with the surrounding infrastructure-error handling.
Proposal
Replace the
.expect()with amatchthat logs a warning and returns, skipping theheight without consuming any burn's retry budget — mirroring how the caller handles a
failed certificate read.
Test Plan
CI (
cargo check/cargo clippy/cargo +nightly fmt). The change is a localerror-handling swap with no behavioral change on the success path.
Release Plan
testnetbranch, thenLinks
bcs::to_bytesgracefully #147ProvenEvents::newinlinera-bridge/src/block_proof.rsstill
.expect()s when BCS-serializing anEvent; making it fallible ripples intoalloy::contract::Resultcallers, so it is left as a separate change.