Skip to content

Commit

Permalink
feat(uniond): added v0.16.0 to upgrades e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
PoisonPhang authored and aeryz committed Dec 8, 2023
1 parent 0482b87 commit fbab0bc
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 5 deletions.
1 change: 1 addition & 0 deletions e2e/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

# Tests from ./upgrades.nix
upgrade-from-genesis = upgrades.upgrade-from-genesis;
upgrade-with-tokenfactory-state = upgrades.upgrade-with-tokenfactory-state;

virtualisation-works = e2e.mkTest {
name = "devnet";
Expand Down
27 changes: 26 additions & 1 deletion e2e/upgrades.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let
union.succeed('docker cp ${mkUpgradeProposal version height}/proposal-${version}.json devnet-minimal-uniond-0-1:/proposal-${version}.json')
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')
union.shell_interact()
time.sleep(6)
${forEachNode (id: "union.succeed('docker exec devnet-minimal-uniond-${id}-1 ${unionvisorBin} --root . call --bundle /bundle -- tx gov vote 1 yes --keyring-backend test --from val-${id} --home ./home -y')")}
Expand All @@ -46,6 +46,7 @@ in
name = "upgrade-from-genesis";

testScript = ''
import time
union.wait_for_open_port(${toString e2e.unionNode.wait_for_open_port})
${forEachNode (id: "union.succeed('docker cp ${bundle} devnet-minimal-uniond-${id}-1:/bundle')")}
Expand All @@ -57,6 +58,30 @@ in
${upgradeTo "v0.16.0" 20}
'';

nodes = {
union = e2e.unionTestnetGenesisNode.node;
};
};
upgrade-with-tokenfactory-state = e2e.mkTest {
name = "upgrade-with-tokenfactory-state";

testScript = ''
import time
union.wait_for_open_port(${toString e2e.unionNode.wait_for_open_port})
${forEachNode (id: "union.succeed('docker cp ${bundle} devnet-minimal-uniond-${id}-1:/bundle')")}
# Ensure the union network commits more than one block
union.wait_until_succeeds('[[ $(curl "http://localhost:26660/block" --fail --silent | ${pkgs.lib.meta.getExe pkgs.jq} ".result.block.header.height | tonumber > 1") == "true" ]]')
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')
# union.succeed('docker exec devnet-minimal-uniond-0-1 ${unionvisorBin} --root . call --bundle /bundle -- tx tokenfactory 10000000bazinga --from val-0 --keyring-backend test --home ./home -y')
${upgradeTo "v0.15.0" 10}
${upgradeTo "v0.16.0" 20}
'';

nodes = {
union = e2e.unionTestnetGenesisNode.node;
};
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
cosmossdk = builtins.fetchGit {
name = "cosmos-sdk";
url = "[email protected]:unionlabs/cosmos-sdk";
rev = "189a9ed768babcbb4de3d27ca9b210a100e766ff";
rev = "f24b2ba59f6ec8fb4624e1b2774ad7f2d90936a2";
allRefs = true;
};
ibcgo = mkUnpack {
Expand Down
2 changes: 1 addition & 1 deletion networks/devnet.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
devnet-validator-keys = self'.packages.minimal-validator-keys;
devnet-validator-node-ids = self'.packages.minimal-validator-node-ids;
network = "union-minimal-1";
bundle = self'.packages.bundle-testnet-4;
bundle = self'.packages.bundle-testnet-next;
};
})
4));
Expand Down
1 change: 1 addition & 0 deletions networks/services/unionvisor.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ in
''
HOME=.
mkdir home
mkdir /tmp
cp -R ${devnet-genesis}/* ./home
cp ${devnet-validator-keys}/valkey-${toString id}.json ./home/config/priv_validator_key.json
cp ${devnet-validator-node-ids}/valnode-${toString id}.json ./home/config/node_key.json
Expand Down
6 changes: 4 additions & 2 deletions uniond/app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import (
store "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/types/module"
consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
)

type AppKeepers struct {
StakingKeeper *stakingkeeper.Keeper
TfKeeper *tfkeeper.Keeper
ConsensusKeeper *consensuskeeper.Keeper
StakingKeeper *stakingkeeper.Keeper
TfKeeper *tfkeeper.Keeper
}

// source: https://github.com/osmosis-labs/osmosis/blob/c783ef52af8617d3ec613d9ce9035386ba8d4a49/app/upgrades/types.go#L24
Expand Down
15 changes: 15 additions & 0 deletions uniond/app/upgrades/v0_16_0/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ import (

func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, keepers *upgrades.AppKeepers) upgradetypes.UpgradeHandler {
return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
consensusParams, err := keepers.ConsensusKeeper.Params(ctx, nil)
if err != nil {
panic(err)
}

PubKeyTypes := [...]string{"bn254"}

consensusParams.Params.Block.MaxBytes = 22020096
consensusParams.Params.Block.MaxGas = -1
consensusParams.Params.Evidence.MaxAgeNumBlocks = 100000
consensusParams.Params.Evidence.MaxAgeDuration = 172800000000000
consensusParams.Params.Evidence.MaxBytes = 1048576
consensusParams.Params.Validator.PubKeyTypes = PubKeyTypes[:]
consensusParams.Params.Version.App = 0
consensusParams.Params.Abci.VoteExtensionsEnableHeight = 0 // TODO decide on when to enable vote extensions
return mm.RunMigrations(ctx, configurator, vm)
}
}

0 comments on commit fbab0bc

Please sign in to comment.