Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patches #24

Open
wants to merge 18 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"

3 changes: 3 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
image: ghcr.io/notional-labs/cosmos


6 changes: 3 additions & 3 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
keeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante"
keeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
// stargazeante "github.com/public-awesome/stargaze/v3/internal/ante"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
// channel keeper.
type HandlerOptions struct {
ante.HandlerOptions
IBCKeeper *keeper.Keeper
IBCKeeper *keeper.Keeper
WasmConfig *wasmTypes.WasmConfig
TXCounterStoreKey sdk.StoreKey
Codec codec.BinaryCodec
Expand Down Expand Up @@ -46,7 +46,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "tx counter key is required for ante builder")
}

var sigGasConsumer = options.SigGasConsumer
sigGasConsumer := options.SigGasConsumer
if sigGasConsumer == nil {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
}
Expand Down
40 changes: 10 additions & 30 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ import (

"github.com/aura-nw/aura/docs"

auramodule "github.com/aura-nw/aura/x/aura"
auramodulekeeper "github.com/aura-nw/aura/x/aura/keeper"
auramoduletypes "github.com/aura-nw/aura/x/aura/types"

"github.com/cosmos/cosmos-sdk/x/authz"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
Expand Down Expand Up @@ -203,7 +199,6 @@ var (
evidence.AppModuleBasic{},
transfer.AppModuleBasic{},
vesting.AppModuleBasic{},
auramodule.AppModuleBasic{},
wasm.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
)
Expand Down Expand Up @@ -277,8 +272,6 @@ type App struct {
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedWasmKeeper capabilitykeeper.ScopedKeeper

AuraKeeper auramodulekeeper.Keeper

// this line is used by starport scaffolding # stargate/app/keeperDeclaration

// the module manager
Expand Down Expand Up @@ -315,7 +308,6 @@ func New(
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
auramoduletypes.StoreKey,
authzkeeper.StoreKey,
wasm.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey
Expand Down Expand Up @@ -353,20 +345,15 @@ func New(
appCodec, keys[authtypes.StoreKey], app.GetSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms,
)

app.AuraKeeper = auramodulekeeper.NewKeeper(
appCodec,
keys[auramoduletypes.StoreKey],
keys[auramoduletypes.MemStoreKey],
app.GetSubspace(auramoduletypes.ModuleName),
)

app.BankKeeper = custombankkeeper.NewBaseKeeper(
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.ModuleAccountAddrs(), app.AuraKeeper,
)

stakingKeeper := stakingkeeper.NewKeeper(
appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName),
)

// TODO: review why MintKeeper consumes app.AuraKeeper (which maybe did nothing?)
app.MintKeeper = custommintkeeper.NewKeeper(
appCodec, keys[minttypes.StoreKey], app.GetSubspace(minttypes.ModuleName), &stakingKeeper,
app.AccountKeeper, app.BankKeeper, app.AuraKeeper, authtypes.FeeCollectorName,
Expand Down Expand Up @@ -432,7 +419,6 @@ func New(
// If evidence needs to be handled for the app, set routes in router here and seal
app.EvidenceKeeper = *evidenceKeeper

auraModule := auramodule.NewAppModule(appCodec, app.AuraKeeper)
// this line is used by starport scaffolding # stargate/app/keeperDefinition

// Create static IBC router, add transfer route, then set and seal it
Expand Down Expand Up @@ -489,7 +475,7 @@ func New(

// NOTE: we may consider parsing `appOpts` inside module constructors. For the moment
// we prefer to be more strict in what arguments the modules expect.
var skipGenesisInvariants = cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants))
skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants))

// NOTE: Any module instantiated in the module manager that is later modified
// must be passed by reference here.
Expand All @@ -516,7 +502,6 @@ func New(
ibc.NewAppModule(app.IBCKeeper),
params.NewAppModule(app.ParamsKeeper),
transferModule,
auraModule,
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
// this line is used by starport scaffolding # stargate/app/appModule
)
Expand Down Expand Up @@ -545,7 +530,6 @@ func New(
// additional non simd modules
ibchost.ModuleName,
ibctransfertypes.ModuleName,
auramoduletypes.ModuleName,
wasm.ModuleName,
)

Expand All @@ -569,7 +553,6 @@ func New(
// additional non simd modules
ibchost.ModuleName,
ibctransfertypes.ModuleName,
auramoduletypes.ModuleName,
wasm.ModuleName,
)

Expand All @@ -592,7 +575,6 @@ func New(
genutiltypes.ModuleName,
evidencetypes.ModuleName,
ibctransfertypes.ModuleName,
auramoduletypes.ModuleName,
feegrant.ModuleName,
authz.ModuleName,
paramstypes.ModuleName,
Expand All @@ -605,7 +587,6 @@ func New(

app.mm.SetOrderMigrations(
authtypes.ModuleName,
auramoduletypes.ModuleName,
banktypes.ModuleName,
capabilitytypes.ModuleName,
distrtypes.ModuleName,
Expand Down Expand Up @@ -643,8 +624,9 @@ func New(
BankKeeper: app.BankKeeper,
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
FeegrantKeeper: app.FeeGrantKeeper,
SigGasConsumer: ante.DefaultSigVerificationGasConsumer},
IBCKeeper: app.IBCKeeper,
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
},
IBCKeeper: app.IBCKeeper,
WasmConfig: &wasmConfig,
TXCounterStoreKey: keys[wasm.StoreKey],
Codec: app.appCodec,
Expand All @@ -661,7 +643,7 @@ func New(

app.SetEndBlocker(app.EndBlocker)
app.setupUpgradeHandlers()
//app.RegisterUpgradeHandlers(configurator)
// app.RegisterUpgradeHandlers(configurator)
if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
tmos.Exit(err.Error())
Expand Down Expand Up @@ -823,7 +805,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibchost.ModuleName)
paramsKeeper.Subspace(auramoduletypes.ModuleName)
paramsKeeper.Subspace(wasm.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace

Expand All @@ -837,7 +818,6 @@ func (app *App) setupUpgradeHandlers() {
v0_3_0.CreateUpgradeHandler(app.mm, app.configurator),
)


// When a planned update height is reached, the old binary will panic
// writing on disk the height and name of the update that triggered it
// This will read that value, and execute the preparations for the upgrade.
Expand All @@ -853,12 +833,12 @@ func (app *App) setupUpgradeHandlers() {
var storeUpgrades *storetypes.StoreUpgrades

switch upgradeInfo.Name {
case v0_3_0.UpgradeName:
// no store upgrades in v0.3.0
case v0_3_0.UpgradeName:
// no store upgrades in v0.3.0
}

if storeUpgrades != nil {
// configure store loader that checks if version == upgradeHeight and applies store upgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, storeUpgrades))
}
}
}
4 changes: 2 additions & 2 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
func (app *App) ExportAppStateAndValidators(
forZeroHeight bool, jailAllowedAddrs []string,
) (servertypes.ExportedApp, error) {

// as if they could withdraw from the start of the next block
ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})

Expand Down Expand Up @@ -50,7 +49,8 @@ func (app *App) ExportAppStateAndValidators(

// prepare for fresh start at zero height
// NOTE zero height genesis is a temporary feature which will be deprecated
// in favour of export at a block height
//
// in favour of export at a block height
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
applyAllowedAddrs := false

Expand Down
1 change: 0 additions & 1 deletion app/upgrades/v0.3.0/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package v030

import (

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
Expand Down
1 change: 0 additions & 1 deletion cmd/aurad/cmd/genwasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ func AddGenesisWasmMsgCmd(defaultNodeHome string) *cobra.Command {
wasmcli.GenesisListCodesCmd(defaultNodeHome, genesisIO),
)
return txCmd

}
11 changes: 4 additions & 7 deletions cmd/aurad/cmd/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Example:
numValidators, _ := cmd.Flags().GetInt(flagNumValidators)
algo, _ := cmd.Flags().GetString(flags.FlagKeyAlgorithm)

//Custome IPaddresses and nodeName
// Custome IPaddresses and nodeName
nodeName, _ := cmd.Flags().GetString(flagNodeNames)

IPaddresses := strings.Split(startingIPAddress, ",")
Expand Down Expand Up @@ -109,7 +109,7 @@ Example:
return cmd
}

const nodeDirPerm = 0755
const nodeDirPerm = 0o755

// Initialize the testnet
func InitTestnet(
Expand All @@ -129,7 +129,6 @@ func InitTestnet(
nodeNames []string,
numValidators int,
) error {

if chainID == "" {
chainID = "chain-" + tmrand.NewRand().Str(6)
}
Expand Down Expand Up @@ -287,7 +286,6 @@ func initGenFiles(
genAccounts []authtypes.GenesisAccount, genBalances []banktypes.Balance,
genFiles []string, numValidators int,
) error {

appGenState := mbm.DefaultGenesis(clientCtx.Codec)

// set the accounts in the genesis state
Expand Down Expand Up @@ -336,7 +334,6 @@ func collectGenFiles(
nodeIDs []string, valPubKeys []cryptotypes.PubKey, numValidators int,
outputDir, nodeDirPrefix, nodeDaemonHome string, nodeNames []string, genBalIterator banktypes.GenesisBalancesIterator,
) error {

var appState json.RawMessage
genTime := tmtime.Now()

Expand Down Expand Up @@ -401,12 +398,12 @@ func writeFile(name string, dir string, contents []byte) error {
writePath := filepath.Join(dir)
file := filepath.Join(writePath, name)

err := tmos.EnsureDir(writePath, 0755)
err := tmos.EnsureDir(writePath, 0o755)
if err != nil {
return err
}

err = tmos.WriteFile(file, contents, 0644)
err = tmos.WriteFile(file, contents, 0o644)
if err != nil {
return err
}
Expand Down
20 changes: 9 additions & 11 deletions cmd/aurad/cmd/vestingaccountcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -26,7 +25,7 @@ const (
flagVestingPeriod = "period-length"
flagVestingAmt = "total-vesting-amount"
flagVestingTime = "total-vesting-time"
flagCliffTime = "cliff-time"
flagCliffTime = "cliff-time"
flagCliffAmount = "cliff-amount"
)

Expand All @@ -43,8 +42,8 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
depCdc := clientCtx.JSONCodec
cdc := depCdc.(codec.Codec)
depCdc := clientCtx.Codec
cdc := depCdc

serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config
Expand Down Expand Up @@ -103,7 +102,6 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
return err
}


vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr)
if err != nil {
return fmt.Errorf("failed to parse vesting amount: %w", err)
Expand All @@ -130,12 +128,12 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
if vestingStart != 0 && periodLength != 0 && cliffAmt[0].Amount.LTE(vestingAmt[0].Amount) && cliffTime <= vestingTime {
vestingTime = vestingTime - cliffTime
var numPeriod int64 = vestingTime / periodLength
//Currently, only allow to vest 1 type of coin per account
//Add 1 period if set cliff

// Currently, only allow to vest 1 type of coin per account
// Add 1 period if set cliff
var totalAmount sdk.Int = vestingAmt[0].Amount.Sub(cliffAmt[0].Amount)
var periodicAmount sdk.Int = totalAmount.QuoRaw(numPeriod)
if (cliffTime > 0 ) {
if cliffTime > 0 {
numPeriod = numPeriod + 1
}
periods := caculateVestingPeriods(vestingTime, periodLength, vestingAmtStr, numPeriod, totalAmount, periodicAmount, cliffTime, cliffAmtStr)
Expand Down Expand Up @@ -223,7 +221,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
func caculateVestingPeriods(vestingTime int64, periodLength int64, vestingAmtStr string, numPeriod int64, totalAmount sdk.Int, periodicAmount sdk.Int, cliffTime int64, cliffAmtStr string) authvesting.Periods {
var counter int = 0
if vestingTime%periodLength != 0 {
//indivisible vesting time
// indivisible vesting time
periods := make([]authvesting.Period, numPeriod+1)
if cliffTime > 0 {
periods[0].Length = cliffTime
Expand All @@ -242,7 +240,7 @@ func caculateVestingPeriods(vestingTime int64, periodLength int64, vestingAmtStr
}
return periods
} else {
//divisible vesting time
// divisible vesting time
periods := make([]authvesting.Period, numPeriod)
if cliffTime > 0 {
periods[0].Length = cliffTime
Expand Down
Loading