Skip to content

Commit 0e9f7a3

Browse files
authored
Merge pull request #72 from oraichain/feat/release-v0.50.6
Feat/release v0.50.6
2 parents a829488 + 11f2f4b commit 0e9f7a3

7 files changed

+128
-18
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ replace (
299299

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

302-
github.com/evmos/ethermint => github.com/oraichain/ethermint-cosmos-0.50 v0.0.0-20241112074159-1d969f3946ea
302+
github.com/evmos/ethermint => github.com/oraichain/ethermint-cosmos-0.50 v0.0.0-20250227073221-242283aa6f1b
303303
// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
304304
// See: https://github.com/cosmos/cosmos-sdk/issues/10409
305305
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.8.1

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -953,8 +953,8 @@ github.com/oraichain/cometbft v0.38.6-0.20250207043129-6ccdb4a201d3 h1:Rj7XV6xqH
953953
github.com/oraichain/cometbft v0.38.6-0.20250207043129-6ccdb4a201d3/go.mod h1:5l0SkgeLRXi6bBfQuevXjKqML1jjfJJlvI1Ulp02/o4=
954954
github.com/oraichain/cosmos-sdk v0.50.5-0.20241115211416-da07f8fc9695 h1:S4IswHlEqqKRNx1nJorAbm3KoELAQqVcOqrOKgidfyQ=
955955
github.com/oraichain/cosmos-sdk v0.50.5-0.20241115211416-da07f8fc9695/go.mod h1:6Eesrx3ZE7vxBZWpK++30H+Uc7Q4ahQWCL7JKU/LEdU=
956-
github.com/oraichain/ethermint-cosmos-0.50 v0.0.0-20241112074159-1d969f3946ea h1:KmcratbKNYsEpFDCMUlQ1jHWan/0tooTSKBKZczSJDM=
957-
github.com/oraichain/ethermint-cosmos-0.50 v0.0.0-20241112074159-1d969f3946ea/go.mod h1:Qo/mdpsOXOcwIe/QfF//cnJDliBnZMDeNOSfPxgyX3I=
956+
github.com/oraichain/ethermint-cosmos-0.50 v0.0.0-20250227073221-242283aa6f1b h1:L23vy1XYxR0/P8GUou7CDSEIj5Ka9YSVnlWU7THtfiY=
957+
github.com/oraichain/ethermint-cosmos-0.50 v0.0.0-20250227073221-242283aa6f1b/go.mod h1:Qo/mdpsOXOcwIe/QfF//cnJDliBnZMDeNOSfPxgyX3I=
958958
github.com/oraichain/go-ethereum v0.0.0-20240919025041-184f816b9d65 h1:oumbt8qiUC1AAt9MgHHnn/deseV5oYdg3T/PoYqsGeM=
959959
github.com/oraichain/go-ethereum v0.0.0-20240919025041-184f816b9d65/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
960960
github.com/oraichain/ibc-go-fork/modules/capability v0.0.0-20241202080239-8bdb6f914705 h1:K/PQ2Ca4UrrT3+zzwa9Ifjf+Q6Hkteh34pfqF1sTLJM=

scripts/e2e-upgrade.sh

+9-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ set -eu
44

55
# setup the network using the old binary
66

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

39+
sleep 5
40+
3941
# create new upgrade proposal
4042
UPGRADE_HEIGHT=${UPGRADE_HEIGHT:-35}
4143

@@ -121,7 +123,7 @@ fi
121123

122124
sh $PWD/scripts/test_clock_counter_contract.sh
123125
# v0.42.1 tests
124-
# 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
126+
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
125127
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.1/test-tokenfactory.sh
126128
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.1/test-tokenfactory-bindings.sh
127129
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.1/test-evm-cosmos-mapping.sh
@@ -135,7 +137,7 @@ NODE_HOME=$VALIDATOR_HOME sh $PWD/scripts/tests-0.42.3/test-commit-timeout.sh
135137

136138
# v0.42.4 tests
137139
NODE_HOME=$VALIDATOR_HOME sh $PWD/scripts/tests-0.42.4/test-cw-stargate-staking-query.sh
138-
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.4/test-cw20-erc20.sh
140+
# NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.4/test-cw20-erc20.sh
139141
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.4/test-globalfee.sh
140142

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

158+
# v0.50.6 tests
159+
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.50.6/test-cw20-erc30-not-mint-aorai.sh
160+
156161
echo "Tests Passed!!"
157162
bash scripts/clean-multinode-local-testnet.sh

scripts/json/proposal.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
55
"authority": "orai10d07y265gmmuvt4z0w9aw880jnsr700jf39xhq",
66
"plan": {
7-
"name": "v0.50.5",
7+
"name": "v0.50.6",
88
"time": "0001-01-01T00:00:00Z",
99
"height": "35",
1010
"info": "upgrade info",

scripts/multinode-local-testnet.sh

+18-7
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ oraid keys add validator1 $ARGS --home $VALIDATOR1_HOME >$HIDE_LOGS
3131
oraid keys add validator2 $ARGS --home $VALIDATOR2_HOME >$HIDE_LOGS
3232
oraid keys add validator3 $ARGS --home $VALIDATOR3_HOME >$HIDE_LOGS
3333

34-
update_genesis () {
35-
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
34+
update_genesis() {
35+
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
3636
}
3737

3838
# change staking denom to orai
@@ -173,18 +173,18 @@ sleep 1
173173
oraid tx bank send $VALIDATOR1_ADDRESS $VALIDATOR3_ADDRESS 5000000000orai --home $VALIDATOR1_HOME $TX_SEND_ARGS >$HIDE_LOGS
174174
# send test orai to a test account
175175
sleep 1
176-
oraid tx bank send $VALIDATOR1_ADDRESS orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9 5000000000orai --home $VALIDATOR1_HOME $TX_SEND_ARGS > $HIDE_LOGS
176+
oraid tx bank send $VALIDATOR1_ADDRESS orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9 5000000000orai --home $VALIDATOR1_HOME $TX_SEND_ARGS >$HIDE_LOGS
177177

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

181181
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"}'
182182
validator_info_temp_path=$PWD/scripts/json/validator.json
183183

184-
echo $validator > $validator_info_temp_path
184+
echo $validator >$validator_info_temp_path
185185

186-
update_validator () {
187-
cat $validator_info_temp_path | jq "$1" > $PWD/scripts/json/temp_validator.json && mv $PWD/scripts/json/temp_validator.json $validator_info_temp_path
186+
update_validator() {
187+
cat $validator_info_temp_path | jq "$1" >$PWD/scripts/json/temp_validator.json && mv $PWD/scripts/json/temp_validator.json $validator_info_temp_path
188188
}
189189

190190
VALIDATOR2_PUBKEY=$(oraid tendermint show-validator --home $VALIDATOR2_HOME | jq -r '.key')
@@ -200,7 +200,18 @@ oraid tx staking create-validator $PWD/scripts/json/validator.json --from valida
200200
update_validator ".pubkey[\"key\"]=\"$VALIDATOR3_PUBKEY\""
201201
update_validator '.moniker="validator3"'
202202
update_validator '.amount="500000000orai"'
203-
oraid tx staking create-validator $PWD/scripts/json/validator.json --from validator3 --home $VALIDATOR3_HOME $TX_SEND_ARGS > $HIDE_LOGS
203+
oraid tx staking create-validator $PWD/scripts/json/validator.json --from validator3 --home $VALIDATOR3_HOME $TX_SEND_ARGS >$HIDE_LOGS
204+
205+
pkill oraid
206+
207+
# disable max-txs evm mempool
208+
sed -i -e "s%^max-txs *=.*%max-txs = 0%; " $VALIDATOR2_APP_TOML
209+
sed -i -e "s%^max-txs *=.*%max-txs = 0%; " $VALIDATOR3_APP_TOML
210+
211+
# start all three validators
212+
screen -S validator1 -d -m oraid start --home $VALIDATOR1_HOME
213+
screen -S validator2 -d -m oraid start --home $VALIDATOR2_HOME
214+
screen -S validator3 -d -m oraid start --home $VALIDATOR3_HOME
204215

205216
echo "All 3 Validators are up and running!"
206217
# cleanup validator.json

scripts/test_clock_counter_contract.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# sh $PWD/scripts/multinode-local-testnet.sh
44
# cw-clock-example.wasm source code: https://github.com/oraichain/cw-plus.git
55

6-
set -eu
6+
set -ux
77

88
WASM_PATH=${WASM_PATH:-"$PWD/scripts/wasm_file/cw-clock-example.wasm"}
99
ARGS="--chain-id testing -y --keyring-backend test --gas auto --gas-adjustment 1.5 -b sync"
@@ -21,15 +21,15 @@ CLOCK_PROPOSAL_FILE=${CLOCK_PROPOSAL_FILE:-"$PWD/scripts/json/clock-proposal.jso
2121
store_ret=$(oraid tx wasm store $WASM_PATH $VALIDATOR1_ARGS $ARGS --output json)
2222
store_txhash=$(echo $store_ret | jq -r '.txhash')
2323
# need to sleep 1s for tx already in block
24-
sleep 2
24+
sleep 5
2525
# 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
2626
# probably because of weird characters from the raw code bytes
2727
oraid query tx $store_txhash --output json > temp.json
2828
code_id=$(cat temp.json | jq -r '.events[4].attributes[] | select(.key | contains("code_id")).value')
2929
rm temp.json
3030
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
3131
# need to sleep 1s for tx already in block
32-
sleep 2
32+
sleep 5
3333
contract_address=$(oraid query wasm list-contract-by-code $code_id --output json | jq -r '.contracts | last')
3434
echo "cw-clock contract address: $contract_address, $CONTRACT_GAS_LIMIT, $TITLE, $INITIAL_DEPOSIT, $DESCRIPTION"
3535

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/bin/bash
2+
# Before running this script, you must setup local network:
3+
# sh $PWD/scripts/multinode-local-testnet.sh
4+
# oraiswap-token.wasm source code: https://github.com/oraichain/oraiswap.git
5+
6+
set -eu
7+
8+
# hard-coded test private key. DO NOT USE!!
9+
PRIVATE_KEY_ETH=${PRIVATE_KEY_ETH:-"021646C7F742C743E60CC460C56242738A3951667E71C803929CB84B6FA4B0D6"}
10+
PRIVATE_KEY_EVM_ADDRESS=${PRIVATE_KEY_EVM_ADDRESS:-"0xB0ac9d216b303a32907632731a93356228CAEE87"}
11+
current_dir=$PWD
12+
WASM_PATH=${WASM_PATH:-"$PWD/scripts/wasm_file/oraiswap-token.wasm"}
13+
ARGS="--chain-id testing -y --keyring-backend test --gas auto --gas-adjustment 1.5 -b sync"
14+
VALIDATOR1_ARGS=${VALIDATOR1_ARGS:-"--from validator1 --home $HOME/.oraid/validator1"}
15+
16+
HIDE_LOGS="/dev/null"
17+
18+
store_ret=$(oraid tx wasm store $WASM_PATH $VALIDATOR1_ARGS $ARGS --output json)
19+
store_txhash=$(echo $store_ret | jq -r '.txhash')
20+
# need to sleep 1s for tx already in block
21+
sleep 2
22+
code_id=$(oraid query tx $store_txhash --output json | jq -r '.events[4].attributes[] | select(.key | contains("code_id")).value')
23+
24+
# 2 addresses that map with the hard-coded private key above
25+
INSTANTIATE_MSG='{"name":"OraichainToken","symbol":"ORAI","decimals":6,"initial_balances":[{"amount":"1000000000","address":"orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9"},{"amount":"1000000000","address":"orai1hgscrqcd2kmju4t5akujeugwrfev7uxv66lnuu"}]}'
26+
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
27+
# need to sleep 1s for tx already in block
28+
sleep 2
29+
contract_address=$(oraid query wasm list-contract-by-code $code_id --output json | jq -r '.contracts | last')
30+
echo "cw-stargate-staking-query contract address: $contract_address"
31+
32+
# clone or pull latest repo
33+
if [ -d "$PWD/../evm-bridge-proxy" ]; then
34+
cd ../evm-bridge-proxy
35+
git pull origin master
36+
else
37+
git clone https://github.com/oraichain/evm-bridge-proxy.git ../evm-bridge-proxy
38+
cd ../evm-bridge-proxy
39+
fi
40+
41+
# prepare env and chain
42+
yarn && yarn compile
43+
echo "PRIVATE_KEY=$PRIVATE_KEY_ETH" >.env
44+
45+
# before deploying erc20, we need to fund the private key's address first
46+
oraid tx bank send $USER orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9 100000orai $VALIDATOR1_ARGS $ARGS >$HIDE_LOGS
47+
sleep 2 # wait for tx
48+
49+
# deploy cw20erc20 contract
50+
output=$(CW20_ADDRESS=$contract_address yarn hardhat run scripts/cw20erc20-deploy.ts --network testing)
51+
# collect only the contract address part
52+
contract_addr=$(echo "$output" | grep -oE '0x[0-9a-fA-F]+')
53+
echo "ERC20 contract addr: $contract_addr"
54+
55+
# validate
56+
contract_addr_len=${#contract_addr}
57+
if [ $contract_addr_len -ne 42 ]; then
58+
echo "Couldn't deploy ERC20 contract. CW20-ERC20 Not Mint Aorai Test Failed"
59+
fi
60+
61+
# try querying balance of owner -> get balance of from cosmwasm contract
62+
output=$(ERC20_ADDRESS=$contract_addr yarn hardhat run scripts/cw20erc20-query-balance-of.ts --network testing)
63+
balance_of=$(echo "$output" | awk '/^[0-9]+$/ { print $1 }')
64+
if ! [ $balance_of == "1000000000" ]; then
65+
echo "Could not query balance of CW20ERC20 address. CW20-ERC20 Not Mint Aorai Test Failed"
66+
exit 1
67+
fi
68+
69+
aorai_balance=$(oraid query bank balance orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9 aorai --output json | jq '.balance.amount')
70+
if [ $aorai_balance >0]; then
71+
echo "Aorai Minted. CW20-ERC20 Not Mint Aorai Test Failed"
72+
exit 1
73+
fi
74+
75+
# try querying decimals -> get decimals from cosmwasm contract
76+
orai_balance_before_transfer=$(oraid query bank balance orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9 orai --output json | jq '.balance.amount')
77+
ERC20_ADDRESS=$contract_addr yarn hardhat run scripts/cw20erc20-transfer.ts --network testing
78+
orai_balance_after_transfer=$(oraid query bank balance orai1kzkf6gttxqar9yrkxfe34ye4vg5v4m588ew7c9 orai --output json | jq '.balance.amount')
79+
80+
# try querying balance of owner after transfer -> should drop
81+
output=$(ERC20_ADDRESS=$contract_addr yarn hardhat run scripts/cw20erc20-query-balance-of.ts --network testing)
82+
balance_of=$(echo "$output" | awk '/^[0-9]+$/ { print $1 }')
83+
if [ $balance_of == "1000000000" ]; then
84+
echo "Could not transfer CW20 token from ERC20 contract. CW20-ERC20 Test Failed"
85+
exit 1
86+
fi
87+
88+
if [ $orai_balance_before_transfer == $orai_balance_after_transfer ]; then
89+
echo "Could not transfer native ORAI token from ERC20 contract. CW20-ERC20 Test Failed"
90+
exit 1
91+
fi
92+
93+
echo "CW20-ERC20 Test Passed"
94+
cd $current_dir

0 commit comments

Comments
 (0)