Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
ibctransferkeeper "github.com/cosmos/ibc-go/v10/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
transferv2 "github.com/cosmos/ibc-go/v10/modules/apps/transfer/v2"
ibcclienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
ibcconnectiontypes "github.com/cosmos/ibc-go/v10/modules/core/03-connection/types"
porttypes "github.com/cosmos/ibc-go/v10/modules/core/05-port/types"
ibcapi "github.com/cosmos/ibc-go/v10/modules/core/api"
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
Expand Down Expand Up @@ -399,9 +401,11 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(distrtypes.ModuleName).WithKeyTable(distrtypes.ParamKeyTable()) //nolint:staticcheck // SA1019
paramsKeeper.Subspace(slashingtypes.ModuleName).WithKeyTable(slashingtypes.ParamKeyTable()) //nolint:staticcheck // SA1019
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) //nolint:staticcheck // SA1019
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable())
keyTable := ibcclienttypes.ParamKeyTable()
keyTable.RegisterParamSet(&ibcconnectiontypes.Params{})
paramsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable)
paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable())
paramsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable())

return paramsKeeper
Expand Down
34 changes: 17 additions & 17 deletions contrib/localnet/proposal_upgrade.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"messages": [
{
"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
"authority": "atone10d07y265gmmuvt4z0w9aw880jnsr700j5z0zqt",
"plan": {
"name": "v3",
"time": "0001-01-01T00:00:00Z",
"height": "80",
"info": "",
"upgraded_client_state": null
}
}
],
"metadata": "ipfs://CID",
"deposit": "512000000uatone",
"title": "v3",
"summary": "v3"
"messages": [
{
"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
"authority": "atone10d07y265gmmuvt4z0w9aw880jnsr700j5z0zqt",
"plan": {
"name": "v4",
"time": "0001-01-01T00:00:00Z",
"height": "30",
"info": "",
"upgraded_client_state": null
}
}
],
"metadata": "ipfs://CID",
"deposit": "512000000uatone",
"title": "v4",
"summary": "v4"
}
135 changes: 135 additions & 0 deletions contrib/scripts/upgrade-node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#!/bin/bash

set -e

# Usage ATOMONED_BIN=$(which simd) ATOMONED_NEW_BIN=<path to new binary> ./upgrade.sh

if [[ -z $ATOMONED_BIN || -z $ATOMONED_NEW_BIN ]]; then
echo "ATOMONED_BIN and ATOMONED_NEW_BIN must be set."
exit 1
fi

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
proposal_path="$script_dir/../localnet/proposal_upgrade.json"
localnet_home=~/.atomone-localnet
localnetd="$ATOMONED_BIN --home $localnet_home"
localnetd_new="$ATOMONED_NEW_BIN --home $localnet_home"

echo "Killing any running chain processes..."
pkill -f "atomoned.*start" || true
sleep 2

echo "init with previous atomoned binary"
rm -rf $localnet_home prev.log new.log
$localnetd init localnet --default-denom uatone --chain-id localnet
$localnetd config chain-id localnet
$localnetd config keyring-backend test
$localnetd keys add val
$localnetd genesis add-genesis-account val 1000000000000uatone,1000000000uphoton
$localnetd keys add user
$localnetd genesis add-genesis-account user 100000000000uatone,1000000000uphoton
$localnetd genesis gentx val 1000000000uatone
$localnetd genesis collect-gentxs
# Add treasury DAO address
$localnetd genesis add-genesis-account atone1qqqqqqqqqqqqqqqqqqqqqqqqqqqqp0dqtalx52 5388766663072uatone
# Add CP funds
$localnetd genesis add-genesis-account atone1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8flcml8 5388766663072uatone
jq '.app_state.distribution.fee_pool.community_pool = [ { "denom": "uatone", "amount": "5388766663072.000000000000000000" }]' $localnet_home/config/genesis.json > /tmp/gen
mv /tmp/gen $localnet_home/config/genesis.json
# Previous add-genesis-account call added the auth module account as a BaseAccount, we need to remove it
jq 'del(.app_state.auth.accounts[] | select(.address == "atone1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8flcml8"))' $localnet_home/config/genesis.json > /tmp/gen
mv /tmp/gen $localnet_home/config/genesis.json
# Set validator gas prices
sed -i.bak 's#^minimum-gas-prices = .*#minimum-gas-prices = "0.01uatone,0.01uphoton"#g' $localnet_home/config/app.toml
# enable REST API
sed -i -z 's/# Enable defines if the API server should be enabled.\nenable = false/enable = true/' $localnet_home/config/app.toml
# Decrease voting period to 1min
jq '.app_state.gov.params.voting_period = "60s"' $localnet_home/config/genesis.json > /tmp/gen
mv /tmp/gen $localnet_home/config/genesis.json
# Lower threshold to 0.01
jq '.app_state.gov.params.threshold = "0.010000000000000000"' $localnet_home/config/genesis.json > /tmp/gen
mv /tmp/gen $localnet_home/config/genesis.json
jq --rawfile data contrib/localnet/constitution-mock.md '.app_state.gov.constitution=$data' $localnet_home/config/genesis.json > /tmp/gen
mv /tmp/gen $localnet_home/config/genesis.json
echo "Start old chain..."
$localnetd start --log_format json &> prev.log &
sleep 10
echo "Stake tokens for user to be able to vote"
stake_tx=$($localnetd tx staking delegate $($localnetd keys show val --bech val -a) 10000000000uatone --from user --fees 10000uphoton --yes --output json)
stake_txhash=$(echo "$stake_tx" | jq -r '.txhash')
echo "Stake tx hash: $stake_txhash"
sleep 6
echo "Querying stake transaction..."
stake_result=$($localnetd q tx "$stake_txhash" --output json)
stake_code=$(echo "$stake_result" | jq -r '.code')
if [ "$stake_code" != "0" ]; then
echo "Stake transaction failed with code $stake_code"
echo "$stake_result" | jq
exit 1
fi
echo "Submitting Upgrade Proposal"
proposal_tx=$($localnetd tx gov submit-proposal "$proposal_path" --from user --fees 10000uphoton --yes --output json)
proposal_txhash=$(echo "$proposal_tx" | jq -r '.txhash')
echo "Proposal tx hash: $proposal_txhash"
sleep 6
echo "Querying proposal transaction..."
proposal_result=$($localnetd q tx "$proposal_txhash" --output json)
proposal_code=$(echo "$proposal_result" | jq -r '.code')
if [ "$proposal_code" != "0" ]; then
echo "Proposal transaction failed with code $proposal_code"
echo "$proposal_result" | jq
exit 1
fi
deposit_tx=$($localnetd tx gov deposit 1 10000000uatone --from val --fees 10000uphoton --yes --output json)
deposit_txhash=$(echo "$deposit_tx" | jq -r '.txhash')
echo "Deposit tx hash: $deposit_txhash"
sleep 6
echo "Querying deposit transaction..."
deposit_result=$($localnetd q tx "$deposit_txhash" --output json)
deposit_code=$(echo "$deposit_result" | jq -r '.code')
if [ "$deposit_code" != "0" ]; then
echo "Deposit transaction failed with code $deposit_code"
echo "$deposit_result" | jq
exit 1
fi
vote_tx=$($localnetd tx gov vote 1 yes --from user --fees 10000uphoton --yes --output json)
vote_txhash=$(echo "$vote_tx" | jq -r '.txhash')
echo "Vote tx hash: $vote_txhash"
sleep 6
echo "Querying vote transaction..."
vote_result=$($localnetd q tx "$vote_txhash" --output json)
vote_code=$(echo "$vote_result" | jq -r '.code')
if [ "$vote_code" != "0" ]; then
echo "Vote transaction failed with code $vote_code"
echo "$vote_result" | jq
exit 1
fi
# Query proposal to get upgrade height
upgrade_height=$($localnetd q gov proposal 1 --output json | jq -r '.messages[0].plan.height')
echo "Proposal should pass! Chain will halt at block height: $upgrade_height"
echo "Waiting for chain to reach upgrade height..."

# Poll chain height until it reaches upgrade height
while true; do
current_height=$($localnetd status 2>&1 | jq -r '.SyncInfo.latest_block_height' 2>/dev/null || echo "0")
echo "Current height: $current_height / Upgrade height: $upgrade_height"

if [ "$current_height" -ge "$upgrade_height" ]; then
echo "Upgrade height reached!"
break
fi

sleep 2
done

sleep 5

echo "Displaying last 6 lines of previous binary logs:"
tail -n 6 prev.log

echo "Killing old binary..."
pkill -f "$ATOMONED_BIN" || true
sleep 2

echo "Starting new binary..."
$localnetd_new start --log_format json
31 changes: 16 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ replace (
cosmossdk.io/x/feegrant => cosmossdk.io/x/feegrant v0.1.1
cosmossdk.io/x/upgrade => github.com/atomone-hub/cosmos-sdk/x/upgrade v0.1.5-atomone.1.0.20251218143825-cbb67818e94a
github.com/cosmos/cosmos-sdk => github.com/atomone-hub/cosmos-sdk v0.50.14-atomone.1.0.20251218143825-cbb67818e94a
github.com/cosmos/ibc-go/v10 => github.com/cosmos/ibc-go/v10 v10.2.0
github.com/cosmos/ibc-go/v10 => github.com/cosmos/ibc-go/v10 v10.5.0
)

require (
cosmossdk.io/api v0.9.2
cosmossdk.io/client/v2 v2.0.0-beta.11
cosmossdk.io/collections v1.2.1
cosmossdk.io/core v0.11.3
cosmossdk.io/depinject v1.2.0
cosmossdk.io/depinject v1.2.1
cosmossdk.io/errors v1.0.2
cosmossdk.io/log v1.5.1
cosmossdk.io/log v1.6.1
cosmossdk.io/math v1.5.3
cosmossdk.io/store v1.1.2
cosmossdk.io/tools/confix v0.1.2
Expand All @@ -25,23 +25,23 @@ require (
cosmossdk.io/x/tx v0.14.0
cosmossdk.io/x/upgrade v0.2.0
github.com/cometbft/cometbft v0.38.20
github.com/cosmos/cosmos-db v1.1.1
github.com/cosmos/cosmos-db v1.1.3
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.53.0
github.com/cosmos/cosmos-sdk v0.53.4
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.7.2
github.com/cosmos/ibc-go/v10 v10.2.0
github.com/cosmos/ibc-go/v10 v10.5.0
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.4
github.com/google/gofuzz v1.2.0
github.com/gorilla/mux v1.8.1
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/ory/dockertest/v3 v3.10.0
github.com/spf13/cast v1.9.2
github.com/spf13/cobra v1.9.1
github.com/spf13/pflag v1.0.6
github.com/spf13/cobra v1.10.1
github.com/spf13/pflag v1.0.9
github.com/spf13/viper v1.20.1
github.com/stretchr/testify v1.10.0
github.com/stretchr/testify v1.11.1
golang.org/x/sync v0.16.0
google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7
google.golang.org/grpc v1.75.0
Expand Down Expand Up @@ -122,14 +122,14 @@ require (
github.com/dgraph-io/ristretto v0.2.0 // indirect
github.com/docker/cli v24.0.7+incompatible // indirect
github.com/docker/docker v20.10.19+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.7.0 // indirect
github.com/emicklei/dot v1.6.2 // indirect
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
github.com/ethereum/go-ethereum v1.15.10 // indirect
github.com/ethereum/go-ethereum v1.15.11 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
Expand All @@ -145,7 +145,7 @@ require (
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/google/go-cmp v0.7.0 // indirect
Expand Down Expand Up @@ -197,7 +197,7 @@ require (
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
github.com/opencontainers/runc v1.1.12 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect
Expand Down Expand Up @@ -244,7 +244,8 @@ require (
go.opentelemetry.io/otel/trace v1.37.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/arch v0.15.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
golang.org/x/arch v0.17.0 // indirect
golang.org/x/crypto v0.41.0 // indirect
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
golang.org/x/net v0.43.0 // indirect
Expand All @@ -260,7 +261,7 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.5.2 // indirect
nhooyr.io/websocket v1.8.11 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
)

replace (
Expand Down
Loading
Loading