mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-03-30 15:08:28 +00:00
275 refactor feedenom on e2e test suite (#312)
* extended AttestMachine FundAccount to support a given fee denominator * renamed testutil/network/network.go to testutil/network/loader.go * renamed new to Load * integrated cosmos/testutil/network to planetmint-go/testutil/network * changed to plmnt token tests only! * removed obsolete variables * fixed newest linter issues --------- Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
f6a7a56704
commit
04e45a7fb2
@ -96,6 +96,9 @@ issues:
|
||||
- path: x/dao/client/cli/tx_reissue_rddl.*\.go
|
||||
linters:
|
||||
- dupl
|
||||
- path: x/dao/client/cli/*\.go
|
||||
linters:
|
||||
- revive
|
||||
- path: testutil/nullify/nullify\.go
|
||||
linters:
|
||||
- exhaustive
|
||||
@ -106,3 +109,24 @@ issues:
|
||||
- path: tests/.*/*\.go
|
||||
linters:
|
||||
- paralleltest
|
||||
- path: testutil/network/network.go
|
||||
linters:
|
||||
- gocognit
|
||||
- gocyclo
|
||||
- wastedassign
|
||||
- nestif
|
||||
- path: x/.*/simulation/.*\.go
|
||||
linters:
|
||||
- revive
|
||||
- path: x/.*/module_simulation\.go
|
||||
linters:
|
||||
- revive
|
||||
- path: x/.*/client/cli/query_params\.go
|
||||
linters:
|
||||
- revive
|
||||
- path: x/.*/.*/cli/query_.*\.go
|
||||
linters:
|
||||
- revive
|
||||
- path: docs/docs\.go
|
||||
linters:
|
||||
- revive
|
6
docs/static/openapi.yml
vendored
6
docs/static/openapi.yml
vendored
@ -47015,8 +47015,6 @@ paths:
|
||||
type: string
|
||||
token_denom:
|
||||
type: string
|
||||
fee_denom:
|
||||
type: string
|
||||
staged_denom:
|
||||
type: string
|
||||
claim_denom:
|
||||
@ -76686,8 +76684,6 @@ definitions:
|
||||
type: string
|
||||
token_denom:
|
||||
type: string
|
||||
fee_denom:
|
||||
type: string
|
||||
staged_denom:
|
||||
type: string
|
||||
claim_denom:
|
||||
@ -76963,8 +76959,6 @@ definitions:
|
||||
type: string
|
||||
token_denom:
|
||||
type: string
|
||||
fee_denom:
|
||||
type: string
|
||||
staged_denom:
|
||||
type: string
|
||||
claim_denom:
|
||||
|
2
go.mod
2
go.mod
@ -4,6 +4,7 @@ go 1.19
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.3.1
|
||||
cosmossdk.io/depinject v1.0.0-alpha.4
|
||||
cosmossdk.io/errors v1.0.0
|
||||
cosmossdk.io/math v1.1.2
|
||||
cosmossdk.io/simapp v0.0.0-20230323161446-0af178d721ff
|
||||
@ -42,7 +43,6 @@ require (
|
||||
cloud.google.com/go/iam v1.1.0 // indirect
|
||||
cloud.google.com/go/storage v1.30.1 // indirect
|
||||
cosmossdk.io/core v0.5.1 // indirect
|
||||
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
|
||||
cosmossdk.io/log v1.2.1 // indirect
|
||||
cosmossdk.io/tools/rosetta v0.2.1 // indirect
|
||||
filippo.io/edwards25519 v1.0.0 // indirect
|
||||
|
@ -11,19 +11,18 @@ message Params {
|
||||
|
||||
string mint_address = 1;
|
||||
string token_denom = 2;
|
||||
string fee_denom = 3;
|
||||
string staged_denom = 4;
|
||||
string claim_denom = 5;
|
||||
string reissuance_asset = 6;
|
||||
int64 reissuance_epochs = 7;
|
||||
int64 pop_epochs = 8;
|
||||
int64 distribution_offset = 9;
|
||||
string distribution_address_early_inv = 10;
|
||||
string distribution_address_investor = 11;
|
||||
string distribution_address_strategic = 12;
|
||||
string distribution_address_dao = 13;
|
||||
string distribution_address_pop = 14;
|
||||
int64 mqtt_response_timeout = 15;
|
||||
string claim_address = 16;
|
||||
uint64 tx_gas_limit = 17;
|
||||
string staged_denom = 3;
|
||||
string claim_denom = 4;
|
||||
string reissuance_asset = 5;
|
||||
int64 reissuance_epochs = 6;
|
||||
int64 pop_epochs = 7;
|
||||
int64 distribution_offset = 8;
|
||||
string distribution_address_early_inv = 9;
|
||||
string distribution_address_investor = 10;
|
||||
string distribution_address_strategic = 11;
|
||||
string distribution_address_dao = 12;
|
||||
string distribution_address_pop = 13;
|
||||
int64 mqtt_response_timeout = 14;
|
||||
string claim_address = 15;
|
||||
uint64 tx_gas_limit = 16;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
func TestE2ETestSuite(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := network.DefaultConfig()
|
||||
cfg := network.LoaderDefaultConfig()
|
||||
cfg.NumValidators = 1
|
||||
suite.Run(t, NewE2ETestSuite(cfg))
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
assetcli "github.com/planetmint/planetmint-go/x/asset/client/cli"
|
||||
assettypes "github.com/planetmint/planetmint-go/x/asset/types"
|
||||
|
||||
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
@ -30,15 +29,10 @@ func NewE2ETestSuite(cfg network.Config) *E2ETestSuite {
|
||||
|
||||
// SetupSuite initializes asset E2ETestSuite
|
||||
func (s *E2ETestSuite) SetupSuite() {
|
||||
var daoGenState daotypes.GenesisState
|
||||
s.cfg.Codec.MustUnmarshalJSON(s.cfg.GenesisState[daotypes.ModuleName], &daoGenState)
|
||||
daoGenState.Params.FeeDenom = sample.FeeDenom
|
||||
s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState)
|
||||
|
||||
s.T().Log("setting up e2e test suite")
|
||||
|
||||
s.network = network.New(s.T(), s.cfg)
|
||||
err := e2etestutil.AttestMachine(s.network, sample.Name, sample.Mnemonic, 0)
|
||||
s.network = network.Load(s.T(), s.cfg)
|
||||
err := e2etestutil.AttestMachine(s.network, sample.Name, sample.Mnemonic, 0, sample.FeeDenom)
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
|
||||
clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
|
||||
"github.com/planetmint/planetmint-go/testutil/network"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
daocli "github.com/planetmint/planetmint-go/x/dao/client/cli"
|
||||
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/stretchr/testify/suite"
|
||||
@ -36,10 +35,9 @@ func (s *AssetDistributionE2ETestSuite) SetupSuite() {
|
||||
s.cfg.Codec.MustUnmarshalJSON(s.cfg.GenesisState[daotypes.ModuleName], &daoGenState)
|
||||
daoGenState.Params.DistributionOffset = s.distributionOffset
|
||||
daoGenState.Params.ReissuanceEpochs = s.reissaunceEpochs
|
||||
daoGenState.Params.FeeDenom = sample.FeeDenom
|
||||
s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState)
|
||||
|
||||
s.network = network.New(s.T(), s.cfg)
|
||||
s.network = network.Load(s.T(), s.cfg)
|
||||
}
|
||||
|
||||
func (s *AssetDistributionE2ETestSuite) TearDownSuite() {
|
||||
|
@ -9,26 +9,26 @@ import (
|
||||
)
|
||||
|
||||
func TestE2ETestSuite(t *testing.T) {
|
||||
cfg := network.DefaultConfig()
|
||||
cfg := network.LoaderDefaultConfig()
|
||||
suite.Run(t, NewE2ETestSuite(cfg))
|
||||
}
|
||||
|
||||
func TestPopE2ETestSuite(t *testing.T) {
|
||||
cfg := network.DefaultConfig()
|
||||
cfg := network.LoaderDefaultConfig()
|
||||
suite.Run(t, NewPopSelectionE2ETestSuite(cfg))
|
||||
}
|
||||
|
||||
func TestGasConsumptionE2ETestSuite(t *testing.T) {
|
||||
cfg := network.DefaultConfig()
|
||||
cfg := network.LoaderDefaultConfig()
|
||||
suite.Run(t, NewGasConsumptionE2ETestSuite(cfg))
|
||||
}
|
||||
|
||||
func TestRestrictedMsgsE2ETestSuite(t *testing.T) {
|
||||
cfg := network.DefaultConfig()
|
||||
cfg := network.LoaderDefaultConfig()
|
||||
suite.Run(t, NewRestrictedMsgsE2ESuite(cfg))
|
||||
}
|
||||
|
||||
func TestAssetDistributionE2ETestSuite(t *testing.T) {
|
||||
cfg := network.DefaultConfig()
|
||||
cfg := network.LoaderDefaultConfig()
|
||||
suite.Run(t, NewAssetDistributionE2ETestSuite(cfg))
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ type GasConsumptionE2ETestSuite struct {
|
||||
cfg network.Config
|
||||
network *network.Network
|
||||
minterAddr sdk.AccAddress
|
||||
feeDenom string
|
||||
}
|
||||
|
||||
func NewGasConsumptionE2ETestSuite(cfg network.Config) *GasConsumptionE2ETestSuite {
|
||||
@ -63,6 +64,7 @@ func (s *GasConsumptionE2ETestSuite) createValAccount(cfg network.Config) (addre
|
||||
func (s *GasConsumptionE2ETestSuite) SetupSuite() {
|
||||
s.T().Log("setting up e2e test suite")
|
||||
|
||||
s.feeDenom = sample.FeeDenom
|
||||
s.cfg.Mnemonics = []string{sample.Mnemonic}
|
||||
addr, err := s.createValAccount(s.cfg)
|
||||
s.Require().NoError(err)
|
||||
@ -79,14 +81,13 @@ func (s *GasConsumptionE2ETestSuite) SetupSuite() {
|
||||
|
||||
var daoGenState daotypes.GenesisState
|
||||
s.cfg.Codec.MustUnmarshalJSON(s.cfg.GenesisState[daotypes.ModuleName], &daoGenState)
|
||||
daoGenState.Params.FeeDenom = sample.FeeDenom
|
||||
daoGenState.Params.MintAddress = s.minterAddr.String()
|
||||
s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState)
|
||||
|
||||
s.network = network.New(s.T(), s.cfg)
|
||||
s.network = network.Load(s.T(), s.cfg)
|
||||
account, err := e2etestutil.CreateAccount(s.network, sample.Name, sample.Mnemonic)
|
||||
s.Require().NoError(err)
|
||||
err = e2etestutil.FundAccount(s.network, account)
|
||||
err = e2etestutil.FundAccount(s.network, account, s.feeDenom)
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
@ -102,7 +103,7 @@ func (s *GasConsumptionE2ETestSuite) TestValidatorConsumption() {
|
||||
addr, _ := k.GetAddress()
|
||||
|
||||
// send huge tx but as val and with no gas kv costs
|
||||
msgs := createMsgs(val.Address, addr, 10)
|
||||
msgs := s.createMsgs(val.Address, addr, 10)
|
||||
|
||||
out, err := lib.BroadcastTxWithFileLock(val.Address, msgs...)
|
||||
s.Require().NoError(err)
|
||||
@ -118,10 +119,14 @@ func (s *GasConsumptionE2ETestSuite) TestNonValidatorConsumptionOverflow() {
|
||||
|
||||
k, err := val.ClientCtx.Keyring.Key(sample.Name)
|
||||
s.Require().NoError(err)
|
||||
|
||||
err = e2etestutil.FundAccount(s.network, k, s.feeDenom)
|
||||
s.Require().NoError(err)
|
||||
|
||||
addr, _ := k.GetAddress()
|
||||
|
||||
// exceed gas limit with too many msgs as non validator
|
||||
msgs := createMsgs(addr, val.Address, 10)
|
||||
msgs := s.createMsgs(addr, val.Address, 10)
|
||||
|
||||
out, err := lib.BroadcastTxWithFileLock(addr, msgs...)
|
||||
s.Require().NoError(err)
|
||||
@ -130,11 +135,11 @@ func (s *GasConsumptionE2ETestSuite) TestNonValidatorConsumptionOverflow() {
|
||||
|
||||
_, err = clitestutil.GetRawLogFromTxOut(val, out)
|
||||
s.Require().Error(err)
|
||||
assert.Equal(s.T(), "out of gas in location: Has; gasWanted: 200000, gasUsed: 200701: out of gas", err.Error())
|
||||
assert.Equal(s.T(), "out of gas in location: ReadFlat; gasWanted: 200000, gasUsed: 200316: out of gas", err.Error())
|
||||
}
|
||||
|
||||
func createMsgs(from sdk.AccAddress, to sdk.AccAddress, n int) (msgs []sdk.Msg) {
|
||||
coins := sdk.NewCoins(sdk.NewInt64Coin("stake", 10))
|
||||
func (s *GasConsumptionE2ETestSuite) createMsgs(from sdk.AccAddress, to sdk.AccAddress, n int) (msgs []sdk.Msg) {
|
||||
coins := sdk.NewCoins(sdk.NewInt64Coin(s.feeDenom, 10))
|
||||
for i := 0; i < n; i++ {
|
||||
msg := banktypes.NewMsgSend(from, to, coins)
|
||||
msgs = append(msgs, msg)
|
||||
|
@ -50,6 +50,7 @@ type PopSelectionE2ETestSuite struct {
|
||||
reissuanceEpochs int64
|
||||
distributionOffset int64
|
||||
claimDenom string
|
||||
feeDenom string
|
||||
}
|
||||
|
||||
func NewPopSelectionE2ETestSuite(cfg network.Config) *PopSelectionE2ETestSuite {
|
||||
@ -63,7 +64,7 @@ func (s *PopSelectionE2ETestSuite) SetupSuite() {
|
||||
s.reissuanceEpochs = 60
|
||||
s.distributionOffset = 2
|
||||
s.claimDenom = "crddl"
|
||||
|
||||
s.feeDenom = sample.FeeDenom
|
||||
s.cfg.Mnemonics = []string{sample.Mnemonic}
|
||||
valAddr, err := s.createValAccount(s.cfg)
|
||||
s.Require().NoError(err)
|
||||
@ -74,11 +75,10 @@ func (s *PopSelectionE2ETestSuite) SetupSuite() {
|
||||
daoGenState.Params.ReissuanceEpochs = s.reissuanceEpochs
|
||||
daoGenState.Params.DistributionOffset = s.distributionOffset
|
||||
daoGenState.Params.MqttResponseTimeout = 200
|
||||
daoGenState.Params.FeeDenom = sample.FeeDenom
|
||||
daoGenState.Params.ClaimAddress = valAddr.String()
|
||||
s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState)
|
||||
|
||||
s.network = network.New(s.T(), s.cfg)
|
||||
s.network = network.Load(s.T(), s.cfg)
|
||||
}
|
||||
|
||||
// TearDownSuite clean up after testing
|
||||
@ -152,7 +152,7 @@ func (s *PopSelectionE2ETestSuite) TestPopSelectionNoActors() {
|
||||
}
|
||||
|
||||
func (s *PopSelectionE2ETestSuite) TestPopSelectionOneActors() {
|
||||
err := e2etestutil.AttestMachine(s.network, machines[0].name, machines[0].mnemonic, 0)
|
||||
err := e2etestutil.AttestMachine(s.network, machines[0].name, machines[0].mnemonic, 0, s.feeDenom)
|
||||
s.Require().NoError(err)
|
||||
|
||||
out := s.perpareLocalTest()
|
||||
@ -163,7 +163,7 @@ func (s *PopSelectionE2ETestSuite) TestPopSelectionOneActors() {
|
||||
}
|
||||
|
||||
func (s *PopSelectionE2ETestSuite) TestPopSelectionTwoActors() {
|
||||
err := e2etestutil.AttestMachine(s.network, machines[1].name, machines[1].mnemonic, 1)
|
||||
err := e2etestutil.AttestMachine(s.network, machines[1].name, machines[1].mnemonic, 1, s.feeDenom)
|
||||
s.Require().NoError(err)
|
||||
|
||||
out := s.perpareLocalTest()
|
||||
|
@ -36,15 +36,10 @@ func NewRestrictedMsgsE2ESuite(cfg network.Config) *RestrictedMsgsE2ESuite {
|
||||
func (s *RestrictedMsgsE2ESuite) SetupSuite() {
|
||||
s.T().Log("setting up e2e test suite")
|
||||
|
||||
var daoGenState daotypes.GenesisState
|
||||
s.cfg.Codec.MustUnmarshalJSON(s.cfg.GenesisState[daotypes.ModuleName], &daoGenState)
|
||||
daoGenState.Params.FeeDenom = sample.FeeDenom
|
||||
s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState)
|
||||
|
||||
s.network = network.New(s.T(), s.cfg)
|
||||
s.network = network.Load(s.T(), s.cfg)
|
||||
account, err := e2etestutil.CreateAccount(s.network, sample.Name, sample.Mnemonic)
|
||||
s.Require().NoError(err)
|
||||
err = e2etestutil.FundAccount(s.network, account)
|
||||
err = e2etestutil.FundAccount(s.network, account, sample.FeeDenom)
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package dao
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
@ -74,9 +73,6 @@ func (s *E2ETestSuite) SetupSuite() {
|
||||
|
||||
var daoGenState daotypes.GenesisState
|
||||
s.cfg.Codec.MustUnmarshalJSON(s.cfg.GenesisState[daotypes.ModuleName], &daoGenState)
|
||||
// set MintAddress in GenesisState
|
||||
// set FeeDenom to node0token because the sending account is initialized with no plmnt tokens
|
||||
daoGenState.Params.FeeDenom = "node0token"
|
||||
daoGenState.Params.DistributionOffset = s.distributionOffset
|
||||
daoGenState.Params.ReissuanceEpochs = s.reissuanceEpochs
|
||||
daoGenState.Params.MintAddress = valAddr.String()
|
||||
@ -101,13 +97,12 @@ func (s *E2ETestSuite) SetupSuite() {
|
||||
bankGenState.Balances = append(bankGenState.Balances, accountBalances...)
|
||||
s.cfg.GenesisState[banktypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&bankGenState)
|
||||
|
||||
s.cfg.MinGasPrices = fmt.Sprintf("0.000006%s", daoGenState.Params.FeeDenom)
|
||||
s.network = network.New(s.T(), s.cfg)
|
||||
s.network = network.Load(s.T(), s.cfg)
|
||||
|
||||
// create account for redeem claim test case
|
||||
account, err := e2etestutil.CreateAccount(s.network, sample.Name, sample.Mnemonic)
|
||||
s.Require().NoError(err)
|
||||
err = e2etestutil.FundAccount(s.network, account)
|
||||
err = e2etestutil.FundAccount(s.network, account, sample.FeeDenom)
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
func TestE2ETestSuite(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := network.DefaultConfig()
|
||||
cfg := network.LoaderDefaultConfig()
|
||||
cfg.NumValidators = 1
|
||||
suite.Run(t, NewE2ETestSuite(cfg))
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/feegrant"
|
||||
e2etestutil "github.com/planetmint/planetmint-go/testutil/e2e"
|
||||
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
@ -22,8 +21,9 @@ import (
|
||||
type E2ETestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
cfg network.Config
|
||||
network *network.Network
|
||||
cfg network.Config
|
||||
network *network.Network
|
||||
feeDenom string
|
||||
}
|
||||
|
||||
// NewE2ETestSuite returns configured machine E2ETestSuite
|
||||
@ -33,18 +33,15 @@ func NewE2ETestSuite(cfg network.Config) *E2ETestSuite {
|
||||
|
||||
// SetupSuite initializes machine E2ETestSuite
|
||||
func (s *E2ETestSuite) SetupSuite() {
|
||||
var daoGenState daotypes.GenesisState
|
||||
s.cfg.Codec.MustUnmarshalJSON(s.cfg.GenesisState[daotypes.ModuleName], &daoGenState)
|
||||
daoGenState.Params.FeeDenom = sample.FeeDenom
|
||||
s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState)
|
||||
|
||||
s.T().Log("setting up e2e test suite")
|
||||
|
||||
s.network = network.New(s.T(), s.cfg)
|
||||
s.feeDenom = sample.FeeDenom
|
||||
s.network = network.Load(s.T(), s.cfg)
|
||||
|
||||
// create machine account for attestation
|
||||
account, err := e2etestutil.CreateAccount(s.network, sample.Name, sample.Mnemonic)
|
||||
s.Require().NoError(err)
|
||||
err = e2etestutil.FundAccount(s.network, account)
|
||||
err = e2etestutil.FundAccount(s.network, account, s.feeDenom)
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
@ -150,7 +147,7 @@ func (s *E2ETestSuite) TestMachineAllowanceAttestation() {
|
||||
|
||||
// create allowance for machine
|
||||
allowedMsgs := []string{"/planetmintgo.machine.MsgAttestMachine"}
|
||||
limit := sdk.NewCoins(sdk.NewInt64Coin("stake", 2))
|
||||
limit := sdk.NewCoins(sdk.NewInt64Coin(s.feeDenom, 2))
|
||||
basic := feegrant.BasicAllowance{
|
||||
SpendLimit: limit,
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
"github.com/planetmint/planetmint-go/lib"
|
||||
"github.com/planetmint/planetmint-go/testutil"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/testutil/network"
|
||||
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
|
||||
"github.com/planetmint/planetmint-go/testutil/network"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -27,7 +27,7 @@ func CreateAccount(network *network.Network, name string, mnemonic string) (acco
|
||||
return account, nil
|
||||
}
|
||||
|
||||
func FundAccount(network *network.Network, account *keyring.Record) (err error) {
|
||||
func FundAccount(network *network.Network, account *keyring.Record, tokenDenom string) (err error) {
|
||||
val := network.Validators[0]
|
||||
|
||||
addr, err := account.GetAddress()
|
||||
@ -36,7 +36,7 @@ func FundAccount(network *network.Network, account *keyring.Record) (err error)
|
||||
}
|
||||
|
||||
// sending funds to account to initialize account on chain
|
||||
coin := sdk.NewCoins(sdk.NewInt64Coin("stake", 10000)) // TODO: make denom dependent on cfg
|
||||
coin := sdk.NewCoins(sdk.NewInt64Coin(tokenDenom, 10000))
|
||||
msg := banktypes.NewMsgSend(val.Address, addr, coin)
|
||||
out, err := lib.BroadcastTxWithFileLock(val.Address, msg)
|
||||
if err != nil {
|
||||
@ -60,7 +60,7 @@ func FundAccount(network *network.Network, account *keyring.Record) (err error)
|
||||
return
|
||||
}
|
||||
|
||||
func AttestMachine(network *network.Network, name string, mnemonic string, num int) (err error) {
|
||||
func AttestMachine(network *network.Network, name string, mnemonic string, num int, tokenDenom string) (err error) {
|
||||
val := network.Validators[0]
|
||||
|
||||
account, err := CreateAccount(network, name, mnemonic)
|
||||
@ -68,7 +68,7 @@ func AttestMachine(network *network.Network, name string, mnemonic string, num i
|
||||
return err
|
||||
}
|
||||
|
||||
err = FundAccount(network, account)
|
||||
err = FundAccount(network, account, tokenDenom)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
126
testutil/network/loader.go
Normal file
126
testutil/network/loader.go
Normal file
@ -0,0 +1,126 @@
|
||||
package network
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
tmdb "github.com/cometbft/cometbft-db"
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/hd"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
||||
pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types"
|
||||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
"github.com/planetmint/planetmint-go/app"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/lib"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
"github.com/planetmint/planetmint-go/util/mocks"
|
||||
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
|
||||
elements "github.com/rddl-network/elements-rpc"
|
||||
elementsmocks "github.com/rddl-network/elements-rpc/utils/mocks"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// Load creates instance with fully configured cosmos network.
|
||||
// Accepts optional config, that will be used in place of the DefaultConfig() if provided.
|
||||
func Load(t *testing.T, configs ...Config) *Network {
|
||||
if len(configs) > 1 {
|
||||
panic("at most one config should be provided")
|
||||
}
|
||||
var cfg Config
|
||||
if len(configs) == 0 {
|
||||
cfg = LoaderDefaultConfig()
|
||||
} else {
|
||||
cfg = configs[0]
|
||||
}
|
||||
validatorTmpDir := t.TempDir()
|
||||
|
||||
// use mock client for testing
|
||||
util.MQTTClient = &mocks.MockMQTTClient{}
|
||||
elements.Client = &elementsmocks.MockClient{}
|
||||
|
||||
// enable application logger in tests
|
||||
appLogger := util.GetAppLogger()
|
||||
appLogger.SetTestingLogger(t)
|
||||
|
||||
// set the proper root dir for the test environment so that the abci.go logic works
|
||||
conf := config.GetConfig()
|
||||
conf.SetRoot(validatorTmpDir + "/node0/simd")
|
||||
|
||||
net, err := New(t, validatorTmpDir, cfg)
|
||||
require.NoError(t, err)
|
||||
|
||||
conf.ValidatorAddress = net.Validators[0].Address.String()
|
||||
// set missing validator client context values for sending txs
|
||||
var output bytes.Buffer
|
||||
net.Validators[0].ClientCtx.BroadcastMode = "sync"
|
||||
net.Validators[0].ClientCtx.FromAddress = net.Validators[0].Address
|
||||
net.Validators[0].ClientCtx.FromName = net.Validators[0].Moniker
|
||||
net.Validators[0].ClientCtx.NodeURI = net.Validators[0].RPCAddress
|
||||
net.Validators[0].ClientCtx.Output = &output
|
||||
net.Validators[0].ClientCtx.SkipConfirm = true
|
||||
|
||||
var daoGenState daotypes.GenesisState
|
||||
cfg.Codec.MustUnmarshalJSON(cfg.GenesisState[daotypes.ModuleName], &daoGenState)
|
||||
|
||||
libConfig := lib.GetConfig()
|
||||
libConfig.SetClientCtx(net.Validators[0].ClientCtx)
|
||||
libConfig.SetRoot(validatorTmpDir + "/node0/simd")
|
||||
|
||||
require.NoError(t, err)
|
||||
_, err = net.WaitForHeight(1)
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(net.Cleanup)
|
||||
return net
|
||||
}
|
||||
|
||||
// LoaderDefaultConfig will initialize config for the network with custom application,
|
||||
// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig
|
||||
func LoaderDefaultConfig() Config {
|
||||
var (
|
||||
encoding = app.MakeEncodingConfig()
|
||||
chainID = "chain-foobarbaz"
|
||||
)
|
||||
return Config{
|
||||
Codec: encoding.Marshaler,
|
||||
TxConfig: encoding.TxConfig,
|
||||
LegacyAmino: encoding.Amino,
|
||||
InterfaceRegistry: encoding.InterfaceRegistry,
|
||||
AccountRetriever: authtypes.AccountRetriever{},
|
||||
AppConstructor: func(val ValidatorI) servertypes.Application {
|
||||
return app.New(
|
||||
val.GetCtx().Logger,
|
||||
tmdb.NewMemDB(),
|
||||
nil,
|
||||
true,
|
||||
map[int64]bool{},
|
||||
val.GetCtx().Config.RootDir,
|
||||
0,
|
||||
encoding,
|
||||
simtestutil.EmptyAppOptions{},
|
||||
baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)),
|
||||
baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices),
|
||||
baseapp.SetChainID(chainID),
|
||||
)
|
||||
},
|
||||
GenesisState: app.ModuleBasics.DefaultGenesis(encoding.Marshaler),
|
||||
TimeoutCommit: 2 * time.Second,
|
||||
ChainID: chainID,
|
||||
NumValidators: 1,
|
||||
BondDenom: sdk.DefaultBondDenom,
|
||||
MinGasPrices: "0.000003" + sample.FeeDenom,
|
||||
AccountTokens: sdk.TokensFromConsensusPower(10000, sdk.DefaultPowerReduction),
|
||||
StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction),
|
||||
BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction),
|
||||
PruningStrategy: pruningtypes.PruningOptionNothing,
|
||||
CleanupDir: true,
|
||||
SigningAlgo: string(hd.Secp256k1Type),
|
||||
KeyringOptions: []keyring.Option{},
|
||||
AccountDenom: sample.FeeDenom,
|
||||
}
|
||||
}
|
@ -1,133 +1,795 @@
|
||||
package network
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"bufio"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
tmdb "github.com/cometbft/cometbft-db"
|
||||
dbm "github.com/cometbft/cometbft-db"
|
||||
tmrand "github.com/cometbft/cometbft/libs/rand"
|
||||
"github.com/cometbft/cometbft/node"
|
||||
tmclient "github.com/cometbft/cometbft/rpc/client"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/spf13/cobra"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
tmlog "github.com/cometbft/cometbft/libs/log"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/configurator"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
|
||||
"cosmossdk.io/depinject"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/hd"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/cosmos/cosmos-sdk/server/api"
|
||||
srvconfig "github.com/cosmos/cosmos-sdk/server/config"
|
||||
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
||||
pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/network"
|
||||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
elements "github.com/rddl-network/elements-rpc"
|
||||
elementsmocks "github.com/rddl-network/elements-rpc/utils/mocks"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/planetmint/planetmint-go/app"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/lib"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
"github.com/planetmint/planetmint-go/util/mocks"
|
||||
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil"
|
||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
)
|
||||
|
||||
// package-wide network lock to only allow one test network at a time
|
||||
var lock = new(sync.Mutex)
|
||||
|
||||
// AppConstructor defines a function which accepts a network configuration and
|
||||
// creates an ABCI Application to provide to Tendermint.
|
||||
type (
|
||||
AppConstructor = func(val ValidatorI) servertypes.Application
|
||||
TestFixtureFactory = func() TestFixture
|
||||
)
|
||||
|
||||
type TestFixture struct {
|
||||
AppConstructor AppConstructor
|
||||
GenesisState map[string]json.RawMessage
|
||||
EncodingConfig moduletestutil.TestEncodingConfig
|
||||
}
|
||||
|
||||
// Config defines the necessary configuration used to bootstrap and start an
|
||||
// in-process local testing network.
|
||||
type Config struct {
|
||||
Codec codec.Codec
|
||||
LegacyAmino *codec.LegacyAmino // TODO: Remove!
|
||||
InterfaceRegistry codectypes.InterfaceRegistry
|
||||
|
||||
TxConfig client.TxConfig
|
||||
AccountRetriever client.AccountRetriever
|
||||
AppConstructor AppConstructor // the ABCI application constructor
|
||||
GenesisState map[string]json.RawMessage // custom genesis state to provide
|
||||
TimeoutCommit time.Duration // the consensus commitment timeout
|
||||
ChainID string // the network chain-id
|
||||
NumValidators int // the total number of validators to create and bond
|
||||
Mnemonics []string // custom user-provided validator operator mnemonics
|
||||
BondDenom string // the staking bond denomination
|
||||
MinGasPrices string // the minimum gas prices each validator will accept
|
||||
AccountTokens math.Int // the amount of unique validator tokens (e.g. 1000node0)
|
||||
StakingTokens math.Int // the amount of tokens each validator has available to stake
|
||||
BondedTokens math.Int // the amount of tokens each validator stakes
|
||||
PruningStrategy string // the pruning strategy each validator will have
|
||||
EnableTMLogging bool // enable Tendermint logging to STDOUT
|
||||
CleanupDir bool // remove base temporary directory during cleanup
|
||||
SigningAlgo string // signing algorithm for keys
|
||||
KeyringOptions []keyring.Option // keyring configuration options
|
||||
RPCAddress string // RPC listen address (including port)
|
||||
APIAddress string // REST API listen address (including port)
|
||||
GRPCAddress string // GRPC server listen address (including port)
|
||||
PrintMnemonic bool // print the mnemonic of first validator as log output for testing
|
||||
AccountDenom string // the denominator of the account tokens
|
||||
}
|
||||
|
||||
// DefaultConfig returns a sane default configuration suitable for nearly all
|
||||
// testing requirements.
|
||||
func DefaultConfig(factory TestFixtureFactory) Config {
|
||||
fixture := factory()
|
||||
|
||||
return Config{
|
||||
Codec: fixture.EncodingConfig.Codec,
|
||||
TxConfig: fixture.EncodingConfig.TxConfig,
|
||||
LegacyAmino: fixture.EncodingConfig.Amino,
|
||||
InterfaceRegistry: fixture.EncodingConfig.InterfaceRegistry,
|
||||
AccountRetriever: authtypes.AccountRetriever{},
|
||||
AppConstructor: fixture.AppConstructor,
|
||||
GenesisState: fixture.GenesisState,
|
||||
TimeoutCommit: 2 * time.Second,
|
||||
ChainID: "chain-" + tmrand.Str(6),
|
||||
NumValidators: 4,
|
||||
BondDenom: sdk.DefaultBondDenom,
|
||||
MinGasPrices: "0.000006" + sample.FeeDenom,
|
||||
AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction),
|
||||
StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction),
|
||||
BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction),
|
||||
PruningStrategy: pruningtypes.PruningOptionNothing,
|
||||
CleanupDir: true,
|
||||
SigningAlgo: string(hd.Secp256k1Type),
|
||||
KeyringOptions: []keyring.Option{},
|
||||
PrintMnemonic: false,
|
||||
AccountDenom: sample.FeeDenom,
|
||||
}
|
||||
}
|
||||
|
||||
// MinimumAppConfig defines the minimum of modules required for a call to New to succeed
|
||||
func MinimumAppConfig() depinject.Config {
|
||||
return configurator.NewAppConfig(
|
||||
configurator.AuthModule(),
|
||||
configurator.ParamsModule(),
|
||||
configurator.BankModule(),
|
||||
configurator.GenutilModule(),
|
||||
configurator.StakingModule(),
|
||||
configurator.ConsensusModule(),
|
||||
configurator.TxModule())
|
||||
}
|
||||
|
||||
func DefaultConfigWithAppConfig(appConfig depinject.Config) (Config, error) {
|
||||
var (
|
||||
appBuilder *runtime.AppBuilder
|
||||
txConfig client.TxConfig
|
||||
legacyAmino *codec.LegacyAmino
|
||||
cdc codec.Codec
|
||||
interfaceRegistry codectypes.InterfaceRegistry
|
||||
)
|
||||
|
||||
if err := depinject.Inject(appConfig,
|
||||
&appBuilder,
|
||||
&txConfig,
|
||||
&cdc,
|
||||
&legacyAmino,
|
||||
&interfaceRegistry,
|
||||
); err != nil {
|
||||
return Config{}, err
|
||||
}
|
||||
|
||||
cfg := DefaultConfig(func() TestFixture {
|
||||
return TestFixture{}
|
||||
})
|
||||
cfg.Codec = cdc
|
||||
cfg.TxConfig = txConfig
|
||||
cfg.LegacyAmino = legacyAmino
|
||||
cfg.InterfaceRegistry = interfaceRegistry
|
||||
cfg.GenesisState = appBuilder.DefaultGenesis()
|
||||
cfg.AppConstructor = func(val ValidatorI) servertypes.Application {
|
||||
// we build a unique app instance for every validator here
|
||||
var appBuilder *runtime.AppBuilder
|
||||
if err := depinject.Inject(appConfig, &appBuilder); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
app := appBuilder.Build(
|
||||
val.GetCtx().Logger,
|
||||
dbm.NewMemDB(),
|
||||
nil,
|
||||
baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)),
|
||||
baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices),
|
||||
baseapp.SetChainID(cfg.ChainID),
|
||||
)
|
||||
|
||||
testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{})
|
||||
|
||||
if err := app.Load(true); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return app
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
type (
|
||||
Network = network.Network
|
||||
Config = network.Config
|
||||
// Network defines a local in-process testing network using SimApp. It can be
|
||||
// configured to start any number of validators, each with its own RPC and API
|
||||
// clients. Typically, this test network would be used in client and integration
|
||||
// testing where user input is expected.
|
||||
//
|
||||
// Note, due to Tendermint constraints in regards to RPC functionality, there
|
||||
// may only be one test network running at a time. Thus, any caller must be
|
||||
// sure to Cleanup after testing is finished in order to allow other tests
|
||||
// to create networks. In addition, only the first validator will have a valid
|
||||
// RPC and API server/client.
|
||||
Network struct {
|
||||
Logger Logger
|
||||
BaseDir string
|
||||
Validators []*Validator
|
||||
|
||||
Config Config
|
||||
}
|
||||
|
||||
// Validator defines an in-process Tendermint validator node. Through this object,
|
||||
// a client can make RPC and API calls and interact with any client command
|
||||
// or handler.
|
||||
Validator struct {
|
||||
AppConfig *srvconfig.Config
|
||||
ClientCtx client.Context
|
||||
Ctx *server.Context
|
||||
Dir string
|
||||
NodeID string
|
||||
PubKey cryptotypes.PubKey
|
||||
Moniker string
|
||||
APIAddress string
|
||||
RPCAddress string
|
||||
P2PAddress string
|
||||
Address sdk.AccAddress
|
||||
ValAddress sdk.ValAddress
|
||||
RPCClient tmclient.Client
|
||||
|
||||
tmNode *node.Node
|
||||
api *api.Server
|
||||
grpc *grpc.Server
|
||||
grpcWeb *http.Server
|
||||
}
|
||||
|
||||
// ValidatorI expose a validator's context and configuration
|
||||
ValidatorI interface {
|
||||
GetCtx() *server.Context
|
||||
GetAppConfig() *srvconfig.Config
|
||||
}
|
||||
|
||||
// Logger is a network logger interface that exposes testnet-level Log() methods for an in-process testing network
|
||||
// This is not to be confused with logging that may happen at an individual node or validator level
|
||||
Logger interface {
|
||||
Log(args ...interface{})
|
||||
Logf(format string, args ...interface{})
|
||||
}
|
||||
)
|
||||
|
||||
// New creates instance with fully configured cosmos network.
|
||||
// Accepts optional config, that will be used in place of the DefaultConfig() if provided.
|
||||
func New(t *testing.T, configs ...Config) *Network {
|
||||
if len(configs) > 1 {
|
||||
panic("at most one config should be provided")
|
||||
}
|
||||
var cfg network.Config
|
||||
if len(configs) == 0 {
|
||||
cfg = DefaultConfig()
|
||||
} else {
|
||||
cfg = configs[0]
|
||||
}
|
||||
validatorTmpDir := t.TempDir()
|
||||
var (
|
||||
_ Logger = (*testing.T)(nil)
|
||||
_ Logger = (*CLILogger)(nil)
|
||||
_ ValidatorI = Validator{}
|
||||
)
|
||||
|
||||
// use mock client for testing
|
||||
util.MQTTClient = &mocks.MockMQTTClient{}
|
||||
elements.Client = &elementsmocks.MockClient{}
|
||||
|
||||
// enable application logger in tests
|
||||
appLogger := util.GetAppLogger()
|
||||
appLogger.SetTestingLogger(t)
|
||||
|
||||
// set the proper root dir for the test environment so that the abci.go logic works
|
||||
conf := config.GetConfig()
|
||||
conf.SetRoot(validatorTmpDir + "/node0/simd")
|
||||
|
||||
net, err := network.New(t, validatorTmpDir, cfg)
|
||||
require.NoError(t, err)
|
||||
|
||||
conf.ValidatorAddress = net.Validators[0].Address.String()
|
||||
// set missing validator client context values for sending txs
|
||||
var output bytes.Buffer
|
||||
net.Validators[0].ClientCtx.BroadcastMode = "sync"
|
||||
net.Validators[0].ClientCtx.FromAddress = net.Validators[0].Address
|
||||
net.Validators[0].ClientCtx.FromName = net.Validators[0].Moniker
|
||||
net.Validators[0].ClientCtx.NodeURI = net.Validators[0].RPCAddress
|
||||
net.Validators[0].ClientCtx.Output = &output
|
||||
net.Validators[0].ClientCtx.SkipConfirm = true
|
||||
|
||||
var daoGenState daotypes.GenesisState
|
||||
cfg.Codec.MustUnmarshalJSON(cfg.GenesisState[daotypes.ModuleName], &daoGenState)
|
||||
|
||||
libConfig := lib.GetConfig()
|
||||
libConfig.SetClientCtx(net.Validators[0].ClientCtx)
|
||||
libConfig.SetFeeDenom(daoGenState.Params.FeeDenom)
|
||||
libConfig.SetRoot(validatorTmpDir + "/node0/simd")
|
||||
|
||||
require.NoError(t, err)
|
||||
_, err = net.WaitForHeight(1)
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(net.Cleanup)
|
||||
return net
|
||||
func (v Validator) GetCtx() *server.Context {
|
||||
return v.Ctx
|
||||
}
|
||||
|
||||
// DefaultConfig will initialize config for the network with custom application,
|
||||
// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig
|
||||
func DefaultConfig() network.Config {
|
||||
func (v Validator) GetAppConfig() *srvconfig.Config {
|
||||
return v.AppConfig
|
||||
}
|
||||
|
||||
// CLILogger wraps a cobra.Command and provides command logging methods.
|
||||
type CLILogger struct {
|
||||
cmd *cobra.Command
|
||||
}
|
||||
|
||||
// Log logs given args.
|
||||
func (s CLILogger) Log(args ...interface{}) {
|
||||
s.cmd.Println(args...)
|
||||
}
|
||||
|
||||
// Logf logs given args according to a format specifier.
|
||||
func (s CLILogger) Logf(format string, args ...interface{}) {
|
||||
s.cmd.Printf(format, args...)
|
||||
}
|
||||
|
||||
// NewCLILogger creates a new CLILogger.
|
||||
func NewCLILogger(cmd *cobra.Command) CLILogger {
|
||||
return CLILogger{cmd}
|
||||
}
|
||||
|
||||
// New creates a new Network for integration tests or in-process testnets run via the CLI
|
||||
func New(l Logger, baseDir string, cfg Config) (*Network, error) {
|
||||
// only one caller/test can create and use a network at a time
|
||||
l.Log("acquiring test network lock")
|
||||
lock.Lock()
|
||||
|
||||
network := &Network{
|
||||
Logger: l,
|
||||
BaseDir: baseDir,
|
||||
Validators: make([]*Validator, cfg.NumValidators),
|
||||
Config: cfg,
|
||||
}
|
||||
|
||||
l.Logf("preparing test network with chain-id \"%s\"\n", cfg.ChainID)
|
||||
|
||||
monikers := make([]string, cfg.NumValidators)
|
||||
nodeIDs := make([]string, cfg.NumValidators)
|
||||
valPubKeys := make([]cryptotypes.PubKey, cfg.NumValidators)
|
||||
|
||||
var (
|
||||
encoding = app.MakeEncodingConfig()
|
||||
chainID = "chain-foobarbaz"
|
||||
genAccounts []authtypes.GenesisAccount
|
||||
genBalances []banktypes.Balance
|
||||
genFiles []string
|
||||
)
|
||||
return network.Config{
|
||||
Codec: encoding.Marshaler,
|
||||
TxConfig: encoding.TxConfig,
|
||||
LegacyAmino: encoding.Amino,
|
||||
InterfaceRegistry: encoding.InterfaceRegistry,
|
||||
AccountRetriever: authtypes.AccountRetriever{},
|
||||
AppConstructor: func(val network.ValidatorI) servertypes.Application {
|
||||
return app.New(
|
||||
val.GetCtx().Logger,
|
||||
tmdb.NewMemDB(),
|
||||
nil,
|
||||
true,
|
||||
map[int64]bool{},
|
||||
val.GetCtx().Config.RootDir,
|
||||
0,
|
||||
encoding,
|
||||
simtestutil.EmptyAppOptions{},
|
||||
baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)),
|
||||
baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices),
|
||||
baseapp.SetChainID(chainID),
|
||||
)
|
||||
},
|
||||
GenesisState: app.ModuleBasics.DefaultGenesis(encoding.Marshaler),
|
||||
TimeoutCommit: 2 * time.Second,
|
||||
ChainID: chainID,
|
||||
NumValidators: 1,
|
||||
BondDenom: sdk.DefaultBondDenom,
|
||||
MinGasPrices: fmt.Sprintf("0.000003%s", sdk.DefaultBondDenom),
|
||||
AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction),
|
||||
StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction),
|
||||
BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction),
|
||||
PruningStrategy: pruningtypes.PruningOptionNothing,
|
||||
CleanupDir: true,
|
||||
SigningAlgo: string(hd.Secp256k1Type),
|
||||
KeyringOptions: []keyring.Option{},
|
||||
|
||||
buf := bufio.NewReader(os.Stdin)
|
||||
|
||||
// generate private keys, node IDs, and initial transactions
|
||||
for i := 0; i < cfg.NumValidators; i++ {
|
||||
appCfg := srvconfig.DefaultConfig()
|
||||
appCfg.Pruning = cfg.PruningStrategy
|
||||
appCfg.MinGasPrices = cfg.MinGasPrices
|
||||
appCfg.API.Enable = true
|
||||
appCfg.API.Swagger = false
|
||||
appCfg.Telemetry.Enabled = false
|
||||
|
||||
ctx := server.NewDefaultContext()
|
||||
tmCfg := ctx.Config
|
||||
tmCfg.Consensus.TimeoutCommit = cfg.TimeoutCommit
|
||||
|
||||
// Only allow the first validator to expose an RPC, API and gRPC
|
||||
// server/client due to Tendermint in-process constraints.
|
||||
apiAddr := ""
|
||||
tmCfg.RPC.ListenAddress = ""
|
||||
appCfg.GRPC.Enable = false
|
||||
appCfg.GRPCWeb.Enable = false
|
||||
apiListenAddr := ""
|
||||
if i == 0 {
|
||||
if cfg.APIAddress != "" {
|
||||
apiListenAddr = cfg.APIAddress
|
||||
} else {
|
||||
var err error
|
||||
apiListenAddr, _, err = server.FreeTCPAddr()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
appCfg.API.Address = apiListenAddr
|
||||
apiURL, err := url.Parse(apiListenAddr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
apiAddr = net.JoinHostPort("http://"+apiURL.Hostname(), apiURL.Port())
|
||||
|
||||
if cfg.RPCAddress != "" {
|
||||
// The above code is likely declaring a variable or constant named "tmCfg" in the Go programming
|
||||
// language. However, without more context or code, it is difficult to determine the exact purpose
|
||||
// or functionality of this code.
|
||||
tmCfg.RPC.ListenAddress = cfg.RPCAddress
|
||||
} else {
|
||||
rpcAddr, _, err := server.FreeTCPAddr()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tmCfg.RPC.ListenAddress = rpcAddr
|
||||
}
|
||||
|
||||
if cfg.GRPCAddress != "" {
|
||||
appCfg.GRPC.Address = cfg.GRPCAddress
|
||||
} else {
|
||||
_, grpcPort, err := server.FreeTCPAddr()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
appCfg.GRPC.Address = "0.0.0.0:" + grpcPort
|
||||
}
|
||||
appCfg.GRPC.Enable = true
|
||||
|
||||
_, grpcWebPort, err := server.FreeTCPAddr()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
appCfg.GRPCWeb.Address = "0.0.0.0:" + grpcWebPort
|
||||
appCfg.GRPCWeb.Enable = true
|
||||
}
|
||||
|
||||
logger := tmlog.NewNopLogger()
|
||||
if cfg.EnableTMLogging {
|
||||
logger = tmlog.NewTMLogger(tmlog.NewSyncWriter(os.Stdout))
|
||||
}
|
||||
|
||||
ctx.Logger = logger
|
||||
|
||||
nodeDirName := fmt.Sprintf("node%d", i)
|
||||
nodeDir := filepath.Join(network.BaseDir, nodeDirName, "simd")
|
||||
clientDir := filepath.Join(network.BaseDir, nodeDirName, "simcli")
|
||||
gentxsDir := filepath.Join(network.BaseDir, "gentxs")
|
||||
|
||||
err := os.MkdirAll(filepath.Join(nodeDir, "config"), 0o755)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = os.MkdirAll(clientDir, 0o755)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tmCfg.SetRoot(nodeDir)
|
||||
tmCfg.Moniker = nodeDirName
|
||||
monikers[i] = nodeDirName
|
||||
|
||||
proxyAddr, _, err := server.FreeTCPAddr()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tmCfg.ProxyApp = proxyAddr
|
||||
|
||||
p2pAddr, _, err := server.FreeTCPAddr()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tmCfg.P2P.ListenAddress = p2pAddr
|
||||
tmCfg.P2P.AddrBookStrict = false
|
||||
tmCfg.P2P.AllowDuplicateIP = true
|
||||
|
||||
nodeID, pubKey, err := genutil.InitializeNodeValidatorFiles(tmCfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
nodeIDs[i] = nodeID
|
||||
valPubKeys[i] = pubKey
|
||||
|
||||
kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, clientDir, buf, cfg.Codec, cfg.KeyringOptions...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
keyringAlgos, _ := kb.SupportedAlgorithms()
|
||||
algo, err := keyring.NewSigningAlgoFromString(cfg.SigningAlgo, keyringAlgos)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var mnemonic string
|
||||
if i < len(cfg.Mnemonics) {
|
||||
mnemonic = cfg.Mnemonics[i]
|
||||
}
|
||||
|
||||
addr, secret, err := testutil.GenerateSaveCoinKey(kb, nodeDirName, mnemonic, true, algo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// if PrintMnemonic is set to true, we print the first validator node's secret to the network's logger
|
||||
// for debugging and manual testing
|
||||
if cfg.PrintMnemonic && i == 0 {
|
||||
printMnemonic(l, secret)
|
||||
}
|
||||
|
||||
info := map[string]string{"secret": secret}
|
||||
infoBz, err := json.Marshal(info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// save private key seed words
|
||||
err = writeFile(fmt.Sprintf("%v.json", "key_seed"), clientDir, infoBz)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
balances := sdk.NewCoins(
|
||||
sdk.NewCoin(cfg.AccountDenom, cfg.AccountTokens),
|
||||
sdk.NewCoin(cfg.BondDenom, cfg.StakingTokens),
|
||||
)
|
||||
|
||||
genFiles = append(genFiles, tmCfg.GenesisFile())
|
||||
genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: balances.Sort()})
|
||||
genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0, 0))
|
||||
|
||||
commission, err := sdk.NewDecFromStr("0.5")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
createValMsg, err := stakingtypes.NewMsgCreateValidator(
|
||||
sdk.ValAddress(addr),
|
||||
valPubKeys[i],
|
||||
sdk.NewCoin(cfg.BondDenom, cfg.BondedTokens),
|
||||
stakingtypes.NewDescription(nodeDirName, "", "", "", ""),
|
||||
stakingtypes.NewCommissionRates(commission, math.LegacyOneDec(), math.LegacyOneDec()),
|
||||
math.OneInt(),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
p2pURL, err := url.Parse(p2pAddr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
memo := fmt.Sprintf("%s@%s:%s", nodeIDs[i], p2pURL.Hostname(), p2pURL.Port())
|
||||
fee := sdk.NewCoins(sdk.NewCoin(cfg.AccountDenom, sdk.NewInt(0)))
|
||||
txBuilder := cfg.TxConfig.NewTxBuilder()
|
||||
err = txBuilder.SetMsgs(createValMsg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
txBuilder.SetFeeAmount(fee) // Arbitrary fee
|
||||
txBuilder.SetGasLimit(1000000) // Need at least 100386
|
||||
txBuilder.SetMemo(memo)
|
||||
|
||||
txFactory := tx.Factory{}
|
||||
txFactory = txFactory.
|
||||
WithChainID(cfg.ChainID).
|
||||
WithMemo(memo).
|
||||
WithKeybase(kb).
|
||||
WithTxConfig(cfg.TxConfig)
|
||||
|
||||
err = tx.Sign(txFactory, nodeDirName, txBuilder, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
txBz, err := cfg.TxConfig.TxJSONEncoder()(txBuilder.GetTx())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = writeFile(fmt.Sprintf("%v.json", nodeDirName), gentxsDir, txBz)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config", "app.toml"), appCfg)
|
||||
|
||||
clientCtx := client.Context{}.
|
||||
WithKeyringDir(clientDir).
|
||||
WithKeyring(kb).
|
||||
WithHomeDir(tmCfg.RootDir).
|
||||
WithChainID(cfg.ChainID).
|
||||
WithInterfaceRegistry(cfg.InterfaceRegistry).
|
||||
WithCodec(cfg.Codec).
|
||||
WithLegacyAmino(cfg.LegacyAmino).
|
||||
WithTxConfig(cfg.TxConfig).
|
||||
WithAccountRetriever(cfg.AccountRetriever)
|
||||
|
||||
// Provide ChainID here since we can't modify it in the Comet config.
|
||||
ctx.Viper.Set(flags.FlagChainID, cfg.ChainID)
|
||||
|
||||
network.Validators[i] = &Validator{
|
||||
AppConfig: appCfg,
|
||||
ClientCtx: clientCtx,
|
||||
Ctx: ctx,
|
||||
Dir: filepath.Join(network.BaseDir, nodeDirName),
|
||||
NodeID: nodeID,
|
||||
PubKey: pubKey,
|
||||
Moniker: nodeDirName,
|
||||
RPCAddress: tmCfg.RPC.ListenAddress,
|
||||
P2PAddress: tmCfg.P2P.ListenAddress,
|
||||
APIAddress: apiAddr,
|
||||
Address: addr,
|
||||
ValAddress: sdk.ValAddress(addr),
|
||||
}
|
||||
}
|
||||
|
||||
err := initGenFiles(cfg, genAccounts, genBalances, genFiles)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = collectGenFiles(cfg, network.Validators, network.BaseDir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
l.Log("starting test network...")
|
||||
for idx, v := range network.Validators {
|
||||
err := startInProcess(cfg, v)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
l.Log("started validator", idx)
|
||||
}
|
||||
|
||||
height, err := network.LatestHeight()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
l.Log("started test network at height:", height)
|
||||
|
||||
// Ensure we cleanup incase any test was abruptly halted (e.g. SIGINT) as any
|
||||
// defer in a test would not be called.
|
||||
server.TrapSignal(network.Cleanup)
|
||||
|
||||
return network, nil
|
||||
}
|
||||
|
||||
// LatestHeight returns the latest height of the network or an error if the
|
||||
// query fails or no validators exist.
|
||||
func (n *Network) LatestHeight() (int64, error) {
|
||||
if len(n.Validators) == 0 {
|
||||
return 0, errors.New("no validators available")
|
||||
}
|
||||
|
||||
ticker := time.NewTicker(time.Second)
|
||||
defer ticker.Stop()
|
||||
|
||||
timeout := time.NewTimer(time.Second * 5)
|
||||
defer timeout.Stop()
|
||||
|
||||
var latestHeight int64
|
||||
val := n.Validators[0]
|
||||
queryClient := tmservice.NewServiceClient(val.ClientCtx)
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-timeout.C:
|
||||
return latestHeight, errors.New("timeout exceeded waiting for block")
|
||||
case <-ticker.C:
|
||||
res, err := queryClient.GetLatestBlock(context.Background(), &tmservice.GetLatestBlockRequest{})
|
||||
if err == nil && res != nil {
|
||||
return res.SdkBlock.Header.Height, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WaitForHeight performs a blocking check where it waits for a block to be
|
||||
// committed after a given block. If that height is not reached within a timeout,
|
||||
// an error is returned. Regardless, the latest height queried is returned.
|
||||
func (n *Network) WaitForHeight(h int64) (int64, error) {
|
||||
return n.WaitForHeightWithTimeout(h, 10*time.Second)
|
||||
}
|
||||
|
||||
// WaitForHeightWithTimeout is the same as WaitForHeight except the caller can
|
||||
// provide a custom timeout.
|
||||
func (n *Network) WaitForHeightWithTimeout(h int64, t time.Duration) (int64, error) {
|
||||
ticker := time.NewTicker(time.Second)
|
||||
defer ticker.Stop()
|
||||
|
||||
timeout := time.NewTimer(t)
|
||||
defer timeout.Stop()
|
||||
|
||||
if len(n.Validators) == 0 {
|
||||
return 0, errors.New("no validators available")
|
||||
}
|
||||
|
||||
var latestHeight int64
|
||||
val := n.Validators[0]
|
||||
queryClient := tmservice.NewServiceClient(val.ClientCtx)
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-timeout.C:
|
||||
return latestHeight, errors.New("timeout exceeded waiting for block")
|
||||
case <-ticker.C:
|
||||
|
||||
res, err := queryClient.GetLatestBlock(context.Background(), &tmservice.GetLatestBlockRequest{})
|
||||
if err == nil && res != nil {
|
||||
latestHeight = res.GetSdkBlock().Header.Height
|
||||
if latestHeight >= h {
|
||||
return latestHeight, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// RetryForBlocks will wait for the next block and execute the function provided.
|
||||
// It will do this until the function returns a nil error or until the number of
|
||||
// blocks has been reached.
|
||||
func (n *Network) RetryForBlocks(retryFunc func() error, blocks int) error {
|
||||
for i := 0; i < blocks; i++ {
|
||||
err := n.WaitForNextBlock()
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
err = retryFunc()
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
// we've reached the last block to wait, return the error
|
||||
if i == blocks-1 {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// WaitForNextBlock waits for the next block to be committed, returning an error
|
||||
// upon failure.
|
||||
func (n *Network) WaitForNextBlock() error {
|
||||
lastBlock, err := n.LatestHeight()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = n.WaitForHeight(lastBlock + 1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Cleanup removes the root testing (temporary) directory and stops both the
|
||||
// Tendermint and API services. It allows other callers to create and start
|
||||
// test networks. This method must be called when a test is finished, typically
|
||||
// in a defer.
|
||||
func (n *Network) Cleanup() {
|
||||
defer func() {
|
||||
lock.Unlock()
|
||||
n.Logger.Log("released test network lock")
|
||||
}()
|
||||
|
||||
n.Logger.Log("cleaning up test network...")
|
||||
|
||||
for _, v := range n.Validators {
|
||||
if v.tmNode != nil && v.tmNode.IsRunning() {
|
||||
_ = v.tmNode.Stop()
|
||||
}
|
||||
|
||||
if v.api != nil {
|
||||
_ = v.api.Close()
|
||||
}
|
||||
|
||||
if v.grpc != nil {
|
||||
v.grpc.Stop()
|
||||
if v.grpcWeb != nil {
|
||||
_ = v.grpcWeb.Close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Give a brief pause for things to finish closing in other processes. Hopefully this helps with the address-in-use errors.
|
||||
// 100ms chosen randomly.
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
if n.Config.CleanupDir {
|
||||
_ = os.RemoveAll(n.BaseDir)
|
||||
}
|
||||
|
||||
n.Logger.Log("finished cleaning up test network")
|
||||
}
|
||||
|
||||
// printMnemonic prints a provided mnemonic seed phrase on a network logger
|
||||
// for debugging and manual testing
|
||||
func printMnemonic(l Logger, secret string) {
|
||||
lines := []string{
|
||||
"THIS MNEMONIC IS FOR TESTING PURPOSES ONLY",
|
||||
"DO NOT USE IN PRODUCTION",
|
||||
"",
|
||||
strings.Join(strings.Fields(secret)[0:8], " "),
|
||||
strings.Join(strings.Fields(secret)[8:16], " "),
|
||||
strings.Join(strings.Fields(secret)[16:24], " "),
|
||||
}
|
||||
|
||||
lineLengths := make([]int, len(lines))
|
||||
for i, line := range lines {
|
||||
lineLengths[i] = len(line)
|
||||
}
|
||||
|
||||
maxLineLength := 0
|
||||
for _, lineLen := range lineLengths {
|
||||
if lineLen > maxLineLength {
|
||||
maxLineLength = lineLen
|
||||
}
|
||||
}
|
||||
|
||||
l.Log("\n")
|
||||
l.Log(strings.Repeat("+", maxLineLength+8))
|
||||
for _, line := range lines {
|
||||
l.Logf("++ %s ++\n", centerText(line, maxLineLength))
|
||||
}
|
||||
l.Log(strings.Repeat("+", maxLineLength+8))
|
||||
l.Log("\n")
|
||||
}
|
||||
|
||||
// centerText centers text across a fixed width, filling either side with whitespace buffers
|
||||
func centerText(text string, width int) string {
|
||||
textLen := len(text)
|
||||
leftBuffer := strings.Repeat(" ", (width-textLen)/2)
|
||||
rightBuffer := strings.Repeat(" ", (width-textLen)/2+(width-textLen)%2)
|
||||
|
||||
return fmt.Sprintf("%s%s%s", leftBuffer, text, rightBuffer)
|
||||
}
|
||||
|
204
testutil/network/util.go
Normal file
204
testutil/network/util.go
Normal file
@ -0,0 +1,204 @@
|
||||
package network
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/cometbft/cometbft/node"
|
||||
"github.com/cometbft/cometbft/p2p"
|
||||
pvm "github.com/cometbft/cometbft/privval"
|
||||
"github.com/cometbft/cometbft/proxy"
|
||||
"github.com/cometbft/cometbft/rpc/client/local"
|
||||
"github.com/cometbft/cometbft/types"
|
||||
tmtime "github.com/cometbft/cometbft/types/time"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/server/api"
|
||||
servergrpc "github.com/cosmos/cosmos-sdk/server/grpc"
|
||||
srvtypes "github.com/cosmos/cosmos-sdk/server/types"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil"
|
||||
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||
)
|
||||
|
||||
func startInProcess(cfg Config, val *Validator) error {
|
||||
logger := val.Ctx.Logger
|
||||
tmCfg := val.Ctx.Config
|
||||
tmCfg.Instrumentation.Prometheus = false
|
||||
|
||||
if err := val.AppConfig.ValidateBasic(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
nodeKey, err := p2p.LoadOrGenNodeKey(tmCfg.NodeKeyFile())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
app := cfg.AppConstructor(*val)
|
||||
genDocProvider := node.DefaultGenesisDocProviderFunc(tmCfg)
|
||||
|
||||
tmNode, err := node.NewNode( //resleak:notresource
|
||||
tmCfg,
|
||||
pvm.LoadOrGenFilePV(tmCfg.PrivValidatorKeyFile(), tmCfg.PrivValidatorStateFile()),
|
||||
nodeKey,
|
||||
proxy.NewLocalClientCreator(app),
|
||||
genDocProvider,
|
||||
node.DefaultDBProvider,
|
||||
node.DefaultMetricsProvider(tmCfg.Instrumentation),
|
||||
logger.With("module", val.Moniker),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := tmNode.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
val.tmNode = tmNode
|
||||
|
||||
if val.RPCAddress != "" {
|
||||
val.RPCClient = local.New(tmNode)
|
||||
}
|
||||
|
||||
// We'll need a RPC client if the validator exposes a gRPC or REST endpoint.
|
||||
if val.APIAddress != "" || val.AppConfig.GRPC.Enable {
|
||||
val.ClientCtx = val.ClientCtx.
|
||||
WithClient(val.RPCClient)
|
||||
|
||||
app.RegisterTxService(val.ClientCtx)
|
||||
app.RegisterTendermintService(val.ClientCtx)
|
||||
app.RegisterNodeService(val.ClientCtx)
|
||||
}
|
||||
|
||||
if val.APIAddress != "" {
|
||||
apiSrv := api.New(val.ClientCtx, logger.With("module", "api-server"))
|
||||
app.RegisterAPIRoutes(apiSrv, val.AppConfig.API)
|
||||
|
||||
errCh := make(chan error)
|
||||
|
||||
go func() {
|
||||
if err := apiSrv.Start(*val.AppConfig); err != nil {
|
||||
errCh <- err
|
||||
}
|
||||
}()
|
||||
|
||||
select {
|
||||
case err := <-errCh:
|
||||
return err
|
||||
case <-time.After(srvtypes.ServerStartTime): // assume server started successfully
|
||||
}
|
||||
|
||||
val.api = apiSrv
|
||||
}
|
||||
|
||||
if val.AppConfig.GRPC.Enable {
|
||||
grpcSrv, err := servergrpc.StartGRPCServer(val.ClientCtx, app, val.AppConfig.GRPC)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
val.grpc = grpcSrv
|
||||
|
||||
if val.AppConfig.GRPCWeb.Enable {
|
||||
val.grpcWeb, err = servergrpc.StartGRPCWeb(grpcSrv, *val.AppConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func collectGenFiles(cfg Config, vals []*Validator, outputDir string) error {
|
||||
genTime := tmtime.Now()
|
||||
|
||||
for i := 0; i < cfg.NumValidators; i++ {
|
||||
tmCfg := vals[i].Ctx.Config
|
||||
|
||||
nodeDir := filepath.Join(outputDir, vals[i].Moniker, "simd")
|
||||
gentxsDir := filepath.Join(outputDir, "gentxs")
|
||||
|
||||
tmCfg.Moniker = vals[i].Moniker
|
||||
tmCfg.SetRoot(nodeDir)
|
||||
|
||||
initCfg := genutiltypes.NewInitConfig(cfg.ChainID, gentxsDir, vals[i].NodeID, vals[i].PubKey)
|
||||
|
||||
genFile := tmCfg.GenesisFile()
|
||||
genDoc, err := types.GenesisDocFromFile(genFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
appState, err := genutil.GenAppStateFromConfig(cfg.Codec, cfg.TxConfig,
|
||||
tmCfg, initCfg, *genDoc, banktypes.GenesisBalancesIterator{}, genutiltypes.DefaultMessageValidator)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// overwrite each validator's genesis file to have a canonical genesis time
|
||||
if err := genutil.ExportGenesisFileWithTime(genFile, cfg.ChainID, nil, appState, genTime); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func initGenFiles(cfg Config, genAccounts []authtypes.GenesisAccount, genBalances []banktypes.Balance, genFiles []string) error {
|
||||
// set the accounts in the genesis state
|
||||
var authGenState authtypes.GenesisState
|
||||
cfg.Codec.MustUnmarshalJSON(cfg.GenesisState[authtypes.ModuleName], &authGenState)
|
||||
|
||||
accounts, err := authtypes.PackAccounts(genAccounts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
authGenState.Accounts = append(authGenState.Accounts, accounts...)
|
||||
cfg.GenesisState[authtypes.ModuleName] = cfg.Codec.MustMarshalJSON(&authGenState)
|
||||
|
||||
// set the balances in the genesis state
|
||||
var bankGenState banktypes.GenesisState
|
||||
cfg.Codec.MustUnmarshalJSON(cfg.GenesisState[banktypes.ModuleName], &bankGenState)
|
||||
|
||||
bankGenState.Balances = append(bankGenState.Balances, genBalances...)
|
||||
cfg.GenesisState[banktypes.ModuleName] = cfg.Codec.MustMarshalJSON(&bankGenState)
|
||||
|
||||
appGenStateJSON, err := json.MarshalIndent(cfg.GenesisState, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
genDoc := types.GenesisDoc{
|
||||
ChainID: cfg.ChainID,
|
||||
AppState: appGenStateJSON,
|
||||
Validators: nil,
|
||||
}
|
||||
|
||||
// generate empty genesis files for each validator and save
|
||||
for i := 0; i < cfg.NumValidators; i++ {
|
||||
if err := genDoc.SaveAs(genFiles[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func writeFile(name string, dir string, contents []byte) error {
|
||||
file := filepath.Join(dir, name)
|
||||
|
||||
if err := os.MkdirAll(dir, 0o755); err != nil {
|
||||
return fmt.Errorf("could not create directory %q: %w", dir, err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(file, contents, 0o644); err != nil { //nolint: gosec
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -26,14 +26,8 @@ const PubKey = "021cd2a59c6f9402ce09effba89b3deb6bb5863733e625f22c06204918061db4
|
||||
// Name is the name of the sample machine to use in tests
|
||||
const Name = "machine"
|
||||
|
||||
// Amount is the amount to transfer to the machine account
|
||||
const Amount = "1000stake"
|
||||
|
||||
// Fees is the amount of fees to use in tests
|
||||
const Fees = "1stake"
|
||||
|
||||
// FeeDenom is the fee denomination for e2e test cases
|
||||
const FeeDenom = "stake"
|
||||
const FeeDenom = "plmnt"
|
||||
|
||||
// DefaultDerivationPath is the BIP44Prefix for PLMNT (see https://github.com/satoshilabs/slips/blob/master/slip-0044.md)
|
||||
const DefaultDerivationPath = "m/44'/8680'/0'/0/0"
|
||||
|
@ -1,7 +1,6 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -40,7 +39,7 @@ func lazyLoadMQTTClient() {
|
||||
|
||||
conf := config.GetConfig()
|
||||
hostPort := net.JoinHostPort(conf.MqttDomain, strconv.FormatInt(int64(conf.MqttPort), 10))
|
||||
uri := fmt.Sprintf("tcp://%s", hostPort)
|
||||
uri := "tcp://%s" + hostPort
|
||||
|
||||
opts := mqtt.NewClientOptions().AddBroker(uri)
|
||||
opts.SetClientID(conf.ValidatorAddress)
|
||||
@ -104,7 +103,7 @@ func GetMqttStatusOfParticipant(address string, responseTimeoutInMs int64) (isAv
|
||||
if ok {
|
||||
return
|
||||
}
|
||||
var messageHandler mqtt.MessageHandler = func(client mqtt.Client, msg mqtt.Message) {
|
||||
var messageHandler mqtt.MessageHandler = func(_ mqtt.Client, msg mqtt.Message) {
|
||||
topicParts := strings.Split(msg.Topic(), "/")
|
||||
if len(topicParts) == 3 && topicParts[1] == address {
|
||||
rwMu.Lock() // Lock for writing
|
||||
|
@ -1,7 +1,6 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@ -19,7 +18,7 @@ var (
|
||||
func GetTxCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: types.ModuleName,
|
||||
Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName),
|
||||
Short: types.ModuleName + " transactions subcommands",
|
||||
DisableFlagParsing: true,
|
||||
SuggestionsMinimumDistance: 2,
|
||||
RunE: client.ValidateCmd,
|
||||
|
@ -1,8 +1,6 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cometbft/cometbft/libs/log"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
@ -47,5 +45,5 @@ func NewKeeper(
|
||||
}
|
||||
|
||||
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
||||
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
|
||||
return ctx.Logger().With("module", "x/"+types.ModuleName)
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@ -19,7 +18,7 @@ var (
|
||||
func GetTxCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: types.ModuleName,
|
||||
Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName),
|
||||
Short: types.ModuleName + " transactions subcommands",
|
||||
DisableFlagParsing: true,
|
||||
SuggestionsMinimumDistance: 2,
|
||||
RunE: client.ValidateCmd,
|
||||
|
@ -1,8 +1,6 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
db "github.com/cometbft/cometbft-db"
|
||||
"github.com/cometbft/cometbft/libs/log"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
@ -72,7 +70,7 @@ func NewKeeper(
|
||||
}
|
||||
|
||||
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
||||
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
|
||||
return ctx.Logger().With("module", "x/"+types.ModuleName)
|
||||
}
|
||||
|
||||
func (k Keeper) SelectPopParticipants(ctx sdk.Context) (challenger string, challengee string) {
|
||||
|
@ -22,7 +22,8 @@ func (k Keeper) RedeemClaimAll(goCtx context.Context, req *types.QueryAllRedeemC
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
redeemClaimStore := prefix.NewStore(store, types.KeyPrefix(types.RedeemClaimKeyPrefix))
|
||||
|
||||
pageRes, err := query.Paginate(redeemClaimStore, req.Pagination, func(key []byte, value []byte) error {
|
||||
// revive linter: from func(key []byte, value []byte) to func(_ []byte, value []byte)
|
||||
pageRes, err := query.Paginate(redeemClaimStore, req.Pagination, func(_ []byte, value []byte) error {
|
||||
var redeemClaim types.RedeemClaim
|
||||
if err := k.cdc.Unmarshal(value, &redeemClaim); err != nil {
|
||||
return err
|
||||
|
@ -13,7 +13,7 @@ func ParamKeyTable() paramtypes.KeyTable {
|
||||
}
|
||||
|
||||
// NewParams creates a new Params instance
|
||||
func NewParams(mintAddress string, tokenDenom string, feeDenom string, stagedDenom string,
|
||||
func NewParams(mintAddress string, tokenDenom string, stagedDenom string,
|
||||
claimDenom string, reissuanceAsset string, reissuanceEpochs int64, popEpochs int64,
|
||||
distributionOffset int64, distributionAddressEarlyInv string, distributionAddressInvestor string,
|
||||
distributionAddressStrategic string, distributionAddressDao string, distributionAddressPop string,
|
||||
@ -21,7 +21,6 @@ func NewParams(mintAddress string, tokenDenom string, feeDenom string, stagedDen
|
||||
return Params{
|
||||
MintAddress: mintAddress,
|
||||
TokenDenom: tokenDenom,
|
||||
FeeDenom: feeDenom,
|
||||
StagedDenom: stagedDenom,
|
||||
ClaimDenom: claimDenom,
|
||||
ReissuanceAsset: reissuanceAsset,
|
||||
@ -51,7 +50,6 @@ func DefaultParams() Params {
|
||||
return NewParams(
|
||||
"plmnt1dyuhg8ldu3d6nvhrvzzemtc3893dys9v9lvdty",
|
||||
"plmnt",
|
||||
"plmnt",
|
||||
"stagedcrddl",
|
||||
"crddl",
|
||||
"7add40beb27df701e02ee85089c5bc0021bc813823fedb5f1dcb5debda7f3da9",
|
||||
|
@ -27,21 +27,20 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
type Params struct {
|
||||
MintAddress string `protobuf:"bytes,1,opt,name=mint_address,json=mintAddress,proto3" json:"mint_address,omitempty"`
|
||||
TokenDenom string `protobuf:"bytes,2,opt,name=token_denom,json=tokenDenom,proto3" json:"token_denom,omitempty"`
|
||||
FeeDenom string `protobuf:"bytes,3,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"`
|
||||
StagedDenom string `protobuf:"bytes,4,opt,name=staged_denom,json=stagedDenom,proto3" json:"staged_denom,omitempty"`
|
||||
ClaimDenom string `protobuf:"bytes,5,opt,name=claim_denom,json=claimDenom,proto3" json:"claim_denom,omitempty"`
|
||||
ReissuanceAsset string `protobuf:"bytes,6,opt,name=reissuance_asset,json=reissuanceAsset,proto3" json:"reissuance_asset,omitempty"`
|
||||
ReissuanceEpochs int64 `protobuf:"varint,7,opt,name=reissuance_epochs,json=reissuanceEpochs,proto3" json:"reissuance_epochs,omitempty"`
|
||||
PopEpochs int64 `protobuf:"varint,8,opt,name=pop_epochs,json=popEpochs,proto3" json:"pop_epochs,omitempty"`
|
||||
DistributionOffset int64 `protobuf:"varint,9,opt,name=distribution_offset,json=distributionOffset,proto3" json:"distribution_offset,omitempty"`
|
||||
DistributionAddressEarlyInv string `protobuf:"bytes,10,opt,name=distribution_address_early_inv,json=distributionAddressEarlyInv,proto3" json:"distribution_address_early_inv,omitempty"`
|
||||
DistributionAddressInvestor string `protobuf:"bytes,11,opt,name=distribution_address_investor,json=distributionAddressInvestor,proto3" json:"distribution_address_investor,omitempty"`
|
||||
DistributionAddressStrategic string `protobuf:"bytes,12,opt,name=distribution_address_strategic,json=distributionAddressStrategic,proto3" json:"distribution_address_strategic,omitempty"`
|
||||
DistributionAddressDao string `protobuf:"bytes,13,opt,name=distribution_address_dao,json=distributionAddressDao,proto3" json:"distribution_address_dao,omitempty"`
|
||||
DistributionAddressPop string `protobuf:"bytes,14,opt,name=distribution_address_pop,json=distributionAddressPop,proto3" json:"distribution_address_pop,omitempty"`
|
||||
MqttResponseTimeout int64 `protobuf:"varint,15,opt,name=mqtt_response_timeout,json=mqttResponseTimeout,proto3" json:"mqtt_response_timeout,omitempty"`
|
||||
ClaimAddress string `protobuf:"bytes,16,opt,name=claim_address,json=claimAddress,proto3" json:"claim_address,omitempty"`
|
||||
TxGasLimit uint64 `protobuf:"varint,17,opt,name=tx_gas_limit,json=txGasLimit,proto3" json:"tx_gas_limit,omitempty"`
|
||||
StagedDenom string `protobuf:"bytes,3,opt,name=staged_denom,json=stagedDenom,proto3" json:"staged_denom,omitempty"`
|
||||
ClaimDenom string `protobuf:"bytes,4,opt,name=claim_denom,json=claimDenom,proto3" json:"claim_denom,omitempty"`
|
||||
ReissuanceAsset string `protobuf:"bytes,5,opt,name=reissuance_asset,json=reissuanceAsset,proto3" json:"reissuance_asset,omitempty"`
|
||||
ReissuanceEpochs int64 `protobuf:"varint,6,opt,name=reissuance_epochs,json=reissuanceEpochs,proto3" json:"reissuance_epochs,omitempty"`
|
||||
PopEpochs int64 `protobuf:"varint,7,opt,name=pop_epochs,json=popEpochs,proto3" json:"pop_epochs,omitempty"`
|
||||
DistributionOffset int64 `protobuf:"varint,8,opt,name=distribution_offset,json=distributionOffset,proto3" json:"distribution_offset,omitempty"`
|
||||
DistributionAddressEarlyInv string `protobuf:"bytes,9,opt,name=distribution_address_early_inv,json=distributionAddressEarlyInv,proto3" json:"distribution_address_early_inv,omitempty"`
|
||||
DistributionAddressInvestor string `protobuf:"bytes,10,opt,name=distribution_address_investor,json=distributionAddressInvestor,proto3" json:"distribution_address_investor,omitempty"`
|
||||
DistributionAddressStrategic string `protobuf:"bytes,11,opt,name=distribution_address_strategic,json=distributionAddressStrategic,proto3" json:"distribution_address_strategic,omitempty"`
|
||||
DistributionAddressDao string `protobuf:"bytes,12,opt,name=distribution_address_dao,json=distributionAddressDao,proto3" json:"distribution_address_dao,omitempty"`
|
||||
DistributionAddressPop string `protobuf:"bytes,13,opt,name=distribution_address_pop,json=distributionAddressPop,proto3" json:"distribution_address_pop,omitempty"`
|
||||
MqttResponseTimeout int64 `protobuf:"varint,14,opt,name=mqtt_response_timeout,json=mqttResponseTimeout,proto3" json:"mqtt_response_timeout,omitempty"`
|
||||
ClaimAddress string `protobuf:"bytes,15,opt,name=claim_address,json=claimAddress,proto3" json:"claim_address,omitempty"`
|
||||
TxGasLimit uint64 `protobuf:"varint,16,opt,name=tx_gas_limit,json=txGasLimit,proto3" json:"tx_gas_limit,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Params) Reset() { *m = Params{} }
|
||||
@ -90,13 +89,6 @@ func (m *Params) GetTokenDenom() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Params) GetFeeDenom() string {
|
||||
if m != nil {
|
||||
return m.FeeDenom
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Params) GetStagedDenom() string {
|
||||
if m != nil {
|
||||
return m.StagedDenom
|
||||
@ -202,39 +194,38 @@ func init() {
|
||||
func init() { proto.RegisterFile("planetmintgo/dao/params.proto", fileDescriptor_a58575036b3ad531) }
|
||||
|
||||
var fileDescriptor_a58575036b3ad531 = []byte{
|
||||
// 507 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0x41, 0x6f, 0x12, 0x41,
|
||||
0x14, 0xc7, 0x59, 0x8b, 0x58, 0x1e, 0xd4, 0xd2, 0xa9, 0x9a, 0x89, 0x95, 0x85, 0xea, 0x05, 0x63,
|
||||
0x64, 0x13, 0xbd, 0x18, 0x6f, 0xad, 0x34, 0x86, 0xc4, 0xc4, 0x06, 0x3d, 0x79, 0xd9, 0x0c, 0xec,
|
||||
0xb0, 0x9d, 0xc8, 0xee, 0x1b, 0x77, 0x1e, 0x84, 0x7e, 0x0b, 0x8f, 0x7a, 0xf3, 0xe3, 0x78, 0xec,
|
||||
0xd1, 0xa3, 0x81, 0x2f, 0x62, 0x76, 0x66, 0x49, 0xd7, 0x04, 0x6e, 0x93, 0xff, 0xef, 0xf7, 0xde,
|
||||
0x9b, 0x4c, 0xe6, 0x41, 0x5b, 0xcf, 0x44, 0x2a, 0x29, 0x51, 0x29, 0xc5, 0x18, 0x44, 0x02, 0x03,
|
||||
0x2d, 0x32, 0x91, 0x98, 0xbe, 0xce, 0x90, 0x90, 0xb5, 0xca, 0xb8, 0x1f, 0x09, 0x7c, 0xfc, 0x20,
|
||||
0xc6, 0x18, 0x2d, 0x0c, 0xf2, 0x93, 0xf3, 0x9e, 0xfe, 0xac, 0x41, 0xed, 0xd2, 0x16, 0xb2, 0x53,
|
||||
0x68, 0xe6, 0x7a, 0x28, 0xa2, 0x28, 0x93, 0xc6, 0x70, 0xaf, 0xeb, 0xf5, 0xea, 0xa3, 0x46, 0x9e,
|
||||
0x9d, 0xb9, 0x88, 0x75, 0xa0, 0x41, 0xf8, 0x55, 0xa6, 0x61, 0x24, 0x53, 0x4c, 0xf8, 0x1d, 0x6b,
|
||||
0x80, 0x8d, 0x06, 0x79, 0xc2, 0x4e, 0xa0, 0x3e, 0x95, 0xb2, 0xc0, 0x7b, 0x16, 0xef, 0x4f, 0xa5,
|
||||
0x74, 0xf0, 0x14, 0x9a, 0x86, 0x44, 0x2c, 0xa3, 0x82, 0x57, 0xdd, 0x00, 0x97, 0x39, 0xa5, 0x03,
|
||||
0x8d, 0xc9, 0x4c, 0xa8, 0xa4, 0x30, 0xee, 0xba, 0x01, 0x36, 0x72, 0xc2, 0x73, 0x68, 0x65, 0x52,
|
||||
0x19, 0x33, 0x17, 0xe9, 0x44, 0x86, 0xc2, 0x18, 0x49, 0xbc, 0x66, 0xad, 0xc3, 0xdb, 0xfc, 0x2c,
|
||||
0x8f, 0xd9, 0x0b, 0x38, 0x2a, 0xa9, 0x52, 0xe3, 0xe4, 0xca, 0xf0, 0x7b, 0x5d, 0xaf, 0xb7, 0x37,
|
||||
0x2a, 0xf5, 0xb8, 0xb0, 0x39, 0x6b, 0x03, 0x68, 0xd4, 0x1b, 0x6b, 0xdf, 0x5a, 0x75, 0x8d, 0xba,
|
||||
0xc0, 0x01, 0x1c, 0x47, 0xca, 0x50, 0xa6, 0xc6, 0x73, 0x52, 0x98, 0x86, 0x38, 0x9d, 0xe6, 0x93,
|
||||
0xeb, 0xd6, 0x63, 0x65, 0xf4, 0xd1, 0x12, 0xf6, 0x0e, 0xfc, 0xff, 0x0a, 0x8a, 0x47, 0x0d, 0xa5,
|
||||
0xc8, 0x66, 0xd7, 0xa1, 0x4a, 0x17, 0x1c, 0xec, 0xad, 0x4f, 0xca, 0x56, 0xf1, 0xcc, 0x17, 0xb9,
|
||||
0x33, 0x4c, 0x17, 0xec, 0x1c, 0xda, 0x5b, 0x9b, 0xa8, 0x74, 0x21, 0x0d, 0x61, 0xc6, 0x1b, 0x3b,
|
||||
0x7b, 0x0c, 0x0b, 0x85, 0x0d, 0x76, 0x5c, 0xc4, 0x50, 0x26, 0x48, 0xc6, 0x6a, 0xc2, 0x9b, 0xb6,
|
||||
0xc9, 0x93, 0x2d, 0x4d, 0x3e, 0x6d, 0x1c, 0xf6, 0x06, 0xf8, 0xd6, 0x2e, 0x91, 0x40, 0x7e, 0x60,
|
||||
0xeb, 0x1f, 0x6d, 0xa9, 0x1f, 0x08, 0xdc, 0x59, 0xa9, 0x51, 0xf3, 0xfb, 0x3b, 0x2b, 0x2f, 0x51,
|
||||
0xb3, 0x57, 0xf0, 0x30, 0xf9, 0x46, 0x14, 0x66, 0xd2, 0x68, 0x4c, 0x8d, 0x0c, 0x49, 0x25, 0x12,
|
||||
0xe7, 0xc4, 0x0f, 0xed, 0xab, 0x1f, 0xe7, 0x70, 0x54, 0xb0, 0xcf, 0x0e, 0xb1, 0x67, 0x70, 0xe0,
|
||||
0xfe, 0xcf, 0xe6, 0x13, 0xb7, 0xec, 0x88, 0xa6, 0x0d, 0x37, 0xbf, 0xb8, 0x0b, 0x4d, 0x5a, 0x86,
|
||||
0xb1, 0x30, 0xe1, 0x4c, 0x25, 0x8a, 0xf8, 0x51, 0xd7, 0xeb, 0x55, 0x47, 0x40, 0xcb, 0xf7, 0xc2,
|
||||
0x7c, 0xc8, 0x93, 0xb7, 0xd5, 0x1f, 0xbf, 0x3a, 0x95, 0xf3, 0xe1, 0xef, 0x95, 0xef, 0xdd, 0xac,
|
||||
0x7c, 0xef, 0xef, 0xca, 0xf7, 0xbe, 0xaf, 0xfd, 0xca, 0xcd, 0xda, 0xaf, 0xfc, 0x59, 0xfb, 0x95,
|
||||
0x2f, 0x41, 0xac, 0xe8, 0x6a, 0x3e, 0xee, 0x4f, 0x30, 0x09, 0x6e, 0x17, 0xad, 0x74, 0x7c, 0x19,
|
||||
0x63, 0xb0, 0xb4, 0x5b, 0x49, 0xd7, 0x5a, 0x9a, 0x71, 0xcd, 0x6e, 0xdb, 0xeb, 0x7f, 0x01, 0x00,
|
||||
0x00, 0xff, 0xff, 0x45, 0xb8, 0xbd, 0x25, 0xb6, 0x03, 0x00, 0x00,
|
||||
// 493 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xb1, 0x6f, 0x13, 0x31,
|
||||
0x14, 0xc6, 0x73, 0x34, 0x0d, 0xc4, 0x49, 0x69, 0x70, 0x01, 0x59, 0x40, 0x2e, 0x01, 0x96, 0x20,
|
||||
0x44, 0x4e, 0x82, 0x05, 0xb1, 0xb5, 0xa4, 0x42, 0x91, 0x90, 0xa8, 0x02, 0x13, 0x8b, 0xe5, 0xdc,
|
||||
0xb9, 0x57, 0x8b, 0x9c, 0x9f, 0x39, 0xbf, 0x44, 0xe9, 0x7f, 0xc1, 0xc8, 0xc8, 0x9f, 0xc3, 0xd8,
|
||||
0x91, 0x11, 0x25, 0xff, 0x06, 0x03, 0xb2, 0xef, 0xa2, 0x5e, 0xa5, 0x64, 0xb3, 0xbe, 0xef, 0xf7,
|
||||
0x7d, 0xb6, 0xac, 0xf7, 0x48, 0xd7, 0xcc, 0x84, 0x96, 0x98, 0x29, 0x8d, 0x29, 0x44, 0x89, 0x80,
|
||||
0xc8, 0x88, 0x5c, 0x64, 0x76, 0x68, 0x72, 0x40, 0xa0, 0x9d, 0xaa, 0x3d, 0x4c, 0x04, 0x3c, 0xba,
|
||||
0x9f, 0x42, 0x0a, 0xde, 0x8c, 0xdc, 0xa9, 0xe0, 0x9e, 0xfd, 0xdb, 0x27, 0x8d, 0x33, 0x1f, 0xa4,
|
||||
0x4f, 0x49, 0xdb, 0xe1, 0x5c, 0x24, 0x49, 0x2e, 0xad, 0x65, 0x41, 0x3f, 0x18, 0x34, 0x27, 0x2d,
|
||||
0xa7, 0x1d, 0x17, 0x12, 0xed, 0x91, 0x16, 0xc2, 0x37, 0xa9, 0x79, 0x22, 0x35, 0x64, 0xec, 0x96,
|
||||
0x27, 0x88, 0x97, 0x46, 0x4e, 0x71, 0x1d, 0x16, 0x45, 0x2a, 0x93, 0x92, 0xd8, 0x2b, 0x3a, 0x0a,
|
||||
0xad, 0x40, 0x7a, 0xa4, 0x15, 0xcf, 0x84, 0xca, 0x4a, 0xa2, 0x5e, 0x74, 0x78, 0xa9, 0x00, 0x5e,
|
||||
0x90, 0x4e, 0x2e, 0x95, 0xb5, 0x73, 0xa1, 0x63, 0xc9, 0x85, 0xb5, 0x12, 0xd9, 0xbe, 0xa7, 0x0e,
|
||||
0xaf, 0xf5, 0x63, 0x27, 0xd3, 0x97, 0xe4, 0x5e, 0x05, 0x95, 0x06, 0xe2, 0x0b, 0xcb, 0x1a, 0xfd,
|
||||
0x60, 0xb0, 0x37, 0xa9, 0x74, 0x9c, 0x7a, 0x9d, 0x76, 0x09, 0x31, 0x60, 0x36, 0xd4, 0x6d, 0x4f,
|
||||
0x35, 0x0d, 0x98, 0xd2, 0x8e, 0xc8, 0x51, 0xa2, 0x2c, 0xe6, 0x6a, 0x3a, 0x47, 0x05, 0x9a, 0xc3,
|
||||
0xf9, 0xb9, 0xbb, 0xf9, 0x8e, 0xe7, 0x68, 0xd5, 0xfa, 0xe4, 0x1d, 0xfa, 0x9e, 0x84, 0x37, 0x02,
|
||||
0xe5, 0xbf, 0x71, 0x29, 0xf2, 0xd9, 0x25, 0x57, 0x7a, 0xc1, 0x9a, 0xfe, 0xd5, 0x8f, 0xab, 0x54,
|
||||
0xf9, 0x93, 0xa7, 0x8e, 0x19, 0xeb, 0x05, 0x3d, 0x21, 0xdd, 0xad, 0x25, 0x4a, 0x2f, 0xa4, 0x45,
|
||||
0xc8, 0x19, 0xd9, 0xd9, 0x31, 0x2e, 0x11, 0x3a, 0xda, 0xf1, 0x10, 0x8b, 0xb9, 0x40, 0x99, 0xaa,
|
||||
0x98, 0xb5, 0x7c, 0xc9, 0x93, 0x2d, 0x25, 0x9f, 0x37, 0x0c, 0x7d, 0x4b, 0xd8, 0xd6, 0x96, 0x44,
|
||||
0x00, 0x6b, 0xfb, 0xfc, 0xc3, 0x2d, 0xf9, 0x91, 0x80, 0x9d, 0x49, 0x03, 0x86, 0x1d, 0xec, 0x4c,
|
||||
0x9e, 0x81, 0xa1, 0xaf, 0xc9, 0x83, 0xec, 0x3b, 0x22, 0xcf, 0xa5, 0x35, 0xa0, 0xad, 0xe4, 0xa8,
|
||||
0x32, 0x09, 0x73, 0x64, 0x77, 0xfd, 0xaf, 0x1f, 0x39, 0x73, 0x52, 0x7a, 0x5f, 0x0a, 0x8b, 0x3e,
|
||||
0x27, 0x07, 0xc5, 0xfc, 0x6c, 0xe6, 0xf4, 0xd0, 0x5f, 0xd1, 0xf6, 0xe2, 0x66, 0x50, 0xfb, 0xa4,
|
||||
0x8d, 0x4b, 0x9e, 0x0a, 0xcb, 0x67, 0x2a, 0x53, 0xc8, 0x3a, 0xfd, 0x60, 0x50, 0x9f, 0x10, 0x5c,
|
||||
0x7e, 0x10, 0xf6, 0xa3, 0x53, 0xde, 0xd5, 0x7f, 0xfe, 0xea, 0xd5, 0x4e, 0xc6, 0xbf, 0x57, 0x61,
|
||||
0x70, 0xb5, 0x0a, 0x83, 0xbf, 0xab, 0x30, 0xf8, 0xb1, 0x0e, 0x6b, 0x57, 0xeb, 0xb0, 0xf6, 0x67,
|
||||
0x1d, 0xd6, 0xbe, 0x46, 0xa9, 0xc2, 0x8b, 0xf9, 0x74, 0x18, 0x43, 0x16, 0x5d, 0xef, 0x52, 0xe5,
|
||||
0xf8, 0x2a, 0x85, 0x68, 0xe9, 0x17, 0x0f, 0x2f, 0x8d, 0xb4, 0xd3, 0x86, 0x5f, 0xa8, 0x37, 0xff,
|
||||
0x03, 0x00, 0x00, 0xff, 0xff, 0x05, 0xd2, 0x9a, 0xb9, 0x99, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *Params) Marshal() (dAtA []byte, err error) {
|
||||
@ -262,98 +253,89 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i--
|
||||
dAtA[i] = 0x1
|
||||
i--
|
||||
dAtA[i] = 0x88
|
||||
dAtA[i] = 0x80
|
||||
}
|
||||
if len(m.ClaimAddress) > 0 {
|
||||
i -= len(m.ClaimAddress)
|
||||
copy(dAtA[i:], m.ClaimAddress)
|
||||
i = encodeVarintParams(dAtA, i, uint64(len(m.ClaimAddress)))
|
||||
i--
|
||||
dAtA[i] = 0x1
|
||||
i--
|
||||
dAtA[i] = 0x82
|
||||
dAtA[i] = 0x7a
|
||||
}
|
||||
if m.MqttResponseTimeout != 0 {
|
||||
i = encodeVarintParams(dAtA, i, uint64(m.MqttResponseTimeout))
|
||||
i--
|
||||
dAtA[i] = 0x78
|
||||
dAtA[i] = 0x70
|
||||
}
|
||||
if len(m.DistributionAddressPop) > 0 {
|
||||
i -= len(m.DistributionAddressPop)
|
||||
copy(dAtA[i:], m.DistributionAddressPop)
|
||||
i = encodeVarintParams(dAtA, i, uint64(len(m.DistributionAddressPop)))
|
||||
i--
|
||||
dAtA[i] = 0x72
|
||||
dAtA[i] = 0x6a
|
||||
}
|
||||
if len(m.DistributionAddressDao) > 0 {
|
||||
i -= len(m.DistributionAddressDao)
|
||||
copy(dAtA[i:], m.DistributionAddressDao)
|
||||
i = encodeVarintParams(dAtA, i, uint64(len(m.DistributionAddressDao)))
|
||||
i--
|
||||
dAtA[i] = 0x6a
|
||||
dAtA[i] = 0x62
|
||||
}
|
||||
if len(m.DistributionAddressStrategic) > 0 {
|
||||
i -= len(m.DistributionAddressStrategic)
|
||||
copy(dAtA[i:], m.DistributionAddressStrategic)
|
||||
i = encodeVarintParams(dAtA, i, uint64(len(m.DistributionAddressStrategic)))
|
||||
i--
|
||||
dAtA[i] = 0x62
|
||||
dAtA[i] = 0x5a
|
||||
}
|
||||
if len(m.DistributionAddressInvestor) > 0 {
|
||||
i -= len(m.DistributionAddressInvestor)
|
||||
copy(dAtA[i:], m.DistributionAddressInvestor)
|
||||
i = encodeVarintParams(dAtA, i, uint64(len(m.DistributionAddressInvestor)))
|
||||
i--
|
||||
dAtA[i] = 0x5a
|
||||
dAtA[i] = 0x52
|
||||
}
|
||||
if len(m.DistributionAddressEarlyInv) > 0 {
|
||||
i -= len(m.DistributionAddressEarlyInv)
|
||||
copy(dAtA[i:], m.DistributionAddressEarlyInv)
|
||||
i = encodeVarintParams(dAtA, i, uint64(len(m.DistributionAddressEarlyInv)))
|
||||
i--
|
||||
dAtA[i] = 0x52
|
||||
dAtA[i] = 0x4a
|
||||
}
|
||||
if m.DistributionOffset != 0 {
|
||||
i = encodeVarintParams(dAtA, i, uint64(m.DistributionOffset))
|
||||
i--
|
||||
dAtA[i] = 0x48
|
||||
dAtA[i] = 0x40
|
||||
}
|
||||
if m.PopEpochs != 0 {
|
||||
i = encodeVarintParams(dAtA, i, uint64(m.PopEpochs))
|
||||
i--
|
||||
dAtA[i] = 0x40
|
||||
dAtA[i] = 0x38
|
||||
}
|
||||
if m.ReissuanceEpochs != 0 {
|
||||
i = encodeVarintParams(dAtA, i, uint64(m.ReissuanceEpochs))
|
||||
i--
|
||||
dAtA[i] = 0x38
|
||||
dAtA[i] = 0x30
|
||||
}
|
||||
if len(m.ReissuanceAsset) > 0 {
|
||||
i -= len(m.ReissuanceAsset)
|
||||
copy(dAtA[i:], m.ReissuanceAsset)
|
||||
i = encodeVarintParams(dAtA, i, uint64(len(m.ReissuanceAsset)))
|
||||
i--
|
||||
dAtA[i] = 0x32
|
||||
dAtA[i] = 0x2a
|
||||
}
|
||||
if len(m.ClaimDenom) > 0 {
|
||||
i -= len(m.ClaimDenom)
|
||||
copy(dAtA[i:], m.ClaimDenom)
|
||||
i = encodeVarintParams(dAtA, i, uint64(len(m.ClaimDenom)))
|
||||
i--
|
||||
dAtA[i] = 0x2a
|
||||
dAtA[i] = 0x22
|
||||
}
|
||||
if len(m.StagedDenom) > 0 {
|
||||
i -= len(m.StagedDenom)
|
||||
copy(dAtA[i:], m.StagedDenom)
|
||||
i = encodeVarintParams(dAtA, i, uint64(len(m.StagedDenom)))
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
}
|
||||
if len(m.FeeDenom) > 0 {
|
||||
i -= len(m.FeeDenom)
|
||||
copy(dAtA[i:], m.FeeDenom)
|
||||
i = encodeVarintParams(dAtA, i, uint64(len(m.FeeDenom)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(m.TokenDenom) > 0 {
|
||||
@ -398,10 +380,6 @@ func (m *Params) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovParams(uint64(l))
|
||||
}
|
||||
l = len(m.FeeDenom)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovParams(uint64(l))
|
||||
}
|
||||
l = len(m.StagedDenom)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovParams(uint64(l))
|
||||
@ -448,7 +426,7 @@ func (m *Params) Size() (n int) {
|
||||
}
|
||||
l = len(m.ClaimAddress)
|
||||
if l > 0 {
|
||||
n += 2 + l + sovParams(uint64(l))
|
||||
n += 1 + l + sovParams(uint64(l))
|
||||
}
|
||||
if m.TxGasLimit != 0 {
|
||||
n += 2 + sovParams(uint64(m.TxGasLimit))
|
||||
@ -556,38 +534,6 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
m.TokenDenom = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field FeeDenom", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowParams
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthParams
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthParams
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.FeeDenom = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field StagedDenom", wireType)
|
||||
}
|
||||
@ -619,7 +565,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.StagedDenom = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 5:
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ClaimDenom", wireType)
|
||||
}
|
||||
@ -651,7 +597,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.ClaimDenom = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 6:
|
||||
case 5:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ReissuanceAsset", wireType)
|
||||
}
|
||||
@ -683,7 +629,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.ReissuanceAsset = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 7:
|
||||
case 6:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ReissuanceEpochs", wireType)
|
||||
}
|
||||
@ -702,7 +648,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 8:
|
||||
case 7:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field PopEpochs", wireType)
|
||||
}
|
||||
@ -721,7 +667,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 9:
|
||||
case 8:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field DistributionOffset", wireType)
|
||||
}
|
||||
@ -740,7 +686,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 10:
|
||||
case 9:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field DistributionAddressEarlyInv", wireType)
|
||||
}
|
||||
@ -772,7 +718,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.DistributionAddressEarlyInv = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 11:
|
||||
case 10:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field DistributionAddressInvestor", wireType)
|
||||
}
|
||||
@ -804,7 +750,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.DistributionAddressInvestor = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 12:
|
||||
case 11:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field DistributionAddressStrategic", wireType)
|
||||
}
|
||||
@ -836,7 +782,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.DistributionAddressStrategic = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 13:
|
||||
case 12:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field DistributionAddressDao", wireType)
|
||||
}
|
||||
@ -868,7 +814,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.DistributionAddressDao = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 14:
|
||||
case 13:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field DistributionAddressPop", wireType)
|
||||
}
|
||||
@ -900,7 +846,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.DistributionAddressPop = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 15:
|
||||
case 14:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field MqttResponseTimeout", wireType)
|
||||
}
|
||||
@ -919,7 +865,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 16:
|
||||
case 15:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ClaimAddress", wireType)
|
||||
}
|
||||
@ -951,7 +897,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.ClaimAddress = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 17:
|
||||
case 16:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field TxGasLimit", wireType)
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@ -19,7 +18,7 @@ var (
|
||||
func GetTxCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: types.ModuleName,
|
||||
Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName),
|
||||
Short: types.ModuleName + " transactions subcommands",
|
||||
DisableFlagParsing: true,
|
||||
SuggestionsMinimumDistance: 2,
|
||||
RunE: client.ValidateCmd,
|
||||
|
@ -1,8 +1,6 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cometbft/cometbft/libs/log"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
@ -56,5 +54,5 @@ func NewKeeper(
|
||||
}
|
||||
|
||||
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
||||
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
|
||||
return ctx.Logger().With("module", "x/"+types.ModuleName)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user