Skip to content

Commit

Permalink
chore: fix commented suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
liyukun committed Sep 5, 2023
1 parent 609e12a commit e7cd6c0
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 23 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
# --failure-output final --test-threads=2 --test-threads=1 mbt
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ jobs:
# uses: actions/upload-artifact@v2
# with:
# name: code-coverage-report
# path: cobertura.xml
# path: cobertura.xml
5 changes: 4 additions & 1 deletion crates/relayer/src/chain/ckb4ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
11 changes: 8 additions & 3 deletions crates/relayer/src/chain/ckb4ibc/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
21 changes: 8 additions & 13 deletions crates/relayer/src/chain/ckb4ibc/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tools/ibc-test/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down

0 comments on commit e7cd6c0

Please sign in to comment.