diff --git a/crates/relayer/src/chain/axon.rs b/crates/relayer/src/chain/axon.rs index e5f79ab6c..97666671b 100644 --- a/crates/relayer/src/chain/axon.rs +++ b/crates/relayer/src/chain/axon.rs @@ -39,9 +39,7 @@ use ibc_proto::{ use ibc_relayer_types::{ applications::ics31_icq::response::CrossChainQueryResponse, clients::ics07_axon::{ - client_state::AxonClientState, - consensus_state::AxonConsensusState, - header::{AxonHeader, AXON_HEADER_TYPE_URL}, + client_state::AxonClientState, consensus_state::AxonConsensusState, header::AxonHeader, light_block::AxonLightBlock, }, core::{ @@ -1392,24 +1390,6 @@ impl AxonChain { create_client::TYPE_URL => { convert!(self, msg, MsgCreateClient, create_client) } - // TODO: this update_client uses Hermes internal message to handle the Axon-specific function, - // so maybe there is possibility to create a new one to do so - update_client::TYPE_URL => { - let msg = update_client::MsgUpdateClient::from_any(msg) - .map_err(|e| Error::protobuf_decode(update_client::TYPE_URL.to_string(), e))?; - let bytes = msg.header.value.as_slice(); - let type_url = msg.header.type_url; - let to = match type_url.as_str() { - AXON_HEADER_TYPE_URL => self.config.ckb_light_client_contract_address, - "CELL_TYPE_URL" => self.config.image_cell_contract_address, - type_url => { - return Err(Error::other_error(format!("unknown type_url {type_url}"))) - } - }; - let tx = TransactionRequest::new().to(to).data(bytes.to_vec()); - self.rt - .block_on(async { Ok(self.client.send_transaction(tx, None).await?.await?) }) - } // connection conn_open_init::TYPE_URL => { convert!(self, msg, MsgConnectionOpenInit, connection_open_init) diff --git a/crates/relayer/src/config/axon.rs b/crates/relayer/src/config/axon.rs index 0bf61d09d..413b55906 100644 --- a/crates/relayer/src/config/axon.rs +++ b/crates/relayer/src/config/axon.rs @@ -1,4 +1,3 @@ -use ethers::types::H160; use ibc_relayer_types::core::ics24_host::identifier::ChainId; use serde_derive::{Deserialize, Serialize}; use tendermint_rpc::Url; @@ -16,8 +15,6 @@ pub struct AxonChainConfig { pub restore_block_count: u64, pub key_name: String, pub store_prefix: String, - pub ckb_light_client_contract_address: H160, - pub image_cell_contract_address: H160, #[serde(default)] pub packet_filter: PacketFilter, diff --git a/crates/relayer/tests/config/fixtures/relayer_conf_example.toml b/crates/relayer/tests/config/fixtures/relayer_conf_example.toml index 58c8e1aae..de46b89da 100644 --- a/crates/relayer/tests/config/fixtures/relayer_conf_example.toml +++ b/crates/relayer/tests/config/fixtures/relayer_conf_example.toml @@ -94,8 +94,6 @@ transfer_contract_address = "0x0000000000000000000000000000000000000000" restore_block_count = 10000 key_name = "relayer_axon_wallet" store_prefix = "forcerelay" -ckb_light_client_contract_address = "0x71C7656EC7ab88b098defB751B7401B5f6d8976F" -image_cell_contract_address = "0x71C7656EC7ab88b098defB751B7401B5f6d8976F" [[chains]] id = "ckb4ibc-0" diff --git a/tools/ibc-test/contracts/deployment/metadata.deployment.toml b/tools/ibc-test/contracts/deployment/metadata.deployment.toml new file mode 100644 index 000000000..32cf5ff04 --- /dev/null +++ b/tools/ibc-test/contracts/deployment/metadata.deployment.toml @@ -0,0 +1,12 @@ +# this is a deployment file for ckb testnet + +[[cells]] +name = "metadata" +enable_type_id = true +location = { file = "../metadata" } + +# The lock script set to output cells +[lock] +code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" +args = "0x470dcdc5e44064909650113a274b3b36aecb6dc7" +hash_type = "type" diff --git a/tools/ibc-test/contracts/metadata b/tools/ibc-test/contracts/metadata new file mode 100644 index 000000000..33b36cdd2 Binary files /dev/null and b/tools/ibc-test/contracts/metadata differ diff --git a/tools/ibc-test/src/framework/utils/axon.rs b/tools/ibc-test/src/framework/utils/axon.rs index f2849f87b..092865feb 100644 --- a/tools/ibc-test/src/framework/utils/axon.rs +++ b/tools/ibc-test/src/framework/utils/axon.rs @@ -159,8 +159,6 @@ pub(crate) fn prepare_axon_chain( let deployment = DeployedContracts { contract_address, transfer_contract_address, - image_cell_contract_address: ethers::types::H160::default(), - ckb_light_client_contract_address: ethers::types::H160::default(), }; let path = working_dir.join(AXON_CONTRACTS_CONFIG_PATH); std::fs::write(path, toml::to_string(&deployment)?).with_context(|| "write deployment info")?; diff --git a/tools/ibc-test/src/generator/deploy_packet_metadata.rs b/tools/ibc-test/src/generator/deploy_packet_metadata.rs index 4d2bf7869..4a4cd1558 100644 --- a/tools/ibc-test/src/generator/deploy_packet_metadata.rs +++ b/tools/ibc-test/src/generator/deploy_packet_metadata.rs @@ -88,23 +88,9 @@ pub fn generate_deploy_packet_metadata(attribute: &ChannelAttribute) -> PacketMe .build(); // Same as axon example single node spec which is used in ibc-tests. - let bls_pub_key = hex::decode("a26e3fe1cf51bd4822072c61bdc315ac32e3d3c2e2484bb92942666399e863b4bf56cf2926383cc706ffc15dfebc85c6").unwrap(); - let metadata = Metadata::new_builder() - .validators( - ValidatorList::new_builder() - .push( - Validator::new_builder() - // Only bls_pub_key matters for now. - .bls_pub_key(Entity::from_slice(&bls_pub_key).unwrap()) - .build(), - ) - .build(), - ) - .build(); - - let metadata_cell_data = MetadataCellData::new_builder() - .metadata(MetadataList::new_builder().push(metadata).build()) - .build(); + let metadata_cell_data = generate_metadata_cell_data( + vec!["a26e3fe1cf51bd4822072c61bdc315ac32e3d3c2e2484bb92942666399e863b4bf56cf2926383cc706ffc15dfebc85c6"] + ); let metadata_output = CellOutput::new_builder() .lock(lock_script.clone()) @@ -162,3 +148,37 @@ pub fn generate_deploy_packet_metadata(attribute: &ChannelAttribute) -> PacketMe balance_index: 2, } } + +fn generate_metadata_cell_data(bls_pubkeys: Vec<&str>) -> MetadataCellData { + let mut validator_list = ValidatorList::new_builder(); + for key in bls_pubkeys { + let bls_pub_key = hex::decode(key).unwrap(); + validator_list = validator_list.push( + Validator::new_builder() + // Only bls_pub_key matters for now. + .bls_pub_key(Entity::from_slice(&bls_pub_key).unwrap()) + .build(), + ); + } + + let metadata = Metadata::new_builder() + .validators(validator_list.build()) + .build(); + + MetadataCellData::new_builder() + .metadata(MetadataList::new_builder().push(metadata).build()) + .build() +} + +#[test] +fn test_generate_metadata_cell_data() { + let metadata = generate_metadata_cell_data( + vec![ + "95a16ed1f4c43a7470917771bf820741dbd040c51967122de66dc5bc9f6eff5953a36be6c0fdf8c202a26d6f2b0f8885", + "a8d1c7c4152ce4ad8eff7ee90406b6cdf27eee97f0e520b8098a88ff3873c83aa8b74d9aab3a1c15361b5d3bc9224e9a", + "8d999a5c29604f32950bfedf289f6b8e7e2f1a19f86b208d370024e709f77d1208f5e000dc4232a63064530613aa4b26", + "afefcad3f6289c0bc0a9fd0015f533dcfcc1d7ba5161ff518702fee7aec33374a08d4fa45baeef85836c1e604e8f221d" + ] + ); + std::fs::write("contracts/metadata", metadata.as_slice()).unwrap(); +} diff --git a/tools/test-framework/src/types/axon/mod.rs b/tools/test-framework/src/types/axon/mod.rs index adfab4d3f..772109e8c 100644 --- a/tools/test-framework/src/types/axon/mod.rs +++ b/tools/test-framework/src/types/axon/mod.rs @@ -5,6 +5,4 @@ use serde_derive::{Deserialize, Serialize}; pub struct DeployedContracts { pub contract_address: H160, pub transfer_contract_address: H160, - pub image_cell_contract_address: H160, - pub ckb_light_client_contract_address: H160, } diff --git a/tools/test-framework/src/types/single/node.rs b/tools/test-framework/src/types/single/node.rs index fe8a46a54..70c001446 100644 --- a/tools/test-framework/src/types/single/node.rs +++ b/tools/test-framework/src/types/single/node.rs @@ -228,8 +228,6 @@ impl FullNode { let DeployedContracts { contract_address, transfer_contract_address, - image_cell_contract_address, - ckb_light_client_contract_address, .. } = deployed_contracts; @@ -243,8 +241,6 @@ impl FullNode { contract_address, transfer_contract_address, restore_block_count, - ckb_light_client_contract_address, - image_cell_contract_address, }; Ok(config::ChainConfig::Axon(axon_config)) }