Skip to content

Commit

Permalink
Merge pull request #240 from permissionlessweb/main
Browse files Browse the repository at this point in the history
V0.18.2 - Polytone CI tests
  • Loading branch information
hard-nett authored Dec 4, 2024
2 parents 74e41ce + eb713e8 commit f58a643
Show file tree
Hide file tree
Showing 17 changed files with 609 additions and 94 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/build_docker.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/interchaintest-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
test:
- "e2e-basic"
- "e2e-pfm"
# - "e2e-upgrade"
- "e2e-polytone"
fail-fast: false

steps:
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ help:
@echo " make [command]"
@echo ""
@echo " make build Build Bitsong node binary"
@echo " make docker Show available docker related commands"
@echo " make e2e Show available e2e commands"
@echo " make hl Show available docker commands (via Strangelove's Heighliner Tooling)"
@echo " make install Install Bitsong node binary"
Expand Down Expand Up @@ -122,7 +123,7 @@ build: go.sum
ifeq ($(OS),Windows_NT)
go build -mod=readonly $(BUILD_FLAGS) -o build/bitsongd.exe ./cmd/bitsongd
else
go build $(BUILD_FLAGS) -o bin/bitsongd ./cmd/bitsongd
go build $(BUILD_FLAGS) -o build/bitsongd ./cmd/bitsongd
endif

install: go.sum
Expand Down
97 changes: 45 additions & 52 deletions app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ package app
import (
"encoding/json"

"github.com/cosmos/cosmos-sdk/codec"

"github.com/CosmWasm/wasmd/x/wasm"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/cosmos/cosmos-sdk/codec"
)

// The genesis state of the blockchain is represented here as a map of raw json
Expand All @@ -18,7 +16,7 @@ import (
// object provided to it during init.
type GenesisState map[string]json.RawMessage

// NewDefaultGenesisState generates the default state for the application.
// NewDefaultGenesisState generates the default state for bitsong.
func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState {
return ModuleBasics.DefaultGenesis(cdc)
}
Expand All @@ -33,59 +31,54 @@ func NewDefaultGenesisStateWithCodec(cdc codec.JSONCodec) GenesisState {
InstantiateDefaultPermission: wasmtypes.AccessTypeEverybody,
},
}
gen[wasm.ModuleName] = cdc.MustMarshalJSON(&wasmGen)
return gen
}

/*func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState {
genesis := ModuleBasics.DefaultGenesis(cdc)
mintGenesis := mintGenesisState()
stakingGenesis := stakingGenesisState()
govGenesis := govGenesisState()
// other default genesis
// mintGenesis := mintGenesisState()
// stakingGenesis := stakingGenesisState()
// govGenesis := govGenesisState()

genesis["mint"] = cdc.MustMarshalJSON(mintGenesis)
genesis["staking"] = cdc.MustMarshalJSON(stakingGenesis)
genesis["gov"] = cdc.MustMarshalJSON(govGenesis)
gen[wasmtypes.ModuleName] = cdc.MustMarshalJSON(&wasmGen)
// gen["mint"] = cdc.MustMarshalJSON(mintGenesis)
// gen["staking"] = cdc.MustMarshalJSON(stakingGenesis)
// gen["gov"] = cdc.MustMarshalJSON(govGenesis)

return genesis
return gen
}

// stakingGenesisState returns the default genesis state for the staking module, replacing the
// bond denom from stake to ubtsg
func stakingGenesisState() *stakingtypes.GenesisState {
return &stakingtypes.GenesisState{
Params: stakingtypes.NewParams(
stakingtypes.DefaultUnbondingTime,
stakingtypes.DefaultMaxValidators,
stakingtypes.DefaultMaxEntries,
0,
types.BondDenom,
),
}
}
// func stakingGenesisState() *stakingtypes.GenesisState {
// return &stakingtypes.GenesisState{
// Params: stakingtypes.NewParams(
// stakingtypes.DefaultUnbondingTime,
// stakingtypes.DefaultMaxValidators,
// stakingtypes.DefaultMaxEntries,
// 0,
// "ubtsg", sdk.ZeroDec(),
// ),
// }
// }

func govGenesisState() *govtypes.GenesisState {
return govtypes.NewGenesisState(
1,
govtypes.NewDepositParams(
sdk.NewCoins(sdk.NewCoin(types.BondDenom, govtypes.DefaultMinDepositTokens)),
govtypes.DefaultPeriod,
),
govtypes.NewVotingParams(govtypes.DefaultPeriod),
govtypes.NewTallyParams(govtypes.DefaultQuorum, govtypes.DefaultThreshold, govtypes.DefaultVetoThreshold),
)
}
// func govGenesisState() *govtypes.GenesisState {
// return govtypes.NewGenesisState(
// 1,
// govtypes.NewDepositParams(
// sdk.NewCoins(sdk.NewCoin("ubtsg", govtypes.DefaultMinDepositTokens)),
// govtypes.DefaultPeriod,
// ),
// govtypes.NewVotingParams(govtypes.DefaultPeriod),
// govtypes.NewTallyParams(govtypes.DefaultQuorum, govtypes.DefaultThreshold, govtypes.DefaultVetoThreshold),
// )
// }

func mintGenesisState() *minttypes.GenesisState {
return &minttypes.GenesisState{
Params: minttypes.NewParams(
types.BondDenom,
sdk.NewDecWithPrec(13, 2),
sdk.NewDecWithPrec(20, 2),
sdk.NewDecWithPrec(7, 2),
sdk.NewDecWithPrec(67, 2),
uint64(60*60*8766/5), // assuming 5 second block times
),
}
}
*/
// func mintGenesisState() *minttypes.GenesisState {
// return &minttypes.GenesisState{
// Params: minttypes.NewParams(
// "ubtsg",
// sdk.NewDecWithPrec(13, 2),
// sdk.NewDecWithPrec(20, 2),
// sdk.NewDecWithPrec(7, 2),
// sdk.NewDecWithPrec(67, 2),
// uint64(60*60*8766/6), // assuming 6 second block times
// ),
// }
// }
4 changes: 2 additions & 2 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func appModules(
app.AppKeepers.AccountKeeper, app.AppKeepers.StakingKeeper, app.BaseApp.DeliverTx,
encodingConfig.TxConfig,
),
auth.NewAppModule(appCodec, app.AppKeepers.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
auth.NewAppModule(appCodec, app.AppKeepers.AccountKeeper, nil, app.GetSubspace(authtypes.ModuleName)),
vesting.NewAppModule(app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper),
bank.NewAppModule(appCodec, app.AppKeepers.BankKeeper, app.AppKeepers.AccountKeeper, app.GetSubspace(banktypes.ModuleName)),
capability.NewAppModule(appCodec, *app.AppKeepers.CapabilityKeeper, false),
Expand Down Expand Up @@ -170,7 +170,7 @@ func simulationModules(
return []module.AppModuleSimulation{
auth.NewAppModule(appCodec, app.AppKeepers.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
bank.NewAppModule(appCodec, app.AppKeepers.BankKeeper, app.AppKeepers.AccountKeeper, app.GetSubspace(banktypes.ModuleName)),
// fantoken.NewAppModule(appCodec, app.FanTokenKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper),
// fantoken.NewAppModule(appCodec, app.FanTokenKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper), // todo: reimplement
capability.NewAppModule(appCodec, *app.AppKeepers.CapabilityKeeper, false),
feegrantmodule.NewAppModule(appCodec, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.AppKeepers.FeeGrantKeeper, app.interfaceRegistry),
authzmodule.NewAppModule(appCodec, app.AppKeepers.AuthzKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.interfaceRegistry),
Expand Down
11 changes: 6 additions & 5 deletions e2e/basic_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (
"time"

sdkmath "cosmossdk.io/math"
// bitsongconformance "github.com/CosmosContracts/juno/tests/interchaintest/conformance"
bitsongconformance "github.com/bitsongofficial/go-bitsong/tests/e2e/conformance"
"github.com/bitsongofficial/go-bitsong/tests/e2e/helpers"

govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
cosmosproto "github.com/cosmos/gogoproto/proto"
Expand Down Expand Up @@ -87,7 +88,7 @@ func CosmosChainUpgradeTest(t *testing.T, chainName, upgradeBranchVersion, upgra
chainUser := users[0]

// execute a contract before the upgrade
// beforeContract := bitsongconformance.StdExecute(t, ctx, chain, chainUser)
beforeContract := bitsongconformance.StdExecute(t, ctx, chain, chainUser)

// upgrade
height, err := chain.Height(ctx)
Expand All @@ -104,10 +105,10 @@ func CosmosChainUpgradeTest(t *testing.T, chainName, upgradeBranchVersion, upgra
UpgradeNodes(t, ctx, chain, client, haltHeight, upgradeRepo, upgradeBranchVersion)

// confirm we can execute against the beforeContract (ref: v20 upgrade patch)
// helpers.ExecuteMsgWithFee(t, ctx, chain, chainUser, beforeContract, "", "10000"+chain.Config().Denom, `{"increment":{}}`)
helpers.ExecuteMsgWithFee(t, ctx, chain, chainUser, beforeContract, "", "10000"+chain.Config().Denom, `{"increment":{}}`)

// Post Upgrade: Conformance Validation
// bitsongconformance.ConformanceCosmWasm(t, ctx, chain, chainUser)
bitsongconformance.ConformanceCosmWasm(t, ctx, chain, chainUser)
// TODO: ibc conformance test
}

Expand Down Expand Up @@ -166,7 +167,7 @@ func ValidatorVoting(t *testing.T, ctx context.Context, chain *cosmos.CosmosChai
func SubmitUpgradeProposal(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, upgradeName string, haltHeight int64) string {
upgradeMsg := []cosmosproto.Message{
&upgradetypes.MsgSoftwareUpgrade{
// gGov Module account
// gov Module account
Authority: "juno10d07y265gmmuvt4z0w9aw880jnsr700jvss730",
Plan: upgradetypes.Plan{
Name: upgradeName,
Expand Down
Binary file added e2e/contracts/polytone_listener.wasm
Binary file not shown.
Binary file added e2e/contracts/polytone_note.wasm
Binary file not shown.
Binary file added e2e/contracts/polytone_proxy.wasm
Binary file not shown.
Binary file added e2e/contracts/polytone_tester.wasm
Binary file not shown.
Binary file added e2e/contracts/polytone_voice.wasm
Binary file not shown.
5 changes: 2 additions & 3 deletions e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ replace (
require (
cosmossdk.io/math v1.3.0
github.com/CosmWasm/wasmd v0.45.0
github.com/CosmWasm/wasmvm v1.5.0
github.com/cosmos/cosmos-sdk v0.47.12
github.com/cosmos/gogoproto v1.4.10
github.com/docker/docker v24.0.7+incompatible
github.com/strangelove-ventures/interchaintest/v7 v7.0.1-0.20240510223205-7272afc780da
github.com/stretchr/testify v1.9.0
go.uber.org/zap v1.26.0
gopkg.in/yaml.v2 v2.4.0
github.com/BurntSushi/toml v1.3.2
)

require (
Expand Down Expand Up @@ -64,9 +64,8 @@ require (
filippo.io/edwards25519 v1.0.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.2 // indirect

github.com/BurntSushi/toml v1.3.2 // indirect
github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect
github.com/CosmWasm/wasmvm v1.5.0 // indirect
github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e // indirect
github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
Expand Down
Loading

0 comments on commit f58a643

Please sign in to comment.