Skip to content

Commit

Permalink
feat: apply new ckb-contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
liyukun committed Aug 15, 2023
1 parent cfb1e3a commit da1e350
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 18 deletions.
8 changes: 4 additions & 4 deletions tools/ckb4ibc-test/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ key_name = "relayer_ckb_wallet"
store_prefix = "forcerelay"
connection_type_args = "0xf49ce32397c6741998b04d7548c5ed372007424daf67ee5bfadaefec3c865781"
channel_type_args = "0xfbe09e8ff3e5f3d0fab7cc7431feed2131846184d356a9626639f55e7f471846"
packet_type_args = "0xdf9cf8784debfcf67cf33b13c368f44191b9835b40521187610bb3931ea34b4d"
packet_type_args = "0xf8514d77b6b4ff051f753e316960b94d0161e947c78db92fcd63a3f4ef0d3599"
[chains.onchain_light_clients]
Ckb4Ibc = { chain_id = "ckb4ibc-1", client_cell_type_args = "0xa582fb062c7f02b476ee29188c773053ea1a40ba8784130afce2c31eee823932" }
Ckb4Ibc = { chain_id = "ckb4ibc-1", client_cell_type_args = "0xb02e68d5c8a7492b3439c657fd4cb4d51eb8c9442ddde3def66cd93747b957fc" }

[[chains]]
id = "ckb4ibc-1"
Expand All @@ -40,6 +40,6 @@ key_name = "relayer_ckb_wallet"
store_prefix = "forcerelay"
connection_type_args = "0xf49ce32397c6741998b04d7548c5ed372007424daf67ee5bfadaefec3c865781"
channel_type_args = "0xfbe09e8ff3e5f3d0fab7cc7431feed2131846184d356a9626639f55e7f471846"
packet_type_args = "0xdf9cf8784debfcf67cf33b13c368f44191b9835b40521187610bb3931ea34b4d"
packet_type_args = "0xf8514d77b6b4ff051f753e316960b94d0161e947c78db92fcd63a3f4ef0d3599"
[chains.onchain_light_clients]
Ckb4Ibc = { chain_id = "ckb4ibc-0", client_cell_type_args = "0xa582fb062c7f02b476ee29188c773053ea1a40ba8784130afce2c31eee823932" }
Ckb4Ibc = { chain_id = "ckb4ibc-0", client_cell_type_args = "0xb02e68d5c8a7492b3439c657fd4cb4d51eb8c9442ddde3def66cd93747b957fc" }
Binary file removed tools/ckb4ibc-test/contracts/ics-chan
Binary file not shown.
Binary file added tools/ckb4ibc-test/contracts/ics-channel
Binary file not shown.
Binary file removed tools/ckb4ibc-test/contracts/ics-conn
Binary file not shown.
Binary file added tools/ckb4ibc-test/contracts/ics-connection
Binary file not shown.
Binary file modified tools/ckb4ibc-test/contracts/ics-packet
100755 → 100644
Binary file not shown.
2 changes: 1 addition & 1 deletion tools/ckb4ibc-test/contracts/version
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ all-contracts-in-debug-mode

commit: 7e1ab522262489513c11122ddd32b0d4a7823c70

<https://github.com/synapseweb3/ibc-ckb-contracts/actions/runs/5585735292>
<https://github.com/synapseweb3/ibc-ckb-contracts/actions/runs/5833958346>
2 changes: 1 addition & 1 deletion tools/ckb4ibc-test/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ pub const CONNECTION_CODE_HASH: H256 =
pub const CHANNEL_CODE_HASH: H256 =
h256!("0x9ea73e5003f580eb4f380944b1de0711c6b5a4bb96c6f9bf8186203b7c684606");
pub const CLIENT_TYPE_ARGS: H256 =
h256!("0xa582fb062c7f02b476ee29188c773053ea1a40ba8784130afce2c31eee823932");
h256!("0xb02e68d5c8a7492b3439c657fd4cb4d51eb8c9442ddde3def66cd93747b957fc");
9 changes: 4 additions & 5 deletions tools/ckb4ibc-test/src/framework/utils/ckb.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::consts::{CHANNEL_CODE_HASH, CLIENT_TYPE_ARGS, CONNECTION_CODE_HASH};
use crate::generator::GENESIS_TXHASH;
use crate::rpc_client::RpcClient;

use anyhow::Result;
Expand All @@ -13,7 +14,7 @@ use ckb_sdk::*;
use ckb_types::core::ScriptHashType;
use ckb_types::packed::Script;
use ckb_types::prelude::{Builder, Entity, Pack};
use ckb_types::{h256, H256};
use ckb_types::H256;
use futures::Future;
use ibc_test_framework::prelude::{ChannelId, Wallet};
use ibc_test_framework::types::process::ChildProcess;
Expand Down Expand Up @@ -74,6 +75,7 @@ fn send_tx(request_body: String, port: u32) -> Result<RpcResponse> {
.error_for_status()?;

// Deserialize the response JSON into RpcResponse
println!("response: {response:?}");
let rpc_response = response.json::<RpcResponse>()?;
Ok(rpc_response)
}
Expand Down Expand Up @@ -200,10 +202,7 @@ pub fn prepare_ckb_chain(
);

// check transaction in genesis
check_and_wait_ckb_transaction(
h256!("0x227de871ce6ab120a67960f831b04148bf79b4e56349dde7a8001f93191736ed"),
port,
);
check_and_wait_ckb_transaction(GENESIS_TXHASH, port);

let output = send_tx(
fs::read_to_string("txs/deploy_conn_chan.json").unwrap(),
Expand Down
4 changes: 2 additions & 2 deletions tools/ckb4ibc-test/src/generator/deploy_conn_chan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ pub fn generate_deploy_conn_chan() -> ConnChanAttribute {
.output(connection_output)
.output(channel_output)
.output(change_output)
.output_data(std::fs::read("./contracts/ics-conn").unwrap().pack())
.output_data(std::fs::read("./contracts/ics-chan").unwrap().pack())
.output_data(std::fs::read("./contracts/ics-connection").unwrap().pack())
.output_data(std::fs::read("./contracts/ics-channel").unwrap().pack())
.output_data(empty_data)
.build();

Expand Down
2 changes: 1 addition & 1 deletion tools/ckb4ibc-test/txs/create_connection.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"id": 3, "jsonrpc": "2.0", "method": "send_transaction", "params": [{"version":"0x0","cell_deps":[{"out_point":{"tx_hash":"0x367479811ddf6d54022d4868c385a54e6729af1257560be76eb0e3c8b2d3a1ce","index":"0x1"},"dep_type":"code"},{"out_point":{"tx_hash":"0x367479811ddf6d54022d4868c385a54e6729af1257560be76eb0e3c8b2d3a1ce","index":"0x0"},"dep_type":"code"},{"out_point":{"tx_hash":"0x29ed5663501cd171513155f8939ad2c9ffeb92aa4879d39cde987f8eb6274407","index":"0x0"},"dep_type":"dep_group"}],"header_deps":[],"inputs":[{"since":"0x0","previous_output":{"tx_hash":"0x367479811ddf6d54022d4868c385a54e6729af1257560be76eb0e3c8b2d3a1ce","index":"0x2"}}],"outputs":[{"capacity":"0x6fc23ac00","lock":{"code_hash":"0xcf6e0c0148123081af1deda0ef162d39cfdfe1ea6565d3689009c1f3562a5e82","hash_type":"type","args":"0xa582fb062c7f02b476ee29188c773053ea1a40ba8784130afce2c31eee823932"},"type":null},{"capacity":"0x48c273950000","lock":{"code_hash":"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8","hash_type":"type","args":"0x470dcdc5e44064909650113a274b3b36aecb6dc7"},"type":null}],"outputs_data":["0x83795d737ad7359b0f3f87eba317e87c7eacba1ea3e21a7f00764c91ad265d2d","0x3078"],"witnesses":["0x5d000000100000005500000055000000410000007e4529c130e6f0544ace729a4c4e18a62f3ec4fbf7771fe7b33ae6717cc8b557298150d51340e46ec02a8b27bb86c1725dcef49b3c2ba79c7c9f0cedf85c23550004000000c38080c0","0x1900000010000000100000001000000005000000c101c281c0"]}]}
{"id": 3, "jsonrpc": "2.0", "method": "send_transaction", "params": [{"version":"0x0","cell_deps":[{"out_point":{"tx_hash":"0x24a573fafbb523192c8e1d094e9c0c5969d576619eb0c23f8c8622ed32188e4f","index":"0x1"},"dep_type":"code"},{"out_point":{"tx_hash":"0x24a573fafbb523192c8e1d094e9c0c5969d576619eb0c23f8c8622ed32188e4f","index":"0x0"},"dep_type":"code"},{"out_point":{"tx_hash":"0x29ed5663501cd171513155f8939ad2c9ffeb92aa4879d39cde987f8eb6274407","index":"0x0"},"dep_type":"dep_group"}],"header_deps":[],"inputs":[{"since":"0x0","previous_output":{"tx_hash":"0x24a573fafbb523192c8e1d094e9c0c5969d576619eb0c23f8c8622ed32188e4f","index":"0x2"}}],"outputs":[{"capacity":"0x6fc23ac00","lock":{"code_hash":"0xcf6e0c0148123081af1deda0ef162d39cfdfe1ea6565d3689009c1f3562a5e82","hash_type":"type","args":"0xb02e68d5c8a7492b3439c657fd4cb4d51eb8c9442ddde3def66cd93747b957fc"},"type":null},{"capacity":"0x48c273950000","lock":{"code_hash":"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8","hash_type":"type","args":"0x470dcdc5e44064909650113a274b3b36aecb6dc7"},"type":null}],"outputs_data":["0x83795d737ad7359b0f3f87eba317e87c7eacba1ea3e21a7f00764c91ad265d2d","0x3078"],"witnesses":["0x5d0000001000000055000000550000004100000081d1bb35a4d55e137d708322108f4eaba1700bb47bd45b58e70597a8dc245868012f9e62a1d485909f5ae2682819c8a96bcfd5e30356af239843a1361cc5034d0104000000c38080c0","0x1900000010000000100000001000000005000000c101c281c0"]}]}
2 changes: 1 addition & 1 deletion tools/ckb4ibc-test/txs/deploy_conn_chan.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tools/ckb4ibc-test/txs/deploy_packet_metadata.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tools/test-framework/src/types/single/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ impl FullNode {
let channel_type_args =
hex_to_h256(b"fbe09e8ff3e5f3d0fab7cc7431feed2131846184d356a9626639f55e7f471846").into();
let packet_type_args =
hex_to_h256(b"df9cf8784debfcf67cf33b13c368f44191b9835b40521187610bb3931ea34b4d").into();
hex_to_h256(b"f8514d77b6b4ff051f753e316960b94d0161e947c78db92fcd63a3f4ef0d3599").into();
let client_cell_type_args =
hex_to_h256(b"a582fb062c7f02b476ee29188c773053ea1a40ba8784130afce2c31eee823932").into();
hex_to_h256(b"b02e68d5c8a7492b3439c657fd4cb4d51eb8c9442ddde3def66cd93747b957fc").into();
let mut onchain_light_clients = HashMap::default();
onchain_light_clients.insert(
ClientType::Ckb4Ibc,
Expand Down

0 comments on commit da1e350

Please sign in to comment.