Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #106 from mycel-domain/feat/upgrade-sdk-cosmwasm
Browse files Browse the repository at this point in the history
Feat/upgrade sdk cosmwasm
  • Loading branch information
taryune authored Nov 16, 2023
2 parents 61ddaf3 + 8115902 commit 2f21eb4
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 159 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Mycel
**Mycel** is a Decentralized ID Infrastructure solution that resolves addresses such as websites, crypto wallets, IPFS, among many more accessible through a single domain with name resolution support in DNS, IBC and smart contracts.

## Dependencies
- Go `1.21.3`
- Ignite CLI `v0.27.2`
- Cosmos SDK `v0.47.3`

## Get started

```
Expand Down
32 changes: 0 additions & 32 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,6 @@ const (
MycelExponent = 6

DefaultBondDenom = BaseCoinUnit

// If EnabledSpecificProposals is "", and this is "true", then enable all x/wasm proposals.
// If EnabledSpecificProposals is "", and this is not "true", then disable all x/wasm proposals.
ProposalsEnabled = "false"
// If set to non-empty string it must be comma-separated list of values that are all a subset
// of "EnableAllProposals" (takes precedence over ProposalsEnabled)
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
EnableSpecificProposals = ""
)

// RegisterDenoms registers token denoms.
Expand Down Expand Up @@ -181,22 +173,6 @@ func getGovProposalHandlers() []govclient.ProposalHandler {
return govProposalHandlers
}

// produce a list of enabled proposals to pass into wasmd app.
func GetEnabledProposals() []wasmtypes.ProposalType {
if EnableSpecificProposals == "" {
if ProposalsEnabled == "true" {
return wasmtypes.EnableAllProposals
}
return wasmtypes.DisableAllProposals
}
chunks := strings.Split(EnableSpecificProposals, ",")
proposals, err := wasmtypes.ConvertToProposals(chunks)
if err != nil {
panic(err)
}
return proposals
}

var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string
Expand Down Expand Up @@ -343,7 +319,6 @@ func New(
homePath string,
invCheckPeriod uint,
encodingConfig appparams.EncodingConfig,
enabledProposals []wasmtypes.ProposalType,
appOpts servertypes.AppOptions,
wasmOpts []wasmkeeper.Option,
baseAppOptions ...func(*baseapp.BaseApp),
Expand All @@ -358,7 +333,6 @@ func New(
invCheckPeriod,
encodingConfig,
appOpts,
enabledProposals,
wasmOpts,
baseAppOptions...,
)
Expand All @@ -374,7 +348,6 @@ func NewApp(
invCheckPeriod uint,
encodingConfig appparams.EncodingConfig,
appOpts servertypes.AppOptions,
enabledProposals []wasmtypes.ProposalType,
wasmOpts []wasmkeeper.Option,
baseAppOptions ...func(*baseapp.BaseApp),

Expand Down Expand Up @@ -659,11 +632,6 @@ func NewApp(
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
wasmOpts...,
)
// The gov proposal types can be individually enabled
if len(enabledProposals) != 0 {
govRouter.AddRoute(wasmtypes.RouterKey, wasmkeeper.NewWasmProposalHandler(app.WasmKeeper, enabledProposals)) //nolint:staticcheck
}

govKeeper.SetLegacyRouter(govRouter)

app.GovKeeper = *govKeeper.SetHooks(
Expand Down
7 changes: 0 additions & 7 deletions app/simulation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"time"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
Expand Down Expand Up @@ -100,7 +99,6 @@ func BenchmarkSimulation(b *testing.B) {
app.DefaultNodeHome,
0,
app.MakeEncodingConfig(),
wasmtypes.EnableAllProposals,
appOptions,
wasmOpt,
baseapp.SetChainID(config.ChainID),
Expand Down Expand Up @@ -180,7 +178,6 @@ func TestAppStateDeterminism(t *testing.T) {
app.DefaultNodeHome,
simcli.FlagPeriodValue,
app.MakeEncodingConfig(),
wasmtypes.EnableAllProposals,
appOptions,
wasmOpt,
fauxMerkleModeOpt,
Expand Down Expand Up @@ -261,7 +258,6 @@ func TestAppImportExport(t *testing.T) {
app.DefaultNodeHome,
0,
app.MakeEncodingConfig(),
wasmtypes.EnableAllProposals,
appOptions,
wasmOpt,
baseapp.SetChainID(config.ChainID),
Expand Down Expand Up @@ -326,7 +322,6 @@ func TestAppImportExport(t *testing.T) {
app.DefaultNodeHome,
0,
app.MakeEncodingConfig(),
wasmtypes.EnableAllProposals,
appOptions,
wasmOpt,
baseapp.SetChainID(config.ChainID),
Expand Down Expand Up @@ -423,7 +418,6 @@ func TestAppSimulationAfterImport(t *testing.T) {
app.DefaultNodeHome,
0,
app.MakeEncodingConfig(),
wasmtypes.EnableAllProposals,
appOptions,
wasmOpt,
fauxMerkleModeOpt,
Expand Down Expand Up @@ -494,7 +488,6 @@ func TestAppSimulationAfterImport(t *testing.T) {
app.DefaultNodeHome,
0,
app.MakeEncodingConfig(),
wasmtypes.EnableAllProposals,
appOptions,
wasmOpt,
fauxMerkleModeOpt,
Expand Down
3 changes: 1 addition & 2 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"cosmossdk.io/math"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
Expand Down Expand Up @@ -40,7 +39,7 @@ func setup(withGenesis bool, invCheckPeriod uint, wasmOpt ...wasmkeeper.Option)
appOptions[server.FlagInvCheckPeriod] = invCheckPeriod

encCdc := MakeEncodingConfig()
app := NewApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, invCheckPeriod, encCdc, EmptyAppOptions{}, wasmtypes.EnableAllProposals, wasmOpt)
app := NewApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, invCheckPeriod, encCdc, EmptyAppOptions{}, wasmOpt)
if withGenesis {
return app, app.DefaultGenesis()
}
Expand Down
2 changes: 0 additions & 2 deletions cmd/myceld/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ func (a appCreator) newApp(
cast.ToString(appOpts.Get(flags.FlagHome)),
cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)),
a.encodingConfig,
app.GetEnabledProposals(),
appOpts,
wasmOpts,
baseapp.SetPruning(pruningOpts),
Expand Down Expand Up @@ -354,7 +353,6 @@ func (a appCreator) appExport(
homePath,
uint(1),
a.encodingConfig,
app.GetEnabledProposals(),
appOpts,
emptyWasmOpts,
)
Expand Down
16 changes: 10 additions & 6 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ version: 1
accounts:
- name: alice
coins:
- 1000000000000000umycel
- 80000000000000umycel
mnemonic: album unlock fence mixture little chest concert limb when melody outdoor tool romance kid throw spread bean exercise squeeze syrup saddle year change alone
- name: bob
- name: faucet
coins:
- 500000000000000umycel
- 20000000000000umycel
mnemonic: holiday coil vicious hunt hybrid maximum post spread stomach input more demise garbage slim mouse relief cage hat interest armed promote nerve craft solar
faucet:
name: bob
name: faucet
coins:
- 100000umycel
- 20000000000000umycel
client:
typescript:
path: typescript/ts-client
Expand All @@ -21,7 +21,7 @@ client:
path: docs/static/openapi.yml
validators:
- name: alice
bonded: 100000000umycel
bonded: 50000000000000umycel
genesis:
chain_id: "mycel-local"
consensus_params:
Expand All @@ -32,6 +32,9 @@ genesis:
crisis:
constant_fee:
denom: umycel
distribution:
params:
community_tax: '0.1'
gov:
params:
min_deposit:
Expand All @@ -43,3 +46,4 @@ genesis:
staking:
params:
bond_denom: umycel

4 changes: 2 additions & 2 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang AS builder
FROM --platform=linux/amd64 golang AS builder
USER root
WORKDIR /build/
COPY ./ /build/
Expand All @@ -11,7 +11,7 @@ RUN ignite chain build \
--release
RUN tar -zxvf release/mycel_linux_amd64.tar.gz

FROM ubuntu
FROM --platform=linux/amd64 ubuntu
ENV LD_LIBRARY_PATH=/usr/local/lib
RUN apt update \
&& apt install -y ca-certificates vim curl
Expand Down
23 changes: 23 additions & 0 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75601,6 +75601,26 @@ definitions:
for executing a MsgStoreAndInstantiateContract message.

Since: 0.40
cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse:
type: object
properties:
code_id:
type: string
format: uint64
title: CodeID is the reference to the stored WASM code
checksum:
type: string
format: byte
title: Checksum is the sha256 hash of the stored code
data:
type: string
format: byte
title: Data contains bytes to returned from the contract
description: |-
MsgStoreAndMigrateContractResponse defines the response structure
for executing a MsgStoreAndMigrateContract message.

Since: 0.42
cosmwasm.wasm.v1.MsgStoreCodeResponse:
type: object
properties:
Expand Down Expand Up @@ -75635,6 +75655,9 @@ definitions:
cosmwasm.wasm.v1.MsgUpdateAdminResponse:
type: object
title: MsgUpdateAdminResponse returns empty data
cosmwasm.wasm.v1.MsgUpdateContractLabelResponse:
type: object
title: MsgUpdateContractLabelResponse returns empty data
cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse:
type: object
title: MsgUpdateInstantiateConfigResponse returns empty data
Expand Down
Loading

0 comments on commit 2f21eb4

Please sign in to comment.