-
Notifications
You must be signed in to change notification settings - Fork 34
part3 upgrade-channel: in case of one chain takes long time for updating and the other chain loses old state #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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>
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>
38785f3
to
f679d7e
Compare
…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>
f679d7e
to
35424ad
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
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.
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 | |||
} | |||
|
|||
/* |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
//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) |
There was a problem hiding this comment.
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.
//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) |
There was a problem hiding this comment.
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.
//UpdateClients(ctx context.Context, src, dst *ProvableChain, doExecuteRelaySrc, doExecuteRelayDst, doExecuteAckSrc, doExecuteAckDst bool, sh SyncHeaders, doRefresh bool) (*RelayMsgs, error) |
Copilot uses AI. Check for mistakes.
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>
35424ad
to
7e8e036
Compare
This is 3rd part of chain query parallelization. see first pullreq for details: #169
Ref: diffs to part2: dai1975#3