Add full transaction CBOR reconstruction via raw segment splicing (returnFullTxCbor) [next] - #176
Merged
Merged
Conversation
New YaciConfig.returnFullTxCbor flag. When enabled, the standalone transaction CBOR ([body, witness_set, is_valid, auxiliary_data] per era CDDL) is assembled by splicing the exact segment bytes sliced from the original block, so no CBOR encoder touches the on-chain bytes: - AuxDataExtractor slices raw auxiliary_data bytes per tx index (definite and indefinite maps) - Witnesses.cbor and AuxData.cbor carry the raw segment bytes; TransactionBody.cbor is also populated when the new flag is set - TxCborUtil assembles the envelope: 0x83 for Shelley/Allegra/Mary, 0x84 with isValid for Alonzo and later; fails closed (null) for Byron/null era or missing segments - Helper Transaction gains txCbor, populated in BlockFetchAgentListenerAdapter - WitnessUtil.getWitnessRawData now handles indefinite-length witness-set arrays Fail-closed invariants: segment count mismatches skip full tx cbor for the whole block, and auxiliary data slices are verified against the body's auxiliary_data_hash (blake2b-256) before use. A missing or invalid segment yields txCbor=null, never wrong bytes, and sync continues unaffected. Default behavior is unchanged when the flag is off. Verified with a real Babbage preprod block fixture: per-segment byte equality, CCL Transaction.deserialize round-trip, invalid-tx flag, and the aux-hash mismatch path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> (cherry picked from commit f3182a5)
|
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.



Summary
Cherry-pick of #169 (merged to
mainas0b37894) ontonext, bringing thereturnFullTxCborfeature to thenextbranch.f3182a5— Add full transaction CBOR reconstruction via raw segment splicing (picked as946d21bwith-xannotation)6e93408(Replace Mockito stubs with Netty fakes in SessionTest) — it was an incidental CI test fix against the old, much simplerSessionTestonmain. Onnext,SessionTesthas since been rewritten and expanded (session retry / candidate work from feat(helper): app-chain sync (103) on the shared peer connection #175), so that commit no longer applies; the existing Mockito-based tests onnextpass as-is.Conflict resolution
One conflict in
YaciConfig.java: both branches appended accessors at the same location (blockFetchCheckRangeExistsonnextvs. the newreturnFullTxCboraccessors). Resolved by keeping both.WitnessUtil.javaandBlockSerializer.javaauto-merged.Testing
:core:test(211 tests) and:helper:test(28 tests) suites pass with no failures, including the newAuxDataExtractorTest,BlockSerializerRawSegmentTest,TxCborUtilTest, andBlockFetchAgentListenerAdapterTest.🤖 Generated with Claude Code