Skip to content

Commit 2226c7a

Browse files
authored
feat(uniond): create v0.20.0 migration (#1439)
2 parents d65b68a + 66bfbac commit 2226c7a

File tree

7 files changed

+91
-36
lines changed

7 files changed

+91
-36
lines changed

e2e/upgrades.nix

+34-29
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
let
33
unionvisorBin = pkgs.lib.meta.getExe unionvisor;
44

5-
# mkUpgradeProposal = version: height: pkgs.runCommand "upgrade-proposal" { } ''
6-
# mkdir -p $out
7-
# echo '{
8-
# "messages": [
9-
# {
10-
# "@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
11-
# "authority": "union10d07y265gmmuvt4z0w9aw880jnsr700js4jdcz",
12-
# "plan": {
13-
# "name": "${version}",
14-
# "height": "${toString height}",
15-
# "info": "${version}"
16-
# }
17-
# }
18-
# ],
19-
# "deposit": "15000000stake",
20-
# "title": "${version}",
21-
# "summary": "Upgrade to ${version}"
22-
# }' > proposal-${version}.json
23-
# mv proposal-${version}.json $out
24-
# '';
5+
mkUpgradeProposal = version: height: pkgs.runCommand "upgrade-proposal" { } ''
6+
mkdir -p $out
7+
echo '{
8+
"messages": [
9+
{
10+
"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
11+
"authority": "union10d07y265gmmuvt4z0w9aw880jnsr700js4jdcz",
12+
"plan": {
13+
"name": "${version}",
14+
"height": "${toString height}",
15+
"info": "${version}"
16+
}
17+
}
18+
],
19+
"deposit": "15000000stake",
20+
"title": "${version}",
21+
"summary": "Upgrade to ${version}"
22+
}' > proposal-${version}.json
23+
mv proposal-${version}.json $out
24+
'';
2525

2626
forEachNode = f: ''
2727
${f "0"}
@@ -30,20 +30,20 @@ let
3030
${f "3"}
3131
'';
3232

33-
# upgradeTo = version: height: ''
34-
# union.succeed('docker cp ${mkUpgradeProposal version height}/proposal-${version}.json devnet-minimal-uniond-0-1:/proposal-${version}.json')
35-
# print(union.succeed('docker exec devnet-minimal-uniond-0-1 ${unionvisorBin} --root . call --bundle /bundle -- tx gov submit-proposal proposal-${version}.json --from val-0 --keyring-backend test --home ./home -y --gas 3000000000'))
33+
upgradeTo = version: height: ''
34+
union.succeed('docker cp ${mkUpgradeProposal version height}/proposal-${version}.json devnet-minimal-uniond-0-1:/proposal-${version}.json')
35+
print(union.succeed('docker exec devnet-minimal-uniond-0-1 ${unionvisorBin} --root . call --bundle /bundle -- tx gov submit-proposal proposal-${version}.json --from val-0 --keyring-backend test --home ./home -y --gas 3000000000'))
3636
37-
# time.sleep(6)
37+
time.sleep(6)
3838
39-
# union.wait_until_succeeds("[[ $(docker exec devnet-minimal-uniond-0-1 ${unionvisorBin} -l off --root . call --bundle /bundle -- query gov proposal ${toString (height / 10)} --home ./home --output json | ${pkgs.lib.meta.getExe pkgs.jq} '.status == \"PROPOSAL_STATUS_VOTING_PERIOD\"') == true ]]", timeout=30)
39+
union.wait_until_succeeds("[[ $(docker exec devnet-minimal-uniond-0-1 ${unionvisorBin} -l off --root . call --bundle /bundle -- query gov proposal ${toString (height / 10)} --home ./home --output json | ${pkgs.lib.meta.getExe pkgs.jq} '.status == \"PROPOSAL_STATUS_VOTING_PERIOD\"') == true ]]", timeout=30)
4040
41-
# ${forEachNode (id: "print(union.succeed('docker exec devnet-minimal-uniond-${id}-1 ${unionvisorBin} --root . call --bundle /bundle -- tx gov vote ${toString (height / 10)} yes --keyring-backend test --from val-${id} --home ./home -y'))")}
41+
${forEachNode (id: "print(union.succeed('docker exec devnet-minimal-uniond-${id}-1 ${unionvisorBin} --root . call --bundle /bundle -- tx gov vote ${toString (height / 10)} yes --keyring-backend test --from val-${id} --home ./home -y'))")}
4242
43-
# union.wait_until_succeeds("[[ $(docker exec devnet-minimal-uniond-0-1 ${unionvisorBin} -l off --root . call --bundle /bundle -- query gov proposal ${toString (height / 10)} --home ./home --output json | ${pkgs.lib.meta.getExe pkgs.jq} '.status == \"PROPOSAL_STATUS_PASSED\"') == true ]]", timeout=30)
43+
union.wait_until_succeeds("[[ $(docker exec devnet-minimal-uniond-0-1 ${unionvisorBin} -l off --root . call --bundle /bundle -- query gov proposal ${toString (height / 10)} --home ./home --output json | ${pkgs.lib.meta.getExe pkgs.jq} '.status == \"PROPOSAL_STATUS_PASSED\"') == true ]]", timeout=30)
4444
45-
# union.wait_until_succeeds('[[ $(curl "http://localhost:26660/block" --fail --silent | ${pkgs.lib.meta.getExe pkgs.jq} ".result.block.header.height | tonumber > ${toString height}") == "true" ]]')
46-
# '';
45+
union.wait_until_succeeds('[[ $(curl "http://localhost:26660/block" --fail --silent | ${pkgs.lib.meta.getExe pkgs.jq} ".result.block.header.height | tonumber > ${toString height}") == "true" ]]')
46+
'';
4747
in
4848
{
4949
upgrade-from-genesis = e2e.mkTest {
@@ -56,6 +56,8 @@ in
5656
5757
# Ensure the union network commits more than one block
5858
union.wait_until_succeeds('[[ $(curl "http://localhost:26660/block" --fail --silent | ${pkgs.lib.meta.getExe pkgs.jq} ".result.block.header.height | tonumber > 1") == "true" ]]')
59+
60+
${upgradeTo "v0.20.0" 10}
5961
'';
6062

6163
nodes = {
@@ -78,6 +80,9 @@ in
7880
union.succeed("docker exec devnet-minimal-uniond-0-1 ${unionvisorBin} --root . call --bundle /bundle -- tx tokenfactory create-denom bazinga --from val-0 --keyring-backend test --home ./home -y --gas 3000000000")
7981
time.sleep(6)
8082
union.succeed("[[ $(docker exec devnet-minimal-uniond-0-1 ${unionvisorBin} -l off --root . call --bundle /bundle -- query tokenfactory denom-authority-metadata factory/union14fldwd959h7glh2e3k45veuqfszvgm69q07jhw/bazinga --home ./home --output json | ${pkgs.lib.meta.getExe pkgs.jq} '.authority_metadata.admin == \"union14fldwd959h7glh2e3k45veuqfszvgm69q07jhw\"') == true ]]")
83+
84+
${upgradeTo "v0.20.0" 10}
85+
union.succeed("[[ $(docker exec devnet-minimal-uniond-0-1 ${unionvisorBin} -l off --root . call --bundle /bundle -- query tokenfactory denom-authority-metadata factory/union14fldwd959h7glh2e3k45veuqfszvgm69q07jhw/bazinga --home ./home --output json | ${pkgs.lib.meta.getExe pkgs.jq} '.authority_metadata.admin == \"union14fldwd959h7glh2e3k45veuqfszvgm69q07jhw\"') == true ]]")
8186
'';
8287

8388
nodes = {

flake.lock

+21-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+5-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
flake = false;
7575
};
7676
nix-filter.url = "github:numtide/nix-filter?rev=3449dc925982ad46246cfc36469baf66e1b64f17";
77-
get-flake.url = "github:ursi/get-flake?rev=e0917b6f564aa5acefb1484b5baf76da21746c3c";
77+
get-flake.url = "github:ursi/get-flake";
7878
wasmvm = {
7979
url = "github:CosmWasm/wasmvm/v1.5.2";
8080
flake = false;
@@ -114,6 +114,10 @@
114114
url = "github:unionlabs/union/release-v0.19.0";
115115
flake = false;
116116
};
117+
v0_20_0 = {
118+
url = "github:unionlabs/union/release-v0.20.0";
119+
flake = false;
120+
};
117121
};
118122
outputs =
119123
inputs@{ self
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package v0_20_0
2+
3+
import (
4+
store "cosmossdk.io/store/types"
5+
"union/app/upgrades"
6+
)
7+
8+
const UpgradeName = "v0.20.0"
9+
10+
var Upgrade = upgrades.Upgrade{
11+
UpgradeName: UpgradeName,
12+
CreateUpgradeHandler: CreateUpgradeHandler,
13+
StoreUpgrades: store.StoreUpgrades{},
14+
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package v0_20_0
2+
3+
import (
4+
"context"
5+
"union/app/upgrades"
6+
7+
upgradetypes "cosmossdk.io/x/upgrade/types"
8+
"github.com/cosmos/cosmos-sdk/types/module"
9+
)
10+
11+
func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, keepers *upgrades.AppKeepers) upgradetypes.UpgradeHandler {
12+
return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
13+
return mm.RunMigrations(ctx, configurator, vm)
14+
}
15+
}

unionvisor/unionvisor.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
mkBundle {
9090
name = "testnet-6";
9191
versions = uniondBundleVersions.complete;
92-
nextVersion = "v0.19.0";
92+
nextVersion = "v0.20.0";
9393
genesis = ../networks/genesis/union-testnet-6/genesis.json;
9494
meta = {
9595
binary_name = "uniond";

versions/versions.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"union-testnet-4": ["v0.14.0", "v0.15.0", "v0.16.0", "v0.17.0"],
33
"union-testnet-5": ["v0.18.0"],
4-
"union-testnet-6": ["v0.19.0"]
4+
"union-testnet-6": ["v0.19.0", "v0.20.0"]
55
}

0 commit comments

Comments
 (0)