From e7cd6c03a4eb183a3de2e48178fbe1031ec5a8da Mon Sep 17 00:00:00 2001 From: liyukun Date: Tue, 5 Sep 2023 20:20:39 +0800 Subject: [PATCH] chore: fix commented suggestion --- .github/workflows/integration.yaml | 8 ++++---- .github/workflows/rust.yml | 2 +- crates/relayer/src/chain/ckb4ibc.rs | 5 ++++- crates/relayer/src/chain/ckb4ibc/monitor.rs | 11 ++++++++--- crates/relayer/src/chain/ckb4ibc/utils.rs | 21 ++++++++------------- tools/ibc-test/src/tests/mod.rs | 2 +- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 43f7fdb05..be4f8f1fe 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -176,9 +176,9 @@ jobs: NEXTEST_RETRIES: 2 CHAIN_COMMAND_PATHS: icad run: | - nix shell .#python .#ica -c cargo \ - test -p ibc-integration-test --features ica --no-fail-fast -- \ - --nocapture --test-threads=1 test_ica_filter + nix shell .#python .#ica -c \ + cargo nextest run -p ibc-integration-test --features ica --no-fail-fast \ + --test-threads=2 test_ica_filter ics29-fee-test: runs-on: ubuntu-20.04 @@ -356,4 +356,4 @@ jobs: # .#apalache \ # -c cargo \ # test -p ibc-integration-test --features mbt --no-fail-fast -- \ - # --failure-output final --test-threads=2 --test-threads=1 mbt \ No newline at end of file + # --failure-output final --test-threads=2 --test-threads=1 mbt diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ae7b7355b..64c307f5f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -126,4 +126,4 @@ jobs: # uses: actions/upload-artifact@v2 # with: # name: code-coverage-report - # path: cobertura.xml \ No newline at end of file + # path: cobertura.xml diff --git a/crates/relayer/src/chain/ckb4ibc.rs b/crates/relayer/src/chain/ckb4ibc.rs index 1d2622ea7..aa717e683 100644 --- a/crates/relayer/src/chain/ckb4ibc.rs +++ b/crates/relayer/src/chain/ckb4ibc.rs @@ -357,6 +357,9 @@ impl Ckb4IbcChain { .and_then(|response| async { let mut resps = vec![]; for cell in response.objects { + if cell.output.lock.args.len() != 32 { + continue; + } let tx = self .rpc_client .get_transaction(&cell.out_point.tx_hash) @@ -449,7 +452,7 @@ impl Ckb4IbcChain { fn sync_counterparty_client_type(&self, client_type: ClientType) { self.counterparty_client_type.send_if_modified(|prev| { - if *prev != Some(client_type) { + if prev.is_none() { *prev = Some(client_type); true } else { diff --git a/crates/relayer/src/chain/ckb4ibc/monitor.rs b/crates/relayer/src/chain/ckb4ibc/monitor.rs index 7ea3de792..54f444280 100644 --- a/crates/relayer/src/chain/ckb4ibc/monitor.rs +++ b/crates/relayer/src/chain/ckb4ibc/monitor.rs @@ -112,9 +112,14 @@ impl Ckb4IbcEventMonitor { MonitorCmd::Subscribe(tx) => tx.send(self.event_bus.subscribe()).unwrap(), } } - self.process_batch(self.fetch_connection_events().await); - self.process_batch(self.fetch_channel_events().await); - self.process_batch(self.fetch_packet_events().await); + let futs = tokio::join!( + self.fetch_channel_events(), + self.fetch_connection_events(), + self.fetch_packet_events(), + ); + self.process_batch(futs.0); + self.process_batch(futs.1); + self.process_batch(futs.2); Next::Continue } diff --git a/crates/relayer/src/chain/ckb4ibc/utils.rs b/crates/relayer/src/chain/ckb4ibc/utils.rs index 5a181d9b0..97e6a00ca 100644 --- a/crates/relayer/src/chain/ckb4ibc/utils.rs +++ b/crates/relayer/src/chain/ckb4ibc/utils.rs @@ -7,7 +7,8 @@ use ckb_ics_axon::object::Proofs as CkbProofs; use ckb_ics_axon::proof::ObjectProof; use ckb_sdk::constants::TYPE_ID_CODE_HASH; use ckb_sdk::rpc::ckb_indexer::ScriptSearchMode; -use ckb_sdk::rpc::ckb_light_client::{ScriptType, SearchKey, SearchKeyFilter}; +use ckb_sdk::rpc::ckb_light_client::{ScriptType, SearchKey}; +use ckb_sdk::traits::{CellQueryOptions, ValueRangeOption}; use ckb_sdk::NetworkType; use ckb_types::core::ScriptHashType; use ckb_types::packed::{Byte32, Bytes, BytesOpt, OutPoint, Script}; @@ -201,18 +202,12 @@ pub fn get_search_key_with_sudt( .hash_type(ScriptHashType::Type.into()) .args(owner_lockhash.as_bytes().to_vec().pack()) .build(); - let filter = SearchKeyFilter { - script: Some(sudt_script.into()), - ..Default::default() - }; - Ok(SearchKey { - script: script.into(), - script_type: ScriptType::Lock, - filter: Some(filter), - with_data: Some(true), - group_by_transaction: None, - script_search_mode: Some(ScriptSearchMode::Exact), - }) + let mut query = CellQueryOptions::new_lock(script); + query.with_data = Some(true); + query.script_search_mode = Some(ScriptSearchMode::Exact); + query.secondary_script = Some(sudt_script); + query.data_len_range = Some(ValueRangeOption::new_exact(16)); + Ok(query.into()) } pub fn get_dummy_merkle_proof(height: Height) -> Proofs { diff --git a/tools/ibc-test/src/tests/mod.rs b/tools/ibc-test/src/tests/mod.rs index d453f3275..ba7dc8c36 100644 --- a/tools/ibc-test/src/tests/mod.rs +++ b/tools/ibc-test/src/tests/mod.rs @@ -34,7 +34,7 @@ fn matrix_test_within_axon_and_ckb() -> Result<(), Error> { run_arbitrary_binary_channel_test(&ChannelTest::new(&CKB4IbcPacketTest::new(packet_run))) } -#[ignore] +#[ignore = "only for my native manual test"] #[test] fn specific_test_only_for_ckb() -> Result<(), Error> { env_vars!(