Skip to content
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

Implement CheckRefreshRequired #12

Merged
merged 3 commits into from
Jan 14, 2025

Conversation

junichi-tanaka
Copy link
Contributor

@junichi-tanaka junichi-tanaka commented Jan 12, 2025

Why

  • To prevent trusting period expires.

What

QA

prepare QA

set the refresh threshold to 5minutes.

diff --git a/e2e/relayer/configs/templates/ibc0.json.tpl b/e2e/relayer/configs/templates/ibc0.json.tpl
index 5e7ae03..74a7698 100644
--- a/e2e/relayer/configs/templates/ibc0.json.tpl
+++ b/e2e/relayer/configs/templates/ibc0.json.tpl
@@ -36,8 +36,8 @@
     "trusting_period": "336h",
     "max_clock_drift": "30s",
     "refresh_threshold_rate": {
-      "numerator": 2,
-      "denominator": 3
+      "numerator": 1,
+      "denominator": 4032
     }
   }
 }
diff --git a/e2e/relayer/scripts/relay b/e2e/relayer/scripts/relay
index 6e5fb16..8229a31 100755
--- a/e2e/relayer/scripts/relay
+++ b/e2e/relayer/scripts/relay
@@ -16,3 +16,5 @@ sleep 4
 ${RLY} tx relay ibc01
 sleep 4
 ${RLY} tx acks ibc01
+sleep 4
+${RLY} service start ibc01

run test

$ cd e2e
$ make network-qbft CONSENSUS_TYPE=qbft
$ script test.log
$ make test

wait for over 15minutes, then exit script command.

check logs

I could see the relayer sent an UpdateClients message every 5minutes.
I believe the first two lines are coming from tx relay and tx acks.

$ grep UpdateClients test.log
{"time":"2025-01-14T09:28:31.658094115+09:00","level":"INFO","source":{"function":"github.com/hyperledger-labs/yui-relayer/core.(*NaiveStrategy).UpdateClients","file":"/home/ubuntu/go/pkg/mod/github.com/hyperledger-labs/[email protected]/core/naive-strategy.go","line":554},"msg":"client on dst chain was scheduled for update","src":{"chain_id":"ibc0","port_id":"mockapp","channel_id":"channel-0"},"dst":{"chain_id":"ibc1","port_id":"mockapp","channel_id":"channel-0"},"module":"core.channel","num_sent_msgs":1}
{"time":"2025-01-14T09:28:41.727615886+09:00","level":"INFO","source":{"function":"github.com/hyperledger-labs/yui-relayer/core.(*NaiveStrategy).UpdateClients","file":"/home/ubuntu/go/pkg/mod/github.com/hyperledger-labs/[email protected]/core/naive-strategy.go","line":551},"msg":"client on src chain was scheduled for update","src":{"chain_id":"ibc0","port_id":"mockapp","channel_id":"channel-0"},"dst":{"chain_id":"ibc1","port_id":"mockapp","channel_id":"channel-0"},"module":"core.channel","num_sent_msgs":1}
{"time":"2025-01-14T09:33:35.26919391+09:00","level":"INFO","source":{"function":"github.com/hyperledger-labs/yui-relayer/core.(*NaiveStrategy).UpdateClients","file":"/home/ubuntu/go/pkg/mod/github.com/hyperledger-labs/[email protected]/core/naive-strategy.go","line":554},"msg":"client on dst chain was scheduled for update","src":{"chain_id":"ibc0","port_id":"mockapp","channel_id":"channel-0"},"dst":{"chain_id":"ibc1","port_id":"mockapp","channel_id":"channel-0"},"module":"core.channel","num_sent_msgs":1}
{"time":"2025-01-14T09:38:37.434438555+09:00","level":"INFO","source":{"function":"github.com/hyperledger-labs/yui-relayer/core.(*NaiveStrategy).UpdateClients","file":"/home/ubuntu/go/pkg/mod/github.com/hyperledger-labs/[email protected]/core/naive-strategy.go","line":554},"msg":"client on dst chain was scheduled for update","src":{"chain_id":"ibc0","port_id":"mockapp","channel_id":"channel-0"},"dst":{"chain_id":"ibc1","port_id":"mockapp","channel_id":"channel-0"},"module":"core.channel","num_sent_msgs":1}
{"time":"2025-01-14T09:43:39.135080206+09:00","level":"INFO","source":{"function":"github.com/hyperledger-labs/yui-relayer/core.(*NaiveStrategy).UpdateClients","file":"/home/ubuntu/go/pkg/mod/github.com/hyperledger-labs/[email protected]/core/naive-strategy.go","line":554},"msg":"client on dst chain was scheduled for update","src":{"chain_id":"ibc0","port_id":"mockapp","channel_id":"channel-0"},"dst":{"chain_id":"ibc1","port_id":"mockapp","channel_id":"channel-0"},"module":"core.channel","num_sent_msgs":1}

module/qbft.go Outdated
@@ -82,7 +82,7 @@ func (cs *ConsensusState) ClientType() string {
}

func (cs *ConsensusState) GetTimestamp() uint64 {
panic("not implemented")
return cs.Timestamp
Copy link
Member

Choose a reason for hiding this comment

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

exported::ConsensusState::GetTimestamp() should return nanoseconds instead of seconds. ref. https://ibc.cosmos.network/v8/ibc/light-clients/consensus-state/#gettimestamp-method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for pointing it out. I'll fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FIxed in 44369ab

module/prover.go Outdated
if err := pr.chain.Codec().UnpackAny(resCons.ConsensusState, &cons); err != nil {
return false, fmt.Errorf("failed to unpack Any into tendermint consensus state: %v", err)
}
lcLastTimestamp := time.Unix(int64(cons.GetTimestamp()), 0)
Copy link
Member

Choose a reason for hiding this comment

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

@junichi-tanaka junichi-tanaka marked this pull request as ready for review January 14, 2025 00:46
@junichi-tanaka junichi-tanaka requested a review from bluele January 14, 2025 00:46
module/prover.go Outdated

var cs exported.ClientState
if err := pr.chain.Codec().UnpackAny(resCs.ClientState, &cs); err != nil {
return false, fmt.Errorf("failed to unpack Any into tendermint client state: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

s/tendermint/besu/

module/prover.go Outdated

var cons exported.ConsensusState
if err := pr.chain.Codec().UnpackAny(resCons.ConsensusState, &cons); err != nil {
return false, fmt.Errorf("failed to unpack Any into tendermint consensus state: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

same as above

@bluele bluele self-requested a review January 14, 2025 02:28
Copy link
Member

@bluele bluele left a comment

Choose a reason for hiding this comment

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

@junichi-tanaka LGTM👍

@bluele bluele merged commit 63af78a into datachainlab:main Jan 14, 2025
2 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.

2 participants