From 98965d718d553fe9750b3caac08fb655f0bcfa73 Mon Sep 17 00:00:00 2001 From: ahramy Date: Mon, 21 Oct 2024 10:05:11 -0700 Subject: [PATCH] feat(stellar-gateway): update gateway message approval args consistent --- .../stellar_approve_messages_execute_data.golden | 2 +- .../stellar_messages_payload_digest.golden | 2 +- external-gateways/stellar/src/lib.rs | 16 ++++++++-------- .../src/testdata/messages_approval_hash.golden | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/contracts/multisig-prover/src/encoding/testdata/stellar_approve_messages_execute_data.golden b/contracts/multisig-prover/src/encoding/testdata/stellar_approve_messages_execute_data.golden index b850c968f..8170e4705 100644 --- a/contracts/multisig-prover/src/encoding/testdata/stellar_approve_messages_execute_data.golden +++ b/contracts/multisig-prover/src/encoding/testdata/stellar_approve_messages_execute_data.golden @@ -1 +1 @@ -0000001000000001000000020000001000000001000000010000001100000001000000050000000f00000010636f6e74726163745f61646472657373000000120000000100000000000000000000000000000000000000000000000000000000000000060000000f0000000a6d6573736167655f696400000000000e00000004746573740000000f0000000c7061796c6f61645f686173680000000d00000020595c9108df17d1cc43e8268ec1516064299c1388bcc86fdd566bcdf400a0a1ed0000000f0000000e736f757263655f6164647265737300000000000e0000003843414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141484b334d0000000f0000000c736f757263655f636861696e0000000e00000006736f7572636500000000001100000001000000030000000f000000056e6f6e63650000000000000d0000002000000000000000000000000000000000000000000000000000000000000007e80000000f000000077369676e657273000000001000000001000000030000001100000001000000020000000f000000097369676e61747572650000000000001000000001000000020000000f000000065369676e656400000000000d00000040b5b3b0749aa585f866d802e32ca4a6356f82eb52e2a1b4797cbaa30f3d755462f2eb995c70d9099e436b8a48498e4d613ff2d3ca7618973a36c2fde17493180f0000000f000000067369676e657200000000001100000001000000020000000f000000067369676e657200000000000d0000002012f7d9a9463212335914b39ee90bfa2045f90b64c1f2d7b58ed335282abac4a40000000f00000006776569676874000000000009000000000000000000000000000000080000001100000001000000020000000f000000097369676e61747572650000000000001000000001000000010000000f00000008556e7369676e65640000000f000000067369676e657200000000001100000001000000020000000f000000067369676e657200000000000d000000204c3863e4b0252a8674c1c6ad70b3ca3002b400b49ddfae5583b21907e65c5dd80000000f00000006776569676874000000000009000000000000000000000000000000010000001100000001000000020000000f000000097369676e61747572650000000000001000000001000000020000000f000000065369676e656400000000000d0000004028e2c8accfa1c2db93349c6d3f783004d6a92cdbf322b92b3555315999e0eaf5d8bdf9deb58d798168a880972e81b8513dcb942de44862317d501cf7445c660a0000000f000000067369676e657200000000001100000001000000020000000f000000067369676e657200000000000d00000020c35aa94d2038f258ecb1bb28fbc8a83ab79d2dc0a7223fd528a8f52a14c032920000000f00000006776569676874000000000009000000000000000000000000000000070000000f000000097468726573686f6c64000000000000090000000000000000000000000000000a \ No newline at end of file +0000001000000001000000020000001000000001000000010000001100000001000000050000000f0000000c736f757263655f636861696e0000000e00000006736f7572636500000000000f0000000a6d6573736167655f696400000000000e00000004746573740000000f0000000e736f757263655f6164647265737300000000000e0000003843414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141484b334d0000000f00000010636f6e74726163745f61646472657373000000120000000100000000000000000000000000000000000000000000000000000000000000060000000f0000000c7061796c6f61645f686173680000000d00000020595c9108df17d1cc43e8268ec1516064299c1388bcc86fdd566bcdf400a0a1ed0000001100000001000000030000000f000000056e6f6e63650000000000000d0000002000000000000000000000000000000000000000000000000000000000000007e80000000f000000077369676e657273000000001000000001000000030000001100000001000000020000000f000000097369676e61747572650000000000001000000001000000020000000f000000065369676e656400000000000d00000040b5b3b0749aa585f866d802e32ca4a6356f82eb52e2a1b4797cbaa30f3d755462f2eb995c70d9099e436b8a48498e4d613ff2d3ca7618973a36c2fde17493180f0000000f000000067369676e657200000000001100000001000000020000000f000000067369676e657200000000000d0000002012f7d9a9463212335914b39ee90bfa2045f90b64c1f2d7b58ed335282abac4a40000000f00000006776569676874000000000009000000000000000000000000000000080000001100000001000000020000000f000000097369676e61747572650000000000001000000001000000010000000f00000008556e7369676e65640000000f000000067369676e657200000000001100000001000000020000000f000000067369676e657200000000000d000000204c3863e4b0252a8674c1c6ad70b3ca3002b400b49ddfae5583b21907e65c5dd80000000f00000006776569676874000000000009000000000000000000000000000000010000001100000001000000020000000f000000097369676e61747572650000000000001000000001000000020000000f000000065369676e656400000000000d0000004028e2c8accfa1c2db93349c6d3f783004d6a92cdbf322b92b3555315999e0eaf5d8bdf9deb58d798168a880972e81b8513dcb942de44862317d501cf7445c660a0000000f000000067369676e657200000000001100000001000000020000000f000000067369676e657200000000000d00000020c35aa94d2038f258ecb1bb28fbc8a83ab79d2dc0a7223fd528a8f52a14c032920000000f00000006776569676874000000000009000000000000000000000000000000070000000f000000097468726573686f6c64000000000000090000000000000000000000000000000a \ No newline at end of file diff --git a/contracts/multisig-prover/src/encoding/testdata/stellar_messages_payload_digest.golden b/contracts/multisig-prover/src/encoding/testdata/stellar_messages_payload_digest.golden index 82b3f830f..cf0053631 100644 --- a/contracts/multisig-prover/src/encoding/testdata/stellar_messages_payload_digest.golden +++ b/contracts/multisig-prover/src/encoding/testdata/stellar_messages_payload_digest.golden @@ -1 +1 @@ -0d29098e3f5a7ead5c97c0f8e74051e1de9cb601105551f8d4a898187e0f4f0d \ No newline at end of file +344590fc7787e0bbfee71155ee0e7a5610cc2bc04446a5b200b3d028aed8c3fe \ No newline at end of file diff --git a/external-gateways/stellar/src/lib.rs b/external-gateways/stellar/src/lib.rs index 6ec121bed..eb2a0e93f 100644 --- a/external-gateways/stellar/src/lib.rs +++ b/external-gateways/stellar/src/lib.rs @@ -47,8 +47,8 @@ impl TryFrom for ScVal { #[derive(Debug, Clone)] pub struct Message { - pub message_id: String, pub source_chain: String, + pub message_id: String, pub source_address: String, pub contract_address: Contract, pub payload_hash: Hash, @@ -75,19 +75,19 @@ impl TryFrom for ScVal { fn try_from(value: Message) -> Result { let keys: [&'static str; 5] = [ - "contract_address", + "source_chain", "message_id", - "payload_hash", "source_address", - "source_chain", + "contract_address", + "payload_hash", ]; let vals: [ScVal; 5] = [ - ScVal::Address(ScAddress::Contract(Hash(value.contract_address.0))), + ScVal::String(StringM::from_str(&value.source_chain)?.into()), ScVal::String(StringM::from_str(&value.message_id)?.into()), - ScVal::Bytes(BytesM::try_from(AsRef::<[u8; 32]>::as_ref(&value.payload_hash))?.into()), ScVal::String(StringM::from_str(&value.source_address)?.into()), - ScVal::String(StringM::from_str(&value.source_chain)?.into()), + ScVal::Address(ScAddress::Contract(Hash(value.contract_address.0))), + ScVal::Bytes(BytesM::try_from(AsRef::<[u8; 32]>::as_ref(&value.payload_hash))?.into()), ]; sc_map_from_slices(&keys, &vals) @@ -429,8 +429,8 @@ mod test { let messages: Messages = (1..=4) .map(|i| Message { - message_id: format!("test-{}", i), source_chain: format!("source-{}", i), + message_id: format!("test-{}", i), source_address: "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" .to_string(), contract_address: "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4" diff --git a/external-gateways/stellar/src/testdata/messages_approval_hash.golden b/external-gateways/stellar/src/testdata/messages_approval_hash.golden index 4512173fc..b1b632e23 100644 --- a/external-gateways/stellar/src/testdata/messages_approval_hash.golden +++ b/external-gateways/stellar/src/testdata/messages_approval_hash.golden @@ -1 +1 @@ -49f6a85aec4b4f72c667f2ba7950a692a59f462007abdbce0181e2982c0b602e \ No newline at end of file +da3910a0a3f2497c2a84986c69ce5ad2fba978a1686ce3edf2fbaaaa35db0206 \ No newline at end of file