Skip to content

Conversation

@Chengxuan
Copy link
Contributor

@Chengxuan Chengxuan commented Sep 10, 2025

Exposing a method to allow confirmation map building using the in-memory canonical chain in the connector for efficient confirmation calculation of any given tx hash.

The new approach is similar to the existing confirmation manager, but with the following differences:

  1. No need to build a confirmation queue outside the block listener; the in-memory canonical chain in the block listener is reused for confirmation checking
  2. Supports confirmation requests that have different lengths

The in-memory canonical chain will be used to build up the confirmations when it contains required blocks, then fall back to existing blocks that get passed into the reconciler. Finally query the targeting JSON-RPC endpoint.

More details in the firefly-evmconnect PR: hyperledger/firefly-evmconnect#174

@Chengxuan Chengxuan requested a review from a team as a code owner September 10, 2025 12:32
@Chengxuan Chengxuan force-pushed the expose-reconcile-confirmation-map branch from 7bc7bb8 to 07127ff Compare September 10, 2025 15:33
Signed-off-by: Chengxuan Xing <[email protected]>
Signed-off-by: Chengxuan Xing <[email protected]>
@Chengxuan Chengxuan changed the title adding a new function for reconciling confirmations map adding a new function for reconciling confirmations map in the connector interface Sep 11, 2025
Signed-off-by: Chengxuan Xing <[email protected]>
Copy link
Contributor

@EnriqueL8 EnriqueL8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few thoughts

Signed-off-by: Chengxuan Xing <[email protected]>
Signed-off-by: Chengxuan Xing <[email protected]>
Signed-off-by: Chengxuan Xing <[email protected]>
Signed-off-by: Chengxuan Xing <[email protected]>
Comment on lines +98 to +112
type ConfirmationUpdateResult struct {
// a linked list of accumulated confirmations for a transaction
// the list is sorted by block number
// - the first block is the block that contains the transaction hash
// - the last block is the most recent confirmation
// this list can be used as input to the future reconcile request to avoid re-fetching the blocks if they are no longer
// in the in-memory partial chain
// WARNING: mutation to this list is not expected, invalid modifications will cause inefficiencies in the reconciliation process
// `rebuilt` will be true if an invalid confirmation list is detected by the reconciliation process
Confirmations []*MinimalBlockInfo `json:"confirmations,omitempty"`
Rebuilt bool `json:"rebuilt,omitempty"` // when true, it means the existing confirmations contained invalid blocks, the new confirmations are rebuilt from scratch
NewFork bool `json:"newFork,omitempty"` // when true, it means a new fork was detected based on the existing confirmations
Confirmed bool `json:"confirmed,omitempty"` // when true, it means the confirmation list is complete and the transaction is confirmed
TargetConfirmationCount uint64 `json:"targetConfirmationCount"` // the target number of confirmations for this reconcile request
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice clear comments thank you 👍

@peterbroadhurst peterbroadhurst merged commit 59cd287 into hyperledger:main Oct 27, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants