Skip to content

Conversation

dai1975
Copy link
Contributor

@dai1975 dai1975 commented Aug 12, 2025

This is 3rd part of chain query parallelization. see first pullreq for details: #169

Ref: diffs to part2: dai1975#3

  • first PR
    • handshake connection
    • handshake channel
  • this PR
    • channel upgrade
  • later PR
    • relay packets

Daisuke Kanda added 30 commits July 23, 2025 03:39
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
fix
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
fix
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
fix
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
fix
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
@dai1975 dai1975 requested review from siburu and Copilot August 12, 2025 11:36
Copilot

This comment was marked as outdated.

Daisuke Kanda added 2 commits August 12, 2025 22:31
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
@dai1975 dai1975 force-pushed the lo7181-long-update-and-lost-state-3 branch from 38785f3 to f679d7e Compare August 13, 2025 08:53
siburu and others added 11 commits August 13, 2025 23:43
…te-and-lost-state

in case of one chain takes long time for updating and the other chain loses old state
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
@dai1975 dai1975 force-pushed the lo7181-long-update-and-lost-state-3 branch from f679d7e to 35424ad Compare August 14, 2025 11:37
@dai1975 dai1975 requested a review from Copilot August 14, 2025 12:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request implements chain query parallelization for channel upgrade operations, focusing on scenarios where one chain takes a long time to update while another chain loses old state.

  • Introduces debug chain and prover wrappers to simulate network conditions like missing trie nodes and wait times
  • Parallelizes chain queries for handshake operations and channel upgrades using goroutines
  • Refactors service and command relay logic to execute src→dst and dst→src relay operations concurrently

Reviewed Changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
chains/debug/* Debug wrapper implementations for simulating network conditions during testing
provers/debug/* Debug prover wrapper for simulating delays and missing state conditions
core/service.go Parallelized relay service execution with separate goroutines for each direction
core/channel-upgrade.go Parallelized channel upgrade queries and state collection
core/connection.go Parallelized connection handshake queries and state collection
core/query.go Refactored query functions to support individual chain queries
tests/cases/tm2tm/scripts/* Test scripts with debug environment variables and extended timeouts

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@@ -129,14 +133,14 @@ checkResult orig
echo '##### case 8 #####'
$RLY tx channel-upgrade init ibc01 ibc0 $altSrcOpts
$RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHCOMPLETE --target-dst-state FLUSHING
sleep 20 # ibc1 exceeds upgrade.timeout.timestamp
sleep 100 # ibc1 exceeds upgrade.timeout.timestamp
Copy link
Preview

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

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

The sleep duration increased from 20 to 100 seconds. Consider using a smaller value or making it configurable to avoid unnecessarily long test execution times.

Suggested change
sleep 100 # ibc1 exceeds upgrade.timeout.timestamp
sleep ${SLEEP_DURATION} # ibc1 exceeds upgrade.timeout.timestamp

Copilot uses AI. Check for mistakes.

$RLY tx channel-upgrade execute ibc01 # ibc0 <= chanUpgradeTimeout, ibc1 <= chanUpgradeCancel
checkResult orig

echo '##### case 9 #####'
$RLY tx channel-upgrade init ibc01 ibc0 $altSrcOpts
$RLY tx channel-upgrade init ibc01 ibc1 $altDstOpts
$RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHING --target-dst-state FLUSHING
sleep 20 # Both chains exceed upgrade.timeout.timestamp
sleep 100 # Both chains exceed upgrade.timeout.timestamp
Copy link
Preview

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

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

The sleep duration increased from 20 to 100 seconds. Consider using a smaller value or making it configurable to avoid unnecessarily long test execution times.

Suggested change
sleep 100 # Both chains exceed upgrade.timeout.timestamp
sleep $SLEEP_DURATION # Both chains exceed upgrade.timeout.timestamp

Copilot uses AI. Check for mistakes.

@@ -496,6 +470,7 @@ func collectAcks(ctx QueryContext, chain *ProvableChain, packets PacketInfoList,
return msgs, nil
}

/*
Copy link
Preview

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

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

The UpdateClients function is commented out but not removed. Consider removing the dead code or documenting why it's preserved.

Copilot uses AI. Check for mistakes.

@@ -18,17 +19,20 @@ type StrategyI interface {
UnrelayedPackets(ctx context.Context, src, dst *ProvableChain, sh SyncHeaders, includeRelayedButUnfinalized bool) (*RelayPackets, error)

// RelayPackets executes RecvPacket to the packets contained in `rp` on both chains (`src` and `dst`).
RelayPackets(ctx context.Context, src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteRelaySrc, doExecuteRelayDst bool) (*RelayMsgs, error)
//RelayPackets(ctx context.Context, src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteRelaySrc, doExecuteRelayDst bool) (*RelayMsgs, error)
Copy link
Preview

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

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

Commented out interface method should be removed instead of kept as dead code.

Suggested change
//RelayPackets(ctx context.Context, src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteRelaySrc, doExecuteRelayDst bool) (*RelayMsgs, error)

Copilot uses AI. Check for mistakes.


// UnrelayedAcknowledgements returns packets to execute AcknowledgePacket to on `src` and `dst`.
// `includeRelayedButUnfinalized` decides if the result includes packets of which acknowledgePacket has been executed but not finalized
UnrelayedAcknowledgements(ctx context.Context, src, dst *ProvableChain, sh SyncHeaders, includeRelayedButUnfinalized bool) (*RelayPackets, error)

// RelayAcknowledgements executes AcknowledgePacket to the packets contained in `rp` on both chains (`src` and `dst`).
RelayAcknowledgements(ctx context.Context, src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteAckSrc, doExecuteAckDst bool) (*RelayMsgs, error)
//RelayAcknowledgements(ctx context.Context, src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteAckSrc, doExecuteAckDst bool) (*RelayMsgs, error)
Copy link
Preview

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

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

Commented out interface method should be removed instead of kept as dead code.

Suggested change
//RelayAcknowledgements(ctx context.Context, src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteAckSrc, doExecuteAckDst bool) (*RelayMsgs, error)

Copilot uses AI. Check for mistakes.


// UpdateClients executes UpdateClient only if needed
UpdateClients(ctx context.Context, src, dst *ProvableChain, doExecuteRelaySrc, doExecuteRelayDst, doExecuteAckSrc, doExecuteAckDst bool, sh SyncHeaders, doRefresh bool) (*RelayMsgs, error)
//UpdateClients(ctx context.Context, src, dst *ProvableChain, doExecuteRelaySrc, doExecuteRelayDst, doExecuteAckSrc, doExecuteAckDst bool, sh SyncHeaders, doRefresh bool) (*RelayMsgs, error)
Copy link
Preview

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

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

Commented out interface method should be removed instead of kept as dead code.

Suggested change
//UpdateClients(ctx context.Context, src, dst *ProvableChain, doExecuteRelaySrc, doExecuteRelayDst, doExecuteAckSrc, doExecuteAckDst bool, sh SyncHeaders, doRefresh bool) (*RelayMsgs, error)

Copilot uses AI. Check for mistakes.

Daisuke Kanda added 8 commits August 15, 2025 01:40
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
Signed-off-by: Daisuke Kanda <daisuke.kanda@datachain.jp>
@dai1975 dai1975 force-pushed the lo7181-long-update-and-lost-state-3 branch from 35424ad to 7e8e036 Compare August 15, 2025 01:58
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.

2 participants