Fix monitor persistence and cross-chain receipt finality - #4
Draft
fengjy73 wants to merge 23 commits into
Draft
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.
What changed
anchor_processuniqueness, including an idempotent production upgrade scriptState=DUS_FINALIZED/DUS_ARCHIVEDas durable finality when final relay transactions omitConfirmStateRoot causes
Legacy Mychain deployments predated the monitor-aware SDP/PTC implementations. Relayer also persists some Mychain addresses as JSON envelopes; hashing the complete envelope produced non-existent contract identities. The generated Monitor Verifier name and updated client configuration were not persisted after setup, so restart recovery could silently lose regulatory wiring.
The regulatory branch also predates two generic Relayer fixes already merged upstream: persisting the merged
BlockchainMetaon a partial update and includingtpbta_lane_keyin anchor progress uniqueness. Both are backported here because losing either state can break monitor/PTC recovery on this branch.Receipt queries had two independent finality defects: the Relayer-to-plugin gRPC call had no deadline, and the Dioxide plugins treated every missing next-hop relay as transient. An archived relay group can have no next hop because an embedded invocation already failed; that state is terminal and must be reported.
The monitor envelope used reverse 32-byte chunks followed by a length word. The previous assembly decoder depended on compiler-specific memory alignment: target receipts could succeed while a 36-byte business payload was truncated and zero padded. The replacement decoder computes the legacy codec boundaries explicitly and copies logical bytes without assembly.
FISCO monitor replacement initially deployed an empty MonitorVerifier and repointed the existing PTC Hub. Existing monitor-node endorsements live in the old verifier and are populated when a TPBTA is added, so the new verifier rejected every regulated target call with
no monitor node endorse info. The upgrade now reuses the verifier already bound to the current PTC Hub.The corrected source-BTA test exposed a second compatibility boundary: Dioxide is a V0 BBC target with no PTC Hub, so calling its V1
hasTpBtainterface blocked an otherwise valid Ethereum-to-Dioxide V1 message after regulatory approval. Relayer now reads the receiving BBC context and only uploads TPBTA when the target actually exposes a configured PTC contract.After the Dioxide submissions became reachable, receipt confirmation exposed a terminal-state persistence bug. The confirm worker already owns the
sdp_msg_poolrow ID, but the old code updated by the transaction hash returned by the plugin. Dioxide's native non-hex hash path left the row pending, causing duplicate execution reports. Confirmed results now update by primary key while retaining the native hash as evidence.One more Dioxide response-shape mismatch remained after persistence was fixed. Final relay transactions can expose only
State=DUS_ARCHIVEDand omitConfirmState; the plugin treated those durable transactions as unknown forever. Both Dioxide implementations now use either confirmed-transaction state or durable block state, while invalid/forked/archived-uncle states are terminal failures. A node-leveltransaction not foundremains an error and is isolated to its own confirmation item rather than blocking a healthy item in the same batch.Validation
981a7490...05c98,e31135e2...54172, andac3c38e6...7b102all reachedSUCCESS, regulationTARGET_EXECUTED, and exact receiver payload recovery5d055175...a1a7changed from an incorrectunknown/pendingreceipt toSUCCESS,tx_success, and regulatorTARGET_EXECUTED success=truewhen the archived-state fix was loaded148af653...fe73dreached target transaction42csksb2...cd5mg, PTC weight 100%, regulationAPPROVED/TARGET_EXECUTED, and all four completeness flags; its Dioxide relay group wasDUS_ARCHIVED/TXN_ARCHIVED, both embedded invocations succeeded, and the receiver payload decoded exactly toeth-to-diox-statefix-regulated-1787692602-sdp-v1my02-> Dioxidediox04: UCP402c5099b2bb0a24dad6de5968362abc8884657abcbd798eb30eaede2fb66266diox04-> Ethereumeth04: UCP7df31f8e109259f25baed08cfaf4b86c22d85d1462557902d1fe19de69a210b1eth04-> Dioxidediox04: UCP0503484006a919b03555cda37bbc6a97fbd38c95d51035a657fe589c6d9af832APPROVED,TARGET_EXECUTED, and all four completeness flagstrueThe full reactor build still depends on private GitHub Packages snapshots; targeted tests were compiled and run against the production-compatible dependency set.