From 5c1e6ae5cfbf508f29d39d818f556b14321be9bb Mon Sep 17 00:00:00 2001 From: Iulian Pascalau Date: Wed, 16 Oct 2024 15:44:55 +0300 Subject: [PATCH 1/6] - added the proxy contract on the upgrade function --- bridge-proxy/src/esdt_safe_proxy.rs | 7 +++++-- bridged-tokens-wrapper/src/esdt_safe_proxy.rs | 7 +++++-- esdt-safe/src/lib.rs | 3 +++ multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs | 8 ++------ multi-transfer-esdt/src/esdt_safe_proxy.rs | 7 +++++-- multisig/src/bridge_proxy_contract_proxy.rs | 8 ++------ multisig/src/esdt_safe_proxy.rs | 7 +++++-- multisig/src/multisig_proxy.rs | 6 +++--- 8 files changed, 30 insertions(+), 23 deletions(-) diff --git a/bridge-proxy/src/esdt_safe_proxy.rs b/bridge-proxy/src/esdt_safe_proxy.rs index 3e56f004..d0cd9f65 100644 --- a/bridge-proxy/src/esdt_safe_proxy.rs +++ b/bridge-proxy/src/esdt_safe_proxy.rs @@ -80,18 +80,21 @@ where pub fn upgrade< Arg0: ProxyArg>, Arg1: ProxyArg>, - Arg2: ProxyArg>, + Arg2: ProxyArg>, + Arg3: ProxyArg>, >( self, fee_estimator_contract_address: Arg0, multi_transfer_contract_address: Arg1, - eth_tx_gas_limit: Arg2, + bridge_proxy_contract_address: Arg2, + eth_tx_gas_limit: Arg3, ) -> TxTypedUpgrade { self.wrapped_tx .payment(NotPayable) .raw_upgrade() .argument(&fee_estimator_contract_address) .argument(&multi_transfer_contract_address) + .argument(&bridge_proxy_contract_address) .argument(ð_tx_gas_limit) .original_result() } diff --git a/bridged-tokens-wrapper/src/esdt_safe_proxy.rs b/bridged-tokens-wrapper/src/esdt_safe_proxy.rs index 3e56f004..d0cd9f65 100644 --- a/bridged-tokens-wrapper/src/esdt_safe_proxy.rs +++ b/bridged-tokens-wrapper/src/esdt_safe_proxy.rs @@ -80,18 +80,21 @@ where pub fn upgrade< Arg0: ProxyArg>, Arg1: ProxyArg>, - Arg2: ProxyArg>, + Arg2: ProxyArg>, + Arg3: ProxyArg>, >( self, fee_estimator_contract_address: Arg0, multi_transfer_contract_address: Arg1, - eth_tx_gas_limit: Arg2, + bridge_proxy_contract_address: Arg2, + eth_tx_gas_limit: Arg3, ) -> TxTypedUpgrade { self.wrapped_tx .payment(NotPayable) .raw_upgrade() .argument(&fee_estimator_contract_address) .argument(&multi_transfer_contract_address) + .argument(&bridge_proxy_contract_address) .argument(ð_tx_gas_limit) .original_result() } diff --git a/esdt-safe/src/lib.rs b/esdt-safe/src/lib.rs index b50c3e52..06e6c73d 100644 --- a/esdt-safe/src/lib.rs +++ b/esdt-safe/src/lib.rs @@ -65,12 +65,15 @@ pub trait EsdtSafe: &self, fee_estimator_contract_address: ManagedAddress, multi_transfer_contract_address: ManagedAddress, + bridge_proxy_contract_address: ManagedAddress, eth_tx_gas_limit: BigUint, ) { self.fee_estimator_contract_address() .set(&fee_estimator_contract_address); self.multi_transfer_contract_address() .set(&multi_transfer_contract_address); + self.bridge_proxy_contract_address(). + set(&bridge_proxy_contract_address); self.eth_tx_gas_limit().set(ð_tx_gas_limit); diff --git a/multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs b/multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs index 842e5d22..5f30fb71 100644 --- a/multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs +++ b/multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs @@ -110,16 +110,12 @@ where .original_result() } - pub fn cancel< - Arg0: ProxyArg, - >( + pub fn update_lowest_tx_id( self, - tx_id: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) - .raw_call("cancel") - .argument(&tx_id) + .raw_call("updateLowestTxId") .original_result() } diff --git a/multi-transfer-esdt/src/esdt_safe_proxy.rs b/multi-transfer-esdt/src/esdt_safe_proxy.rs index 3e56f004..d0cd9f65 100644 --- a/multi-transfer-esdt/src/esdt_safe_proxy.rs +++ b/multi-transfer-esdt/src/esdt_safe_proxy.rs @@ -80,18 +80,21 @@ where pub fn upgrade< Arg0: ProxyArg>, Arg1: ProxyArg>, - Arg2: ProxyArg>, + Arg2: ProxyArg>, + Arg3: ProxyArg>, >( self, fee_estimator_contract_address: Arg0, multi_transfer_contract_address: Arg1, - eth_tx_gas_limit: Arg2, + bridge_proxy_contract_address: Arg2, + eth_tx_gas_limit: Arg3, ) -> TxTypedUpgrade { self.wrapped_tx .payment(NotPayable) .raw_upgrade() .argument(&fee_estimator_contract_address) .argument(&multi_transfer_contract_address) + .argument(&bridge_proxy_contract_address) .argument(ð_tx_gas_limit) .original_result() } diff --git a/multisig/src/bridge_proxy_contract_proxy.rs b/multisig/src/bridge_proxy_contract_proxy.rs index 842e5d22..5f30fb71 100644 --- a/multisig/src/bridge_proxy_contract_proxy.rs +++ b/multisig/src/bridge_proxy_contract_proxy.rs @@ -110,16 +110,12 @@ where .original_result() } - pub fn cancel< - Arg0: ProxyArg, - >( + pub fn update_lowest_tx_id( self, - tx_id: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) - .raw_call("cancel") - .argument(&tx_id) + .raw_call("updateLowestTxId") .original_result() } diff --git a/multisig/src/esdt_safe_proxy.rs b/multisig/src/esdt_safe_proxy.rs index 3e56f004..d0cd9f65 100644 --- a/multisig/src/esdt_safe_proxy.rs +++ b/multisig/src/esdt_safe_proxy.rs @@ -80,18 +80,21 @@ where pub fn upgrade< Arg0: ProxyArg>, Arg1: ProxyArg>, - Arg2: ProxyArg>, + Arg2: ProxyArg>, + Arg3: ProxyArg>, >( self, fee_estimator_contract_address: Arg0, multi_transfer_contract_address: Arg1, - eth_tx_gas_limit: Arg2, + bridge_proxy_contract_address: Arg2, + eth_tx_gas_limit: Arg3, ) -> TxTypedUpgrade { self.wrapped_tx .payment(NotPayable) .raw_upgrade() .argument(&fee_estimator_contract_address) .argument(&multi_transfer_contract_address) + .argument(&bridge_proxy_contract_address) .argument(ð_tx_gas_limit) .original_result() } diff --git a/multisig/src/multisig_proxy.rs b/multisig/src/multisig_proxy.rs index a652c8ba..1ae8bd16 100644 --- a/multisig/src/multisig_proxy.rs +++ b/multisig/src/multisig_proxy.rs @@ -180,7 +180,7 @@ where /// Sender Address, Destination Address, Token ID, Amount, Tx Nonce pub fn propose_multi_transfer_esdt_batch< Arg0: ProxyArg, - Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, ManagedOption>>>>, + Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, Option>>>>, >( self, eth_batch_id: Arg0, @@ -934,7 +934,7 @@ where /// To check if it was executed as well, use the wasActionExecuted view pub fn was_transfer_action_proposed< Arg0: ProxyArg, - Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, ManagedOption>>>>, + Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, Option>>>>, >( self, eth_batch_id: Arg0, @@ -953,7 +953,7 @@ where /// Will return 0 if the transfers were not proposed pub fn get_action_id_for_transfer_batch< Arg0: ProxyArg, - Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, ManagedOption>>>>, + Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, Option>>>>, >( self, eth_batch_id: Arg0, From be04924a493e52d3441b998edd71e2253f006c68 Mon Sep 17 00:00:00 2001 From: Iulian Pascalau Date: Wed, 16 Oct 2024 15:48:16 +0300 Subject: [PATCH 2/6] - fixed tests --- multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs | 1 + multisig/tests/multisig_blackbox_test.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs b/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs index 8f967610..70f0cc7e 100644 --- a/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs +++ b/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs @@ -164,6 +164,7 @@ impl MultiTransferTestState { .upgrade( ManagedAddress::zero(), MULTI_TRANSFER_ADDRESS.to_address(), + BRIDGE_PROXY_ADDRESS.to_address(), ESDT_SAFE_ETH_TX_GAS_LIMIT, ) .code(ESDT_SAFE_CODE_PATH) diff --git a/multisig/tests/multisig_blackbox_test.rs b/multisig/tests/multisig_blackbox_test.rs index 14aadfff..fba5a36c 100644 --- a/multisig/tests/multisig_blackbox_test.rs +++ b/multisig/tests/multisig_blackbox_test.rs @@ -207,6 +207,7 @@ impl MultiTransferTestState { .upgrade( ManagedAddress::zero(), MULTI_TRANSFER_ADDRESS.to_address(), + BRIDGE_PROXY_ADDRESS.to_address(), ESDT_SAFE_ETH_TX_GAS_LIMIT, ) .code(ESDT_SAFE_CODE_PATH) From de2ad693917d0cd2ddd9561e5e9b095260a312fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Costin=20Caraba=C8=99?= Date: Wed, 16 Oct 2024 16:13:35 +0300 Subject: [PATCH 3/6] multisig: fix proxy --- multisig/src/multisig_proxy.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/multisig/src/multisig_proxy.rs b/multisig/src/multisig_proxy.rs index 1ae8bd16..a652c8ba 100644 --- a/multisig/src/multisig_proxy.rs +++ b/multisig/src/multisig_proxy.rs @@ -180,7 +180,7 @@ where /// Sender Address, Destination Address, Token ID, Amount, Tx Nonce pub fn propose_multi_transfer_esdt_batch< Arg0: ProxyArg, - Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, Option>>>>, + Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, ManagedOption>>>>, >( self, eth_batch_id: Arg0, @@ -934,7 +934,7 @@ where /// To check if it was executed as well, use the wasActionExecuted view pub fn was_transfer_action_proposed< Arg0: ProxyArg, - Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, Option>>>>, + Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, ManagedOption>>>>, >( self, eth_batch_id: Arg0, @@ -953,7 +953,7 @@ where /// Will return 0 if the transfers were not proposed pub fn get_action_id_for_transfer_batch< Arg0: ProxyArg, - Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, Option>>>>, + Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, ManagedOption>>>>, >( self, eth_batch_id: Arg0, From c1b606919b45a36d3f9fbf836e05a63402f14d89 Mon Sep 17 00:00:00 2001 From: Iulian Pascalau Date: Wed, 16 Oct 2024 16:50:21 +0300 Subject: [PATCH 4/6] - fixed scripts - fixed/added/tested the upgrade scripts - added proxy compare workflow --- .github/workflows/proxy-compare.yml | 32 ++++++++++ .../interaction/config/menu_functions.cfg | 30 ++++++++-- .../interaction/config/multisig-snippets.sh | 15 +++++ .../config/multitransfer-snippets.sh | 25 +++++++- multisig/interaction/config/proxy-snippets.sh | 24 ++++++++ multisig/interaction/config/safe-snippets.sh | 34 +++++++++++ .../interaction/config/upgrade-snippets.sh | 60 ------------------- .../interaction/config/wrapped-snippets.sh | 9 --- multisig/interaction/script.sh | 27 +++++++-- 9 files changed, 175 insertions(+), 81 deletions(-) create mode 100644 .github/workflows/proxy-compare.yml delete mode 100644 multisig/interaction/config/upgrade-snippets.sh diff --git a/.github/workflows/proxy-compare.yml b/.github/workflows/proxy-compare.yml new file mode 100644 index 00000000..73386c86 --- /dev/null +++ b/.github/workflows/proxy-compare.yml @@ -0,0 +1,32 @@ +name: CI + +on: + push: + branches: + - master + - feat/* + pull_request: + +jobs: + proxy_compare: + name: Proxy compare - newly generated vs present in file tree + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + default: true + toolchain: stable + target: wasm32-unknown-unknown + + - name: Install prerequisites + run: | + cargo install --path framework/meta + + - name: Run proxy compare + run: | + cd contracts + sc-meta all proxy --compare diff --git a/multisig/interaction/config/menu_functions.cfg b/multisig/interaction/config/menu_functions.cfg index b920c9d7..48c727c5 100644 --- a/multisig/interaction/config/menu_functions.cfg +++ b/multisig/interaction/config/menu_functions.cfg @@ -7,17 +7,12 @@ source $SCRIPTPATH/config/multisig-snippets.sh source $SCRIPTPATH/config/multitransfer-snippets.sh source $SCRIPTPATH/config/proxy-snippets.sh source $SCRIPTPATH/config/relayers-snippets.sh -source $SCRIPTPATH/config/upgrade-snippets.sh source $SCRIPTPATH/config/wrapped-snippets.sh source $SCRIPTPATH/config/safe-snippets.sh source $SCRIPTPATH/config/testing.sh CHECK_VARIABLES ALICE PROXY CHAIN_ID -function upgrade-wrapper { - wrapper-upgrade -} - function upgrade-wrapper-universal-token { wrapper-updateWrappedToken } @@ -54,9 +49,9 @@ function deploy-bridge-contracts { confirmation-with-skip setEsdtSafeOnSCProxy confirmation-with-skip setEsdtSafeOnWrapper - confirmation-with-skip setSCProxyOnWrapper confirmation-with-skip setBridgedTokensWrapperOnEsdtSafe + confirmation-with-skip setSCProxyOnEsdtSafe confirmation-with-skip changeChildContractsOwnershipSafe confirmation-with-skip changeChildContractsOwnershipMultiTransfer @@ -182,6 +177,29 @@ function upgrade-aggregator { aggregator-upgrade } +function upgrade-wrapper { + wrapper-upgrade +} + +function upgrade-safe { + confirmation-with-skip deploySafeForUpgrade + confirmation-with-skip upgradeSafeContract +} + +function upgrade-multi-transfer { + confirmation-with-skip deployMultiTransferForUpgrade + confirmation-with-skip upgradeMultiTransferContract +} + +function upgrade-proxy { + confirmation-with-skip deployBridgeProxyForUpgrade + confirmation-with-skip upgradeBridgeProxyContract +} + +function upgrade-multisig { + confirmation-with-skip upgradeMultisig +} + function faucet-deposit { confirmation-with-skip deployFaucet echo -e diff --git a/multisig/interaction/config/multisig-snippets.sh b/multisig/interaction/config/multisig-snippets.sh index 3eb939eb..a0dade83 100644 --- a/multisig/interaction/config/multisig-snippets.sh +++ b/multisig/interaction/config/multisig-snippets.sh @@ -228,3 +228,18 @@ initSupplyMintBurn() { --arguments str:${CHAIN_SPECIFIC_TOKEN} ${MINT} ${BURN} \ --send --proxy=${PROXY} --chain=${CHAIN_ID} } + +upgradeMultisig() { + CHECK_VARIABLES SAFE MULTI_TRANSFER BRIDGE_PROXY MULTISIG_WASM + + mxpy --verbose contract upgrade ${MULTISIG} --bytecode=${MULTISIG_WASM} --recall-nonce --pem=${ALICE} \ + --gas-limit=100000000 --send \ + --arguments ${SAFE} ${MULTI_TRANSFER} ${BRIDGE_PROXY} \ + --outfile="upgrade-multisig-child-sc.json" --proxy=${PROXY} --chain=${CHAIN_ID} || return + + TRANSACTION=$(mxpy data parse --file="./upgrade-multisig-child-sc.json" --expression="data['emitted_tx']['hash']") + ADDRESS=$(mxpy data parse --file="./upgrade-multisig-child-sc.json" --expression="data['contractAddress']") + + echo "" + echo "Multisig contract updated: ${ADDRESS}" +} diff --git a/multisig/interaction/config/multitransfer-snippets.sh b/multisig/interaction/config/multitransfer-snippets.sh index 61f1d10c..68958542 100644 --- a/multisig/interaction/config/multitransfer-snippets.sh +++ b/multisig/interaction/config/multitransfer-snippets.sh @@ -29,4 +29,27 @@ setBridgedTokensWrapperOnMultiTransfer() { --gas-limit=60000000 --function="setWrappingContractAddress" \ --arguments ${BRIDGED_TOKENS_WRAPPER} \ --send --proxy=${PROXY} --chain=${CHAIN_ID} -} \ No newline at end of file +} + +deployMultiTransferForUpgrade() { + CHECK_VARIABLES MULTI_TRANSFER_WASM + + mxpy --verbose contract deploy --bytecode=${MULTI_TRANSFER_WASM} --recall-nonce --pem=${ALICE} \ + --gas-limit=100000000 --metadata-payable \ + --send --outfile="deploy-multitransfer-upgrade.interaction.json" --proxy=${PROXY} --chain=${CHAIN_ID} || return + + TRANSACTION=$(mxpy data parse --file="./deploy-multitransfer-upgrade.interaction.json" --expression="data['emittedTransactionHash']") + ADDRESS=$(mxpy data parse --file="./deploy-multitransfer-upgrade.interaction.json" --expression="data['contractAddress']") + + echo "" + echo "New multi transfer contract address: ${ADDRESS}" +} + +upgradeMultiTransferContract() { + local NEW_MULTI_TRANSFER_ADDR=$(mxpy data parse --file="./deploy-multitransfer-upgrade.interaction.json" --expression="data['contractAddress']") + + mxpy --verbose contract call ${MULTISIG} --recall-nonce --pem=${ALICE} \ + --gas-limit=400000000 --function="upgradeChildContractFromSource" \ + --arguments ${MULTI_TRANSFER} ${NEW_MULTI_TRANSFER_ADDR} 0x00 \ + --send --outfile="upgrade-multitransfer-child-sc.json" --proxy=${PROXY} --chain=${CHAIN_ID} +} diff --git a/multisig/interaction/config/proxy-snippets.sh b/multisig/interaction/config/proxy-snippets.sh index ffad8187..507815d0 100644 --- a/multisig/interaction/config/proxy-snippets.sh +++ b/multisig/interaction/config/proxy-snippets.sh @@ -43,3 +43,27 @@ setEsdtSafeOnSCProxy() { --arguments ${SAFE} \ --send --proxy=${PROXY} --chain=${CHAIN_ID} } + +deployBridgeProxyForUpgrade() { + CHECK_VARIABLES PROXY_WASM MULTI_TRANSFER + + mxpy --verbose contract deploy --bytecode=${PROXY_WASM} --recall-nonce --pem=${ALICE} \ + --gas-limit=200000000 \ + --arguments ${MULTI_TRANSFER} \ + --send --outfile="deploy-proxy-upgrade.interaction.json" --proxy=${PROXY} --chain=${CHAIN_ID} || return + + TRANSACTION=$(mxpy data parse --file="./deploy-proxy-upgrade.interaction.json" --expression="data['emittedTransactionHash']") + ADDRESS=$(mxpy data parse --file="./deploy-proxy-upgrade.interaction.json" --expression="data['contractAddress']") + + echo "" + echo "New proxy contract address: ${ADDRESS}" +} + +upgradeBridgeProxyContract() { + local NEW_BRIDGE_PROXY_ADDR=$(mxpy data parse --file="./deploy-proxy-upgrade.interaction.json" --expression="data['contractAddress']") + + mxpy --verbose contract call ${MULTISIG} --recall-nonce --pem=${ALICE} \ + --gas-limit=400000000 --function="upgradeChildContractFromSource" \ + --arguments ${BRIDGE_PROXY} ${NEW_BRIDGE_PROXY_ADDR} 0x00 \ + --send --outfile="upgrade-proxy-child-sc.json" --proxy=${PROXY} --chain=${CHAIN_ID} +} diff --git a/multisig/interaction/config/safe-snippets.sh b/multisig/interaction/config/safe-snippets.sh index 988d14af..2adf00fd 100644 --- a/multisig/interaction/config/safe-snippets.sh +++ b/multisig/interaction/config/safe-snippets.sh @@ -43,3 +43,37 @@ setBridgedTokensWrapperOnEsdtSafe() { --arguments ${BRIDGED_TOKENS_WRAPPER} \ --send --proxy=${PROXY} --chain=${CHAIN_ID} } + +setSCProxyOnEsdtSafe() { + CHECK_VARIABLES SAFE BRIDGE_PROXY + + mxpy --verbose contract call ${SAFE} --recall-nonce --pem=${ALICE} \ + --gas-limit=60000000 --function="setBridgeProxyContractAddress" \ + --arguments ${BRIDGE_PROXY} \ + --send --proxy=${PROXY} --chain=${CHAIN_ID} +} + +deploySafeForUpgrade() { + CHECK_VARIABLES SAFE_WASM MULTI_TRANSFER AGGREGATOR BRIDGE_PROXY + + mxpy --verbose contract deploy --bytecode=${SAFE_WASM} --recall-nonce --pem=${ALICE} \ + --gas-limit=150000000 \ + --arguments ${AGGREGATOR} ${MULTI_TRANSFER} 1 \ + --send --outfile="deploy-safe-upgrade.interaction.json" --proxy=${PROXY} --chain=${CHAIN_ID} || return + + TRANSACTION=$(mxpy data parse --file="./deploy-safe-upgrade.interaction.json" --expression="data['emittedTransactionHash']") + ADDRESS=$(mxpy data parse --file="./deploy-safe-upgrade.interaction.json" --expression="data['contractAddress']") + + echo "" + echo "New safe contract address: ${ADDRESS}" +} + +upgradeSafeContract() { + local NEW_SAFE_ADDR=$(mxpy data parse --file="./deploy-safe-upgrade.interaction.json" --expression="data['contractAddress']") + + mxpy --verbose contract call ${MULTISIG} --recall-nonce --pem=${ALICE} \ + --gas-limit=400000000 --function="upgradeChildContractFromSource" \ + --arguments ${SAFE} ${NEW_SAFE_ADDR} 0x00 \ + ${AGGREGATOR} ${MULTI_TRANSFER} ${BRIDGE_PROXY} 1 \ + --send --outfile="upgrade-safe-child-sc.json" --proxy=${PROXY} --chain=${CHAIN_ID} +} diff --git a/multisig/interaction/config/upgrade-snippets.sh b/multisig/interaction/config/upgrade-snippets.sh deleted file mode 100644 index 60c9fa62..00000000 --- a/multisig/interaction/config/upgrade-snippets.sh +++ /dev/null @@ -1,60 +0,0 @@ -#TODO: check & updates upgrade snippets -deploySafeForUpgrade() { - getAggregatorAddressHex - - local ESDT_SAFE_ETH_TX_GAS_LIMIT=20000 # gives us 200$ for multiversx->eth - - mxpy --verbose contract deploy --project=${PROJECT_SAFE} --recall-nonce --pem=${ALICE} \ - --gas-limit=150000000 \ - --arguments 0x${AGGREGATOR_ADDRESS_HEX} ${ESDT_SAFE_ETH_TX_GAS_LIMIT} \ - --send --outfile="deploy-safe-upgrade.interaction.json" --proxy=${PROXY} --chain=${CHAIN_ID} || return - - ADDRESS=$(mxpy data parse --file="./deploy-safe-upgrade.interaction.json" --expression="data['contractAddress']") - - echo "" - echo "Safe contract address: ${ADDRESS}" -} - - -upgradeSafeContract() { - getEsdtSafeAddressHex - getAggregatorAddressHex - local ESDT_SAFE_ETH_TX_GAS_LIMIT=20000 - - local NEW_SAFE_BECH=$(mxpy data parse --file="./deploy-safe-upgrade.interaction.json" --expression="data['contractAddress']") - local NEW_SAFE_ADDR=$(mxpy wallet bech32 --decode $NEW_SAFE_BECH) - - - - mxpy --verbose contract call ${ADDRESS} --recall-nonce --pem=${ALICE} \ - --gas-limit=400000000 --function="upgradeChildContractFromSource" \ - --arguments 0x${ESDT_SAFE_ADDRESS_HEX} 0x${NEW_SAFE_ADDR} 0x00 \ - 0x${AGGREGATOR_ADDRESS_HEX} ${ESDT_SAFE_ETH_TX_GAS_LIMIT} \ - --send --outfile="upgradesafe-child-sc-spam.json" --proxy=${PROXY} --chain=${CHAIN_ID} -} - -upgrade() { - mxpy --verbose contract upgrade ${ADDRESS} --project=${PROJECT} --recall-nonce --pem=${ALICE} \ - --gas-limit=100000000 --send --outfile="upgrade.json" --proxy=${PROXY} --chain=${CHAIN_ID} || return -} - -upgradeMultisig() { - CHECK_VARIABLES RELAYER_ADDR_0 RELAYER_ADDR_1 RELAYER_ADDR_2 RELAYER_ADDR_3 \ - RELAYER_ADDR_4 RELAYER_ADDR_5 RELAYER_ADDR_6 RELAYER_ADDR_7 RELAYER_ADDR_8 \ - RELAYER_ADDR_9 SAFE MULTI_TRANSFER RELAYER_REQUIRED_STAKE SLASH_AMOUNT QUORUM MULTISIG MULTISIG_WASM - - MIN_STAKE=$(echo "$RELAYER_REQUIRED_STAKE*10^18" | bc) - mxpy --verbose contract upgrade ${MULTISIG} --bytecode=${MULTISIG_WASM} --recall-nonce --pem=${ALICE} \ - --gas-limit=200000000 \ - --arguments ${SAFE} ${MULTI_TRANSFER} ${BRIDGE_PROXY} \ - --send --outfile="deploy-testnet.interaction.json" --proxy=${PROXY} --chain=${CHAIN_ID} || return - - TRANSACTION=$(mxpy data parse --file="./deploy-testnet.interaction.json" --expression="data['emitted_tx']['hash']") - ADDRESS=$(mxpy data parse --file="./deploy-testnet.interaction.json" --expression="data['contractAddress']") - - mxpy data store --key=address-testnet-multisig --value=${ADDRESS} - mxpy data store --key=deployTransaction-testnet --value=${TRANSACTION} - - echo "" - echo "Multisig contract address: ${ADDRESS}" -} \ No newline at end of file diff --git a/multisig/interaction/config/wrapped-snippets.sh b/multisig/interaction/config/wrapped-snippets.sh index 60bba5e6..87a1fc0e 100644 --- a/multisig/interaction/config/wrapped-snippets.sh +++ b/multisig/interaction/config/wrapped-snippets.sh @@ -137,12 +137,3 @@ setEsdtSafeOnWrapper() { --arguments ${SAFE} \ --send --proxy=${PROXY} --chain=${CHAIN_ID} } - -setSCProxyOnWrapper() { - CHECK_VARIABLES BRIDGED_TOKENS_WRAPPER BRIDGE_PROXY - - mxpy --verbose contract call ${BRIDGED_TOKENS_WRAPPER} --recall-nonce --pem=${ALICE} \ - --gas-limit=60000000 --function="setBridgeProxyContractAddress" \ - --arguments ${BRIDGE_PROXY} \ - --send --proxy=${PROXY} --chain=${CHAIN_ID} -} diff --git a/multisig/interaction/script.sh b/multisig/interaction/script.sh index 1fe0cd7f..84e5fb17 100755 --- a/multisig/interaction/script.sh +++ b/multisig/interaction/script.sh @@ -13,10 +13,6 @@ case "$1" in confirmation deploy-bridge-contracts ;; -'upgrade-wrapper') - confirmation upgrade-wrapper - ;; - 'add-relayer') confirmation addBoardMember ;; @@ -95,6 +91,26 @@ case "$1" in confirmation upgrade-aggregator ;; +'upgrade-wrapper') + confirmation upgrade-wrapper + ;; + +'upgrade-safe') + confirmation upgrade-safe + ;; + +'upgrade-multi-transfer') + confirmation upgrade-multi-transfer + ;; + +'upgrade-proxy') + confirmation upgrade-proxy + ;; + +'upgrade-multisig') + confirmation upgrade-multisig + ;; + 'whitelist-native-token') confirmation whitelist-native-token ;; @@ -111,7 +127,8 @@ case "$1" in echo "Usage: Invalid choice: '"$1"'" echo -e echo "Choose from:" - echo " { \"deploy-bridge-contracts\", \"upgrade-aggregator\", \"upgrade-wrapper\", " + echo " { \"deploy-bridge-contracts\", " + echo " \"upgrade-aggregator\", \"upgrade-wrapper\", \"upgrade-safe\", \"upgrade-multi-transfer\", \"upgrade-proxy\", \"upgrade-multisig\" " echo " \"pause-contracts\", \"unpause-contracts\", \"add-relayer\", \"remove-relayer\", " echo " \"set-safe-max-tx\", \"set-safe-batch-block-duration\", \"change-quorum\", \"set-swap-fee\", " echo " \"whitelist-token\", \"whitelist-native-token\", \"remove-whitelist-token\", \"upgrade-wrapper-universal-token\", \"upgrade-wrapper-chain-specific-token\", " From 25c36a922307a3d22e648b98faca43fd7b68b3fa Mon Sep 17 00:00:00 2001 From: Iulian Pascalau Date: Wed, 16 Oct 2024 16:55:15 +0300 Subject: [PATCH 5/6] - fixing workflow --- .github/workflows/proxy-compare.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/proxy-compare.yml b/.github/workflows/proxy-compare.yml index 73386c86..7517cc7d 100644 --- a/.github/workflows/proxy-compare.yml +++ b/.github/workflows/proxy-compare.yml @@ -28,5 +28,4 @@ jobs: - name: Run proxy compare run: | - cd contracts sc-meta all proxy --compare From 65a916d1b39289d9b42b875f8c8b4907d3b7606d Mon Sep 17 00:00:00 2001 From: Iulian Pascalau Date: Wed, 16 Oct 2024 16:58:07 +0300 Subject: [PATCH 6/6] - removed workflow --- .github/workflows/proxy-compare.yml | 31 ----------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .github/workflows/proxy-compare.yml diff --git a/.github/workflows/proxy-compare.yml b/.github/workflows/proxy-compare.yml deleted file mode 100644 index 7517cc7d..00000000 --- a/.github/workflows/proxy-compare.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: CI - -on: - push: - branches: - - master - - feat/* - pull_request: - -jobs: - proxy_compare: - name: Proxy compare - newly generated vs present in file tree - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - default: true - toolchain: stable - target: wasm32-unknown-unknown - - - name: Install prerequisites - run: | - cargo install --path framework/meta - - - name: Run proxy compare - run: | - sc-meta all proxy --compare