Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sui/stellar audit fixes and rlp change #428

Merged
merged 5 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contracts/soroban/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contracts/soroban/contracts/cluster-connection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true, features = ["alloc"] }
soroban-rlp = { path = "../../libs/soroban-rlp" }
soroban-xcall-lib = { path = "../../libs/soroban-xcall-lib" }

[dev-dependencies]
soroban-sdk = { workspace = true, features = ["testutils"] }
76 changes: 67 additions & 9 deletions contracts/soroban/contracts/cluster-connection/src/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use soroban_sdk::{token, vec, Address, Bytes, BytesN, Env, Map, String, Vec};
use soroban_sdk::{token, xdr::ToXdr, Address, Bytes, BytesN, Env, Map, String, Vec};
use crate::{errors::ContractError, interfaces::interface_xcall::XcallClient, storage};
use soroban_rlp::encoder;
use soroban_xcall_lib::network_address::NetworkAddress;

pub fn ensure_relayer(e: &Env) -> Result<Address, ContractError> {
let relayer = storage::relayer(&e)?;
Expand Down Expand Up @@ -63,13 +63,14 @@ pub fn verify_signatures(
conn_sn: &u128,
message: &Bytes,
) -> bool {
let dst_network = get_network_id(e);
let validators = storage::get_validators(e).unwrap();
let threshold = storage::get_validators_threshold(e).unwrap();

if signatures.len() < threshold {
return false
}
let message_hash = e.crypto().keccak256(&get_encoded_message(e, src_network, conn_sn, message));
let message_hash = e.crypto().keccak256(&get_encoded_message(e, src_network, conn_sn, message, &dst_network));
let mut unique_validators = Map::new(e);
let mut count = 0;

Expand Down Expand Up @@ -98,13 +99,58 @@ pub fn verify_signatures(
}


pub fn get_encoded_message(e: &Env, src_network: &String, conn_sn: &u128, message: &Bytes) -> Bytes {
let mut list = vec![&e];
list.push_back(encoder::encode_string(&e, src_network.clone()));
list.push_back(encoder::encode_u128(&e, conn_sn.clone()));
list.push_back(encoder::encode(&e, message.clone()));
pub fn string_to_bytes(env: &Env, value: String) -> Bytes {
let string_xdr = value.clone().to_xdr(&env);
let mut bytes = Bytes::new(&env);
for i in 8..(8 + value.len()) {
if let Some(byte) = string_xdr.get(i) {
bytes.push_back(byte);
}
}
bytes
}

pub fn get_encoded_message(e: &Env, src_network: &String, conn_sn: &u128, message: &Bytes, dst_network: &String) -> Bytes {
let mut encoded = Bytes::new(e);
encoded.append(&string_to_bytes(e, src_network.clone()));
encoded.append(&u128_to_string(e, *conn_sn));
encoded.append(message);
encoded.append(&string_to_bytes(e, dst_network.clone()));
encoded
}

encoder::encode_list(&e, list, false)
pub fn u128_to_string(env: &Env, value: u128) -> Bytes {
let mut num = value;
let mut temp_bytes = Bytes::new(&env);
let mut bytes = Bytes::new(&env);

if value == 0 {
temp_bytes.push_back(b'0');
return temp_bytes;
}
while num > 0 {
let digit = (num % 10) as u8 + b'0';
temp_bytes.push_back(digit);
num /= 10;
}
for byte in temp_bytes.iter().rev() {
bytes.push_back(byte);
}
bytes
}

#[cfg(not(test))]
pub fn get_network_id(e: &Env) -> String {
let xcall_addr = storage::get_xcall(&e).unwrap();
let client = XcallClient::new(&e, &xcall_addr);
let network_address = NetworkAddress::from_string(client.get_network_address());
network_address.nid(&e)
}

#[cfg(test)]
pub fn get_network_id(e: &Env) -> String {
let network_address = NetworkAddress::from_string(String::from_str(e, "archway/testnet"));
network_address.nid(&e)
}

#[cfg(not(test))]
Expand All @@ -130,3 +176,15 @@ pub fn call_xcall_handle_error(e: &Env, sn: u128) -> Result<(), ContractError> {

Ok(())
}

#[test]
fn verify_encoded_message() {
use soroban_sdk::bytes;
let env = Env::default();
let src_network = String::from_str(&env, "0x2.icon");
let conn_sn = 128;
let message = bytes!(&env, 0x68656c6c6f);
let dst_network = String::from_str(&env, "archway");
let encoded = get_encoded_message(&env, &src_network, &conn_sn, &message, &dst_network);
assert_eq!(encoded, bytes!(&env,0x3078322e69636f6e31323868656c6c6f61726368776179));
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ pub trait IXcall {
) -> Result<(), ContractError>;

fn handle_error(env: Env, sender: Address, sequence_no: u128) -> Result<(), ContractError>;

fn get_network_address(env: Env) -> Result<String, ContractError>;
}
88 changes: 50 additions & 38 deletions contracts/soroban/contracts/cluster-connection/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
types::InitializeMsg,
};
use soroban_sdk::{
symbol_short, testutils::{Address as _, AuthorizedFunction, AuthorizedInvocation, Events}, token, vec, Address, Bytes, BytesN, Env, IntoVal, String, Symbol, Vec
bytesn, symbol_short, testutils::{Address as _, AuthorizedFunction, AuthorizedInvocation, Events}, token, vec, Address, Bytes, BytesN, Env, IntoVal, String, Symbol, Vec
};

pub struct TestContext {
Expand Down Expand Up @@ -356,14 +356,16 @@ fn test_add_validator() {

ctx.init_context(&client);

let val1 = [4, 174, 54, 168, 191, 216, 207, 101, 134, 243, 76, 104, 133, 40, 137, 72, 53, 245, 231, 193, 157, 54, 104, 155, 172, 84, 96, 101, 107, 97, 60, 94, 171, 241, 250, 152, 34, 18, 170, 39, 202, 236, 226, 58, 39, 8, 235, 60, 137, 54, 225, 50, 185, 253, 130, 197, 174, 226, 170, 75, 6, 145, 123, 87, 19];
let val2 = [4, 91, 65, 155, 222, 192, 210, 187, 193, 108, 232, 174, 20, 79, 248, 232, 37, 18, 63, 208, 203, 62, 54, 208, 7, 91, 109, 141, 229, 170, 181, 51, 136, 172, 143, 180, 194, 138, 138, 56, 67, 243, 7, 60, 218, 164, 12, 148, 63, 116, 115, 127, 192, 206, 164, 169, 95, 135, 119, 138, 255, 172, 115, 129, 144];
let val3 = [4, 248, 192, 175, 198, 228, 250, 20, 158, 23, 251, 176, 244, 208, 150, 71, 151, 27, 208, 22, 41, 30, 154, 198, 109, 10, 112, 142, 200, 47, 200, 213, 210, 172, 135, 141, 129, 183, 211, 241, 211, 127, 16, 19, 67, 159, 195, 235, 88, 164, 223, 47, 128, 47, 147, 28, 121, 28, 93, 129, 176, 144, 52, 243, 55];
let val1 = bytesn!(&ctx.env, 0x04deca512d5cb87673b23ab10c3e3572e30a2b5dc78cd500bf84bf066275c0bb320cb6cd266aa179b41323b5a18ab4a170248ed89b436b5559bab38c816ce12209);
let val2 = bytesn!(&ctx.env, 0x04f9379b2955d759a9532f8daa0c4a25da0ae706dd057de02af7754adb4b956ec9b8bf7a8a5a6686bc74dff736442a874c6bae5dcbcdb7113e24fbfa2337c63a01);
let val3 = bytesn!(&ctx.env, 0x041d7fa5b41fe40ae85130c4cc334f7852c25c19e7f326a916d49f6b9c3f35a1216bf53c805d177c28f7bedc2d2521cb0f13dc832ef689797965274d26df50cd0f);
let val4 = bytesn!(&ctx.env, 0x041d7fa5b41fe40ae85130c4cc334f7852c25c19e7f326a916d49f6b9c3f35a1216bf53c805d177c28f7bedc2d2521cb0f13dc832ef689797965274d26df50cd0f);

let mut validators = Vec::new(&ctx.env);
validators.push_back(BytesN::from_array(&ctx.env, &val1));
validators.push_back(BytesN::from_array(&ctx.env, &val2));
validators.push_back(BytesN::from_array(&ctx.env, &val3));
validators.push_back(val1);
validators.push_back(val2);
validators.push_back(val3);
validators.push_back(val4);
client.update_validators(&validators, &3_u32);

assert_eq!(
Expand Down Expand Up @@ -395,14 +397,16 @@ fn test_set_threshold() {

ctx.init_context(&client);

let val1 = [4, 174, 54, 168, 191, 216, 207, 101, 134, 243, 76, 104, 133, 40, 137, 72, 53, 245, 231, 193, 157, 54, 104, 155, 172, 84, 96, 101, 107, 97, 60, 94, 171, 241, 250, 152, 34, 18, 170, 39, 202, 236, 226, 58, 39, 8, 235, 60, 137, 54, 225, 50, 185, 253, 130, 197, 174, 226, 170, 75, 6, 145, 123, 87, 19];
let val2 = [4, 91, 65, 155, 222, 192, 210, 187, 193, 108, 232, 174, 20, 79, 248, 232, 37, 18, 63, 208, 203, 62, 54, 208, 7, 91, 109, 141, 229, 170, 181, 51, 136, 172, 143, 180, 194, 138, 138, 56, 67, 243, 7, 60, 218, 164, 12, 148, 63, 116, 115, 127, 192, 206, 164, 169, 95, 135, 119, 138, 255, 172, 115, 129, 144];
let val3 = [4, 248, 192, 175, 198, 228, 250, 20, 158, 23, 251, 176, 244, 208, 150, 71, 151, 27, 208, 22, 41, 30, 154, 198, 109, 10, 112, 142, 200, 47, 200, 213, 210, 172, 135, 141, 129, 183, 211, 241, 211, 127, 16, 19, 67, 159, 195, 235, 88, 164, 223, 47, 128, 47, 147, 28, 121, 28, 93, 129, 176, 144, 52, 243, 55];
let val1 = bytesn!(&ctx.env, 0x04deca512d5cb87673b23ab10c3e3572e30a2b5dc78cd500bf84bf066275c0bb320cb6cd266aa179b41323b5a18ab4a170248ed89b436b5559bab38c816ce12209);
let val2 = bytesn!(&ctx.env, 0x04f9379b2955d759a9532f8daa0c4a25da0ae706dd057de02af7754adb4b956ec9b8bf7a8a5a6686bc74dff736442a874c6bae5dcbcdb7113e24fbfa2337c63a01);
let val3 = bytesn!(&ctx.env, 0x041d7fa5b41fe40ae85130c4cc334f7852c25c19e7f326a916d49f6b9c3f35a1216bf53c805d177c28f7bedc2d2521cb0f13dc832ef689797965274d26df50cd0f);
let val4 = bytesn!(&ctx.env, 0x041d7fa5b41fe40ae85130c4cc334f7852c25c19e7f326a916d49f6b9c3f35a1216bf53c805d177c28f7bedc2d2521cb0f13dc832ef689797965274d26df50cd0f);

let mut validators = Vec::new(&ctx.env);
validators.push_back(BytesN::from_array(&ctx.env, &val1));
validators.push_back(BytesN::from_array(&ctx.env, &val2));
validators.push_back(BytesN::from_array(&ctx.env, &val3));
validators.push_back(val1);
validators.push_back(val2);
validators.push_back(val3);
validators.push_back(val4);
client.update_validators(&validators, &3_u32);

let threshold: u32 = 2_u32;
Expand Down Expand Up @@ -437,22 +441,25 @@ fn test_receive_message() {

ctx.init_context(&client);

let val1 = [4, 174, 54, 168, 191, 216, 207, 101, 134, 243, 76, 104, 133, 40, 137, 72, 53, 245, 231, 193, 157, 54, 104, 155, 172, 84, 96, 101, 107, 97, 60, 94, 171, 241, 250, 152, 34, 18, 170, 39, 202, 236, 226, 58, 39, 8, 235, 60, 137, 54, 225, 50, 185, 253, 130, 197, 174, 226, 170, 75, 6, 145, 123, 87, 19];
let val2 = [4, 91, 65, 155, 222, 192, 210, 187, 193, 108, 232, 174, 20, 79, 248, 232, 37, 18, 63, 208, 203, 62, 54, 208, 7, 91, 109, 141, 229, 170, 181, 51, 136, 172, 143, 180, 194, 138, 138, 56, 67, 243, 7, 60, 218, 164, 12, 148, 63, 116, 115, 127, 192, 206, 164, 169, 95, 135, 119, 138, 255, 172, 115, 129, 144];
let val3 = [4, 248, 192, 175, 198, 228, 250, 20, 158, 23, 251, 176, 244, 208, 150, 71, 151, 27, 208, 22, 41, 30, 154, 198, 109, 10, 112, 142, 200, 47, 200, 213, 210, 172, 135, 141, 129, 183, 211, 241, 211, 127, 16, 19, 67, 159, 195, 235, 88, 164, 223, 47, 128, 47, 147, 28, 121, 28, 93, 129, 176, 144, 52, 243, 55];
let val1 = bytesn!(&ctx.env, 0x04deca512d5cb87673b23ab10c3e3572e30a2b5dc78cd500bf84bf066275c0bb320cb6cd266aa179b41323b5a18ab4a170248ed89b436b5559bab38c816ce12209);
let val2 = bytesn!(&ctx.env, 0x04f9379b2955d759a9532f8daa0c4a25da0ae706dd057de02af7754adb4b956ec9b8bf7a8a5a6686bc74dff736442a874c6bae5dcbcdb7113e24fbfa2337c63a01);
let val3 = bytesn!(&ctx.env, 0x041d7fa5b41fe40ae85130c4cc334f7852c25c19e7f326a916d49f6b9c3f35a1216bf53c805d177c28f7bedc2d2521cb0f13dc832ef689797965274d26df50cd0f);
let val4 = bytesn!(&ctx.env, 0x041d7fa5b41fe40ae85130c4cc334f7852c25c19e7f326a916d49f6b9c3f35a1216bf53c805d177c28f7bedc2d2521cb0f13dc832ef689797965274d26df50cd0f);

let mut validators = Vec::new(&ctx.env);
validators.push_back(BytesN::from_array(&ctx.env, &val1));
validators.push_back(BytesN::from_array(&ctx.env, &val2));
validators.push_back(BytesN::from_array(&ctx.env, &val3));
client.update_validators(&validators, &1_u32);
validators.push_back(val1);
validators.push_back(val2);
validators.push_back(val3);
validators.push_back(val4);
client.update_validators(&validators, &2_u32);

let conn_sn = 456456_u128;
let conn_sn = 128_u128;
let msg = Bytes::from_array(&ctx.env,&[104, 101, 108, 108, 111]);
let src_network = String::from_str(&ctx.env, "0x2.icon");

let mut signatures = Vec::new(&ctx.env);
signatures.push_back(BytesN::from_array(&ctx.env, &[35, 247, 49, 199, 251, 53, 83, 51, 115, 148, 35, 48, 85, 203, 185, 236, 5, 171, 221, 29, 247, 203, 190, 195, 208, 218, 204, 237, 88, 191, 91, 75, 48, 87, 108, 161, 75, 234, 147, 234, 65, 134, 233, 32, 249, 159, 43, 159, 86, 211, 1, 117, 176, 167, 53, 99, 34, 243, 165, 215, 93, 232, 67, 184, 27]));
signatures.push_back(bytesn!(&ctx.env, 0x660d542b3f6de9cd08f238fd44133eeebfea290b21dae7322a63b516c57b8df12c4c0a340b60ed567c8da53578346c212b27b797eb42a75fb4b7076c567a6ff91c));
signatures.push_back(bytesn!(&ctx.env, 0x8024de4c7b003df96bb699cfaa1bfb8a682787cd0853f555d48494c65c766f8104804848095890a9a6d15946da52dafb18e5c1d0dbe7f33fc7a5fa5cf8b1f6e21c));

client.recv_message_with_signatures(&src_network, &conn_sn, &msg, &signatures);
}
Expand All @@ -465,22 +472,24 @@ fn test_receive_message_less_signatures() {

ctx.init_context(&client);

let val1 = [4, 174, 54, 168, 191, 216, 207, 101, 134, 243, 76, 104, 133, 40, 137, 72, 53, 245, 231, 193, 157, 54, 104, 155, 172, 84, 96, 101, 107, 97, 60, 94, 171, 241, 250, 152, 34, 18, 170, 39, 202, 236, 226, 58, 39, 8, 235, 60, 137, 54, 225, 50, 185, 253, 130, 197, 174, 226, 170, 75, 6, 145, 123, 87, 19];
let val2 = [4, 91, 65, 155, 222, 192, 210, 187, 193, 108, 232, 174, 20, 79, 248, 232, 37, 18, 63, 208, 203, 62, 54, 208, 7, 91, 109, 141, 229, 170, 181, 51, 136, 172, 143, 180, 194, 138, 138, 56, 67, 243, 7, 60, 218, 164, 12, 148, 63, 116, 115, 127, 192, 206, 164, 169, 95, 135, 119, 138, 255, 172, 115, 129, 144];
let val3 = [4, 248, 192, 175, 198, 228, 250, 20, 158, 23, 251, 176, 244, 208, 150, 71, 151, 27, 208, 22, 41, 30, 154, 198, 109, 10, 112, 142, 200, 47, 200, 213, 210, 172, 135, 141, 129, 183, 211, 241, 211, 127, 16, 19, 67, 159, 195, 235, 88, 164, 223, 47, 128, 47, 147, 28, 121, 28, 93, 129, 176, 144, 52, 243, 55];
let val1 = bytesn!(&ctx.env, 0x04deca512d5cb87673b23ab10c3e3572e30a2b5dc78cd500bf84bf066275c0bb320cb6cd266aa179b41323b5a18ab4a170248ed89b436b5559bab38c816ce12209);
let val2 = bytesn!(&ctx.env, 0x04f9379b2955d759a9532f8daa0c4a25da0ae706dd057de02af7754adb4b956ec9b8bf7a8a5a6686bc74dff736442a874c6bae5dcbcdb7113e24fbfa2337c63a01);
let val3 = bytesn!(&ctx.env, 0x041d7fa5b41fe40ae85130c4cc334f7852c25c19e7f326a916d49f6b9c3f35a1216bf53c805d177c28f7bedc2d2521cb0f13dc832ef689797965274d26df50cd0f);
let val4 = bytesn!(&ctx.env, 0x041d7fa5b41fe40ae85130c4cc334f7852c25c19e7f326a916d49f6b9c3f35a1216bf53c805d177c28f7bedc2d2521cb0f13dc832ef689797965274d26df50cd0f);

let mut validators = Vec::new(&ctx.env);
validators.push_back(BytesN::from_array(&ctx.env, &val1));
validators.push_back(BytesN::from_array(&ctx.env, &val2));
validators.push_back(BytesN::from_array(&ctx.env, &val3));
validators.push_back(val1);
validators.push_back(val2);
validators.push_back(val3);
validators.push_back(val4);
client.update_validators(&validators, &2_u32);

let conn_sn = 456456_u128;
let conn_sn = 128_u128;
let msg = Bytes::from_array(&ctx.env,&[104, 101, 108, 108, 111]);
let src_network = String::from_str(&ctx.env, "0x2.icon");

let mut signatures = Vec::new(&ctx.env);
signatures.push_back(BytesN::from_array(&ctx.env, &[35, 247, 49, 199, 251, 53, 83, 51, 115, 148, 35, 48, 85, 203, 185, 236, 5, 171, 221, 29, 247, 203, 190, 195, 208, 218, 204, 237, 88, 191, 91, 75, 48, 87, 108, 161, 75, 234, 147, 234, 65, 134, 233, 32, 249, 159, 43, 159, 86, 211, 1, 117, 176, 167, 53, 99, 34, 243, 165, 215, 93, 232, 67, 184, 27]));
signatures.push_back(bytesn!(&ctx.env, 0x660d542b3f6de9cd08f238fd44133eeebfea290b21dae7322a63b516c57b8df12c4c0a340b60ed567c8da53578346c212b27b797eb42a75fb4b7076c567a6ff91c));

client.recv_message_with_signatures(&src_network, &conn_sn, &msg, &signatures);
}
Expand All @@ -493,22 +502,25 @@ fn test_receive_message_with_invalid_signature() {

ctx.init_context(&client);

let val1 = [4, 174, 54, 168, 191, 216, 207, 101, 134, 243, 76, 104, 133, 40, 137, 72, 53, 245, 231, 193, 157, 54, 104, 155, 172, 84, 96, 101, 107, 97, 60, 94, 171, 241, 250, 152, 34, 18, 170, 39, 202, 236, 226, 58, 39, 8, 235, 60, 137, 54, 225, 50, 185, 253, 130, 197, 174, 226, 170, 75, 6, 145, 123, 87, 19];
let val2 = [4, 91, 65, 155, 222, 192, 210, 187, 193, 108, 232, 174, 20, 79, 248, 232, 37, 18, 63, 208, 203, 62, 54, 208, 7, 91, 109, 141, 229, 170, 181, 51, 136, 172, 143, 180, 194, 138, 138, 56, 67, 243, 7, 60, 218, 164, 12, 148, 63, 116, 115, 127, 192, 206, 164, 169, 95, 135, 119, 138, 255, 172, 115, 129, 144];
let val3 = [4, 248, 192, 175, 198, 228, 250, 20, 158, 23, 251, 176, 244, 208, 150, 71, 151, 27, 208, 22, 41, 30, 154, 198, 109, 10, 112, 142, 200, 47, 200, 213, 210, 172, 135, 141, 129, 183, 211, 241, 211, 127, 16, 19, 67, 159, 195, 235, 88, 164, 223, 47, 128, 47, 147, 28, 121, 28, 93, 129, 176, 144, 52, 243, 55];
let val1 = bytesn!(&ctx.env, 0x04deca512d5cb87673b23ab10c3e3572e30a2b5dc78cd500bf84bf066275c0bb320cb6cd266aa179b41323b5a18ab4a170248ed89b436b5559bab38c816ce12209);
let val2 = bytesn!(&ctx.env, 0x04f9379b2955d759a9532f8daa0c4a25da0ae706dd057de02af7754adb4b956ec9b8bf7a8a5a6686bc74dff736442a874c6bae5dcbcdb7113e24fbfa2337c63a01);
let val3 = bytesn!(&ctx.env, 0x041d7fa5b41fe40ae85130c4cc334f7852c25c19e7f326a916d49f6b9c3f35a1216bf53c805d177c28f7bedc2d2521cb0f13dc832ef689797965274d26df50cd0f);
let val4 = bytesn!(&ctx.env, 0x041d7fa5b41fe40ae85130c4cc334f7852c25c19e7f326a916d49f6b9c3f35a1216bf53c805d177c28f7bedc2d2521cb0f13dc832ef689797965274d26df50cd0f);

let mut validators = Vec::new(&ctx.env);
validators.push_back(BytesN::from_array(&ctx.env, &val1));
validators.push_back(BytesN::from_array(&ctx.env, &val2));
validators.push_back(BytesN::from_array(&ctx.env, &val3));
client.update_validators(&validators, &1_u32);
validators.push_back(val1);
validators.push_back(val2);
validators.push_back(val3);
validators.push_back(val4);
client.update_validators(&validators, &2_u32);

let conn_sn = 456456_u128;
let msg = Bytes::from_array(&ctx.env,&[104, 100, 108, 108, 111]);
let src_network = String::from_str(&ctx.env, "0x2.icon");

let mut signatures = Vec::new(&ctx.env);
signatures.push_back(BytesN::from_array(&ctx.env, &[35, 247, 49, 199, 251, 53, 83, 51, 115, 148, 35, 48, 85, 203, 185, 236, 5, 171, 221, 29, 247, 203, 190, 195, 208, 218, 204, 237, 88, 191, 91, 75, 48, 87, 108, 161, 75, 234, 147, 234, 65, 134, 233, 32, 249, 159, 43, 159, 86, 211, 1, 117, 176, 167, 53, 99, 34, 243, 165, 215, 93, 232, 67, 184, 27]));
signatures.push_back(bytesn!(&ctx.env, 0x660d542b3f6de9cd08f238fd44133eeebfea290b21dae7322a63b516c57b8df12c4c0a340b60ed567c8da53578346c212b27b797eb42a75fb4b7076c567a6ff91c));
signatures.push_back(bytesn!(&ctx.env, 0x660d542b3f6de9cd08f238fd44133eeebfea290b21dae7322a63b516c57b8df12c4c0a340b60ed567c8da53578346c212b27b797eb42a75fb4b7076c567a6ff91c));

client.recv_message_with_signatures(&src_network, &conn_sn, &msg, &signatures);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ module xcall::cluster_entry{
}

entry fun recieve_message_with_signatures(xcall:&mut XCallState,cap:&ConnCap,src_net_id:String,sn:u128,msg:vector<u8>,signatures:vector<vector<u8>>,ctx: &mut TxContext){
let dst_net_id=xcall_state::get_net_id(xcall);
let state=get_state_mut(xcall_state::get_connection_states_mut(xcall),cap.connection_id());
cluster_state::verify_signatures(state, src_net_id, sn, msg, signatures);
cluster_state::verify_signatures(state, src_net_id, sn, msg, dst_net_id, signatures);
cluster_state::check_save_receipt(state, src_net_id, sn);
xcall::handle_message(xcall, cap,src_net_id, msg,ctx);
}
Expand Down
Loading
Loading