Skip to content

Commit

Permalink
Merge pull request #72 from oraichain/feat/release-v0.50.6
Browse files Browse the repository at this point in the history
Feat/release v0.50.6
  • Loading branch information
GNaD13 authored Feb 27, 2025
2 parents a829488 + 11f2f4b commit 0e9f7a3
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 18 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ replace (

github.com/ethereum/go-ethereum => github.com/oraichain/go-ethereum v0.0.0-20240919025041-184f816b9d65

github.com/evmos/ethermint => github.com/oraichain/ethermint-cosmos-0.50 v0.0.0-20241112074159-1d969f3946ea
github.com/evmos/ethermint => github.com/oraichain/ethermint-cosmos-0.50 v0.0.0-20250227073221-242283aa6f1b
// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
// See: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.8.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -953,8 +953,8 @@ github.com/oraichain/cometbft v0.38.6-0.20250207043129-6ccdb4a201d3 h1:Rj7XV6xqH
github.com/oraichain/cometbft v0.38.6-0.20250207043129-6ccdb4a201d3/go.mod h1:5l0SkgeLRXi6bBfQuevXjKqML1jjfJJlvI1Ulp02/o4=
github.com/oraichain/cosmos-sdk v0.50.5-0.20241115211416-da07f8fc9695 h1:S4IswHlEqqKRNx1nJorAbm3KoELAQqVcOqrOKgidfyQ=
github.com/oraichain/cosmos-sdk v0.50.5-0.20241115211416-da07f8fc9695/go.mod h1:6Eesrx3ZE7vxBZWpK++30H+Uc7Q4ahQWCL7JKU/LEdU=
github.com/oraichain/ethermint-cosmos-0.50 v0.0.0-20241112074159-1d969f3946ea h1:KmcratbKNYsEpFDCMUlQ1jHWan/0tooTSKBKZczSJDM=
github.com/oraichain/ethermint-cosmos-0.50 v0.0.0-20241112074159-1d969f3946ea/go.mod h1:Qo/mdpsOXOcwIe/QfF//cnJDliBnZMDeNOSfPxgyX3I=
github.com/oraichain/ethermint-cosmos-0.50 v0.0.0-20250227073221-242283aa6f1b h1:L23vy1XYxR0/P8GUou7CDSEIj5Ka9YSVnlWU7THtfiY=
github.com/oraichain/ethermint-cosmos-0.50 v0.0.0-20250227073221-242283aa6f1b/go.mod h1:Qo/mdpsOXOcwIe/QfF//cnJDliBnZMDeNOSfPxgyX3I=
github.com/oraichain/go-ethereum v0.0.0-20240919025041-184f816b9d65 h1:oumbt8qiUC1AAt9MgHHnn/deseV5oYdg3T/PoYqsGeM=
github.com/oraichain/go-ethereum v0.0.0-20240919025041-184f816b9d65/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/oraichain/ibc-go-fork/modules/capability v0.0.0-20241202080239-8bdb6f914705 h1:K/PQ2Ca4UrrT3+zzwa9Ifjf+Q6Hkteh34pfqF1sTLJM=
Expand Down
13 changes: 9 additions & 4 deletions scripts/e2e-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ set -eu

# setup the network using the old binary

OLD_VERSION=${OLD_VERSION:-"v0.50.4"}
OLD_VERSION=${OLD_VERSION:-"v0.50.5"}
WASM_PATH=${WASM_PATH:-"$PWD/scripts/wasm_file/oraiswap-token.wasm"}
ARGS="--chain-id testing -y --keyring-backend test --gas auto --gas-adjustment 1.5"
NEW_VERSION=${NEW_VERSION:-"v0.50.5"}
NEW_VERSION=${NEW_VERSION:-"v0.50.6"}
VALIDATOR_HOME=${VALIDATOR_HOME:-"$HOME/.oraid/validator1"}
MIGRATE_MSG=${MIGRATE_MSG:-'{}'}
EXECUTE_MSG=${EXECUTE_MSG:-'{"ping":{}}'}
Expand Down Expand Up @@ -36,6 +36,8 @@ cd $current_dir
# setup local network
sh $PWD/scripts/multinode-local-testnet.sh

sleep 5

# create new upgrade proposal
UPGRADE_HEIGHT=${UPGRADE_HEIGHT:-35}

Expand Down Expand Up @@ -121,7 +123,7 @@ fi

sh $PWD/scripts/test_clock_counter_contract.sh
# v0.42.1 tests
# USER=validator1 USER2=validator2 WASM_PATH="$PWD/scripts/wasm_file/counter_high_gas_cost.wasm" sh $PWD/scripts/tests-0.42.1/test-gasless.sh
USER=validator1 USER2=validator2 WASM_PATH="$PWD/scripts/wasm_file/counter_high_gas_cost.wasm" sh $PWD/scripts/tests-0.42.1/test-gasless.sh
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.1/test-tokenfactory.sh
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.1/test-tokenfactory-bindings.sh
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.1/test-evm-cosmos-mapping.sh
Expand All @@ -135,7 +137,7 @@ NODE_HOME=$VALIDATOR_HOME sh $PWD/scripts/tests-0.42.3/test-commit-timeout.sh

# v0.42.4 tests
NODE_HOME=$VALIDATOR_HOME sh $PWD/scripts/tests-0.42.4/test-cw-stargate-staking-query.sh
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.4/test-cw20-erc20.sh
# NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.4/test-cw20-erc20.sh
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.4/test-globalfee.sh

# v0.50.1 tests
Expand All @@ -153,5 +155,8 @@ USER=validator1 USER2=validator2 sh $PWD/scripts/tests-0.50.3/test-gasless.sh
# v0.50.4 tests
NODE_HOME=$VALIDATOR_HOME USER=validator1 FUND=1000orai sh $PWD/scripts/tests-0.50.4/test-tokenfactory-force-transfer.sh

# v0.50.6 tests
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.50.6/test-cw20-erc30-not-mint-aorai.sh

echo "Tests Passed!!"
bash scripts/clean-multinode-local-testnet.sh
2 changes: 1 addition & 1 deletion scripts/json/proposal.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
"authority": "orai10d07y265gmmuvt4z0w9aw880jnsr700jf39xhq",
"plan": {
"name": "v0.50.5",
"name": "v0.50.6",
"time": "0001-01-01T00:00:00Z",
"height": "35",
"info": "upgrade info",
Expand Down
25 changes: 18 additions & 7 deletions scripts/multinode-local-testnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ oraid keys add validator1 $ARGS --home $VALIDATOR1_HOME >$HIDE_LOGS
oraid keys add validator2 $ARGS --home $VALIDATOR2_HOME >$HIDE_LOGS
oraid keys add validator3 $ARGS --home $VALIDATOR3_HOME >$HIDE_LOGS

update_genesis () {
cat $VALIDATOR1_HOME/config/genesis.json | jq "$1" > $VALIDATOR1_HOME/config/tmp_genesis.json && mv $VALIDATOR1_HOME/config/tmp_genesis.json $VALIDATOR1_HOME/config/genesis.json
update_genesis() {
cat $VALIDATOR1_HOME/config/genesis.json | jq "$1" >$VALIDATOR1_HOME/config/tmp_genesis.json && mv $VALIDATOR1_HOME/config/tmp_genesis.json $VALIDATOR1_HOME/config/genesis.json
}

# change staking denom to orai
Expand Down Expand Up @@ -173,18 +173,18 @@ sleep 1
oraid tx bank send $VALIDATOR1_ADDRESS $VALIDATOR3_ADDRESS 5000000000orai --home $VALIDATOR1_HOME $TX_SEND_ARGS >$HIDE_LOGS
# send test orai to a test account
sleep 1
oraid tx bank send $VALIDATOR1_ADDRESS orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9 5000000000orai --home $VALIDATOR1_HOME $TX_SEND_ARGS > $HIDE_LOGS
oraid tx bank send $VALIDATOR1_ADDRESS orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9 5000000000orai --home $VALIDATOR1_HOME $TX_SEND_ARGS >$HIDE_LOGS

echo "Waiting 1 second to create two new validators..."
sleep 1

validator='{"pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"xj740yWkYQbJCNkof2m7hQWpyaO6eFQ8qvGmYrtsqjQ="},"amount":"500000000orai","moniker":"validator3","identity":"","website":"","security":"","details":"","commission-rate":"0.1","commission-max-rate":"0.2","commission-max-change-rate":"0.05","min-self-delegation":"500000000"}'
validator_info_temp_path=$PWD/scripts/json/validator.json

echo $validator > $validator_info_temp_path
echo $validator >$validator_info_temp_path

update_validator () {
cat $validator_info_temp_path | jq "$1" > $PWD/scripts/json/temp_validator.json && mv $PWD/scripts/json/temp_validator.json $validator_info_temp_path
update_validator() {
cat $validator_info_temp_path | jq "$1" >$PWD/scripts/json/temp_validator.json && mv $PWD/scripts/json/temp_validator.json $validator_info_temp_path
}

VALIDATOR2_PUBKEY=$(oraid tendermint show-validator --home $VALIDATOR2_HOME | jq -r '.key')
Expand All @@ -200,7 +200,18 @@ oraid tx staking create-validator $PWD/scripts/json/validator.json --from valida
update_validator ".pubkey[\"key\"]=\"$VALIDATOR3_PUBKEY\""
update_validator '.moniker="validator3"'
update_validator '.amount="500000000orai"'
oraid tx staking create-validator $PWD/scripts/json/validator.json --from validator3 --home $VALIDATOR3_HOME $TX_SEND_ARGS > $HIDE_LOGS
oraid tx staking create-validator $PWD/scripts/json/validator.json --from validator3 --home $VALIDATOR3_HOME $TX_SEND_ARGS >$HIDE_LOGS

pkill oraid

# disable max-txs evm mempool
sed -i -e "s%^max-txs *=.*%max-txs = 0%; " $VALIDATOR2_APP_TOML
sed -i -e "s%^max-txs *=.*%max-txs = 0%; " $VALIDATOR3_APP_TOML

# start all three validators
screen -S validator1 -d -m oraid start --home $VALIDATOR1_HOME
screen -S validator2 -d -m oraid start --home $VALIDATOR2_HOME
screen -S validator3 -d -m oraid start --home $VALIDATOR3_HOME

echo "All 3 Validators are up and running!"
# cleanup validator.json
Expand Down
6 changes: 3 additions & 3 deletions scripts/test_clock_counter_contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# sh $PWD/scripts/multinode-local-testnet.sh
# cw-clock-example.wasm source code: https://github.com/oraichain/cw-plus.git

set -eu
set -ux

WASM_PATH=${WASM_PATH:-"$PWD/scripts/wasm_file/cw-clock-example.wasm"}
ARGS="--chain-id testing -y --keyring-backend test --gas auto --gas-adjustment 1.5 -b sync"
Expand All @@ -21,15 +21,15 @@ CLOCK_PROPOSAL_FILE=${CLOCK_PROPOSAL_FILE:-"$PWD/scripts/json/clock-proposal.jso
store_ret=$(oraid tx wasm store $WASM_PATH $VALIDATOR1_ARGS $ARGS --output json)
store_txhash=$(echo $store_ret | jq -r '.txhash')
# need to sleep 1s for tx already in block
sleep 2
sleep 5
# need to use temp.json since there's a weird error: jq: parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 1, column 72291
# probably because of weird characters from the raw code bytes
oraid query tx $store_txhash --output json > temp.json
code_id=$(cat temp.json | jq -r '.events[4].attributes[] | select(.key | contains("code_id")).value')
rm temp.json
oraid tx wasm instantiate $code_id '{}' --label 'cw clock contract' $VALIDATOR1_ARGS --admin $(oraid keys show validator1 --keyring-backend test --home $HOME/.oraid/validator1 -a) $ARGS > $HIDE_LOGS
# need to sleep 1s for tx already in block
sleep 2
sleep 5
contract_address=$(oraid query wasm list-contract-by-code $code_id --output json | jq -r '.contracts | last')
echo "cw-clock contract address: $contract_address, $CONTRACT_GAS_LIMIT, $TITLE, $INITIAL_DEPOSIT, $DESCRIPTION"

Expand Down
94 changes: 94 additions & 0 deletions scripts/tests-0.50.6/test-cw20-erc30-not-mint-aorai.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/bin/bash
# Before running this script, you must setup local network:
# sh $PWD/scripts/multinode-local-testnet.sh
# oraiswap-token.wasm source code: https://github.com/oraichain/oraiswap.git

set -eu

# hard-coded test private key. DO NOT USE!!
PRIVATE_KEY_ETH=${PRIVATE_KEY_ETH:-"021646C7F742C743E60CC460C56242738A3951667E71C803929CB84B6FA4B0D6"}
PRIVATE_KEY_EVM_ADDRESS=${PRIVATE_KEY_EVM_ADDRESS:-"0xB0ac9d216b303a32907632731a93356228CAEE87"}
current_dir=$PWD
WASM_PATH=${WASM_PATH:-"$PWD/scripts/wasm_file/oraiswap-token.wasm"}
ARGS="--chain-id testing -y --keyring-backend test --gas auto --gas-adjustment 1.5 -b sync"
VALIDATOR1_ARGS=${VALIDATOR1_ARGS:-"--from validator1 --home $HOME/.oraid/validator1"}

HIDE_LOGS="/dev/null"

store_ret=$(oraid tx wasm store $WASM_PATH $VALIDATOR1_ARGS $ARGS --output json)
store_txhash=$(echo $store_ret | jq -r '.txhash')
# need to sleep 1s for tx already in block
sleep 2
code_id=$(oraid query tx $store_txhash --output json | jq -r '.events[4].attributes[] | select(.key | contains("code_id")).value')

# 2 addresses that map with the hard-coded private key above
INSTANTIATE_MSG='{"name":"OraichainToken","symbol":"ORAI","decimals":6,"initial_balances":[{"amount":"1000000000","address":"orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9"},{"amount":"1000000000","address":"orai1hgscrqcd2kmju4t5akujeugwrfev7uxv66lnuu"}]}'
oraid tx wasm instantiate $code_id $INSTANTIATE_MSG --label 'cw20 ORAI' $VALIDATOR1_ARGS --admin $(oraid keys show validator1 --keyring-backend test --home $HOME/.oraid/validator1 -a) $ARGS >$HIDE_LOGS
# need to sleep 1s for tx already in block
sleep 2
contract_address=$(oraid query wasm list-contract-by-code $code_id --output json | jq -r '.contracts | last')
echo "cw-stargate-staking-query contract address: $contract_address"

# clone or pull latest repo
if [ -d "$PWD/../evm-bridge-proxy" ]; then
cd ../evm-bridge-proxy
git pull origin master
else
git clone https://github.com/oraichain/evm-bridge-proxy.git ../evm-bridge-proxy
cd ../evm-bridge-proxy
fi

# prepare env and chain
yarn && yarn compile
echo "PRIVATE_KEY=$PRIVATE_KEY_ETH" >.env

# before deploying erc20, we need to fund the private key's address first
oraid tx bank send $USER orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9 100000orai $VALIDATOR1_ARGS $ARGS >$HIDE_LOGS
sleep 2 # wait for tx

# deploy cw20erc20 contract
output=$(CW20_ADDRESS=$contract_address yarn hardhat run scripts/cw20erc20-deploy.ts --network testing)
# collect only the contract address part
contract_addr=$(echo "$output" | grep -oE '0x[0-9a-fA-F]+')
echo "ERC20 contract addr: $contract_addr"

# validate
contract_addr_len=${#contract_addr}
if [ $contract_addr_len -ne 42 ]; then
echo "Couldn't deploy ERC20 contract. CW20-ERC20 Not Mint Aorai Test Failed"
fi

# try querying balance of owner -> get balance of from cosmwasm contract
output=$(ERC20_ADDRESS=$contract_addr yarn hardhat run scripts/cw20erc20-query-balance-of.ts --network testing)
balance_of=$(echo "$output" | awk '/^[0-9]+$/ { print $1 }')
if ! [ $balance_of == "1000000000" ]; then
echo "Could not query balance of CW20ERC20 address. CW20-ERC20 Not Mint Aorai Test Failed"
exit 1
fi

aorai_balance=$(oraid query bank balance orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9 aorai --output json | jq '.balance.amount')
if [ $aorai_balance >0]; then
echo "Aorai Minted. CW20-ERC20 Not Mint Aorai Test Failed"
exit 1
fi

# try querying decimals -> get decimals from cosmwasm contract
orai_balance_before_transfer=$(oraid query bank balance orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9 orai --output json | jq '.balance.amount')
ERC20_ADDRESS=$contract_addr yarn hardhat run scripts/cw20erc20-transfer.ts --network testing
orai_balance_after_transfer=$(oraid query bank balance orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9 orai --output json | jq '.balance.amount')

# try querying balance of owner after transfer -> should drop
output=$(ERC20_ADDRESS=$contract_addr yarn hardhat run scripts/cw20erc20-query-balance-of.ts --network testing)
balance_of=$(echo "$output" | awk '/^[0-9]+$/ { print $1 }')
if [ $balance_of == "1000000000" ]; then
echo "Could not transfer CW20 token from ERC20 contract. CW20-ERC20 Test Failed"
exit 1
fi

if [ $orai_balance_before_transfer == $orai_balance_after_transfer ]; then
echo "Could not transfer native ORAI token from ERC20 contract. CW20-ERC20 Test Failed"
exit 1
fi

echo "CW20-ERC20 Test Passed"
cd $current_dir

0 comments on commit 0e9f7a3

Please sign in to comment.