2019-06-20 13:37:57 +00:00
|
|
|
package app
|
|
|
|
|
|
|
|
import (
|
2022-01-08 00:39:27 +00:00
|
|
|
"fmt"
|
2019-06-20 13:37:57 +00:00
|
|
|
"io"
|
2023-04-17 19:54:13 +00:00
|
|
|
"net/http"
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2024-02-06 22:54:10 +00:00
|
|
|
dbm "github.com/cometbft/cometbft-db"
|
|
|
|
abci "github.com/cometbft/cometbft/abci/types"
|
|
|
|
tmjson "github.com/cometbft/cometbft/libs/json"
|
|
|
|
tmlog "github.com/cometbft/cometbft/libs/log"
|
2022-01-08 00:39:27 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/baseapp"
|
|
|
|
"github.com/cosmos/cosmos-sdk/client"
|
2023-04-04 00:08:45 +00:00
|
|
|
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
|
2022-01-08 00:39:27 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
2022-01-08 00:39:27 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec/types"
|
|
|
|
"github.com/cosmos/cosmos-sdk/server/api"
|
|
|
|
"github.com/cosmos/cosmos-sdk/server/config"
|
|
|
|
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
2023-04-04 00:08:45 +00:00
|
|
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2019-07-18 17:36:31 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/types/module"
|
|
|
|
"github.com/cosmos/cosmos-sdk/version"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/auth"
|
2022-01-08 00:39:27 +00:00
|
|
|
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
2024-02-06 22:54:10 +00:00
|
|
|
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
|
2022-01-08 00:39:27 +00:00
|
|
|
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
|
|
|
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
2019-10-04 17:55:49 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
|
2024-06-16 09:23:29 +00:00
|
|
|
vestingkeeper "github.com/cosmos/cosmos-sdk/x/auth/vesting/keeper"
|
2022-04-21 20:16:28 +00:00
|
|
|
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
|
2022-04-21 20:34:14 +00:00
|
|
|
"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"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/bank"
|
2022-01-08 00:39:27 +00:00
|
|
|
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
|
|
|
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
|
|
|
"github.com/cosmos/cosmos-sdk/x/capability"
|
|
|
|
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
|
|
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
2024-02-06 22:54:10 +00:00
|
|
|
consensus "github.com/cosmos/cosmos-sdk/x/consensus"
|
|
|
|
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
|
|
|
|
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/crisis"
|
2022-01-08 00:39:27 +00:00
|
|
|
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
|
|
|
|
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
distr "github.com/cosmos/cosmos-sdk/x/distribution"
|
2022-01-08 00:39:27 +00:00
|
|
|
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
|
|
|
|
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
|
2020-04-23 16:35:58 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/evidence"
|
2022-01-08 00:39:27 +00:00
|
|
|
evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper"
|
|
|
|
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
|
2019-07-18 17:36:31 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/genutil"
|
2022-01-08 00:39:27 +00:00
|
|
|
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/gov"
|
2023-04-04 00:08:45 +00:00
|
|
|
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
|
2022-01-08 00:39:27 +00:00
|
|
|
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
|
|
|
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
2023-04-04 00:08:45 +00:00
|
|
|
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
|
|
|
|
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
|
2023-01-26 16:50:27 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/mint"
|
|
|
|
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
|
|
|
|
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/params"
|
2019-07-18 17:36:31 +00:00
|
|
|
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
|
2022-01-08 00:39:27 +00:00
|
|
|
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
|
|
|
|
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
|
|
|
paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/slashing"
|
2022-01-08 00:39:27 +00:00
|
|
|
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
|
|
|
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/staking"
|
2022-01-08 00:39:27 +00:00
|
|
|
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
|
|
|
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
2020-05-07 20:34:05 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/upgrade"
|
|
|
|
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
|
2022-01-08 00:39:27 +00:00
|
|
|
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
|
|
|
|
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
|
2024-03-07 21:47:46 +00:00
|
|
|
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
|
|
|
|
packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/keeper"
|
|
|
|
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
|
2024-02-06 22:54:10 +00:00
|
|
|
transfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer"
|
|
|
|
ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper"
|
|
|
|
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
|
|
|
|
ibc "github.com/cosmos/ibc-go/v7/modules/core"
|
|
|
|
ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client"
|
|
|
|
ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client"
|
|
|
|
ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
|
2024-03-07 21:47:46 +00:00
|
|
|
ibcporttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
|
2024-02-06 22:54:10 +00:00
|
|
|
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
|
|
|
|
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
|
2024-02-16 17:49:58 +00:00
|
|
|
solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine"
|
2024-02-06 22:54:10 +00:00
|
|
|
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
|
2024-07-11 13:23:31 +00:00
|
|
|
"github.com/ethereum/go-ethereum/core/vm"
|
2023-04-04 00:08:45 +00:00
|
|
|
evmante "github.com/evmos/ethermint/app/ante"
|
|
|
|
ethermintconfig "github.com/evmos/ethermint/server/config"
|
|
|
|
"github.com/evmos/ethermint/x/evm"
|
|
|
|
evmkeeper "github.com/evmos/ethermint/x/evm/keeper"
|
|
|
|
evmtypes "github.com/evmos/ethermint/x/evm/types"
|
|
|
|
"github.com/evmos/ethermint/x/feemarket"
|
|
|
|
feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper"
|
|
|
|
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"
|
2023-04-17 19:54:13 +00:00
|
|
|
"github.com/gorilla/mux"
|
2020-03-04 19:50:30 +00:00
|
|
|
|
2024-05-01 03:17:24 +00:00
|
|
|
"github.com/0glabs/0g-chain/app/ante"
|
2024-05-01 05:53:58 +00:00
|
|
|
chainparams "github.com/0glabs/0g-chain/app/params"
|
|
|
|
"github.com/0glabs/0g-chain/chaincfg"
|
2024-05-09 18:54:47 +00:00
|
|
|
dasignersprecompile "github.com/0glabs/0g-chain/precompiles/dasigners"
|
|
|
|
|
2024-05-01 03:17:24 +00:00
|
|
|
"github.com/0glabs/0g-chain/x/bep3"
|
|
|
|
bep3keeper "github.com/0glabs/0g-chain/x/bep3/keeper"
|
|
|
|
bep3types "github.com/0glabs/0g-chain/x/bep3/types"
|
|
|
|
"github.com/0glabs/0g-chain/x/committee"
|
|
|
|
committeeclient "github.com/0glabs/0g-chain/x/committee/client"
|
|
|
|
committeekeeper "github.com/0glabs/0g-chain/x/committee/keeper"
|
|
|
|
committeetypes "github.com/0glabs/0g-chain/x/committee/types"
|
2024-05-01 06:08:58 +00:00
|
|
|
council "github.com/0glabs/0g-chain/x/council/v1"
|
|
|
|
councilkeeper "github.com/0glabs/0g-chain/x/council/v1/keeper"
|
|
|
|
counciltypes "github.com/0glabs/0g-chain/x/council/v1/types"
|
2024-05-09 18:54:47 +00:00
|
|
|
dasigners "github.com/0glabs/0g-chain/x/dasigners/v1"
|
|
|
|
dasignerskeeper "github.com/0glabs/0g-chain/x/dasigners/v1/keeper"
|
|
|
|
dasignerstypes "github.com/0glabs/0g-chain/x/dasigners/v1/types"
|
2024-05-01 03:17:24 +00:00
|
|
|
evmutil "github.com/0glabs/0g-chain/x/evmutil"
|
|
|
|
evmutilkeeper "github.com/0glabs/0g-chain/x/evmutil/keeper"
|
|
|
|
evmutiltypes "github.com/0glabs/0g-chain/x/evmutil/types"
|
|
|
|
issuance "github.com/0glabs/0g-chain/x/issuance"
|
|
|
|
issuancekeeper "github.com/0glabs/0g-chain/x/issuance/keeper"
|
|
|
|
issuancetypes "github.com/0glabs/0g-chain/x/issuance/types"
|
|
|
|
"github.com/0glabs/0g-chain/x/precisebank"
|
|
|
|
precisebankkeeper "github.com/0glabs/0g-chain/x/precisebank/keeper"
|
|
|
|
precisebanktypes "github.com/0glabs/0g-chain/x/precisebank/types"
|
|
|
|
pricefeed "github.com/0glabs/0g-chain/x/pricefeed"
|
|
|
|
pricefeedkeeper "github.com/0glabs/0g-chain/x/pricefeed/keeper"
|
|
|
|
pricefeedtypes "github.com/0glabs/0g-chain/x/pricefeed/types"
|
|
|
|
validatorvesting "github.com/0glabs/0g-chain/x/validator-vesting"
|
|
|
|
validatorvestingrest "github.com/0glabs/0g-chain/x/validator-vesting/client/rest"
|
|
|
|
validatorvestingtypes "github.com/0glabs/0g-chain/x/validator-vesting/types"
|
2024-05-09 18:54:47 +00:00
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
"github.com/ethereum/go-ethereum/core/vm"
|
2019-06-20 13:37:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2022-01-08 00:39:27 +00:00
|
|
|
// ModuleBasics manages simple versions of full app modules.
|
|
|
|
// It's used for things such as codec registration and genesis file verification.
|
2019-07-18 17:36:31 +00:00
|
|
|
ModuleBasics = module.NewBasicManager(
|
2024-02-06 22:54:10 +00:00
|
|
|
genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
|
2019-07-18 17:36:31 +00:00
|
|
|
auth.AppModuleBasic{},
|
|
|
|
bank.AppModuleBasic{},
|
2022-01-08 00:39:27 +00:00
|
|
|
capability.AppModuleBasic{},
|
2019-07-18 17:36:31 +00:00
|
|
|
staking.AppModuleBasic{},
|
|
|
|
distr.AppModuleBasic{},
|
2023-04-04 00:08:45 +00:00
|
|
|
gov.NewAppModuleBasic([]govclient.ProposalHandler{
|
2022-01-08 00:39:27 +00:00
|
|
|
paramsclient.ProposalHandler,
|
2023-04-04 00:08:45 +00:00
|
|
|
upgradeclient.LegacyProposalHandler,
|
|
|
|
upgradeclient.LegacyCancelProposalHandler,
|
2022-01-08 00:39:27 +00:00
|
|
|
ibcclientclient.UpdateClientProposalHandler,
|
|
|
|
ibcclientclient.UpgradeProposalHandler,
|
|
|
|
committeeclient.ProposalHandler,
|
2023-04-04 00:08:45 +00:00
|
|
|
}),
|
2019-07-18 17:36:31 +00:00
|
|
|
params.AppModuleBasic{},
|
|
|
|
crisis.AppModuleBasic{},
|
|
|
|
slashing.AppModuleBasic{},
|
2022-01-08 00:39:27 +00:00
|
|
|
ibc.AppModuleBasic{},
|
2024-02-06 22:54:10 +00:00
|
|
|
ibctm.AppModuleBasic{},
|
2024-02-16 17:49:58 +00:00
|
|
|
solomachine.AppModuleBasic{},
|
2024-03-07 21:47:46 +00:00
|
|
|
packetforward.AppModuleBasic{},
|
2020-05-07 20:34:05 +00:00
|
|
|
upgrade.AppModuleBasic{},
|
2020-04-23 16:35:58 +00:00
|
|
|
evidence.AppModuleBasic{},
|
2022-04-21 20:34:14 +00:00
|
|
|
authzmodule.AppModuleBasic{},
|
2022-01-08 00:39:27 +00:00
|
|
|
transfer.AppModuleBasic{},
|
|
|
|
vesting.AppModuleBasic{},
|
2022-04-21 20:16:28 +00:00
|
|
|
evm.AppModuleBasic{},
|
|
|
|
feemarket.AppModuleBasic{},
|
2022-01-08 00:39:27 +00:00
|
|
|
issuance.AppModuleBasic{},
|
|
|
|
bep3.AppModuleBasic{},
|
2019-11-29 10:55:10 +00:00
|
|
|
pricefeed.AppModuleBasic{},
|
2020-03-10 22:29:16 +00:00
|
|
|
committee.AppModuleBasic{},
|
2022-01-08 00:39:27 +00:00
|
|
|
validatorvesting.AppModuleBasic{},
|
2022-04-21 20:16:28 +00:00
|
|
|
evmutil.AppModuleBasic{},
|
2023-01-26 16:50:27 +00:00
|
|
|
mint.AppModuleBasic{},
|
2024-05-10 16:30:28 +00:00
|
|
|
precisebank.AppModuleBasic{},
|
2024-05-01 06:08:58 +00:00
|
|
|
council.AppModuleBasic{},
|
2024-05-09 18:54:47 +00:00
|
|
|
dasigners.AppModuleBasic{},
|
2024-08-02 10:34:24 +00:00
|
|
|
consensus.AppModuleBasic{},
|
2019-07-18 17:36:31 +00:00
|
|
|
)
|
2019-09-11 22:33:20 +00:00
|
|
|
|
|
|
|
// module account permissions
|
2022-01-08 00:39:27 +00:00
|
|
|
// If these are changed, the permissions stored in accounts
|
|
|
|
// must also be migrated during a chain upgrade.
|
2019-09-11 22:33:20 +00:00
|
|
|
mAccPerms = map[string][]string{
|
2022-01-08 00:39:27 +00:00
|
|
|
authtypes.FeeCollectorName: nil,
|
|
|
|
distrtypes.ModuleName: nil,
|
|
|
|
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
|
|
|
|
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
|
|
|
|
govtypes.ModuleName: {authtypes.Burner},
|
|
|
|
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
|
2022-04-21 20:16:28 +00:00
|
|
|
evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account
|
2022-08-23 17:04:40 +00:00
|
|
|
evmutiltypes.ModuleName: {authtypes.Minter, authtypes.Burner},
|
2022-01-08 00:39:27 +00:00
|
|
|
issuancetypes.ModuleAccountName: {authtypes.Minter, authtypes.Burner},
|
|
|
|
bep3types.ModuleName: {authtypes.Burner, authtypes.Minter},
|
2023-01-26 16:50:27 +00:00
|
|
|
minttypes.ModuleName: {authtypes.Minter},
|
2024-05-10 16:30:28 +00:00
|
|
|
precisebanktypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for reserve account to back fractional amounts
|
2020-05-21 04:50:12 +00:00
|
|
|
}
|
2019-09-11 22:33:20 +00:00
|
|
|
)
|
2019-07-18 17:36:31 +00:00
|
|
|
|
2020-04-23 16:35:58 +00:00
|
|
|
// Verify app interface at compile time
|
2023-10-11 17:22:25 +00:00
|
|
|
var (
|
2024-02-06 22:54:10 +00:00
|
|
|
_ servertypes.Application = (*App)(nil)
|
2023-10-11 17:22:25 +00:00
|
|
|
)
|
2020-04-23 16:35:58 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// Options bundles several configuration params for an App.
|
|
|
|
type Options struct {
|
|
|
|
SkipLoadLatest bool
|
|
|
|
SkipUpgradeHeights map[int64]bool
|
|
|
|
SkipGenesisInvariants bool
|
|
|
|
InvariantCheckPeriod uint
|
|
|
|
MempoolEnableAuth bool
|
|
|
|
MempoolAuthAddresses []sdk.AccAddress
|
2022-04-21 20:16:28 +00:00
|
|
|
EVMTrace string
|
|
|
|
EVMMaxGasWanted uint64
|
|
|
|
}
|
|
|
|
|
|
|
|
// DefaultOptions is a sensible default Options value.
|
|
|
|
var DefaultOptions = Options{
|
|
|
|
EVMTrace: ethermintconfig.DefaultEVMTracer,
|
|
|
|
EVMMaxGasWanted: ethermintconfig.DefaultMaxTxGasWanted,
|
2020-12-02 17:37:11 +00:00
|
|
|
}
|
|
|
|
|
2024-05-01 05:53:58 +00:00
|
|
|
// App is the 0gChain ABCI application.
|
2019-06-20 17:02:29 +00:00
|
|
|
type App struct {
|
2022-01-08 00:39:27 +00:00
|
|
|
*baseapp.BaseApp
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// codec
|
|
|
|
legacyAmino *codec.LegacyAmino
|
|
|
|
appCodec codec.Codec
|
|
|
|
interfaceRegistry types.InterfaceRegistry
|
2019-06-20 13:37:57 +00:00
|
|
|
|
|
|
|
// keys to access the substores
|
2023-04-04 00:08:45 +00:00
|
|
|
keys map[string]*storetypes.KVStoreKey
|
|
|
|
tkeys map[string]*storetypes.TransientStoreKey
|
|
|
|
memKeys map[string]*storetypes.MemoryStoreKey
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2019-07-26 12:11:23 +00:00
|
|
|
// keepers from all the modules
|
2024-02-06 22:54:10 +00:00
|
|
|
accountKeeper authkeeper.AccountKeeper
|
|
|
|
bankKeeper bankkeeper.Keeper
|
|
|
|
capabilityKeeper *capabilitykeeper.Keeper
|
|
|
|
stakingKeeper *stakingkeeper.Keeper
|
|
|
|
distrKeeper distrkeeper.Keeper
|
|
|
|
govKeeper govkeeper.Keeper
|
|
|
|
paramsKeeper paramskeeper.Keeper
|
|
|
|
authzKeeper authzkeeper.Keeper
|
|
|
|
crisisKeeper crisiskeeper.Keeper
|
|
|
|
slashingKeeper slashingkeeper.Keeper
|
|
|
|
ibcKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
|
2024-03-07 21:47:46 +00:00
|
|
|
packetForwardKeeper *packetforwardkeeper.Keeper
|
2024-02-06 22:54:10 +00:00
|
|
|
evmKeeper *evmkeeper.Keeper
|
|
|
|
evmutilKeeper evmutilkeeper.Keeper
|
|
|
|
feeMarketKeeper feemarketkeeper.Keeper
|
|
|
|
upgradeKeeper upgradekeeper.Keeper
|
|
|
|
evidenceKeeper evidencekeeper.Keeper
|
|
|
|
transferKeeper ibctransferkeeper.Keeper
|
2024-08-02 10:34:24 +00:00
|
|
|
CouncilKeeper councilkeeper.Keeper
|
2024-02-06 22:54:10 +00:00
|
|
|
issuanceKeeper issuancekeeper.Keeper
|
|
|
|
bep3Keeper bep3keeper.Keeper
|
|
|
|
pricefeedKeeper pricefeedkeeper.Keeper
|
|
|
|
committeeKeeper committeekeeper.Keeper
|
2024-08-02 10:34:24 +00:00
|
|
|
vestingKeeper vestingkeeper.VestingKeeper
|
2024-02-06 22:54:10 +00:00
|
|
|
mintKeeper mintkeeper.Keeper
|
2024-08-02 10:34:24 +00:00
|
|
|
dasignersKeeper dasignerskeeper.Keeper
|
2024-02-06 22:54:10 +00:00
|
|
|
consensusParamsKeeper consensusparamkeeper.Keeper
|
2024-05-10 16:30:28 +00:00
|
|
|
precisebankKeeper precisebankkeeper.Keeper
|
2022-01-08 00:39:27 +00:00
|
|
|
|
|
|
|
// make scoped keepers public for test purposes
|
|
|
|
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
|
|
|
|
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
|
2019-07-18 17:36:31 +00:00
|
|
|
|
|
|
|
// the module manager
|
|
|
|
mm *module.Manager
|
2019-09-11 22:33:20 +00:00
|
|
|
|
|
|
|
// simulation manager
|
|
|
|
sm *module.SimulationManager
|
2022-01-08 00:39:27 +00:00
|
|
|
|
|
|
|
// configurator
|
|
|
|
configurator module.Configurator
|
2019-06-20 13:37:57 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
func init() {
|
|
|
|
}
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// NewApp returns a reference to an initialized App.
|
|
|
|
func NewApp(
|
|
|
|
logger tmlog.Logger,
|
|
|
|
db dbm.DB,
|
|
|
|
homePath string,
|
|
|
|
traceStore io.Writer,
|
2024-05-01 05:53:58 +00:00
|
|
|
encodingConfig chainparams.EncodingConfig,
|
2022-01-08 00:39:27 +00:00
|
|
|
options Options,
|
|
|
|
baseAppOptions ...func(*baseapp.BaseApp),
|
|
|
|
) *App {
|
|
|
|
appCodec := encodingConfig.Marshaler
|
|
|
|
legacyAmino := encodingConfig.Amino
|
|
|
|
interfaceRegistry := encodingConfig.InterfaceRegistry
|
|
|
|
|
2024-05-01 05:53:58 +00:00
|
|
|
bApp := baseapp.NewBaseApp(chaincfg.AppName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...)
|
2019-06-20 13:37:57 +00:00
|
|
|
bApp.SetCommitMultiStoreTracer(traceStore)
|
2022-01-08 00:39:27 +00:00
|
|
|
bApp.SetVersion(version.Version)
|
|
|
|
bApp.SetInterfaceRegistry(interfaceRegistry)
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2019-09-11 22:33:20 +00:00
|
|
|
keys := sdk.NewKVStoreKeys(
|
2022-01-08 00:39:27 +00:00
|
|
|
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
|
2024-03-07 21:47:46 +00:00
|
|
|
distrtypes.StoreKey, slashingtypes.StoreKey, packetforwardtypes.StoreKey,
|
2024-02-06 22:54:10 +00:00
|
|
|
govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey,
|
2022-01-08 00:39:27 +00:00
|
|
|
upgradetypes.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey,
|
2022-04-21 20:34:14 +00:00
|
|
|
evmtypes.StoreKey, feemarkettypes.StoreKey, authzkeeper.StoreKey,
|
2024-05-01 03:46:33 +00:00
|
|
|
capabilitytypes.StoreKey,
|
2022-01-08 00:39:27 +00:00
|
|
|
issuancetypes.StoreKey, bep3types.StoreKey, pricefeedtypes.StoreKey,
|
2024-08-02 10:34:24 +00:00
|
|
|
committeetypes.StoreKey, evmutiltypes.StoreKey,
|
|
|
|
minttypes.StoreKey,
|
|
|
|
counciltypes.StoreKey,
|
|
|
|
dasignerstypes.StoreKey,
|
|
|
|
vestingtypes.StoreKey,
|
2024-05-10 16:30:28 +00:00
|
|
|
consensusparamtypes.StoreKey, crisistypes.StoreKey, precisebanktypes.StoreKey,
|
2019-09-11 22:33:20 +00:00
|
|
|
)
|
2023-04-04 00:08:45 +00:00
|
|
|
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey)
|
2022-01-08 00:39:27 +00:00
|
|
|
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
|
2019-09-11 22:33:20 +00:00
|
|
|
|
2023-10-11 17:22:25 +00:00
|
|
|
// Authority for gov proposals, using the x/gov module account address
|
2024-02-06 22:54:10 +00:00
|
|
|
govAuthAddr := authtypes.NewModuleAddress(govtypes.ModuleName)
|
|
|
|
govAuthAddrStr := govAuthAddr.String()
|
2023-10-11 17:22:25 +00:00
|
|
|
|
2022-05-09 18:37:36 +00:00
|
|
|
app := &App{
|
2022-01-08 00:39:27 +00:00
|
|
|
BaseApp: bApp,
|
|
|
|
legacyAmino: legacyAmino,
|
|
|
|
appCodec: appCodec,
|
|
|
|
interfaceRegistry: interfaceRegistry,
|
|
|
|
keys: keys,
|
|
|
|
tkeys: tkeys,
|
|
|
|
memKeys: memKeys,
|
2019-06-20 13:37:57 +00:00
|
|
|
}
|
|
|
|
|
2019-07-18 17:36:31 +00:00
|
|
|
// init params keeper and subspaces
|
2022-01-08 00:39:27 +00:00
|
|
|
app.paramsKeeper = paramskeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
legacyAmino,
|
|
|
|
keys[paramstypes.StoreKey],
|
|
|
|
tkeys[paramstypes.TStoreKey],
|
|
|
|
)
|
|
|
|
authSubspace := app.paramsKeeper.Subspace(authtypes.ModuleName)
|
|
|
|
bankSubspace := app.paramsKeeper.Subspace(banktypes.ModuleName)
|
|
|
|
stakingSubspace := app.paramsKeeper.Subspace(stakingtypes.ModuleName)
|
|
|
|
distrSubspace := app.paramsKeeper.Subspace(distrtypes.ModuleName)
|
|
|
|
slashingSubspace := app.paramsKeeper.Subspace(slashingtypes.ModuleName)
|
2023-04-04 00:08:45 +00:00
|
|
|
govSubspace := app.paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable())
|
2022-01-08 00:39:27 +00:00
|
|
|
crisisSubspace := app.paramsKeeper.Subspace(crisistypes.ModuleName)
|
|
|
|
issuanceSubspace := app.paramsKeeper.Subspace(issuancetypes.ModuleName)
|
|
|
|
bep3Subspace := app.paramsKeeper.Subspace(bep3types.ModuleName)
|
|
|
|
pricefeedSubspace := app.paramsKeeper.Subspace(pricefeedtypes.ModuleName)
|
2024-02-06 22:54:10 +00:00
|
|
|
ibcSubspace := app.paramsKeeper.Subspace(ibcexported.ModuleName)
|
2022-01-08 00:39:27 +00:00
|
|
|
ibctransferSubspace := app.paramsKeeper.Subspace(ibctransfertypes.ModuleName)
|
2024-03-07 21:47:46 +00:00
|
|
|
packetforwardSubspace := app.paramsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable())
|
2022-04-21 20:16:28 +00:00
|
|
|
feemarketSubspace := app.paramsKeeper.Subspace(feemarkettypes.ModuleName)
|
|
|
|
evmSubspace := app.paramsKeeper.Subspace(evmtypes.ModuleName)
|
2022-08-23 17:04:40 +00:00
|
|
|
evmutilSubspace := app.paramsKeeper.Subspace(evmutiltypes.ModuleName)
|
2023-01-26 16:50:27 +00:00
|
|
|
mintSubspace := app.paramsKeeper.Subspace(minttypes.ModuleName)
|
2022-01-08 00:39:27 +00:00
|
|
|
|
2024-02-06 22:54:10 +00:00
|
|
|
// set the BaseApp's parameter store
|
|
|
|
app.consensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[consensusparamtypes.StoreKey], govAuthAddrStr)
|
|
|
|
bApp.SetParamStore(&app.consensusParamsKeeper)
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
app.capabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey])
|
2024-02-06 22:54:10 +00:00
|
|
|
scopedIBCKeeper := app.capabilityKeeper.ScopeToModule(ibcexported.ModuleName)
|
2022-01-08 00:39:27 +00:00
|
|
|
scopedTransferKeeper := app.capabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
|
|
|
|
app.capabilityKeeper.Seal()
|
2019-07-18 17:36:31 +00:00
|
|
|
|
|
|
|
// add keepers
|
2022-01-08 00:39:27 +00:00
|
|
|
app.accountKeeper = authkeeper.NewAccountKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[authtypes.StoreKey],
|
2022-06-06 17:04:13 +00:00
|
|
|
authtypes.ProtoBaseAccount,
|
2022-01-08 00:39:27 +00:00
|
|
|
mAccPerms,
|
2023-04-04 00:08:45 +00:00
|
|
|
sdk.GetConfig().GetBech32AccountAddrPrefix(),
|
2024-02-06 22:54:10 +00:00
|
|
|
govAuthAddrStr,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.bankKeeper = bankkeeper.NewBaseKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[banktypes.StoreKey],
|
2019-06-20 13:37:57 +00:00
|
|
|
app.accountKeeper,
|
2022-01-08 00:39:27 +00:00
|
|
|
app.loadBlockedMaccAddrs(),
|
2024-02-06 22:54:10 +00:00
|
|
|
govAuthAddrStr,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2024-06-16 15:18:18 +00:00
|
|
|
app.vestingKeeper = vestingkeeper.NewVestingKeeper(app.accountKeeper, app.bankKeeper, keys[vestingtypes.StoreKey])
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
app.stakingKeeper = stakingkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[stakingtypes.StoreKey],
|
2019-07-18 17:36:31 +00:00
|
|
|
app.accountKeeper,
|
|
|
|
app.bankKeeper,
|
2024-06-16 15:18:18 +00:00
|
|
|
app.vestingKeeper,
|
2024-08-02 10:34:24 +00:00
|
|
|
govAuthAddrStr,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-04-25 13:48:40 +00:00
|
|
|
app.authzKeeper = authzkeeper.NewKeeper(
|
|
|
|
keys[authzkeeper.StoreKey],
|
|
|
|
appCodec,
|
|
|
|
app.BaseApp.MsgServiceRouter(),
|
2023-04-04 00:08:45 +00:00
|
|
|
app.accountKeeper,
|
2022-04-25 13:48:40 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.distrKeeper = distrkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[distrtypes.StoreKey],
|
|
|
|
app.accountKeeper,
|
|
|
|
app.bankKeeper,
|
2024-02-06 22:54:10 +00:00
|
|
|
app.stakingKeeper,
|
2022-01-08 00:39:27 +00:00
|
|
|
authtypes.FeeCollectorName,
|
2024-02-06 22:54:10 +00:00
|
|
|
govAuthAddrStr,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.slashingKeeper = slashingkeeper.NewKeeper(
|
|
|
|
appCodec,
|
2024-02-06 22:54:10 +00:00
|
|
|
app.legacyAmino,
|
2022-01-08 00:39:27 +00:00
|
|
|
keys[slashingtypes.StoreKey],
|
2024-02-06 22:54:10 +00:00
|
|
|
app.stakingKeeper,
|
|
|
|
govAuthAddrStr,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2024-02-06 22:54:10 +00:00
|
|
|
app.crisisKeeper = *crisiskeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[crisistypes.StoreKey],
|
2022-01-08 00:39:27 +00:00
|
|
|
options.InvariantCheckPeriod,
|
|
|
|
app.bankKeeper,
|
|
|
|
authtypes.FeeCollectorName,
|
2024-02-06 22:54:10 +00:00
|
|
|
govAuthAddrStr,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2024-02-06 22:54:10 +00:00
|
|
|
app.upgradeKeeper = *upgradekeeper.NewKeeper(
|
2022-01-08 00:39:27 +00:00
|
|
|
options.SkipUpgradeHeights,
|
|
|
|
keys[upgradetypes.StoreKey],
|
|
|
|
appCodec,
|
|
|
|
homePath,
|
|
|
|
app.BaseApp,
|
2024-02-06 22:54:10 +00:00
|
|
|
govAuthAddrStr,
|
2020-05-07 20:34:05 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.evidenceKeeper = *evidencekeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[evidencetypes.StoreKey],
|
2024-02-06 22:54:10 +00:00
|
|
|
app.stakingKeeper,
|
2020-04-23 16:35:58 +00:00
|
|
|
app.slashingKeeper,
|
|
|
|
)
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
app.ibcKeeper = ibckeeper.NewKeeper(
|
|
|
|
appCodec,
|
2024-02-06 22:54:10 +00:00
|
|
|
keys[ibcexported.StoreKey],
|
2022-01-08 00:39:27 +00:00
|
|
|
ibcSubspace,
|
|
|
|
app.stakingKeeper,
|
|
|
|
app.upgradeKeeper,
|
|
|
|
scopedIBCKeeper,
|
2021-06-02 17:03:25 +00:00
|
|
|
)
|
2020-04-27 14:55:20 +00:00
|
|
|
|
2022-04-21 20:16:28 +00:00
|
|
|
// Create Ethermint keepers
|
|
|
|
app.feeMarketKeeper = feemarketkeeper.NewKeeper(
|
2023-04-04 00:08:45 +00:00
|
|
|
appCodec,
|
2024-02-06 22:54:10 +00:00
|
|
|
govAuthAddr,
|
2023-04-04 00:08:45 +00:00
|
|
|
keys[feemarkettypes.StoreKey],
|
|
|
|
tkeys[feemarkettypes.TransientKey],
|
|
|
|
feemarketSubspace,
|
2022-04-21 20:16:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
app.evmutilKeeper = evmutilkeeper.NewKeeper(
|
|
|
|
app.appCodec,
|
|
|
|
keys[evmutiltypes.StoreKey],
|
2022-08-23 17:04:40 +00:00
|
|
|
evmutilSubspace,
|
|
|
|
app.bankKeeper,
|
|
|
|
app.accountKeeper,
|
2022-04-21 20:16:28 +00:00
|
|
|
)
|
|
|
|
|
2024-05-10 16:30:28 +00:00
|
|
|
app.precisebankKeeper = precisebankkeeper.NewKeeper(
|
|
|
|
app.appCodec,
|
|
|
|
keys[precisebanktypes.StoreKey],
|
2024-05-21 21:11:13 +00:00
|
|
|
app.bankKeeper,
|
|
|
|
app.accountKeeper,
|
2024-05-10 16:30:28 +00:00
|
|
|
)
|
|
|
|
|
2022-04-21 20:16:28 +00:00
|
|
|
app.evmKeeper = evmkeeper.NewKeeper(
|
2023-04-04 00:08:45 +00:00
|
|
|
appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey],
|
2024-02-06 22:54:10 +00:00
|
|
|
govAuthAddr,
|
2024-07-10 21:20:12 +00:00
|
|
|
app.accountKeeper,
|
|
|
|
app.precisebankKeeper, // x/precisebank in place of x/bank
|
|
|
|
app.stakingKeeper,
|
|
|
|
app.feeMarketKeeper,
|
2024-07-11 13:23:31 +00:00
|
|
|
vm.NewEVM,
|
2022-04-21 20:16:28 +00:00
|
|
|
options.EVMTrace,
|
2023-04-04 00:08:45 +00:00
|
|
|
evmSubspace,
|
2024-05-09 18:54:47 +00:00
|
|
|
precompiles,
|
2022-04-21 20:16:28 +00:00
|
|
|
)
|
2024-05-09 18:54:47 +00:00
|
|
|
// dasigners keeper
|
|
|
|
app.dasignersKeeper = dasignerskeeper.NewKeeper(keys[dasignerstypes.StoreKey], appCodec, app.stakingKeeper)
|
|
|
|
// precopmiles
|
|
|
|
precompiles := make(map[common.Address]vm.PrecompiledContract)
|
|
|
|
daSignersPrecompile, err := dasignersprecompile.NewDASignersPrecompile(app.dasignersKeeper)
|
|
|
|
if err != nil {
|
|
|
|
panic("initialize precompile failed")
|
|
|
|
}
|
|
|
|
precompiles[daSignersPrecompile.Address()] = daSignersPrecompile
|
2022-04-21 20:16:28 +00:00
|
|
|
|
2022-08-23 17:04:40 +00:00
|
|
|
app.evmutilKeeper.SetEvmKeeper(app.evmKeeper)
|
|
|
|
|
2024-03-07 21:47:46 +00:00
|
|
|
// It's important to note that the PFM Keeper must be initialized before the Transfer Keeper
|
|
|
|
app.packetForwardKeeper = packetforwardkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[packetforwardtypes.StoreKey],
|
|
|
|
nil, // will be zero-value here, reference is set later on with SetTransferKeeper.
|
|
|
|
app.ibcKeeper.ChannelKeeper,
|
|
|
|
app.distrKeeper,
|
|
|
|
app.bankKeeper,
|
|
|
|
app.ibcKeeper.ChannelKeeper,
|
|
|
|
govAuthAddrStr,
|
|
|
|
)
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
app.transferKeeper = ibctransferkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[ibctransfertypes.StoreKey],
|
|
|
|
ibctransferSubspace,
|
2024-03-07 21:47:46 +00:00
|
|
|
app.packetForwardKeeper,
|
2022-04-21 20:16:28 +00:00
|
|
|
app.ibcKeeper.ChannelKeeper,
|
2022-01-08 00:39:27 +00:00
|
|
|
&app.ibcKeeper.PortKeeper,
|
2019-10-02 13:10:28 +00:00
|
|
|
app.accountKeeper,
|
|
|
|
app.bankKeeper,
|
2022-01-08 00:39:27 +00:00
|
|
|
scopedTransferKeeper,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2024-03-07 21:47:46 +00:00
|
|
|
app.packetForwardKeeper.SetTransferKeeper(app.transferKeeper)
|
2022-01-08 00:39:27 +00:00
|
|
|
transferModule := transfer.NewAppModule(app.transferKeeper)
|
2024-03-07 21:47:46 +00:00
|
|
|
|
|
|
|
// allow ibc packet forwarding for ibc transfers.
|
|
|
|
// transfer stack contains (from top to bottom):
|
|
|
|
// - Packet Forward Middleware
|
|
|
|
// - Transfer
|
|
|
|
var transferStack ibcporttypes.IBCModule
|
|
|
|
transferStack = transfer.NewIBCModule(app.transferKeeper)
|
|
|
|
transferStack = packetforward.NewIBCMiddleware(
|
|
|
|
transferStack,
|
|
|
|
app.packetForwardKeeper,
|
|
|
|
0, // retries on timeout
|
|
|
|
packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp,
|
|
|
|
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
|
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
|
|
|
|
// Create static IBC router, add transfer route, then set and seal it
|
2024-03-07 21:47:46 +00:00
|
|
|
ibcRouter := ibcporttypes.NewRouter()
|
|
|
|
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.ibcKeeper.SetRouter(ibcRouter)
|
|
|
|
|
|
|
|
app.issuanceKeeper = issuancekeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[issuancetypes.StoreKey],
|
|
|
|
issuanceSubspace,
|
[R4R] Testnet-5k proposal (#404)
* R4R: BEP3 module (#370)
* bep3 module scaffold from cosmos/scaffold
* Populated types, keeper with HTLT msgs, module params, and scaffolding for keys, and genesis
* added KavaHTLT struct, UpdateHTLT struct, resolved compilation errors
* refactored kavaHTLT struct <-> msgs
* Implemented params, refactored UpdateKavaHTLT to UpdateKHTLT interface
* Updated keeper with byTimeIndex methods
* HTLT creation flow
* adjustments in prep for repo config updates
* App moudle updated for bep3, MsgCreateHTLT tested, HTLT keeper methods tested
* Updated bep3 params to match spec
* tests for MsgRefundHTLT, MsgDepositHTLT, MsgClaimHTLT
* AddHtlt cli cmd, queryHtlts cmd, added conversion funcs for binance -> cosmos types, refactored MsgCreateHTLT from binance.AccAddress to sdk.AccAddress
* working edits related to bep3-deputy compatibility
* removed binance-chain go sdk dependency
* updated msg ValidateBasic() return to sdk.Error type
* implement MsgCalculateSwapID
* added MsgCalculateSwapID test, updated randomNumberHash type to []byte
* removed binance type conversions
* msg codec registration
* clean /types directory
* CLI cmds:create htlt, query htlt
* update keeper logic
* handle MsgCreateHTLT
* implement htlt type, msg types
* implement global chain types
* update querier
* added go-ethereum to go mod
* refactor QuerySwap to QueryHTLT
* update HTLTMsg to MsgCreateHTLT
* implemented htlt deposit
* add token transfer to MsgCreateHTLT
* implement refund, claim client txs
* add refund/claim cmds to tx cmd
* commiting go.sum for build
* implemented keeper claim logic
* add RandomNumberHash to create-htlt event
* implement refund keeper logic
* AddHTLT updated to CreateHTLT
* added params keeper
* updated params to single chain, added sample genesis file
* implemented htlt keeper param checks
* removed go-ethereum dependency
* updated go.sum
* housekeeping on keeper tests
* updated cli tx cmds
* ran go.tidy
* remove links from module readme
* updated coin construction in tests
* added expectedIncome checks in ValidateBasic()
* made ValidateAsset() more robust
* update param format for tests
* added basic HTLTByTime index
* implement abci, fix expectedIncome validation
* byTime index updated to blocks, added swap ID & expiration block to htlt
* added not-expired check to HTLT claims
* cross-chain mint/burn logic, htlt string type refactored to []byte
* fix bnb_deputy_address param
* remove abci panic
* cmn.HexBytes, byTime index iteration update, claim-mint logic update
* update genesis example
* general codebase cleaning
* renamed HTLT to AtomicSwap
* staging for PR
* updated naming conventions
* refactor + revisions
* removed code related to deposits & swap block index
* added timestamp validation comment
* post-refactor housekeeping
* post refactor housekeeping (keeper)
* remove GenesisAtomicSwap type
* refactor asset supply logic
* BeginBlocker expires swaps automatically
* param asset.limit type updated to sdk.Int
* remove claimed swaps from block index
* fix DefaultDeputyAddress
* removed BaseSwap
* revisions
* total genesis coins
* updated tx examples
* Automatically update fees for risky cdps (#381)
* wip: sketch implementation
* adding initial function to calcuate risky fees for cdps
* adding todo comment to fix the function arguments
* changing the function arguments
* adding multiplication, print error, change types
* get the number of periods, add comments and questios for code review
* adding specification notes
* removing old comment
* replace collateral with collateral denom
* remove todo and clarify comment
* Update x/cdp/keeper/fees.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/keeper/fees.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update go.sum
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/keeper/fees.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/keeper/fees.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/keeper/fees.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/abci.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* updating fees
* error handling and propogation
* fix collat denom variable
* fix build issues, error, variable names, parameter type
* Update x/cdp/abci.go
Use `err` as name instead of `e`
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/keeper/fees.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* fixing error variable name
* changing call to method to compute risky cdps fees
* changing the calcualation to select risky cdps to be based on normalized ratio
* adding skeleton for test methods, adding skeleton helper function for creating cdps for use in tests
* fixing function call to helper method
* fix assignment, calling function that returns two variables instead of one
* adding comment and fixing call to create cdps
* adding create cdps function and updating / fixing the test. one of the expected tests is failing, need to figure out why that is. added a todo question to note it
* logging the cdp object before and after updating. it seems that the fees are not set / written before or after
* adding interim changed
* updated
* fixing normalized ratio
* code cleanup
* changing print of accumulated fees
* removing debug code
* remove completed todo
* remove old variable
* remove spewing print statement
* remove dead todo
* adding note about prices for future
* remove dead code
* try to fix test
* fix types
* fix types
* fix context in call
* changing back as new version breaks a test
* fix
* cleanup, removing logging and old code
* remove dead code
* removing changes to cdp test
* Update x/cdp/keeper/fees.go
Remove old comment as suggested
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/spec/04_begin_block.md
Fix typo as suggested
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
* Add Savings Rate (#365)
* fix: ensure cdp module accounts created at gensis
* feat: add savings rate
* chore: update alias
* fix: update default test param values
* chore: update spec for savings rate
* fix: add distribution time to genesis state
* fix: iterate over accounts using callback function
* feat: use seprate mod account for savings rate
* fix: remove mod account coins from total supply
* address review comments
* fix: genesis function initialization
* fix: update alias
* add comment about maintaining module account list
* feat: add genesis example
* R4R: bep3 module upgrades (#388)
* bep3 module scaffold from cosmos/scaffold
* Populated types, keeper with HTLT msgs, module params, and scaffolding for keys, and genesis
* added KavaHTLT struct, UpdateHTLT struct, resolved compilation errors
* refactored kavaHTLT struct <-> msgs
* Implemented params, refactored UpdateKavaHTLT to UpdateKHTLT interface
* Updated keeper with byTimeIndex methods
* HTLT creation flow
* adjustments in prep for repo config updates
* App moudle updated for bep3, MsgCreateHTLT tested, HTLT keeper methods tested
* Updated bep3 params to match spec
* tests for MsgRefundHTLT, MsgDepositHTLT, MsgClaimHTLT
* AddHtlt cli cmd, queryHtlts cmd, added conversion funcs for binance -> cosmos types, refactored MsgCreateHTLT from binance.AccAddress to sdk.AccAddress
* working edits related to bep3-deputy compatibility
* removed binance-chain go sdk dependency
* updated msg ValidateBasic() return to sdk.Error type
* implement MsgCalculateSwapID
* added MsgCalculateSwapID test, updated randomNumberHash type to []byte
* removed binance type conversions
* msg codec registration
* clean /types directory
* CLI cmds:create htlt, query htlt
* update keeper logic
* handle MsgCreateHTLT
* implement htlt type, msg types
* implement global chain types
* update querier
* added go-ethereum to go mod
* refactor QuerySwap to QueryHTLT
* update HTLTMsg to MsgCreateHTLT
* implemented htlt deposit
* add token transfer to MsgCreateHTLT
* implement refund, claim client txs
* add refund/claim cmds to tx cmd
* commiting go.sum for build
* implemented keeper claim logic
* add RandomNumberHash to create-htlt event
* implement refund keeper logic
* AddHTLT updated to CreateHTLT
* added params keeper
* updated params to single chain, added sample genesis file
* implemented htlt keeper param checks
* removed go-ethereum dependency
* updated go.sum
* housekeeping on keeper tests
* updated cli tx cmds
* ran go.tidy
* remove links from module readme
* updated coin construction in tests
* added expectedIncome checks in ValidateBasic()
* made ValidateAsset() more robust
* update param format for tests
* added basic HTLTByTime index
* implement abci, fix expectedIncome validation
* byTime index updated to blocks, added swap ID & expiration block to htlt
* added not-expired check to HTLT claims
* cross-chain mint/burn logic, htlt string type refactored to []byte
* fix bnb_deputy_address param
* remove abci panic
* cmn.HexBytes, byTime index iteration update, claim-mint logic update
* update genesis example
* general codebase cleaning
* renamed HTLT to AtomicSwap
* staging for PR
* updated naming conventions
* refactor + revisions
* removed code related to deposits & swap block index
* added timestamp validation comment
* post-refactor housekeeping
* post refactor housekeeping (keeper)
* remove GenesisAtomicSwap type
* refactor asset supply logic
* BeginBlocker expires swaps automatically
* param asset.limit type updated to sdk.Int
* remove claimed swaps from block index
* fix DefaultDeputyAddress
* removed BaseSwap
* revisions
* total genesis coins
* updated tx examples
* timestamp to unix
* add past timestamp limit
* update random number byte encoding
* add recipient_other_chain to AtomicSwap
* add TODO for timestamp arg parsing
* generate secure random numbers
* update tx cli
* keeper tests
* add bnb token
* bep3 params test set up, test CreateAtomicSwap
* swap table tests
* Revert "bep3 params test set up, test CreateAtomicSwap"
This reverts commits containing tests.
* use tmtime.Now()
* Kava distribution module (#387)
* wip: kavadist module structure
* feat: implement minting logic
* wip: sketch module
* wip: module level code
* wip: bug fixes
* wip: add tests
* wip: resolve todos and tidy
* fix: remove unused file
* address review comments
* fix: update genesis for guide (#394)
* add kava_dist to sample genesis file (#396)
* R4R: BEP3 module test suite (#395)
* refactor secure rng
* refactor common tests, implement keeper tests
* implement asset tests
* implement params, querier tests
* implement keeper swap tests
* refactor import naming conventions
* implement core types tests
* improve keeper swap tests
* implement genesis types test
* implement params test + revisions
* implement duplicate swap test
* implement duplicate swap ID test
* R4R: BEP3 additional features + module test suite (#397)
* update and reorder errors
* implement swap deletion block delay
* add swap deletion block delay, set up tests
* add secure random number gen
* implement AtomicSwapLongtermStorage index
* fix syntax error
* abci test updates
* implement handler test
* implement core genesis tests
* update asset supply logic
* implement functional asset supply
* pretty print atomic swaps
* requested revisions
* fix test suite post merge
* implement and integrate asset supply tests
* update import genesis, add storage duration param
* implement swap deletion ABCI test
* go mod tidy
* remove duplicated interface assertion
* add new bep3 param to contrib genesis file
* remove btc from supported assets
* revisions: LongtermStorageDuration param
* revisions: suite ctx, fix genesis, update contrib
* implement AssetSupply type, store key, keeper
* integrate supply and swaps; genesis, tests
* remove legacy comments
* requested revisions
* update alias
* Swagger Rest Automating Testing With Dredd (#390)
* swagger testing and mods
* fixed a test
* fixed withdraw address
* adding script to start the chain
* fixed val rewards test
* fix outstanding rewards test
* fixed rewards
* hooks skeleton
* adding test file and hooks
* updates on the hooks working
* now creates a transaction and sends to the chain via rest api successfully
* small fix - now works
* 34 tests now passing successfully
* fix print statement error
* instructions on how to run the tests
* changing function names when to run the hooks
* adding instructions on how to setup and run the dredd tests
* removing large error output file
* removing binary file
* removing more output logging files
* creating a vote on a proposal to send to the blockchain
* adding instructions on how to setup chain
* adding function to get account number and sequence number
* adding send msg to blockchain method
* posting vote tx to blockchain - successfully prepares and sends vote to endpoint but endpoint returns 'inactive proposal with id'
* successfully depositing 600 stake to a proposal
* successfully depositing onto a proposal and then voting on it
* got another governance test working now after submitting a vote to the blockchain
* updating instructions on how to run
* fixed another voting test
* fixed deposits test
* fixed another gov test
* fix print line
* fix circle ci build issue with println
* improving instructions on how to build and run the hooks and dredd tests
* improving instructions on how to build and run the hooks and dredd tests
* finally fixed param change governance proposal test
* trying to unskip tests wip
* fixed gov/proposals test
* fixed another test
* fixed a slashing test
* fixed another redelegation test
* fixed another unbonding delegation test
* fixed more staking tests
* fixed another staking test
* fixed another test
* fixed more tests. 50 now passing, 15 failing
* fixed mislabeled variable
* managed to fix unjail test
* fixed bank acct transfers test
* change certain types from number to string to match the output, typo fix
* another typo fix
* fixed delegation test
* finally figured out and fixed the latest blocks types mismatch - fixed the test
* fixed staking delegators validators test
* removed and noted unimplemented tests from yaml file. fixed blocks height test
* fixed transcations test
* adding functionality to send transfer of coins to blockchain, and to send delegations
* updating the yaml to line up with a valid message format
* added delegation method
* adding test results showing 57 are now passing and only 5 failing
* remove test yaml file from pull req
* testing file updates
* adding test memo
* added undelegation hook method - fixed unbonding delegation test
* fixed the get tx from hash test
* adding not if you encounter validator set is different errors how to fix. 59 tests now passsing, 3 failing
* adding test results showing 59 passing, 3 failing
* finally fixed encode test - 60 tests now passing only 2 failing
* adding test results 60 passing 1 failing
* more test updates
* finally fixed decode test - 61 tests now passing only 1 failing
* test results 61 tests passing 1 failing
* remove dead code
* all 62 tests are now passingga swagger.yaml 0 failing
* used for testing and generating transactions and testing hooks
* updating run instructions
* more instructions updates
* updating the test file
* adding note on reading from a file
* refactoring code and cleanup
* refactoring getting the keybase
* code cleanup for address, keyname methods, remove unused code
* more code cleanup around addresses
* updating the instructions on how to run the dredd tests
* adding comment
* adding additional requirements to the go.mod dependency file
* remove hardcoded home directory, read using os golang library
* increase timeout in example run script
* remove hardcoded home directory
* reordering commands to get rid of errors if key directory is deleted
* changing to use temporary directory
* updating dredd timeout time
* finally managed to get the script wroking using a temporary directory instead of the default
* adding notes and comments
* changing to use a temp directory instead of default directory
* remove un-needed file
* rename debugging tools folder
* adding instructions to install dredd and npm
* Update swagger-ui/startchain.sh
Send output to dev null not to console
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update swagger-ui/startchain.sh
Send output to dev null not to console
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* adding new version of test.go to setup the chain
* adding todo to update instructions for new workflow
* updating script to start and setup the chain
* updating the transaction hash test
* update the start chain script to setup the chain correctly
* add the script to stop the chain and the rest server
* updated the instructions for the new workflow so that all the tests pass the first time
* updated the instructions on how to run the tests
* update instructions for printing logs or not
* updating the startchain script to add messages when starting the rest server and preparing transactions
* adding print messages when stop chain is completed
* updating test results to just include test output and not the debug log statements
* cleaning up the messages that are printed to the user
* moving files to their own directory
* build go test file and remove previous binary
* move instructions
* updating instructions now that test file is auto built
* building, running dredd tests, propagating error code, shut down blockchain all in one script
* fix object type to array type for block latests
* cleaning up the script
* rename script as it now does all the setup, test running, shutdown, and cleanup
* update instructions for new workflow
* adding a shell script to call from the makefile
* adding a make command to build and run all the dredd tests
* update instructions to run using make
* updated code review comment
* minor update to instructions
* update remove file command so doesn't print an error if the file has already been deleted
* renaming folder and test
* adjust code comment
* removing example test results
* updating instructions to remove reference to the test results
* remove old hooks file
* remove obsolete code comment
* remove swagger file, will change references to the other one
* remove shell script, will now use the one called from make instead
* renaming as underscore messes up go build
* clean up script, fix return code issues
* cleanup output file
* fix object to array issue
* add comments to explain functionality
* use variables for kvd home and kvcli home, check for errors
* change the kvcli home directory. need to take this from command line
* take kvcli from command line parameter to golang file
* take kvcli directory from command line parameter
Co-authored-by: John Maheswaran <john@kava.io>
Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
* R4R: Update BEP3 rest endpoints + format example requests (#402)
* update and reorder errors
* implement swap deletion block delay
* add swap deletion block delay, set up tests
* add secure random number gen
* implement AtomicSwapLongtermStorage index
* fix syntax error
* abci test updates
* implement handler test
* implement core genesis tests
* update asset supply logic
* implement functional asset supply
* pretty print atomic swaps
* requested revisions
* fix test suite post merge
* implement and integrate asset supply tests
* update import genesis, add storage duration param
* implement swap deletion ABCI test
* go mod tidy
* remove duplicated interface assertion
* add new bep3 param to contrib genesis file
* remove btc from supported assets
* revisions: LongtermStorageDuration param
* revisions: suite ctx, fix genesis, update contrib
* implement AssetSupply type, store key, keeper
* integrate supply and swaps; genesis, tests
* remove legacy comments
* requested revisions
* update alias
* rest queries
* implement BEP3 REST txs
* draft rest server readme + example json files
* tested all swap rest examples
* implement query swaps rest endpoint
* feat: update genesis examples
* fix: use post instead of put (#405)
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: John Maheswaran <jmaheswaran@users.noreply.github.com>
Co-authored-by: John Maheswaran <john@kava.io>
2020-03-28 02:54:00 +00:00
|
|
|
app.accountKeeper,
|
2022-01-08 00:39:27 +00:00
|
|
|
app.bankKeeper,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.bep3Keeper = bep3keeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[bep3types.StoreKey],
|
|
|
|
app.bankKeeper,
|
2020-05-06 17:56:43 +00:00
|
|
|
app.accountKeeper,
|
[R4R] Testnet-5k proposal (#404)
* R4R: BEP3 module (#370)
* bep3 module scaffold from cosmos/scaffold
* Populated types, keeper with HTLT msgs, module params, and scaffolding for keys, and genesis
* added KavaHTLT struct, UpdateHTLT struct, resolved compilation errors
* refactored kavaHTLT struct <-> msgs
* Implemented params, refactored UpdateKavaHTLT to UpdateKHTLT interface
* Updated keeper with byTimeIndex methods
* HTLT creation flow
* adjustments in prep for repo config updates
* App moudle updated for bep3, MsgCreateHTLT tested, HTLT keeper methods tested
* Updated bep3 params to match spec
* tests for MsgRefundHTLT, MsgDepositHTLT, MsgClaimHTLT
* AddHtlt cli cmd, queryHtlts cmd, added conversion funcs for binance -> cosmos types, refactored MsgCreateHTLT from binance.AccAddress to sdk.AccAddress
* working edits related to bep3-deputy compatibility
* removed binance-chain go sdk dependency
* updated msg ValidateBasic() return to sdk.Error type
* implement MsgCalculateSwapID
* added MsgCalculateSwapID test, updated randomNumberHash type to []byte
* removed binance type conversions
* msg codec registration
* clean /types directory
* CLI cmds:create htlt, query htlt
* update keeper logic
* handle MsgCreateHTLT
* implement htlt type, msg types
* implement global chain types
* update querier
* added go-ethereum to go mod
* refactor QuerySwap to QueryHTLT
* update HTLTMsg to MsgCreateHTLT
* implemented htlt deposit
* add token transfer to MsgCreateHTLT
* implement refund, claim client txs
* add refund/claim cmds to tx cmd
* commiting go.sum for build
* implemented keeper claim logic
* add RandomNumberHash to create-htlt event
* implement refund keeper logic
* AddHTLT updated to CreateHTLT
* added params keeper
* updated params to single chain, added sample genesis file
* implemented htlt keeper param checks
* removed go-ethereum dependency
* updated go.sum
* housekeeping on keeper tests
* updated cli tx cmds
* ran go.tidy
* remove links from module readme
* updated coin construction in tests
* added expectedIncome checks in ValidateBasic()
* made ValidateAsset() more robust
* update param format for tests
* added basic HTLTByTime index
* implement abci, fix expectedIncome validation
* byTime index updated to blocks, added swap ID & expiration block to htlt
* added not-expired check to HTLT claims
* cross-chain mint/burn logic, htlt string type refactored to []byte
* fix bnb_deputy_address param
* remove abci panic
* cmn.HexBytes, byTime index iteration update, claim-mint logic update
* update genesis example
* general codebase cleaning
* renamed HTLT to AtomicSwap
* staging for PR
* updated naming conventions
* refactor + revisions
* removed code related to deposits & swap block index
* added timestamp validation comment
* post-refactor housekeeping
* post refactor housekeeping (keeper)
* remove GenesisAtomicSwap type
* refactor asset supply logic
* BeginBlocker expires swaps automatically
* param asset.limit type updated to sdk.Int
* remove claimed swaps from block index
* fix DefaultDeputyAddress
* removed BaseSwap
* revisions
* total genesis coins
* updated tx examples
* Automatically update fees for risky cdps (#381)
* wip: sketch implementation
* adding initial function to calcuate risky fees for cdps
* adding todo comment to fix the function arguments
* changing the function arguments
* adding multiplication, print error, change types
* get the number of periods, add comments and questios for code review
* adding specification notes
* removing old comment
* replace collateral with collateral denom
* remove todo and clarify comment
* Update x/cdp/keeper/fees.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/keeper/fees.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update go.sum
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/keeper/fees.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/keeper/fees.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/keeper/fees.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/abci.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* updating fees
* error handling and propogation
* fix collat denom variable
* fix build issues, error, variable names, parameter type
* Update x/cdp/abci.go
Use `err` as name instead of `e`
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/keeper/fees.go
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* fixing error variable name
* changing call to method to compute risky cdps fees
* changing the calcualation to select risky cdps to be based on normalized ratio
* adding skeleton for test methods, adding skeleton helper function for creating cdps for use in tests
* fixing function call to helper method
* fix assignment, calling function that returns two variables instead of one
* adding comment and fixing call to create cdps
* adding create cdps function and updating / fixing the test. one of the expected tests is failing, need to figure out why that is. added a todo question to note it
* logging the cdp object before and after updating. it seems that the fees are not set / written before or after
* adding interim changed
* updated
* fixing normalized ratio
* code cleanup
* changing print of accumulated fees
* removing debug code
* remove completed todo
* remove old variable
* remove spewing print statement
* remove dead todo
* adding note about prices for future
* remove dead code
* try to fix test
* fix types
* fix types
* fix context in call
* changing back as new version breaks a test
* fix
* cleanup, removing logging and old code
* remove dead code
* removing changes to cdp test
* Update x/cdp/keeper/fees.go
Remove old comment as suggested
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update x/cdp/spec/04_begin_block.md
Fix typo as suggested
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
* Add Savings Rate (#365)
* fix: ensure cdp module accounts created at gensis
* feat: add savings rate
* chore: update alias
* fix: update default test param values
* chore: update spec for savings rate
* fix: add distribution time to genesis state
* fix: iterate over accounts using callback function
* feat: use seprate mod account for savings rate
* fix: remove mod account coins from total supply
* address review comments
* fix: genesis function initialization
* fix: update alias
* add comment about maintaining module account list
* feat: add genesis example
* R4R: bep3 module upgrades (#388)
* bep3 module scaffold from cosmos/scaffold
* Populated types, keeper with HTLT msgs, module params, and scaffolding for keys, and genesis
* added KavaHTLT struct, UpdateHTLT struct, resolved compilation errors
* refactored kavaHTLT struct <-> msgs
* Implemented params, refactored UpdateKavaHTLT to UpdateKHTLT interface
* Updated keeper with byTimeIndex methods
* HTLT creation flow
* adjustments in prep for repo config updates
* App moudle updated for bep3, MsgCreateHTLT tested, HTLT keeper methods tested
* Updated bep3 params to match spec
* tests for MsgRefundHTLT, MsgDepositHTLT, MsgClaimHTLT
* AddHtlt cli cmd, queryHtlts cmd, added conversion funcs for binance -> cosmos types, refactored MsgCreateHTLT from binance.AccAddress to sdk.AccAddress
* working edits related to bep3-deputy compatibility
* removed binance-chain go sdk dependency
* updated msg ValidateBasic() return to sdk.Error type
* implement MsgCalculateSwapID
* added MsgCalculateSwapID test, updated randomNumberHash type to []byte
* removed binance type conversions
* msg codec registration
* clean /types directory
* CLI cmds:create htlt, query htlt
* update keeper logic
* handle MsgCreateHTLT
* implement htlt type, msg types
* implement global chain types
* update querier
* added go-ethereum to go mod
* refactor QuerySwap to QueryHTLT
* update HTLTMsg to MsgCreateHTLT
* implemented htlt deposit
* add token transfer to MsgCreateHTLT
* implement refund, claim client txs
* add refund/claim cmds to tx cmd
* commiting go.sum for build
* implemented keeper claim logic
* add RandomNumberHash to create-htlt event
* implement refund keeper logic
* AddHTLT updated to CreateHTLT
* added params keeper
* updated params to single chain, added sample genesis file
* implemented htlt keeper param checks
* removed go-ethereum dependency
* updated go.sum
* housekeeping on keeper tests
* updated cli tx cmds
* ran go.tidy
* remove links from module readme
* updated coin construction in tests
* added expectedIncome checks in ValidateBasic()
* made ValidateAsset() more robust
* update param format for tests
* added basic HTLTByTime index
* implement abci, fix expectedIncome validation
* byTime index updated to blocks, added swap ID & expiration block to htlt
* added not-expired check to HTLT claims
* cross-chain mint/burn logic, htlt string type refactored to []byte
* fix bnb_deputy_address param
* remove abci panic
* cmn.HexBytes, byTime index iteration update, claim-mint logic update
* update genesis example
* general codebase cleaning
* renamed HTLT to AtomicSwap
* staging for PR
* updated naming conventions
* refactor + revisions
* removed code related to deposits & swap block index
* added timestamp validation comment
* post-refactor housekeeping
* post refactor housekeeping (keeper)
* remove GenesisAtomicSwap type
* refactor asset supply logic
* BeginBlocker expires swaps automatically
* param asset.limit type updated to sdk.Int
* remove claimed swaps from block index
* fix DefaultDeputyAddress
* removed BaseSwap
* revisions
* total genesis coins
* updated tx examples
* timestamp to unix
* add past timestamp limit
* update random number byte encoding
* add recipient_other_chain to AtomicSwap
* add TODO for timestamp arg parsing
* generate secure random numbers
* update tx cli
* keeper tests
* add bnb token
* bep3 params test set up, test CreateAtomicSwap
* swap table tests
* Revert "bep3 params test set up, test CreateAtomicSwap"
This reverts commits containing tests.
* use tmtime.Now()
* Kava distribution module (#387)
* wip: kavadist module structure
* feat: implement minting logic
* wip: sketch module
* wip: module level code
* wip: bug fixes
* wip: add tests
* wip: resolve todos and tidy
* fix: remove unused file
* address review comments
* fix: update genesis for guide (#394)
* add kava_dist to sample genesis file (#396)
* R4R: BEP3 module test suite (#395)
* refactor secure rng
* refactor common tests, implement keeper tests
* implement asset tests
* implement params, querier tests
* implement keeper swap tests
* refactor import naming conventions
* implement core types tests
* improve keeper swap tests
* implement genesis types test
* implement params test + revisions
* implement duplicate swap test
* implement duplicate swap ID test
* R4R: BEP3 additional features + module test suite (#397)
* update and reorder errors
* implement swap deletion block delay
* add swap deletion block delay, set up tests
* add secure random number gen
* implement AtomicSwapLongtermStorage index
* fix syntax error
* abci test updates
* implement handler test
* implement core genesis tests
* update asset supply logic
* implement functional asset supply
* pretty print atomic swaps
* requested revisions
* fix test suite post merge
* implement and integrate asset supply tests
* update import genesis, add storage duration param
* implement swap deletion ABCI test
* go mod tidy
* remove duplicated interface assertion
* add new bep3 param to contrib genesis file
* remove btc from supported assets
* revisions: LongtermStorageDuration param
* revisions: suite ctx, fix genesis, update contrib
* implement AssetSupply type, store key, keeper
* integrate supply and swaps; genesis, tests
* remove legacy comments
* requested revisions
* update alias
* Swagger Rest Automating Testing With Dredd (#390)
* swagger testing and mods
* fixed a test
* fixed withdraw address
* adding script to start the chain
* fixed val rewards test
* fix outstanding rewards test
* fixed rewards
* hooks skeleton
* adding test file and hooks
* updates on the hooks working
* now creates a transaction and sends to the chain via rest api successfully
* small fix - now works
* 34 tests now passing successfully
* fix print statement error
* instructions on how to run the tests
* changing function names when to run the hooks
* adding instructions on how to setup and run the dredd tests
* removing large error output file
* removing binary file
* removing more output logging files
* creating a vote on a proposal to send to the blockchain
* adding instructions on how to setup chain
* adding function to get account number and sequence number
* adding send msg to blockchain method
* posting vote tx to blockchain - successfully prepares and sends vote to endpoint but endpoint returns 'inactive proposal with id'
* successfully depositing 600 stake to a proposal
* successfully depositing onto a proposal and then voting on it
* got another governance test working now after submitting a vote to the blockchain
* updating instructions on how to run
* fixed another voting test
* fixed deposits test
* fixed another gov test
* fix print line
* fix circle ci build issue with println
* improving instructions on how to build and run the hooks and dredd tests
* improving instructions on how to build and run the hooks and dredd tests
* finally fixed param change governance proposal test
* trying to unskip tests wip
* fixed gov/proposals test
* fixed another test
* fixed a slashing test
* fixed another redelegation test
* fixed another unbonding delegation test
* fixed more staking tests
* fixed another staking test
* fixed another test
* fixed more tests. 50 now passing, 15 failing
* fixed mislabeled variable
* managed to fix unjail test
* fixed bank acct transfers test
* change certain types from number to string to match the output, typo fix
* another typo fix
* fixed delegation test
* finally figured out and fixed the latest blocks types mismatch - fixed the test
* fixed staking delegators validators test
* removed and noted unimplemented tests from yaml file. fixed blocks height test
* fixed transcations test
* adding functionality to send transfer of coins to blockchain, and to send delegations
* updating the yaml to line up with a valid message format
* added delegation method
* adding test results showing 57 are now passing and only 5 failing
* remove test yaml file from pull req
* testing file updates
* adding test memo
* added undelegation hook method - fixed unbonding delegation test
* fixed the get tx from hash test
* adding not if you encounter validator set is different errors how to fix. 59 tests now passsing, 3 failing
* adding test results showing 59 passing, 3 failing
* finally fixed encode test - 60 tests now passing only 2 failing
* adding test results 60 passing 1 failing
* more test updates
* finally fixed decode test - 61 tests now passing only 1 failing
* test results 61 tests passing 1 failing
* remove dead code
* all 62 tests are now passingga swagger.yaml 0 failing
* used for testing and generating transactions and testing hooks
* updating run instructions
* more instructions updates
* updating the test file
* adding note on reading from a file
* refactoring code and cleanup
* refactoring getting the keybase
* code cleanup for address, keyname methods, remove unused code
* more code cleanup around addresses
* updating the instructions on how to run the dredd tests
* adding comment
* adding additional requirements to the go.mod dependency file
* remove hardcoded home directory, read using os golang library
* increase timeout in example run script
* remove hardcoded home directory
* reordering commands to get rid of errors if key directory is deleted
* changing to use temporary directory
* updating dredd timeout time
* finally managed to get the script wroking using a temporary directory instead of the default
* adding notes and comments
* changing to use a temp directory instead of default directory
* remove un-needed file
* rename debugging tools folder
* adding instructions to install dredd and npm
* Update swagger-ui/startchain.sh
Send output to dev null not to console
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* Update swagger-ui/startchain.sh
Send output to dev null not to console
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* adding new version of test.go to setup the chain
* adding todo to update instructions for new workflow
* updating script to start and setup the chain
* updating the transaction hash test
* update the start chain script to setup the chain correctly
* add the script to stop the chain and the rest server
* updated the instructions for the new workflow so that all the tests pass the first time
* updated the instructions on how to run the tests
* update instructions for printing logs or not
* updating the startchain script to add messages when starting the rest server and preparing transactions
* adding print messages when stop chain is completed
* updating test results to just include test output and not the debug log statements
* cleaning up the messages that are printed to the user
* moving files to their own directory
* build go test file and remove previous binary
* move instructions
* updating instructions now that test file is auto built
* building, running dredd tests, propagating error code, shut down blockchain all in one script
* fix object type to array type for block latests
* cleaning up the script
* rename script as it now does all the setup, test running, shutdown, and cleanup
* update instructions for new workflow
* adding a shell script to call from the makefile
* adding a make command to build and run all the dredd tests
* update instructions to run using make
* updated code review comment
* minor update to instructions
* update remove file command so doesn't print an error if the file has already been deleted
* renaming folder and test
* adjust code comment
* removing example test results
* updating instructions to remove reference to the test results
* remove old hooks file
* remove obsolete code comment
* remove swagger file, will change references to the other one
* remove shell script, will now use the one called from make instead
* renaming as underscore messes up go build
* clean up script, fix return code issues
* cleanup output file
* fix object to array issue
* add comments to explain functionality
* use variables for kvd home and kvcli home, check for errors
* change the kvcli home directory. need to take this from command line
* take kvcli from command line parameter to golang file
* take kvcli directory from command line parameter
Co-authored-by: John Maheswaran <john@kava.io>
Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
* R4R: Update BEP3 rest endpoints + format example requests (#402)
* update and reorder errors
* implement swap deletion block delay
* add swap deletion block delay, set up tests
* add secure random number gen
* implement AtomicSwapLongtermStorage index
* fix syntax error
* abci test updates
* implement handler test
* implement core genesis tests
* update asset supply logic
* implement functional asset supply
* pretty print atomic swaps
* requested revisions
* fix test suite post merge
* implement and integrate asset supply tests
* update import genesis, add storage duration param
* implement swap deletion ABCI test
* go mod tidy
* remove duplicated interface assertion
* add new bep3 param to contrib genesis file
* remove btc from supported assets
* revisions: LongtermStorageDuration param
* revisions: suite ctx, fix genesis, update contrib
* implement AssetSupply type, store key, keeper
* integrate supply and swaps; genesis, tests
* remove legacy comments
* requested revisions
* update alias
* rest queries
* implement BEP3 REST txs
* draft rest server readme + example json files
* tested all swap rest examples
* implement query swaps rest endpoint
* feat: update genesis examples
* fix: use post instead of put (#405)
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: John Maheswaran <jmaheswaran@users.noreply.github.com>
Co-authored-by: John Maheswaran <john@kava.io>
2020-03-28 02:54:00 +00:00
|
|
|
bep3Subspace,
|
2020-05-21 04:50:12 +00:00
|
|
|
app.ModuleAccountAddrs(),
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.pricefeedKeeper = pricefeedkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[pricefeedtypes.StoreKey],
|
|
|
|
pricefeedSubspace,
|
|
|
|
)
|
2022-12-13 00:38:27 +00:00
|
|
|
|
2023-01-26 16:50:27 +00:00
|
|
|
app.mintKeeper = mintkeeper.NewKeeper(
|
2022-12-09 21:24:35 +00:00
|
|
|
appCodec,
|
2023-01-26 16:50:27 +00:00
|
|
|
keys[minttypes.StoreKey],
|
2022-12-09 21:24:35 +00:00
|
|
|
app.stakingKeeper,
|
|
|
|
app.accountKeeper,
|
|
|
|
app.bankKeeper,
|
2023-01-26 16:50:27 +00:00
|
|
|
authtypes.FeeCollectorName,
|
2024-02-06 22:54:10 +00:00
|
|
|
govAuthAddrStr,
|
2022-09-22 18:26:08 +00:00
|
|
|
)
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// create committee keeper with router
|
2023-04-04 00:08:45 +00:00
|
|
|
committeeGovRouter := govv1beta1.NewRouter()
|
2022-01-08 00:39:27 +00:00
|
|
|
committeeGovRouter.
|
2023-04-04 00:08:45 +00:00
|
|
|
AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler).
|
2022-01-08 00:39:27 +00:00
|
|
|
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
|
2024-02-06 22:54:10 +00:00
|
|
|
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(&app.upgradeKeeper))
|
2022-01-08 00:39:27 +00:00
|
|
|
// Note: the committee proposal handler is not registered on the committee router. This means committees cannot create or update other committees.
|
|
|
|
// Adding the committee proposal handler to the router is possible but awkward as the handler depends on the keeper which depends on the handler.
|
|
|
|
app.committeeKeeper = committeekeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[committeetypes.StoreKey],
|
|
|
|
committeeGovRouter,
|
|
|
|
app.paramsKeeper,
|
|
|
|
app.accountKeeper,
|
|
|
|
app.bankKeeper,
|
|
|
|
)
|
2022-09-29 17:01:06 +00:00
|
|
|
|
|
|
|
// register the staking hooks
|
2024-02-06 22:54:10 +00:00
|
|
|
app.stakingKeeper.SetHooks(
|
2023-04-04 00:08:45 +00:00
|
|
|
stakingtypes.NewMultiStakingHooks(
|
|
|
|
app.distrKeeper.Hooks(),
|
|
|
|
app.slashingKeeper.Hooks(),
|
2024-02-06 22:54:10 +00:00
|
|
|
))
|
2022-09-29 17:01:06 +00:00
|
|
|
|
2022-04-22 20:57:33 +00:00
|
|
|
// create gov keeper with router
|
|
|
|
// NOTE this must be done after any keepers referenced in the gov router (ie committee) are defined
|
2023-04-04 00:08:45 +00:00
|
|
|
govRouter := govv1beta1.NewRouter()
|
2022-04-22 20:57:33 +00:00
|
|
|
govRouter.
|
2023-04-04 00:08:45 +00:00
|
|
|
AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler).
|
2022-04-22 20:57:33 +00:00
|
|
|
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
|
2024-02-06 22:54:10 +00:00
|
|
|
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(&app.upgradeKeeper)).
|
2022-04-22 20:57:33 +00:00
|
|
|
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)).
|
|
|
|
AddRoute(committeetypes.RouterKey, committee.NewProposalHandler(app.committeeKeeper))
|
2023-04-04 00:08:45 +00:00
|
|
|
|
|
|
|
govConfig := govtypes.DefaultConfig()
|
2024-02-06 22:54:10 +00:00
|
|
|
govKeeper := govkeeper.NewKeeper(
|
2022-04-22 20:57:33 +00:00
|
|
|
appCodec,
|
|
|
|
keys[govtypes.StoreKey],
|
|
|
|
app.accountKeeper,
|
|
|
|
app.bankKeeper,
|
2024-02-06 22:54:10 +00:00
|
|
|
app.stakingKeeper,
|
2023-04-04 00:08:45 +00:00
|
|
|
app.MsgServiceRouter(),
|
|
|
|
govConfig,
|
2024-02-06 22:54:10 +00:00
|
|
|
govAuthAddrStr,
|
2022-04-22 20:57:33 +00:00
|
|
|
)
|
2024-02-06 22:54:10 +00:00
|
|
|
govKeeper.SetLegacyRouter(govRouter)
|
|
|
|
app.govKeeper = *govKeeper
|
2022-01-08 00:39:27 +00:00
|
|
|
|
2022-09-27 15:49:50 +00:00
|
|
|
// override x/gov tally handler with custom implementation
|
|
|
|
tallyHandler := NewTallyHandler(
|
2024-08-02 10:34:24 +00:00
|
|
|
app.govKeeper, *app.stakingKeeper, app.bankKeeper,
|
2022-09-27 15:49:50 +00:00
|
|
|
)
|
|
|
|
app.govKeeper.SetTallyHandler(tallyHandler)
|
|
|
|
|
2024-05-01 06:08:58 +00:00
|
|
|
app.CouncilKeeper = councilkeeper.NewKeeper(
|
|
|
|
keys[counciltypes.StoreKey], appCodec, app.stakingKeeper,
|
|
|
|
)
|
|
|
|
|
2019-09-11 22:33:20 +00:00
|
|
|
// create the module manager (Note: Any module instantiated in the module manager that is later modified
|
|
|
|
// must be passed by reference here.)
|
2019-07-18 17:36:31 +00:00
|
|
|
app.mm = module.NewManager(
|
2022-01-08 00:39:27 +00:00
|
|
|
genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx, encodingConfig.TxConfig),
|
2024-02-06 22:54:10 +00:00
|
|
|
auth.NewAppModule(appCodec, app.accountKeeper, authsims.RandomGenesisAccounts, authSubspace),
|
|
|
|
bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper, bankSubspace),
|
|
|
|
capability.NewAppModule(appCodec, *app.capabilityKeeper, false), // todo: confirm if this is okay to not be sealed
|
|
|
|
staking.NewAppModule(appCodec, app.stakingKeeper, app.accountKeeper, app.bankKeeper, stakingSubspace),
|
|
|
|
distr.NewAppModule(appCodec, app.distrKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper, distrSubspace),
|
|
|
|
gov.NewAppModule(appCodec, &app.govKeeper, app.accountKeeper, app.bankKeeper, govSubspace),
|
2022-01-08 00:39:27 +00:00
|
|
|
params.NewAppModule(app.paramsKeeper),
|
2024-02-06 22:54:10 +00:00
|
|
|
crisis.NewAppModule(&app.crisisKeeper, options.SkipGenesisInvariants, crisisSubspace),
|
|
|
|
slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper, slashingSubspace),
|
|
|
|
consensus.NewAppModule(appCodec, app.consensusParamsKeeper),
|
2022-01-08 00:39:27 +00:00
|
|
|
ibc.NewAppModule(app.ibcKeeper),
|
2024-03-07 21:47:46 +00:00
|
|
|
packetforward.NewAppModule(app.packetForwardKeeper, packetforwardSubspace),
|
2023-05-04 17:27:04 +00:00
|
|
|
evm.NewAppModule(app.evmKeeper, app.accountKeeper),
|
2023-04-04 00:08:45 +00:00
|
|
|
feemarket.NewAppModule(app.feeMarketKeeper, feemarketSubspace),
|
2024-02-06 22:54:10 +00:00
|
|
|
upgrade.NewAppModule(&app.upgradeKeeper),
|
2020-04-23 16:35:58 +00:00
|
|
|
evidence.NewAppModule(app.evidenceKeeper),
|
2022-01-08 00:39:27 +00:00
|
|
|
transferModule,
|
2024-08-02 10:34:24 +00:00
|
|
|
vesting.NewAppModule(app.accountKeeper, app.bankKeeper, app.vestingKeeper),
|
2022-04-21 20:34:14 +00:00
|
|
|
authzmodule.NewAppModule(appCodec, app.authzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry),
|
2022-01-08 00:39:27 +00:00
|
|
|
issuance.NewAppModule(app.issuanceKeeper, app.accountKeeper, app.bankKeeper),
|
|
|
|
bep3.NewAppModule(app.bep3Keeper, app.accountKeeper, app.bankKeeper),
|
2020-04-23 16:35:58 +00:00
|
|
|
pricefeed.NewAppModule(app.pricefeedKeeper, app.accountKeeper),
|
2022-01-08 00:39:27 +00:00
|
|
|
validatorvesting.NewAppModule(app.bankKeeper),
|
|
|
|
committee.NewAppModule(app.committeeKeeper, app.accountKeeper),
|
2023-07-24 23:00:19 +00:00
|
|
|
evmutil.NewAppModule(app.evmutilKeeper, app.bankKeeper, app.accountKeeper),
|
2023-04-04 00:08:45 +00:00
|
|
|
// nil InflationCalculationFn, use SDK's default inflation function
|
2024-02-06 22:54:10 +00:00
|
|
|
mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper, nil, mintSubspace),
|
2024-05-10 16:30:28 +00:00
|
|
|
precisebank.NewAppModule(app.precisebankKeeper, app.bankKeeper, app.accountKeeper),
|
2019-06-20 13:37:57 +00:00
|
|
|
)
|
|
|
|
|
2022-04-25 13:48:40 +00:00
|
|
|
// Warning: Some begin blockers must run before others. Ensure the dependencies are understood before modifying this list.
|
2020-05-07 20:34:05 +00:00
|
|
|
app.mm.SetOrderBeginBlockers(
|
2022-01-08 00:39:27 +00:00
|
|
|
// Upgrade begin blocker runs migrations on the first block after an upgrade. It should run before any other module.
|
|
|
|
upgradetypes.ModuleName,
|
|
|
|
// Capability begin blocker runs non state changing initialization.
|
|
|
|
capabilitytypes.ModuleName,
|
|
|
|
// Committee begin blocker changes module params by enacting proposals.
|
|
|
|
// Run before to ensure params are updated together before state changes.
|
|
|
|
committeetypes.ModuleName,
|
2023-10-02 20:10:22 +00:00
|
|
|
// Community begin blocker should run before x/mint and x/kavadist since
|
|
|
|
// the disable inflation upgrade will update those modules' params.
|
2023-01-26 16:50:27 +00:00
|
|
|
minttypes.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
distrtypes.ModuleName,
|
|
|
|
// During begin block slashing happens after distr.BeginBlocker so that
|
|
|
|
// there is nothing left over in the validator fee pool, so as to keep the
|
|
|
|
// CanWithdrawInvariant invariant.
|
|
|
|
slashingtypes.ModuleName,
|
|
|
|
evidencetypes.ModuleName,
|
|
|
|
stakingtypes.ModuleName,
|
2022-04-21 20:16:28 +00:00
|
|
|
feemarkettypes.ModuleName,
|
|
|
|
evmtypes.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
// Auction begin blocker will close out expired auctions and pay debt back to cdp.
|
|
|
|
// It should be run before cdp begin blocker which cancels out debt with stable and starts more auctions.
|
|
|
|
bep3types.ModuleName,
|
|
|
|
issuancetypes.ModuleName,
|
2024-02-06 22:54:10 +00:00
|
|
|
ibcexported.ModuleName,
|
2022-04-21 20:16:28 +00:00
|
|
|
// Add all remaining modules with an empty begin blocker below since cosmos 0.45.0 requires it
|
|
|
|
vestingtypes.ModuleName,
|
|
|
|
pricefeedtypes.ModuleName,
|
|
|
|
validatorvestingtypes.ModuleName,
|
2022-04-22 16:01:43 +00:00
|
|
|
authtypes.ModuleName,
|
|
|
|
banktypes.ModuleName,
|
|
|
|
govtypes.ModuleName,
|
|
|
|
crisistypes.ModuleName,
|
|
|
|
genutiltypes.ModuleName,
|
|
|
|
ibctransfertypes.ModuleName,
|
|
|
|
paramstypes.ModuleName,
|
2022-04-25 13:48:40 +00:00
|
|
|
authz.ModuleName,
|
2022-04-22 16:01:43 +00:00
|
|
|
evmutiltypes.ModuleName,
|
2024-02-06 22:54:10 +00:00
|
|
|
consensusparamtypes.ModuleName,
|
2024-03-07 21:47:46 +00:00
|
|
|
packetforwardtypes.ModuleName,
|
2024-05-10 16:30:28 +00:00
|
|
|
precisebanktypes.ModuleName,
|
2020-05-07 20:34:05 +00:00
|
|
|
)
|
2019-07-18 17:36:31 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// Warning: Some end blockers must run before others. Ensure the dependencies are understood before modifying this list.
|
|
|
|
app.mm.SetOrderEndBlockers(
|
|
|
|
crisistypes.ModuleName,
|
|
|
|
govtypes.ModuleName,
|
|
|
|
stakingtypes.ModuleName,
|
2022-04-21 20:16:28 +00:00
|
|
|
evmtypes.ModuleName,
|
|
|
|
// fee market module must go after evm module in order to retrieve the block gas used.
|
|
|
|
feemarkettypes.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
pricefeedtypes.ModuleName,
|
2022-04-21 20:16:28 +00:00
|
|
|
// Add all remaining modules with an empty end blocker below since cosmos 0.45.0 requires it
|
|
|
|
capabilitytypes.ModuleName,
|
|
|
|
issuancetypes.ModuleName,
|
|
|
|
slashingtypes.ModuleName,
|
|
|
|
distrtypes.ModuleName,
|
|
|
|
bep3types.ModuleName,
|
|
|
|
committeetypes.ModuleName,
|
|
|
|
upgradetypes.ModuleName,
|
|
|
|
evidencetypes.ModuleName,
|
|
|
|
vestingtypes.ModuleName,
|
2024-02-06 22:54:10 +00:00
|
|
|
ibcexported.ModuleName,
|
2022-04-21 20:16:28 +00:00
|
|
|
validatorvestingtypes.ModuleName,
|
2022-04-22 16:01:43 +00:00
|
|
|
authtypes.ModuleName,
|
|
|
|
banktypes.ModuleName,
|
|
|
|
genutiltypes.ModuleName,
|
|
|
|
ibctransfertypes.ModuleName,
|
|
|
|
paramstypes.ModuleName,
|
2022-04-25 13:48:40 +00:00
|
|
|
authz.ModuleName,
|
2022-04-22 16:01:43 +00:00
|
|
|
evmutiltypes.ModuleName,
|
2023-01-26 16:50:27 +00:00
|
|
|
minttypes.ModuleName,
|
2024-02-06 22:54:10 +00:00
|
|
|
consensusparamtypes.ModuleName,
|
2024-03-07 21:47:46 +00:00
|
|
|
packetforwardtypes.ModuleName,
|
2024-05-10 16:30:28 +00:00
|
|
|
precisebanktypes.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
)
|
2019-07-18 17:36:31 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// Warning: Some init genesis methods must run before others. Ensure the dependencies are understood before modifying this list
|
2019-09-25 19:50:03 +00:00
|
|
|
app.mm.SetOrderInitGenesis(
|
2022-01-08 00:39:27 +00:00
|
|
|
capabilitytypes.ModuleName, // initialize capabilities, run before any module creating or claiming capabilities in InitGenesis
|
|
|
|
authtypes.ModuleName, // loads all accounts, run before any module with a module account
|
|
|
|
banktypes.ModuleName,
|
|
|
|
distrtypes.ModuleName,
|
|
|
|
stakingtypes.ModuleName,
|
|
|
|
slashingtypes.ModuleName, // iterates over validators, run after staking
|
|
|
|
govtypes.ModuleName,
|
2023-01-26 16:50:27 +00:00
|
|
|
minttypes.ModuleName,
|
2024-02-06 22:54:10 +00:00
|
|
|
ibcexported.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
evidencetypes.ModuleName,
|
2022-04-21 20:34:14 +00:00
|
|
|
authz.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
ibctransfertypes.ModuleName,
|
2022-04-25 13:48:40 +00:00
|
|
|
evmtypes.ModuleName,
|
|
|
|
feemarkettypes.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
issuancetypes.ModuleName,
|
|
|
|
bep3types.ModuleName,
|
|
|
|
pricefeedtypes.ModuleName,
|
|
|
|
committeetypes.ModuleName,
|
2022-04-22 16:01:43 +00:00
|
|
|
evmutiltypes.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
genutiltypes.ModuleName, // runs arbitrary txs included in genisis state, so run after modules have been initialized
|
2022-04-21 20:16:28 +00:00
|
|
|
// Add all remaining modules with an empty InitGenesis below since cosmos 0.45.0 requires it
|
|
|
|
vestingtypes.ModuleName,
|
|
|
|
paramstypes.ModuleName,
|
|
|
|
upgradetypes.ModuleName,
|
|
|
|
validatorvestingtypes.ModuleName,
|
2024-02-06 22:54:10 +00:00
|
|
|
consensusparamtypes.ModuleName,
|
2024-03-07 21:47:46 +00:00
|
|
|
packetforwardtypes.ModuleName,
|
2024-05-10 16:30:28 +00:00
|
|
|
precisebanktypes.ModuleName, // Must be run after x/bank to verify reserve balance
|
|
|
|
crisistypes.ModuleName, // runs the invariants at genesis, should run after other modules
|
2019-09-25 19:50:03 +00:00
|
|
|
)
|
2019-07-18 17:36:31 +00:00
|
|
|
|
|
|
|
app.mm.RegisterInvariants(&app.crisisKeeper)
|
2022-01-08 00:39:27 +00:00
|
|
|
|
|
|
|
app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())
|
2022-12-19 21:50:43 +00:00
|
|
|
app.RegisterServices(app.configurator)
|
2019-07-18 17:36:31 +00:00
|
|
|
|
2022-09-01 20:20:37 +00:00
|
|
|
// RegisterUpgradeHandlers is used for registering any on-chain upgrades.
|
|
|
|
// It needs to be called after `app.mm` and `app.configurator` are set.
|
|
|
|
app.RegisterUpgradeHandlers()
|
|
|
|
|
2019-09-11 22:33:20 +00:00
|
|
|
// create the simulation manager and define the order of the modules for deterministic simulations
|
|
|
|
//
|
|
|
|
// NOTE: This is not required for apps that don't use the simulator for fuzz testing
|
|
|
|
// transactions.
|
2022-01-08 00:39:27 +00:00
|
|
|
// TODO
|
|
|
|
// app.sm = module.NewSimulationManager(
|
|
|
|
// auth.NewAppModule(app.accountKeeper),
|
|
|
|
// bank.NewAppModule(app.bankKeeper, app.accountKeeper),
|
|
|
|
// gov.NewAppModule(app.govKeeper, app.accountKeeper, app.accountKeeper, app.bankKeeper),
|
|
|
|
// mint.NewAppModule(app.mintKeeper),
|
|
|
|
// distr.NewAppModule(app.distrKeeper, app.accountKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper),
|
2022-04-21 20:16:28 +00:00
|
|
|
// staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.accountKeeper, app.bankKeeper),
|
|
|
|
// evm.NewAppModule(app.evmKeeper, app.accountKeeper),
|
2022-01-08 00:39:27 +00:00
|
|
|
// slashing.NewAppModule(app.slashingKeeper, app.accountKeeper, app.stakingKeeper),
|
|
|
|
// )
|
|
|
|
// app.sm.RegisterStoreDecoders()
|
2019-09-11 22:33:20 +00:00
|
|
|
|
|
|
|
// initialize stores
|
|
|
|
app.MountKVStores(keys)
|
|
|
|
app.MountTransientStores(tkeys)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.MountMemoryStores(memKeys)
|
2019-09-11 22:33:20 +00:00
|
|
|
|
2019-07-18 17:36:31 +00:00
|
|
|
// initialize the app
|
2022-01-08 00:39:27 +00:00
|
|
|
var fetchers []ante.AddressFetcher
|
|
|
|
if options.MempoolEnableAuth {
|
|
|
|
fetchers = append(fetchers,
|
|
|
|
func(sdk.Context) []sdk.AccAddress { return options.MempoolAuthAddresses },
|
|
|
|
app.bep3Keeper.GetAuthorizedAddresses,
|
|
|
|
app.pricefeedKeeper.GetAuthorizedAddresses,
|
|
|
|
)
|
2020-12-02 17:37:11 +00:00
|
|
|
}
|
2022-04-21 20:16:28 +00:00
|
|
|
|
|
|
|
anteOptions := ante.HandlerOptions{
|
2023-04-04 00:08:45 +00:00
|
|
|
AccountKeeper: app.accountKeeper,
|
|
|
|
BankKeeper: app.bankKeeper,
|
|
|
|
EvmKeeper: app.evmKeeper,
|
|
|
|
IBCKeeper: app.ibcKeeper,
|
|
|
|
FeeMarketKeeper: app.feeMarketKeeper,
|
|
|
|
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
|
|
|
|
SigGasConsumer: evmante.DefaultSigVerificationGasConsumer,
|
|
|
|
MaxTxGasWanted: options.EVMMaxGasWanted,
|
|
|
|
AddressFetchers: fetchers,
|
|
|
|
ExtensionOptionChecker: nil,
|
|
|
|
TxFeeChecker: nil,
|
2022-04-21 20:16:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
antehandler, err := ante.NewAnteHandler(anteOptions)
|
2022-01-08 00:39:27 +00:00
|
|
|
if err != nil {
|
|
|
|
panic(fmt.Sprintf("failed to create antehandler: %s", err))
|
|
|
|
}
|
|
|
|
|
2020-12-02 17:37:11 +00:00
|
|
|
app.SetAnteHandler(antehandler)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.SetInitChainer(app.InitChainer)
|
|
|
|
app.SetBeginBlocker(app.BeginBlocker)
|
2019-06-20 13:37:57 +00:00
|
|
|
app.SetEndBlocker(app.EndBlocker)
|
|
|
|
|
2019-07-18 17:36:31 +00:00
|
|
|
// load store
|
2022-01-08 00:39:27 +00:00
|
|
|
if !options.SkipLoadLatest {
|
|
|
|
if err := app.LoadLatestVersion(); err != nil {
|
|
|
|
panic(fmt.Sprintf("failed to load latest version: %s", err))
|
2019-06-20 13:37:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
app.ScopedIBCKeeper = scopedIBCKeeper
|
|
|
|
app.ScopedTransferKeeper = scopedTransferKeeper
|
2019-06-25 13:29:56 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
return app
|
2020-02-13 00:49:32 +00:00
|
|
|
}
|
|
|
|
|
2022-12-19 21:50:43 +00:00
|
|
|
func (app *App) RegisterServices(cfg module.Configurator) {
|
2023-01-26 17:01:28 +00:00
|
|
|
app.mm.RegisterServices(cfg)
|
2022-12-19 21:50:43 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// BeginBlocker contains app specific logic for the BeginBlock abci call.
|
2019-06-20 17:02:29 +00:00
|
|
|
func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
|
2019-07-18 17:36:31 +00:00
|
|
|
return app.mm.BeginBlock(ctx, req)
|
2019-06-20 13:37:57 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// EndBlocker contains app specific logic for the EndBlock abci call.
|
2019-06-20 17:02:29 +00:00
|
|
|
func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
|
2019-07-18 17:36:31 +00:00
|
|
|
return app.mm.EndBlock(ctx, req)
|
2019-06-20 13:37:57 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// InitChainer contains app specific logic for the InitChain abci call.
|
2019-07-18 17:36:31 +00:00
|
|
|
func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
|
2019-06-20 13:37:57 +00:00
|
|
|
var genesisState GenesisState
|
2022-01-08 00:39:27 +00:00
|
|
|
if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2024-05-01 05:53:58 +00:00
|
|
|
// Store current module versions in 0gChain-10 to setup future in-place upgrades.
|
2022-04-25 13:48:40 +00:00
|
|
|
// During in-place migrations, the old module versions in the store will be referenced to determine which migrations to run.
|
|
|
|
app.upgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap())
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
|
2019-06-20 13:37:57 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// LoadHeight loads the app state for a particular height.
|
2019-06-20 17:02:29 +00:00
|
|
|
func (app *App) LoadHeight(height int64) error {
|
2022-01-08 00:39:27 +00:00
|
|
|
return app.LoadVersion(height)
|
2019-06-20 13:37:57 +00:00
|
|
|
}
|
|
|
|
|
2019-07-18 17:36:31 +00:00
|
|
|
// ModuleAccountAddrs returns all the app's module account addresses.
|
|
|
|
func (app *App) ModuleAccountAddrs() map[string]bool {
|
|
|
|
modAccAddrs := make(map[string]bool)
|
|
|
|
for acc := range mAccPerms {
|
2022-01-08 00:39:27 +00:00
|
|
|
modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true
|
2019-07-18 17:36:31 +00:00
|
|
|
}
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2019-07-18 17:36:31 +00:00
|
|
|
return modAccAddrs
|
2019-06-20 13:37:57 +00:00
|
|
|
}
|
2019-09-11 22:33:20 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// InterfaceRegistry returns the app's InterfaceRegistry.
|
|
|
|
func (app *App) InterfaceRegistry() types.InterfaceRegistry {
|
|
|
|
return app.interfaceRegistry
|
|
|
|
}
|
|
|
|
|
|
|
|
// SimulationManager implements the SimulationApp interface.
|
|
|
|
func (app *App) SimulationManager() *module.SimulationManager {
|
|
|
|
return app.sm
|
|
|
|
}
|
|
|
|
|
|
|
|
// RegisterAPIRoutes registers all application module routes with the provided API server.
|
|
|
|
func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
|
|
|
|
clientCtx := apiSvr.ClientCtx
|
|
|
|
|
2023-04-06 22:51:34 +00:00
|
|
|
// Register custom REST routes
|
|
|
|
validatorvestingrest.RegisterRoutes(clientCtx, apiSvr.Router)
|
|
|
|
|
2023-04-17 19:54:13 +00:00
|
|
|
// Register rewrite routes
|
|
|
|
RegisterAPIRouteRewrites(apiSvr.Router)
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// Register GRPC Gateway routes
|
|
|
|
tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
|
|
|
|
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
|
|
|
|
ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
|
2023-04-04 00:08:45 +00:00
|
|
|
nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
|
2022-01-08 00:39:27 +00:00
|
|
|
|
2022-02-01 16:32:17 +00:00
|
|
|
// Swagger API configuration is ignored
|
2022-01-08 00:39:27 +00:00
|
|
|
}
|
2020-05-21 04:50:12 +00:00
|
|
|
|
2023-04-17 19:54:13 +00:00
|
|
|
// RegisterAPIRouteRewrites registers overwritten API routes that are
|
|
|
|
// registered after this function is called. This must be called before any
|
|
|
|
// other route registrations on the router in order for rewrites to take effect.
|
|
|
|
// The first route that matches in the mux router wins, so any registrations
|
|
|
|
// here will be prioritized over the later registrations in modules.
|
|
|
|
func RegisterAPIRouteRewrites(router *mux.Router) {
|
|
|
|
// Mapping of client path to backend path. Similar to nginx rewrite rules,
|
|
|
|
// but does not return a 301 or 302 redirect.
|
|
|
|
// Eg: querying /cosmos/distribution/v1beta1/community_pool will return
|
|
|
|
// the same response as querying /kava/community/v1beta1/total_balance
|
|
|
|
routeMap := map[string]string{
|
2024-05-01 17:43:59 +00:00
|
|
|
"/cosmos/distribution/v1beta1/community_pool": "/0g/community/v1beta1/total_balance",
|
2023-04-17 19:54:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for clientPath, backendPath := range routeMap {
|
|
|
|
router.HandleFunc(
|
|
|
|
clientPath,
|
|
|
|
func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
r.URL.Path = backendPath
|
|
|
|
|
|
|
|
// Use handler of the new path
|
|
|
|
router.ServeHTTP(w, r)
|
|
|
|
},
|
|
|
|
).Methods("GET")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// RegisterTxService implements the Application.RegisterTxService method.
|
|
|
|
// It registers transaction related endpoints on the app's grpc server.
|
|
|
|
func (app *App) RegisterTxService(clientCtx client.Context) {
|
|
|
|
authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry)
|
2020-05-21 04:50:12 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// RegisterTendermintService implements the Application.RegisterTendermintService method.
|
|
|
|
// It registers the standard tendermint grpc endpoints on the app's grpc server.
|
|
|
|
func (app *App) RegisterTendermintService(clientCtx client.Context) {
|
2023-04-04 00:08:45 +00:00
|
|
|
tmservice.RegisterTendermintService(
|
|
|
|
clientCtx,
|
|
|
|
app.BaseApp.GRPCQueryRouter(),
|
|
|
|
app.interfaceRegistry,
|
|
|
|
app.Query,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (app *App) RegisterNodeService(clientCtx client.Context) {
|
|
|
|
nodeservice.RegisterNodeService(clientCtx, app.BaseApp.GRPCQueryRouter())
|
2019-09-11 22:33:20 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// loadBlockedMaccAddrs returns a map indicating the blocked status of each module account address
|
|
|
|
func (app *App) loadBlockedMaccAddrs() map[string]bool {
|
|
|
|
modAccAddrs := app.ModuleAccountAddrs()
|
2022-12-13 00:38:27 +00:00
|
|
|
allowedMaccs := map[string]bool{
|
2023-06-05 18:39:53 +00:00
|
|
|
// NOTE: if adding evmutil, adjust the cosmos-coins-fully-backed-invariant accordingly.
|
2022-12-13 00:38:27 +00:00
|
|
|
}
|
2022-07-28 16:39:57 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
for addr := range modAccAddrs {
|
2022-12-13 00:38:27 +00:00
|
|
|
// Set allowed module accounts as unblocked
|
|
|
|
if allowedMaccs[addr] {
|
2022-01-08 00:39:27 +00:00
|
|
|
modAccAddrs[addr] = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return modAccAddrs
|
2020-04-23 16:35:58 +00:00
|
|
|
}
|
|
|
|
|
2019-09-11 22:33:20 +00:00
|
|
|
// GetMaccPerms returns a mapping of the application's module account permissions.
|
|
|
|
func GetMaccPerms() map[string][]string {
|
|
|
|
perms := make(map[string][]string)
|
|
|
|
for k, v := range mAccPerms {
|
|
|
|
perms[k] = v
|
|
|
|
}
|
|
|
|
return perms
|
|
|
|
}
|