diff --git a/multisig/scenarios/execute_multiversx_to_ethereum_tx_batch.scen.json b/multisig/scenarios/execute_multiversx_to_ethereum_tx_batch.scen.json index c965c992..a71e0268 100644 --- a/multisig/scenarios/execute_multiversx_to_ethereum_tx_batch.scen.json +++ b/multisig/scenarios/execute_multiversx_to_ethereum_tx_batch.scen.json @@ -38,7 +38,7 @@ "nonce": "*", "balance": "*", "storage": { - "str:action_data.item|u32:1": { + "str:actionData.item|u32:1": { "1-action_type": "u8:1", "2-batch_id": "u64:1", "3-tx_batch_status_len": "u32:2", @@ -51,7 +51,6 @@ "+": {} } }, - { "step": "scCall", "txId": "second-relayer-sign", @@ -257,4 +256,4 @@ } } ] -} +} \ No newline at end of file diff --git a/multisig/scenarios/reject_multiversx_to_ethereum_tx_batch.scen.json b/multisig/scenarios/reject_multiversx_to_ethereum_tx_batch.scen.json index 122fabab..033bd8ab 100644 --- a/multisig/scenarios/reject_multiversx_to_ethereum_tx_batch.scen.json +++ b/multisig/scenarios/reject_multiversx_to_ethereum_tx_batch.scen.json @@ -38,7 +38,7 @@ "nonce": "*", "balance": "*", "storage": { - "str:action_data.item|u32:1": { + "str:actionData.item|u32:1": { "1-action_type": "u8:1", "2-batch_id": "u64:1", "3-tx_batch_status_len": "u32:2", @@ -286,4 +286,4 @@ } } ] -} +} \ No newline at end of file diff --git a/multisig/scenarios/setup.scen.json b/multisig/scenarios/setup.scen.json index 56e2e062..e96de844 100644 --- a/multisig/scenarios/setup.scen.json +++ b/multisig/scenarios/setup.scen.json @@ -75,11 +75,6 @@ "str:tokenTicker|nested:str:GWEI": "str:GWEI", "str:tokenTicker|nested:str:WEGLD-123456": "str:WEGLD", "str:tokenTicker|nested:str:ETH-123456": "str:ETH", - "str:tokenWhitelist.index|nested:str:WEGLD-123456": "1", - "str:tokenWhitelist.item|u32:1": "str:WEGLD-123456", - "str:tokenWhitelist.index|nested:str:ETH-123456": "2", - "str:tokenWhitelist.item|u32:2": "str:ETH-123456", - "str:tokenWhitelist.len": "2", "str:mintBalances|nested:str:WEGLD-123456": "500,000,000,000", "str:mintBalances|nested:str:ETH-123456": "500,000,000,000" }, @@ -106,6 +101,11 @@ "balance": "1000", "storage": {} }, + "address:relayer3": { + "nonce": "0", + "balance": "1000", + "storage": {} + }, "address:user": { "nonce": "0", "balance": "0", @@ -170,12 +170,12 @@ "str:proxyAddress": "sc:bridge_proxy", "str:bridgedTokensWrapperAddress": "sc:bridged_tokens_wrapper", "str:feeEstimatorAddress": "sc:price_aggregator", - "str:num_board_members": "2", + "str:numBoardMembers": "2", "str:quorum": "2", "str:requiredStakeAmount": "1000", "str:slashAmount": "500", - "str:user_role|u32:1": "1", - "str:user_role|u32:2": "1", + "str:userRole|u32:1": "1", + "str:userRole|u32:2": "1", "str:user_address_to_id|address:relayer1": "1", "str:user_address_to_id|address:relayer2": "2", "str:user_count": "2", @@ -287,20 +287,6 @@ ] } }, - { - "step": "scQuery", - "txId": "get-all-known-tokens", - "tx": { - "to": "sc:esdt_safe", - "function": "getAllKnownTokens" - }, - "expect": { - "out": [ - "str:WEGLD-123456", - "str:ETH-123456" - ] - } - }, { "step": "scCall", "txId": "unpause multisig", @@ -375,6 +361,20 @@ "gas": "*", "refund": "*" } + }, + { + "step": "scQuery", + "txId": "get-all-known-tokens", + "tx": { + "to": "sc:esdt_safe", + "function": "getAllKnownTokens" + }, + "expect": { + "out": [ + "str:WEGLD-123456", + "str:ETH-123456" + ] + } } ] } \ No newline at end of file diff --git a/multisig/scenarios/unstake.scen.json b/multisig/scenarios/unstake.scen.json index ab177b2a..af19caaf 100644 --- a/multisig/scenarios/unstake.scen.json +++ b/multisig/scenarios/unstake.scen.json @@ -42,6 +42,67 @@ "gasLimit": "35,000,000", "gasPrice": "0" }, + "expect": { + "status": "4", + "message": "str:Quorum size not appropriate", + "out": [], + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "txId": "third-relayer-stake", + "tx": { + "from": "address:relayer3", + "to": "sc:multisig", + "value": "1000", + "function": "stake", + "arguments": [], + "gasLimit": "35,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "4", + "message": "str:Only board members can stake", + "out": [], + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "txId": "add-board-member", + "tx": { + "from": "address:owner", + "to": "sc:multisig", + "function": "addBoardMember", + "arguments": [ + "address:relayer3" + ], + "gasLimit": "35,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "0", + "message": "", + "out": [], + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "txId": "third-relayer-stake", + "tx": { + "from": "address:relayer3", + "to": "sc:multisig", + "value": "1,000", + "function": "stake", + "arguments": [], + "gasLimit": "35,000,000", + "gasPrice": "0" + }, "expect": { "status": "0", "message": "", @@ -50,17 +111,52 @@ "refund": "*" } }, + { + "step": "scQuery", + "txId": "getAllStakedRelayers - only one staked", + "tx": { + "to": "sc:multisig", + "function": "getAllStakedRelayers", + "arguments": [] + }, + "expect": { + "status": "0", + "message": "", + "out": [ + "address:relayer1", + "address:relayer2", + "address:relayer3" + ] + } + }, { "step": "checkState", "accounts": { + "address:relayer1": { + "nonce": "2", + "balance": "0", + "storage": {} + }, + "address:relayer2": { + "nonce": "1", + "balance": "0", + "storage": {} + }, + "address:relayer3": { + "nonce": "2", + "balance": "0", + "storage": {} + }, "sc:multisig": { "nonce": "*", - "balance": "*", + "balance": "3000", "storage": { - "str:quorum": "1", + "str:amountStaked|address:relayer1": "1000", + "str:amountStaked|address:relayer2": "1000", + "str:amountStaked|address:relayer3": "1000", "+": "" }, - "code": "*" + "code": "file:../output/multisig.wasm" }, "+": {} } @@ -92,11 +188,12 @@ "accounts": { "sc:multisig": { "nonce": "*", - "balance": "2000", + "balance": "3000", "storage": { - "str:quorum": "1", - "str:user_role|u32:1": "1", + "str:quorum": "2", + "str:user_role|u32:1": "0", "str:user_role|u32:2": "0", + "str:user_role|u32:3": "0", "+": "" }, "code": "*" @@ -158,11 +255,12 @@ }, "sc:multisig": { "nonce": "*", - "balance": "1000", + "balance": "2000", "storage": { - "str:quorum": "1", - "str:user_role|u32:1": "1", + "str:quorum": "2", + "str:user_role|u32:1": "0", "str:user_role|u32:2": "0", + "str:user_role|u32:3": "0", "+": "" }, "code": "*" diff --git a/multisig/src/setup.rs b/multisig/src/setup.rs index 351458c0..8e90cdf1 100644 --- a/multisig/src/setup.rs +++ b/multisig/src/setup.rs @@ -82,7 +82,7 @@ pub trait SetupModule: let total_users = self.user_mapper().get_user_count(); let mut board_member_with_valid_stake: usize = 0; - for user_id in 0..total_users { + for user_id in 1..total_users + 1 { let user_role = self.user_id_to_role(user_id).get(); if user_role.is_board_member() {