From 604d430ae0ec38bc6f5df82bf399f82778e044e7 Mon Sep 17 00:00:00 2001 From: liyukun Date: Wed, 17 Jan 2024 16:11:15 +0800 Subject: [PATCH] chore: test min_payment and re-deploy contracts --- .../migration/cluster/2024-01-17-063031.json | 13 -------- .../migration/cluster/2024-01-17-080846.json | 13 ++++++++ .../cluster_agent/2024-01-17-063159.json | 13 -------- .../cluster_agent/2024-01-17-081009.json | 13 ++++++++ .../cluster_proxy/2024-01-17-063116.json | 13 -------- .../cluster_proxy/2024-01-17-080920.json | 13 ++++++++ .../migration/spore/2024-01-17-062908.json | 13 -------- .../migration/spore/2024-01-17-080725.json | 13 ++++++++ ...-17-062938.json => 2024-01-17-080751.json} | 4 +-- tests/src/tests/cluster.rs | 30 +++++++++---------- tests/src/tests/spore.rs | 2 +- tests/src/utils/mod.rs | 10 +++++++ 12 files changed, 79 insertions(+), 71 deletions(-) delete mode 100644 deployment/migration/cluster/2024-01-17-063031.json create mode 100644 deployment/migration/cluster/2024-01-17-080846.json delete mode 100644 deployment/migration/cluster_agent/2024-01-17-063159.json create mode 100644 deployment/migration/cluster_agent/2024-01-17-081009.json delete mode 100644 deployment/migration/cluster_proxy/2024-01-17-063116.json create mode 100644 deployment/migration/cluster_proxy/2024-01-17-080920.json delete mode 100644 deployment/migration/spore/2024-01-17-062908.json create mode 100644 deployment/migration/spore/2024-01-17-080725.json rename deployment/migration/spore_extension_lua/{2024-01-17-062938.json => 2024-01-17-080751.json} (58%) diff --git a/deployment/migration/cluster/2024-01-17-063031.json b/deployment/migration/cluster/2024-01-17-063031.json deleted file mode 100644 index a86b106..0000000 --- a/deployment/migration/cluster/2024-01-17-063031.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "cell_recipes": [ - { - "name": "cluster", - "tx_hash": "0xa6d205a31ce707d7246cda5338accf15e5071b27d44d7ed4e9e62609819b0259", - "index": 0, - "occupied_capacity": 4650200000000, - "data_hash": "0xfd3596ac32e252de9be7681187489a7ec23ca75267e41eab691dd63ebb02a08a", - "type_id": "0xe6023cfda763eca8a1acdd18290a5fa6b8d8bbcdb77bc185872f059441794aa0" - } - ], - "dep_group_recipes": [] -} \ No newline at end of file diff --git a/deployment/migration/cluster/2024-01-17-080846.json b/deployment/migration/cluster/2024-01-17-080846.json new file mode 100644 index 0000000..92048a8 --- /dev/null +++ b/deployment/migration/cluster/2024-01-17-080846.json @@ -0,0 +1,13 @@ +{ + "cell_recipes": [ + { + "name": "cluster", + "tx_hash": "0x4072aa8ef8794cc8e70ae57c1dd29d2a343bc7f0cd6b13ce30ae6cd7d5b6a7d9", + "index": 0, + "occupied_capacity": 4697400000000, + "data_hash": "0x372b7c11d7b688e02d9c2b7604fbdf0dc898a0f6741854ea6c65d41f8ef4a64e", + "type_id": "0xe6023cfda763eca8a1acdd18290a5fa6b8d8bbcdb77bc185872f059441794aa0" + } + ], + "dep_group_recipes": [] +} \ No newline at end of file diff --git a/deployment/migration/cluster_agent/2024-01-17-063159.json b/deployment/migration/cluster_agent/2024-01-17-063159.json deleted file mode 100644 index 84e0a08..0000000 --- a/deployment/migration/cluster_agent/2024-01-17-063159.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "cell_recipes": [ - { - "name": "cluster_agent", - "tx_hash": "0xfed3754cdabd9e37e2b013f4d00fa76a9746bce65a22f64a117412556d8a322c", - "index": 0, - "occupied_capacity": 5285400000000, - "data_hash": "0x4e756cd4242a104338b344c094feabd66f2f54849662f5620dc0608bbe5e60ef", - "type_id": "0xbd205fcbe1438115dbc34ba44eb8dbc03d6880037388d22f781134ce5519d771" - } - ], - "dep_group_recipes": [] -} \ No newline at end of file diff --git a/deployment/migration/cluster_agent/2024-01-17-081009.json b/deployment/migration/cluster_agent/2024-01-17-081009.json new file mode 100644 index 0000000..62dc496 --- /dev/null +++ b/deployment/migration/cluster_agent/2024-01-17-081009.json @@ -0,0 +1,13 @@ +{ + "cell_recipes": [ + { + "name": "cluster_agent", + "tx_hash": "0x4951fba8ae56d10c409221e412b5b5457da8b23e92b1fab8c627f609a4f53929", + "index": 0, + "occupied_capacity": 5310200000000, + "data_hash": "0xa170fc93235213e90214e4273bb283e7979bf6477f70b4f2319d3777ec36235c", + "type_id": "0xbd205fcbe1438115dbc34ba44eb8dbc03d6880037388d22f781134ce5519d771" + } + ], + "dep_group_recipes": [] +} \ No newline at end of file diff --git a/deployment/migration/cluster_proxy/2024-01-17-063116.json b/deployment/migration/cluster_proxy/2024-01-17-063116.json deleted file mode 100644 index 7bcb44c..0000000 --- a/deployment/migration/cluster_proxy/2024-01-17-063116.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "cell_recipes": [ - { - "name": "cluster_proxy", - "tx_hash": "0x1b38b15844851ff1715f00607d259cacfab154f6c5bbf4d2abd5e728c6122e04", - "index": 0, - "occupied_capacity": 4575000000000, - "data_hash": "0x8b43d72ea5d3f9946399e09c16d581c2ffb8a558aef1d58ed0575feefd527549", - "type_id": "0x084539191561d1d04ea07640d9d34fbffb863814519fdb8358c534f7e0244968" - } - ], - "dep_group_recipes": [] -} \ No newline at end of file diff --git a/deployment/migration/cluster_proxy/2024-01-17-080920.json b/deployment/migration/cluster_proxy/2024-01-17-080920.json new file mode 100644 index 0000000..b95f822 --- /dev/null +++ b/deployment/migration/cluster_proxy/2024-01-17-080920.json @@ -0,0 +1,13 @@ +{ + "cell_recipes": [ + { + "name": "cluster_proxy", + "tx_hash": "0xbb0960de5c1960b57babd4cf4f468ac27572d24ef51dba8a2719f31dcebbc88f", + "index": 0, + "occupied_capacity": 4636600000000, + "data_hash": "0xfc1fbe95e7fb5be520f1adb2bdbd1529422613b02254ff01fd0f30604861ae36", + "type_id": "0x084539191561d1d04ea07640d9d34fbffb863814519fdb8358c534f7e0244968" + } + ], + "dep_group_recipes": [] +} \ No newline at end of file diff --git a/deployment/migration/spore/2024-01-17-062908.json b/deployment/migration/spore/2024-01-17-062908.json deleted file mode 100644 index f2443b1..0000000 --- a/deployment/migration/spore/2024-01-17-062908.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "cell_recipes": [ - { - "name": "spore", - "tx_hash": "0x21c1bf4bd8103ae6b29ac159bc0e3c133a39025b74a25d0ca3552a06cf17a7d0", - "index": 0, - "occupied_capacity": 7502200000000, - "data_hash": "0x954913b09ac48ad067d9fe0ea3472b1853a2d32754db9236ffb1d632a8b28c66", - "type_id": "0xa83025cb568121357cce0b980b757fdc935d88714db01a048af933be41f6e0e5" - } - ], - "dep_group_recipes": [] -} \ No newline at end of file diff --git a/deployment/migration/spore/2024-01-17-080725.json b/deployment/migration/spore/2024-01-17-080725.json new file mode 100644 index 0000000..006bc44 --- /dev/null +++ b/deployment/migration/spore/2024-01-17-080725.json @@ -0,0 +1,13 @@ +{ + "cell_recipes": [ + { + "name": "spore", + "tx_hash": "0x4d75c3201b06d9d4e4058468abb2b5d9aebacd4b065f6a855b4cbc2f23dfb87f", + "index": 0, + "occupied_capacity": 7409400000000, + "data_hash": "0xfd2dc714c4d4cb81e8621e5c124465a048d06551b467f58eaa64041dd322cf81", + "type_id": "0xa83025cb568121357cce0b980b757fdc935d88714db01a048af933be41f6e0e5" + } + ], + "dep_group_recipes": [] +} \ No newline at end of file diff --git a/deployment/migration/spore_extension_lua/2024-01-17-062938.json b/deployment/migration/spore_extension_lua/2024-01-17-080751.json similarity index 58% rename from deployment/migration/spore_extension_lua/2024-01-17-062938.json rename to deployment/migration/spore_extension_lua/2024-01-17-080751.json index 68fcc6b..ccae105 100644 --- a/deployment/migration/spore_extension_lua/2024-01-17-062938.json +++ b/deployment/migration/spore_extension_lua/2024-01-17-080751.json @@ -2,10 +2,10 @@ "cell_recipes": [ { "name": "spore_extension_lua", - "tx_hash": "0x78018e4294ad775254a79974afd430f57b74c8bd48eb690d400b3268838b1dcf", + "tx_hash": "0xc4a70f8569649f63ca96ca8d2863f57403d5a6bf03c0b831b6400d0e5dc7dc36", "index": 0, "occupied_capacity": 3155000000000, - "data_hash": "0x3d24df661a87f65574eea63d7424e2bf978c498800a671dee63614dc7d473289", + "data_hash": "0x94a9b875911ace20f1f0d063a26495d14e4b04e32fd218261bb747f34e71ae47", "type_id": "0x32f1cf61bc9747afd2f8ae4955e3f8bf80e2eb9d822d02e8561842f2cdb87930" } ], diff --git a/tests/src/tests/cluster.rs b/tests/src/tests/cluster.rs index 2ad5798..072274f 100644 --- a/tests/src/tests/cluster.rs +++ b/tests/src/tests/cluster.rs @@ -181,19 +181,15 @@ fn test_cluster_agent_mint() { build_spore_contract_materials(&mut context, "cluster"); let cluster_id = build_type_id(&input_cell, 0); let cluster_type = - build_spore_type_script(&mut context, &cluster_out_point, cluster_id.to_vec().into()); + build_spore_type_script_with_payment(&mut context, &cluster_out_point, &cluster_id, 1); let cluster_dep = build_normal_cell_dep(&mut context, cluster.as_slice(), cluster_type); // proxy let (proxy_out_point, proxy_script_dep) = build_spore_contract_materials(&mut context, "cluster_proxy"); let proxy_id = build_type_id(&input_cell, 1); - let proxy_type_arg = vec![proxy_id.to_vec(), vec![1]].concat(); - let proxy_type = build_spore_type_script( - &mut context, - &proxy_out_point, - proxy_type_arg.clone().into(), - ); + let proxy_type = + build_spore_type_script_with_payment(&mut context, &proxy_out_point, &proxy_id, 1); let proxy_dep = build_normal_cell_dep(&mut context, &cluster_id, proxy_type.clone()); let proxy_type_hash = proxy_type.unwrap_or_default().calc_script_hash(); @@ -242,19 +238,21 @@ mod cluster_agent_transfer { // agent in Input let old_cluster_id = build_type_id(&input_cell, 0); let old_agent_data = blake2b_256("12345676890"); - let old_agent_type = build_spore_type_script( + let old_agent_type = build_spore_type_script_with_payment( &mut context, &agent_out_point, - old_cluster_id.to_vec().into(), + &old_cluster_id, + 1, ); let old_agent_cell = build_agent_proxy_input(&mut context, &old_agent_data, old_agent_type); // agent in Output let new_cluster_id = build_type_id(&input_cell, new_cluster_out_index); - let new_agent_type = build_spore_type_script( + let new_agent_type = build_spore_type_script_with_payment( &mut context, &agent_out_point, - new_cluster_id.to_vec().into(), + &new_cluster_id, + 1, ); let new_agent_cell = build_normal_output_cell_with_type(&mut context, new_agent_type.clone()); @@ -308,7 +306,7 @@ fn test_cluster_agent_burn() { let cluster_id = build_type_id(&input_cell, 0); let agent_data = blake2b_256("12345676890"); let agent_type = - build_spore_type_script(&mut context, &agent_out_point, cluster_id.to_vec().into()); + build_spore_type_script_with_payment(&mut context, &agent_out_point, &cluster_id, 1); let agent_cell = build_agent_proxy_input(&mut context, &agent_data, agent_type.clone()); // build agent burn tx @@ -348,7 +346,7 @@ fn test_cluster_proxy_mint() { build_spore_contract_materials(&mut context, "cluster_proxy"); let proxy_id = build_type_id(&input_cell, 0); let proxy_type = - build_spore_type_script(&mut context, &proxy_out_point, proxy_id.to_vec().into()); + build_spore_type_script_with_payment(&mut context, &proxy_out_point, &proxy_id, 1); let proxy_out_cell = build_normal_output_cell_with_type(&mut context, proxy_type.clone()); let tx = TransactionBuilder::default() @@ -381,13 +379,13 @@ mod cluster_proxy_transfer { let old_cluster_id = blake2b_256("12345678"); let old_proxy_id = build_type_id(&input_cell, 0); let old_proxy_type = - build_spore_type_script(&mut context, &proxy_out_point, old_proxy_id.to_vec().into()); + build_spore_type_script_with_payment(&mut context, &proxy_out_point, &old_proxy_id, 1); let old_proxy_cell = build_agent_proxy_input(&mut context, &old_cluster_id, old_proxy_type); // proxy in Output let new_proxy_id = build_type_id(&input_cell, new_proxy_out_index); let new_proxy_type = - build_spore_type_script(&mut context, &proxy_out_point, new_proxy_id.to_vec().into()); + build_spore_type_script_with_payment(&mut context, &proxy_out_point, &new_proxy_id, 1); let new_proxy_cell = build_normal_output_cell_with_type(&mut context, new_proxy_type.clone()); @@ -441,7 +439,7 @@ fn test_cluster_proxy_burn() { let cluster_id = blake2b_256("12345678"); let proxy_id = build_type_id(&input_cell, 0); let proxy_type = - build_spore_type_script(&mut context, &proxy_out_point, proxy_id.to_vec().into()); + build_spore_type_script_with_payment(&mut context, &proxy_out_point, &proxy_id, 1); let proxy_cell = build_agent_proxy_input(&mut context, &cluster_id, proxy_type.clone()); // build proxy burn tx diff --git a/tests/src/tests/spore.rs b/tests/src/tests/spore.rs index 578ff40..024de8d 100644 --- a/tests/src/tests/spore.rs +++ b/tests/src/tests/spore.rs @@ -514,7 +514,7 @@ mod simple_spore_destroy { let tx = TransactionBuilder::default() .input(spore_input) .output(normal_output) - .output_data(serialized.as_slice().pack()) + .output_data(Default::default()) .cell_dep(spore_script_dep) .build(); diff --git a/tests/src/utils/mod.rs b/tests/src/utils/mod.rs index 1f2190c..4c7ebff 100644 --- a/tests/src/utils/mod.rs +++ b/tests/src/utils/mod.rs @@ -59,6 +59,16 @@ pub fn build_spore_type_script( context.build_script_with_hash_type(out_point, ScriptHashType::Data1, args) } +pub fn build_spore_type_script_with_payment( + context: &mut Context, + out_point: &OutPoint, + args: &[u8; 32], + payment: u8, +) -> Option