diff --git a/protocol/testing/containertest/Dockerfile b/protocol/testing/containertest/Dockerfile index 6f4f1f3cea..0cf132ae8c 100644 --- a/protocol/testing/containertest/Dockerfile +++ b/protocol/testing/containertest/Dockerfile @@ -7,6 +7,7 @@ COPY ./testing/containertest/preupgrade_genesis.json /dydxprotocol/preupgrade_ge COPY ./testing/genesis.sh /dydxprotocol/genesis.sh COPY ./daemons/pricefeed/client/constants/testdata /dydxprotocol/exchange_config COPY ./testing/delaymsg_config /dydxprotocol/delaymsg_config +COPY ./testing/version/. /dydxprotocol/ RUN go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0 diff --git a/protocol/testing/containertest/containertest.sh b/protocol/testing/containertest/containertest.sh index fbaf6df002..b7680e5800 100755 --- a/protocol/testing/containertest/containertest.sh +++ b/protocol/testing/containertest/containertest.sh @@ -5,9 +5,9 @@ set -eo pipefail # This file should be run as part of `docker-compose.yml`. source "./genesis.sh" +source "./version.sh" CHAIN_ID="localdydxprotocol" -PREUPGRADE_VERSION="v5.1.0-rc2" # Define mnemonics for all validators. MNEMONICS=( diff --git a/protocol/testing/containertest/testnet.go b/protocol/testing/containertest/testnet.go index 4d83280c56..ff1d657d55 100644 --- a/protocol/testing/containertest/testnet.go +++ b/protocol/testing/containertest/testnet.go @@ -9,6 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/dydxprotocol/v4-chain/protocol/daemons/pricefeed/client/price_function/testexchange" pricefeed "github.com/dydxprotocol/v4-chain/protocol/daemons/pricefeed/client/types" + "github.com/dydxprotocol/v4-chain/protocol/testing/version" "github.com/dydxprotocol/v4-chain/protocol/testutil/constants" pricefeed_testutil "github.com/dydxprotocol/v4-chain/protocol/testutil/pricefeed" "github.com/ory/dockertest/v3" @@ -24,9 +25,6 @@ const persistentPeers = "17e5e45691f0d01449c84fd4ae87279578cdd7ec@testnet-local- // Resources will expire in 10 minutes const resourceLifetimeSecs = 600 -// The version of that we're upgrading to (aka the current commit) -const UpgradeToVersion = "v6.0.0" - func monikers() map[string]string { return map[string]string{ "alice": constants.AliceMnenomic, @@ -158,7 +156,7 @@ func (t *Testnet) initializeNode(moniker string) (*Node, error) { Env: []string{ "DAEMON_NAME=dydxprotocold", fmt.Sprintf("DAEMON_HOME=/dydxprotocol/chain/.%s", moniker), - fmt.Sprintf("UPGRADE_TO_VERSION=%s", UpgradeToVersion), + fmt.Sprintf("UPGRADE_TO_VERSION=%s", version.CurrentVersion), }, ExtraHosts: []string{ fmt.Sprintf("%s:host-gateway", testexchange.TestExchangeHost), diff --git a/protocol/testing/containertest/testnet_test.go b/protocol/testing/containertest/testnet_test.go index 4f78736829..d8a0473419 100644 --- a/protocol/testing/containertest/testnet_test.go +++ b/protocol/testing/containertest/testnet_test.go @@ -17,6 +17,7 @@ import ( "github.com/cosmos/gogoproto/jsonpb" "github.com/cosmos/gogoproto/proto" "github.com/dydxprotocol/v4-chain/protocol/daemons/pricefeed/client/types" + "github.com/dydxprotocol/v4-chain/protocol/testing/version" "github.com/dydxprotocol/v4-chain/protocol/testutil/constants" "github.com/dydxprotocol/v4-chain/protocol/testutil/daemons/pricefeed/exchange_config" assets "github.com/dydxprotocol/v4-chain/protocol/x/assets/types" @@ -282,6 +283,6 @@ func TestUpgrade(t *testing.T) { defer testnet.MustCleanUp() node := testnet.Nodes["alice"] - err = UpgradeTestnet(constants.AliceAccAddress.String(), t, node, UpgradeToVersion) + err = UpgradeTestnet(constants.AliceAccAddress.String(), t, node, version.CurrentVersion) require.NoError(t, err) } diff --git a/protocol/testing/current_version.sh b/protocol/testing/current_version.sh deleted file mode 100755 index bb0a2af3aa..0000000000 --- a/protocol/testing/current_version.sh +++ /dev/null @@ -1,5 +0,0 @@ -CURRENT_VERSION="v6.0.0" - -# Define the mapping from version to URL -declare -A version_to_url -version_to_url["v5.2.0"]="https://github.com/dydxprotocol/v4-chain/releases/download/protocol%2Fv5.2.0/dydxprotocold-v5.2.0-linux-amd64.tar.gz" diff --git a/protocol/testing/mainnet/Dockerfile b/protocol/testing/mainnet/Dockerfile index f5eccfcacf..d6796ae52b 100644 --- a/protocol/testing/mainnet/Dockerfile +++ b/protocol/testing/mainnet/Dockerfile @@ -3,7 +3,7 @@ FROM dydxprotocol-base RUN apk add --no-cache bash jq aws-cli RUN go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0 -COPY ./testing/current_version.sh /dydxprotocol/ +COPY ./testing/version/. /dydxprotocol/ COPY ./testing/mainnet/. /dydxprotocol/ ENV HOME /dydxprotocol diff --git a/protocol/testing/mainnet/vars.sh b/protocol/testing/mainnet/vars.sh index c786aeca5f..85e4b77fd8 100755 --- a/protocol/testing/mainnet/vars.sh +++ b/protocol/testing/mainnet/vars.sh @@ -1,7 +1,7 @@ #!/bin/bash set -eo pipefail -source "./current_version.sh" +source "./version.sh" # Full node home directories will be set up for indices 0 to LAST_FULL_NODE_INDEX LAST_FULL_NODE_INDEX=5 diff --git a/protocol/testing/testnet/Dockerfile b/protocol/testing/testnet/Dockerfile index b79ee15e56..1e9df43957 100644 --- a/protocol/testing/testnet/Dockerfile +++ b/protocol/testing/testnet/Dockerfile @@ -3,7 +3,7 @@ FROM dydxprotocol-base RUN apk add --no-cache bash jq aws-cli RUN go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0 -COPY ./testing/current_version.sh /dydxprotocol/ +COPY ./testing/version/. /dydxprotocol/ COPY ./testing/testnet/. /dydxprotocol/ ENV HOME /dydxprotocol diff --git a/protocol/testing/testnet/vars.sh b/protocol/testing/testnet/vars.sh index ffb9161bec..2a29294a74 100755 --- a/protocol/testing/testnet/vars.sh +++ b/protocol/testing/testnet/vars.sh @@ -1,7 +1,7 @@ #!/bin/bash set -eo pipefail -source "./current_version.sh" +source "./version.sh" # Full node home directories will be set up for indices 0 to LAST_FULL_NODE_INDEX LAST_FULL_NODE_INDEX=2 diff --git a/protocol/testing/version/README.md b/protocol/testing/version/README.md new file mode 100644 index 0000000000..4a6f2b1d22 --- /dev/null +++ b/protocol/testing/version/README.md @@ -0,0 +1 @@ +This directory contains files to configure version names used for upgrade tests and internal nodes. These versions are used for things such as upgrade proposals and cosmovisor directory names. When updating tests and images for a new version, most of the time you just need to change the `VERSION_CURRENT` and `VERSION_PREUPGRADE` files. diff --git a/protocol/testing/version/VERSION_CURRENT b/protocol/testing/version/VERSION_CURRENT new file mode 100644 index 0000000000..9f925ba24c --- /dev/null +++ b/protocol/testing/version/VERSION_CURRENT @@ -0,0 +1 @@ +v6.0.0 \ No newline at end of file diff --git a/protocol/testing/version/VERSION_PREUPGRADE b/protocol/testing/version/VERSION_PREUPGRADE new file mode 100644 index 0000000000..f01c12bcd9 --- /dev/null +++ b/protocol/testing/version/VERSION_PREUPGRADE @@ -0,0 +1 @@ +v5.2.0 \ No newline at end of file diff --git a/protocol/testing/version/version.go b/protocol/testing/version/version.go new file mode 100644 index 0000000000..fa91f19a78 --- /dev/null +++ b/protocol/testing/version/version.go @@ -0,0 +1,6 @@ +package version + +import _ "embed" + +//go:embed VERSION_CURRENT +var CurrentVersion string diff --git a/protocol/testing/version/version.sh b/protocol/testing/version/version.sh new file mode 100755 index 0000000000..f7886f8c31 --- /dev/null +++ b/protocol/testing/version/version.sh @@ -0,0 +1,7 @@ +#!/bin/bash +CURRENT_VERSION=$(