test: migrate last few integration tests to integration/v2 (#23359)
Co-authored-by: Alex | Interchain Labs <alex@skip.money>
This commit is contained in:
parent
9ea03a3c4b
commit
7e391959b9
@ -35,7 +35,7 @@ require (
|
||||
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect
|
||||
cosmossdk.io/collections v1.1.0 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2 // indirect
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/log v1.5.0 // indirect
|
||||
cosmossdk.io/math v1.5.0
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
2
go.mod
2
go.mod
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/log v1.5.0
|
||||
|
||||
4
go.sum
4
go.sum
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -41,7 +41,7 @@ require (
|
||||
require (
|
||||
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2 // indirect
|
||||
cosmossdk.io/depinject v1.1.0 // indirect
|
||||
cosmossdk.io/math v1.5.0 // indirect
|
||||
cosmossdk.io/store v1.10.0-rc.1 // indirect
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -63,7 +63,7 @@ require (
|
||||
cloud.google.com/go/iam v1.3.1 // indirect
|
||||
cloud.google.com/go/storage v1.43.0 // indirect
|
||||
cosmossdk.io/collections v1.1.0 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2 // indirect
|
||||
cosmossdk.io/errors v1.0.1 // indirect
|
||||
cosmossdk.io/errors/v2 v2.0.0 // indirect
|
||||
cosmossdk.io/server/v2/stf v1.0.0-beta.2 // indirect
|
||||
|
||||
@ -616,8 +616,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -36,6 +36,10 @@ Ref: https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.j
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [v1.1.0] - 2025-01-05
|
||||
|
||||
* [#23359](https://github.com/cosmos/cosmos-sdk/pull/23359) Add `RunCommandWithInputAndArgs` on CLIWrapper.
|
||||
|
||||
## [v1.0.0] - 2024-12-19
|
||||
|
||||
* [#22849](https://github.com/cosmos/cosmos-sdk/pull/22849) Avoid telemetry server conflicts on port 7180
|
||||
|
||||
@ -191,6 +191,14 @@ func (c CLIWrapper) RunCommandWithArgs(args ...string) string {
|
||||
return execOutput
|
||||
}
|
||||
|
||||
// RunCommandWithInputAndArgs use for run cli command, not tx
|
||||
// Takes input as io.Reader for the command
|
||||
func (c CLIWrapper) RunCommandWithInputAndArgs(input io.Reader, args ...string) string {
|
||||
c.t.Helper()
|
||||
execOutput, _ := c.runWithInput(args, input)
|
||||
return execOutput
|
||||
}
|
||||
|
||||
// AwaitTxCommitted wait for tx committed on chain
|
||||
// returns the server execution result and true when found within 3 blocks.
|
||||
func (c CLIWrapper) AwaitTxCommitted(submitResp string, timeout ...time.Duration) (string, bool) {
|
||||
|
||||
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/log v1.5.0
|
||||
cosmossdk.io/math v1.5.0
|
||||
@ -33,7 +33,7 @@ require (
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/google/go-cmp v0.6.0
|
||||
github.com/google/gofuzz v1.2.0
|
||||
github.com/spf13/viper v1.19.0
|
||||
github.com/spf13/viper v1.19.0 // indirect
|
||||
gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b
|
||||
)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,261 +0,0 @@
|
||||
package baseapp_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math"
|
||||
"testing"
|
||||
|
||||
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
|
||||
cmtjson "github.com/cometbft/cometbft/libs/json"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
|
||||
coretesting "cosmossdk.io/core/testing"
|
||||
"cosmossdk.io/depinject"
|
||||
"cosmossdk.io/log"
|
||||
sdkmath "cosmossdk.io/math"
|
||||
store "cosmossdk.io/store/types"
|
||||
_ "cosmossdk.io/x/accounts"
|
||||
txsigning "cosmossdk.io/x/tx/signing"
|
||||
|
||||
baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
baseapputil "github.com/cosmos/cosmos-sdk/tests/integration/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/configurator"
|
||||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
|
||||
"github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
|
||||
)
|
||||
|
||||
var blockMaxGas = uint64(simtestutil.DefaultConsensusParams.Block.MaxGas)
|
||||
|
||||
type BlockGasImpl struct {
|
||||
panicTx bool
|
||||
gasToConsume uint64
|
||||
key store.StoreKey
|
||||
}
|
||||
|
||||
func (m BlockGasImpl) Set(ctx context.Context, msg *baseapptestutil.MsgKeyValue) (*baseapptestutil.MsgCreateKeyValueResponse, error) {
|
||||
sdkCtx := sdk.UnwrapSDKContext(ctx)
|
||||
sdkCtx.KVStore(m.key).Set(msg.Key, msg.Value)
|
||||
sdkCtx.GasMeter().ConsumeGas(m.gasToConsume, "TestMsg")
|
||||
if m.panicTx {
|
||||
panic("panic in tx execution")
|
||||
}
|
||||
return &baseapptestutil.MsgCreateKeyValueResponse{}, nil
|
||||
}
|
||||
|
||||
func TestBaseApp_BlockGas(t *testing.T) {
|
||||
testcases := []struct {
|
||||
name string
|
||||
gasToConsume uint64 // gas to consume in the msg execution
|
||||
panicTx bool // panic explicitly in tx execution
|
||||
expErr bool
|
||||
}{
|
||||
{"less than block gas meter", 10, false, false},
|
||||
{"more than block gas meter", blockMaxGas, false, true},
|
||||
{"more than block gas meter", uint64(float64(blockMaxGas) * 1.2), false, true},
|
||||
{"consume MaxUint64", math.MaxUint64, true, true},
|
||||
{"consume MaxGasWanted", txtypes.MaxGasWanted, false, true},
|
||||
{"consume block gas when panicked", 10, true, true},
|
||||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
var (
|
||||
bankKeeper baseapputil.BankKeeper
|
||||
accountKeeper baseapputil.AuthKeeper
|
||||
appBuilder *runtime.AppBuilder
|
||||
txConfig client.TxConfig
|
||||
cdc codec.Codec
|
||||
interfaceRegistry codectypes.InterfaceRegistry
|
||||
err error
|
||||
)
|
||||
|
||||
err = depinject.Inject(
|
||||
depinject.Configs(
|
||||
configurator.NewAppConfig(
|
||||
configurator.AccountsModule(),
|
||||
configurator.AuthModule(),
|
||||
configurator.TxModule(),
|
||||
configurator.ValidateModule(),
|
||||
configurator.ConsensusModule(),
|
||||
configurator.BankModule(),
|
||||
configurator.StakingModule(),
|
||||
),
|
||||
depinject.Supply(log.NewNopLogger()),
|
||||
),
|
||||
&bankKeeper,
|
||||
&accountKeeper,
|
||||
&interfaceRegistry,
|
||||
&txConfig,
|
||||
&cdc,
|
||||
&appBuilder)
|
||||
require.NoError(t, err)
|
||||
|
||||
bapp := appBuilder.Build(coretesting.NewMemDB(), nil)
|
||||
bapp.SetTxEncoder(txConfig.TxEncoder())
|
||||
bapp.SetTxDecoder(txConfig.TxDecoder())
|
||||
|
||||
err = bapp.Load(true)
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
baseapptestutil.RegisterInterfaces(interfaceRegistry)
|
||||
baseapptestutil.RegisterKeyValueServer(bapp.MsgServiceRouter(), BlockGasImpl{
|
||||
panicTx: tc.panicTx,
|
||||
gasToConsume: tc.gasToConsume,
|
||||
key: bapp.UnsafeFindStoreKey(testutil.BankModuleName),
|
||||
})
|
||||
|
||||
genState := baseapputil.GenesisStateWithSingleValidator(t, cdc, appBuilder)
|
||||
stateBytes, err := cmtjson.MarshalIndent(genState, "", " ")
|
||||
require.NoError(t, err)
|
||||
_, err = bapp.InitChain(&abci.InitChainRequest{
|
||||
Validators: []abci.ValidatorUpdate{},
|
||||
ConsensusParams: simtestutil.DefaultConsensusParams,
|
||||
AppStateBytes: stateBytes,
|
||||
})
|
||||
|
||||
require.NoError(t, err)
|
||||
ctx := bapp.NewContext(false)
|
||||
|
||||
// tx fee
|
||||
feeCoin := sdk.NewCoin("atom", sdkmath.NewInt(150))
|
||||
feeAmount := sdk.NewCoins(feeCoin)
|
||||
|
||||
// test account and fund
|
||||
priv1, _, addr1 := testdata.KeyTestPubAddr()
|
||||
err = bankKeeper.MintCoins(ctx, testutil.MintModuleName, feeAmount)
|
||||
require.NoError(t, err)
|
||||
err = bankKeeper.SendCoinsFromModuleToAccount(ctx, testutil.MintModuleName, addr1, feeAmount)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, feeCoin.Amount, bankKeeper.GetBalance(ctx, addr1, feeCoin.Denom).Amount)
|
||||
|
||||
// msg and signatures
|
||||
msg := &baseapptestutil.MsgKeyValue{
|
||||
Key: []byte("ok"),
|
||||
Value: []byte("ok"),
|
||||
Signer: addr1.String(),
|
||||
}
|
||||
|
||||
txBuilder := txConfig.NewTxBuilder()
|
||||
|
||||
require.NoError(t, txBuilder.SetMsgs(msg))
|
||||
txBuilder.SetFeeAmount(feeAmount)
|
||||
txBuilder.SetGasLimit(uint64(simtestutil.DefaultConsensusParams.Block.MaxGas))
|
||||
|
||||
privs, accNums, accSeqs := []cryptotypes.PrivKey{priv1}, []uint64{0}, []uint64{0}
|
||||
_, txBytes, err := createTestTx(txConfig, txBuilder, privs, accNums, accSeqs, ctx.ChainID())
|
||||
require.NoError(t, err)
|
||||
|
||||
rsp, err := bapp.FinalizeBlock(&abci.FinalizeBlockRequest{Height: 1, Txs: [][]byte{txBytes}})
|
||||
require.NoError(t, err)
|
||||
|
||||
// check result
|
||||
ctx = bapp.GetContextForFinalizeBlock(txBytes)
|
||||
okValue := ctx.KVStore(bapp.UnsafeFindStoreKey(testutil.BankModuleName)).Get([]byte("ok"))
|
||||
|
||||
if tc.expErr {
|
||||
if tc.panicTx {
|
||||
require.Equal(t, sdkerrors.ErrPanic.ABCICode(), rsp.TxResults[0].Code)
|
||||
} else {
|
||||
require.Equal(t, sdkerrors.ErrOutOfGas.ABCICode(), rsp.TxResults[0].Code)
|
||||
}
|
||||
require.Empty(t, okValue)
|
||||
} else {
|
||||
require.Equal(t, uint32(0), rsp.TxResults[0].Code, "failure", rsp.TxResults[0].Log)
|
||||
require.Equal(t, []byte("ok"), okValue)
|
||||
}
|
||||
// check block gas is always consumed
|
||||
baseGas := uint64(39075) // baseGas is the gas consumed before tx msg
|
||||
expGasConsumed := addUint64Saturating(tc.gasToConsume, baseGas)
|
||||
if expGasConsumed > uint64(simtestutil.DefaultConsensusParams.Block.MaxGas) {
|
||||
// capped by gasLimit
|
||||
expGasConsumed = uint64(simtestutil.DefaultConsensusParams.Block.MaxGas)
|
||||
}
|
||||
require.Equal(t, int(expGasConsumed), int(ctx.BlockGasMeter().GasConsumed()))
|
||||
// tx fee is always deducted
|
||||
require.Equal(t, int64(0), bankKeeper.GetBalance(ctx, addr1, feeCoin.Denom).Amount.Int64())
|
||||
// sender's sequence is always increased
|
||||
seq := accountKeeper.GetAccount(ctx, addr1).GetSequence()
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, uint64(1), seq)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func createTestTx(txConfig client.TxConfig, txBuilder client.TxBuilder, privs []cryptotypes.PrivKey, accNums, accSeqs []uint64, chainID string) (xauthsigning.Tx, []byte, error) {
|
||||
// First round: we gather all the signer infos. We use the "set empty
|
||||
// signature" hack to do that.
|
||||
var sigsV2 []signing.SignatureV2
|
||||
for i, priv := range privs {
|
||||
sigV2 := signing.SignatureV2{
|
||||
PubKey: priv.PubKey(),
|
||||
Data: &signing.SingleSignatureData{
|
||||
SignMode: txConfig.SignModeHandler().DefaultMode(),
|
||||
Signature: nil,
|
||||
},
|
||||
Sequence: accSeqs[i],
|
||||
}
|
||||
|
||||
sigsV2 = append(sigsV2, sigV2)
|
||||
}
|
||||
err := txBuilder.SetSignatures(sigsV2...)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// Second round: all signer infos are set, so each signer can sign.
|
||||
sigsV2 = []signing.SignatureV2{}
|
||||
for i, priv := range privs {
|
||||
anyPk, err := codectypes.NewAnyWithValue(priv.PubKey())
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
signerData := txsigning.SignerData{
|
||||
Address: sdk.AccAddress(priv.PubKey().Bytes()).String(),
|
||||
ChainID: chainID,
|
||||
AccountNumber: accNums[i],
|
||||
Sequence: accSeqs[i],
|
||||
PubKey: &anypb.Any{TypeUrl: anyPk.TypeUrl, Value: anyPk.Value},
|
||||
}
|
||||
sigV2, err := tx.SignWithPrivKey(
|
||||
context.TODO(), txConfig.SignModeHandler().DefaultMode(), signerData,
|
||||
txBuilder, priv, txConfig, accSeqs[i])
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
sigsV2 = append(sigsV2, sigV2)
|
||||
}
|
||||
err = txBuilder.SetSignatures(sigsV2...)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
txBytes, err := txConfig.TxEncoder()(txBuilder.GetTx())
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return txBuilder.GetTx(), txBytes, nil
|
||||
}
|
||||
|
||||
func addUint64Saturating(a, b uint64) uint64 {
|
||||
if math.MaxUint64-a < b {
|
||||
return math.MaxUint64
|
||||
}
|
||||
|
||||
return a + b
|
||||
}
|
||||
@ -1,67 +0,0 @@
|
||||
package baseapp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
cmttypes "github.com/cometbft/cometbft/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
_ "cosmossdk.io/x/bank"
|
||||
banktypes "cosmossdk.io/x/bank/types"
|
||||
_ "cosmossdk.io/x/consensus"
|
||||
_ "cosmossdk.io/x/staking"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/mock"
|
||||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
_ "github.com/cosmos/cosmos-sdk/x/auth"
|
||||
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
)
|
||||
|
||||
// GenesisStateWithSingleValidator initializes GenesisState with a single validator and genesis accounts
|
||||
// that also act as delegators.
|
||||
func GenesisStateWithSingleValidator(t *testing.T, codec codec.Codec, builder *runtime.AppBuilder) map[string]json.RawMessage {
|
||||
t.Helper()
|
||||
|
||||
privVal := mock.NewPV()
|
||||
pubKey, err := privVal.GetPubKey()
|
||||
require.NoError(t, err)
|
||||
|
||||
// create validator set with single validator
|
||||
validator := cmttypes.NewValidator(pubKey, 1)
|
||||
valSet := cmttypes.NewValidatorSet([]*cmttypes.Validator{validator})
|
||||
|
||||
// generate genesis account
|
||||
senderPrivKey := secp256k1.GenPrivKey()
|
||||
acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0)
|
||||
balances := []banktypes.Balance{
|
||||
{
|
||||
Address: acc.GetAddress().String(),
|
||||
Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100000000000000))),
|
||||
},
|
||||
}
|
||||
|
||||
genesisState := builder.DefaultGenesis()
|
||||
// sus
|
||||
genesisState, err = simtestutil.GenesisStateWithValSet(codec, genesisState, valSet, []authtypes.GenesisAccount{acc}, balances...)
|
||||
require.NoError(t, err)
|
||||
|
||||
return genesisState
|
||||
}
|
||||
|
||||
type BankKeeper interface {
|
||||
MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error
|
||||
SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
|
||||
GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin
|
||||
}
|
||||
|
||||
type AuthKeeper interface {
|
||||
GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
|
||||
}
|
||||
@ -1,69 +0,0 @@
|
||||
package genutil
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
abciproto "github.com/cometbft/cometbft/api/cometbft/abci/v1"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
)
|
||||
|
||||
type cometABCIWrapper struct {
|
||||
app *runtime.App
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) Info(_ context.Context, req *abciproto.InfoRequest) (*abciproto.InfoResponse, error) {
|
||||
return w.app.Info(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) Query(ctx context.Context, req *abciproto.QueryRequest) (*abciproto.QueryResponse, error) {
|
||||
return w.app.Query(ctx, req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) CheckTx(_ context.Context, req *abciproto.CheckTxRequest) (*abciproto.CheckTxResponse, error) {
|
||||
return w.app.CheckTx(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) InitChain(_ context.Context, req *abciproto.InitChainRequest) (*abciproto.InitChainResponse, error) {
|
||||
return w.app.InitChain(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) PrepareProposal(_ context.Context, req *abciproto.PrepareProposalRequest) (*abciproto.PrepareProposalResponse, error) {
|
||||
return w.app.PrepareProposal(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) ProcessProposal(_ context.Context, req *abciproto.ProcessProposalRequest) (*abciproto.ProcessProposalResponse, error) {
|
||||
return w.app.ProcessProposal(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) FinalizeBlock(_ context.Context, req *abciproto.FinalizeBlockRequest) (*abciproto.FinalizeBlockResponse, error) {
|
||||
return w.app.FinalizeBlock(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) ExtendVote(ctx context.Context, req *abciproto.ExtendVoteRequest) (*abciproto.ExtendVoteResponse, error) {
|
||||
return w.app.ExtendVote(ctx, req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) VerifyVoteExtension(_ context.Context, req *abciproto.VerifyVoteExtensionRequest) (*abciproto.VerifyVoteExtensionResponse, error) {
|
||||
return w.app.VerifyVoteExtension(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) Commit(_ context.Context, _ *abciproto.CommitRequest) (*abciproto.CommitResponse, error) {
|
||||
return w.app.Commit()
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) ListSnapshots(_ context.Context, req *abciproto.ListSnapshotsRequest) (*abciproto.ListSnapshotsResponse, error) {
|
||||
return w.app.ListSnapshots(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) OfferSnapshot(_ context.Context, req *abciproto.OfferSnapshotRequest) (*abciproto.OfferSnapshotResponse, error) {
|
||||
return w.app.OfferSnapshot(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) LoadSnapshotChunk(_ context.Context, req *abciproto.LoadSnapshotChunkRequest) (*abciproto.LoadSnapshotChunkResponse, error) {
|
||||
return w.app.LoadSnapshotChunk(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) ApplySnapshotChunk(_ context.Context, req *abciproto.ApplySnapshotChunkRequest) (*abciproto.ApplySnapshotChunkResponse, error) {
|
||||
return w.app.ApplySnapshotChunk(req)
|
||||
}
|
||||
@ -1,298 +0,0 @@
|
||||
package genutil
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
corectx "cosmossdk.io/core/context"
|
||||
"cosmossdk.io/log"
|
||||
banktypes "cosmossdk.io/x/bank/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/hd"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
genutilhelpers "github.com/cosmos/cosmos-sdk/testutil/x/genutil"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil"
|
||||
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
|
||||
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||
)
|
||||
|
||||
func TestAddGenesisAccountCmd(t *testing.T) {
|
||||
_, _, addr1 := testdata.KeyTestPubAddr()
|
||||
ac := codectestutil.CodecOptions{}.GetAddressCodec()
|
||||
addr1Str, err := ac.BytesToString(addr1)
|
||||
require.NoError(t, err)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
addr string
|
||||
denom string
|
||||
withKeyring bool
|
||||
expectErr bool
|
||||
}{
|
||||
{
|
||||
name: "invalid address",
|
||||
addr: "",
|
||||
denom: "1000atom",
|
||||
withKeyring: false,
|
||||
expectErr: true,
|
||||
},
|
||||
{
|
||||
name: "valid address",
|
||||
addr: addr1Str,
|
||||
denom: "1000atom",
|
||||
withKeyring: false,
|
||||
expectErr: false,
|
||||
},
|
||||
{
|
||||
name: "multiple denoms",
|
||||
addr: addr1Str,
|
||||
denom: "1000atom, 2000stake",
|
||||
withKeyring: false,
|
||||
expectErr: false,
|
||||
},
|
||||
{
|
||||
name: "with keyring",
|
||||
addr: "set",
|
||||
denom: "1000atom",
|
||||
withKeyring: true,
|
||||
expectErr: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
logger := log.NewNopLogger()
|
||||
v := viper.New()
|
||||
|
||||
encodingConfig := moduletestutil.MakeTestEncodingConfig(
|
||||
codectestutil.CodecOptions{},
|
||||
auth.AppModule{},
|
||||
)
|
||||
appCodec := encodingConfig.Codec
|
||||
txConfig := encodingConfig.TxConfig
|
||||
err = genutilhelpers.ExecInitCmd(testMbm, home, appCodec)
|
||||
require.NoError(t, err)
|
||||
|
||||
err := writeAndTrackDefaultConfig(v, home)
|
||||
require.NoError(t, err)
|
||||
clientCtx := client.Context{}.WithCodec(appCodec).WithHomeDir(home).
|
||||
WithAddressCodec(ac).WithTxConfig(txConfig)
|
||||
|
||||
if tc.withKeyring {
|
||||
path := hd.CreateHDPath(118, 0, 0).String()
|
||||
kr, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendMemory, home, nil, appCodec)
|
||||
require.NoError(t, err)
|
||||
_, _, err = kr.NewMnemonic(
|
||||
tc.addr,
|
||||
keyring.English,
|
||||
path,
|
||||
keyring.DefaultBIP39Passphrase,
|
||||
hd.Secp256k1,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
clientCtx = clientCtx.WithKeyring(kr)
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
|
||||
ctx = context.WithValue(ctx, corectx.ViperContextKey, v)
|
||||
ctx = context.WithValue(ctx, corectx.LoggerContextKey, logger)
|
||||
|
||||
cmd := genutilcli.AddGenesisAccountCmd()
|
||||
cmd.SetArgs([]string{
|
||||
tc.addr,
|
||||
tc.denom,
|
||||
})
|
||||
|
||||
if tc.expectErr {
|
||||
require.Error(t, cmd.ExecuteContext(ctx))
|
||||
} else {
|
||||
require.NoError(t, cmd.ExecuteContext(ctx))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestBulkAddGenesisAccountCmd(t *testing.T) {
|
||||
ac := codectestutil.CodecOptions{}.GetAddressCodec()
|
||||
_, _, addr1 := testdata.KeyTestPubAddr()
|
||||
_, _, addr2 := testdata.KeyTestPubAddr()
|
||||
_, _, addr3 := testdata.KeyTestPubAddr()
|
||||
addr1Str, err := ac.BytesToString(addr1)
|
||||
require.NoError(t, err)
|
||||
addr2Str, err := ac.BytesToString(addr2)
|
||||
require.NoError(t, err)
|
||||
addr3Str, err := ac.BytesToString(addr3)
|
||||
require.NoError(t, err)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
state [][]genutil.GenesisAccount
|
||||
expected map[string]sdk.Coins
|
||||
appendFlag bool
|
||||
expectErr bool
|
||||
}{
|
||||
{
|
||||
name: "invalid address",
|
||||
state: [][]genutil.GenesisAccount{
|
||||
{
|
||||
{
|
||||
Address: "invalid",
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
},
|
||||
},
|
||||
},
|
||||
expectErr: true,
|
||||
},
|
||||
{
|
||||
name: "no append flag for multiple account adds",
|
||||
state: [][]genutil.GenesisAccount{
|
||||
{
|
||||
{
|
||||
Address: addr1Str,
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
},
|
||||
},
|
||||
{
|
||||
{
|
||||
Address: addr1Str,
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 2)),
|
||||
},
|
||||
},
|
||||
},
|
||||
appendFlag: false,
|
||||
expectErr: true,
|
||||
},
|
||||
|
||||
{
|
||||
name: "multiple additions with append",
|
||||
state: [][]genutil.GenesisAccount{
|
||||
{
|
||||
{
|
||||
Address: addr1Str,
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
},
|
||||
{
|
||||
Address: addr2Str,
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
},
|
||||
},
|
||||
{
|
||||
{
|
||||
Address: addr1Str,
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 2)),
|
||||
},
|
||||
{
|
||||
Address: addr2Str,
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("stake", 1)),
|
||||
},
|
||||
{
|
||||
Address: addr3Str,
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
},
|
||||
},
|
||||
},
|
||||
expected: map[string]sdk.Coins{
|
||||
addr1Str: sdk.NewCoins(sdk.NewInt64Coin("test", 3)),
|
||||
addr2Str: sdk.NewCoins(sdk.NewInt64Coin("test", 1), sdk.NewInt64Coin("stake", 1)),
|
||||
addr3Str: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
},
|
||||
appendFlag: true,
|
||||
expectErr: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
logger := log.NewNopLogger()
|
||||
v := viper.New()
|
||||
|
||||
encodingConfig := moduletestutil.MakeTestEncodingConfig(
|
||||
codectestutil.CodecOptions{},
|
||||
auth.AppModule{},
|
||||
)
|
||||
appCodec := encodingConfig.Codec
|
||||
txConfig := encodingConfig.TxConfig
|
||||
err = genutilhelpers.ExecInitCmd(testMbm, home, appCodec)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = writeAndTrackDefaultConfig(v, home)
|
||||
require.NoError(t, err)
|
||||
clientCtx := client.Context{}.WithCodec(appCodec).WithHomeDir(home).
|
||||
WithAddressCodec(ac).WithTxConfig(txConfig)
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
|
||||
ctx = context.WithValue(ctx, corectx.ViperContextKey, v)
|
||||
ctx = context.WithValue(ctx, corectx.LoggerContextKey, logger)
|
||||
|
||||
// The first iteration (pre-append) may not error.
|
||||
// Check if any errors after all state transitions to genesis.
|
||||
doesErr := false
|
||||
|
||||
// apply multiple state iterations if applicable (e.g. --append)
|
||||
for _, state := range tc.state {
|
||||
bz, err := json.Marshal(state)
|
||||
require.NoError(t, err)
|
||||
|
||||
filePath := path.Join(home, "accounts.json")
|
||||
err = os.WriteFile(filePath, bz, 0o600)
|
||||
require.NoError(t, err)
|
||||
|
||||
cmd := genutilcli.AddBulkGenesisAccountCmd()
|
||||
args := []string{filePath}
|
||||
if tc.appendFlag {
|
||||
args = append(args, "--append")
|
||||
}
|
||||
cmd.SetArgs(args)
|
||||
|
||||
err = cmd.ExecuteContext(ctx)
|
||||
if err != nil {
|
||||
doesErr = true
|
||||
}
|
||||
}
|
||||
require.Equal(t, tc.expectErr, doesErr)
|
||||
|
||||
// an error already occurred, no need to check the state
|
||||
if doesErr {
|
||||
return
|
||||
}
|
||||
|
||||
appState, _, err := genutiltypes.GenesisStateFromGenFile(path.Join(home, "config", "genesis.json"))
|
||||
require.NoError(t, err)
|
||||
|
||||
bankState := banktypes.GetGenesisStateFromAppState(encodingConfig.Codec, appState)
|
||||
|
||||
require.EqualValues(t, len(tc.expected), len(bankState.Balances))
|
||||
for _, acc := range bankState.Balances {
|
||||
require.True(
|
||||
t,
|
||||
tc.expected[acc.Address].Equal(acc.Coins),
|
||||
"expected: %v, got: %v",
|
||||
tc.expected[acc.Address],
|
||||
acc.Coins,
|
||||
)
|
||||
}
|
||||
|
||||
expectedSupply := sdk.NewCoins()
|
||||
for _, coins := range tc.expected {
|
||||
expectedSupply = expectedSupply.Add(coins...)
|
||||
}
|
||||
require.Equal(t, expectedSupply, bankState.Supply)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -1,427 +0,0 @@
|
||||
package genutil
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
abci_server "github.com/cometbft/cometbft/abci/server"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
corectx "cosmossdk.io/core/context"
|
||||
"cosmossdk.io/depinject"
|
||||
"cosmossdk.io/log"
|
||||
_ "cosmossdk.io/x/accounts"
|
||||
_ "cosmossdk.io/x/bank"
|
||||
_ "cosmossdk.io/x/consensus"
|
||||
"cosmossdk.io/x/staking"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/types"
|
||||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/configurator"
|
||||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
||||
genutilhelpers "github.com/cosmos/cosmos-sdk/testutil/x/genutil"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil"
|
||||
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
|
||||
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||
_ "github.com/cosmos/cosmos-sdk/x/validate"
|
||||
)
|
||||
|
||||
var testMbm = module.NewManager(
|
||||
staking.NewAppModule(makeCodec(), nil),
|
||||
genutil.NewAppModule(makeCodec(), nil, nil, nil, nil, nil),
|
||||
)
|
||||
|
||||
func TestInitCmd(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
flags func(dir string) []string
|
||||
shouldErr bool
|
||||
err error
|
||||
}{
|
||||
{
|
||||
name: "happy path",
|
||||
flags: func(dir string) []string {
|
||||
return []string{
|
||||
"appnode-test",
|
||||
}
|
||||
},
|
||||
shouldErr: false,
|
||||
err: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
logger := log.NewNopLogger()
|
||||
viper := viper.New()
|
||||
|
||||
err := writeAndTrackDefaultConfig(viper, home)
|
||||
require.NoError(t, err)
|
||||
interfaceRegistry := types.NewInterfaceRegistry()
|
||||
marshaler := codec.NewProtoCodec(interfaceRegistry)
|
||||
clientCtx := client.Context{}.
|
||||
WithCodec(marshaler).
|
||||
WithLegacyAmino(makeAminoCodec()).
|
||||
WithHomeDir(home)
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
|
||||
ctx = context.WithValue(ctx, corectx.ViperContextKey, viper)
|
||||
ctx = context.WithValue(ctx, corectx.LoggerContextKey, logger)
|
||||
|
||||
cmd := genutilcli.InitCmd(testMbm)
|
||||
cmd.SetArgs(
|
||||
tt.flags(home),
|
||||
)
|
||||
|
||||
if tt.shouldErr {
|
||||
err := cmd.ExecuteContext(ctx)
|
||||
require.EqualError(t, err, tt.err.Error())
|
||||
} else {
|
||||
require.NoError(t, cmd.ExecuteContext(ctx))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestInitRecover(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
logger := log.NewNopLogger()
|
||||
viper := viper.New()
|
||||
|
||||
err := writeAndTrackDefaultConfig(viper, home)
|
||||
require.NoError(t, err)
|
||||
interfaceRegistry := types.NewInterfaceRegistry()
|
||||
marshaler := codec.NewProtoCodec(interfaceRegistry)
|
||||
clientCtx := client.Context{}.
|
||||
WithCodec(marshaler).
|
||||
WithLegacyAmino(makeAminoCodec()).
|
||||
WithHomeDir(home)
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
|
||||
ctx = context.WithValue(ctx, corectx.ViperContextKey, viper)
|
||||
ctx = context.WithValue(ctx, corectx.LoggerContextKey, logger)
|
||||
|
||||
cmd := genutilcli.InitCmd(testMbm)
|
||||
cmd.SetContext(ctx)
|
||||
mockIn := testutil.ApplyMockIODiscardOutErr(cmd)
|
||||
|
||||
cmd.SetArgs([]string{
|
||||
"appnode-test",
|
||||
fmt.Sprintf("--%s=true", genutilcli.FlagRecover),
|
||||
})
|
||||
|
||||
// use valid mnemonic and complete recovery key generation successfully
|
||||
mockIn.Reset(
|
||||
"decide praise business actor peasant farm drastic weather extend front hurt later song give verb rhythm worry fun pond reform school tumble august one\n",
|
||||
)
|
||||
require.NoError(t, cmd.ExecuteContext(ctx))
|
||||
}
|
||||
|
||||
func TestInitDefaultBondDenom(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
logger := log.NewNopLogger()
|
||||
viper := viper.New()
|
||||
|
||||
err := writeAndTrackDefaultConfig(viper, home)
|
||||
require.NoError(t, err)
|
||||
interfaceRegistry := types.NewInterfaceRegistry()
|
||||
marshaler := codec.NewProtoCodec(interfaceRegistry)
|
||||
clientCtx := client.Context{}.
|
||||
WithCodec(marshaler).
|
||||
WithLegacyAmino(makeAminoCodec()).
|
||||
WithHomeDir(home)
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
|
||||
ctx = context.WithValue(ctx, corectx.ViperContextKey, viper)
|
||||
ctx = context.WithValue(ctx, corectx.LoggerContextKey, logger)
|
||||
|
||||
cmd := genutilcli.InitCmd(testMbm)
|
||||
|
||||
cmd.SetArgs([]string{
|
||||
"appnode-test",
|
||||
fmt.Sprintf("--%s=testtoken", genutilcli.FlagDefaultBondDenom),
|
||||
})
|
||||
require.NoError(t, cmd.ExecuteContext(ctx))
|
||||
}
|
||||
|
||||
func TestEmptyState(t *testing.T) {
|
||||
// TODO: rewrite for v2: https://github.com/cosmos/cosmos-sdk/issues/20799
|
||||
|
||||
// home := t.TempDir()
|
||||
// logger := log.NewNopLogger()
|
||||
// viper := viper.New()
|
||||
|
||||
// err := writeAndTrackDefaultConfig(viper, home)
|
||||
// require.NoError(t, err)
|
||||
// interfaceRegistry := types.NewInterfaceRegistry()
|
||||
// marshaler := codec.NewProtoCodec(interfaceRegistry)
|
||||
// clientCtx := client.Context{}.
|
||||
// WithCodec(marshaler).
|
||||
// WithLegacyAmino(makeAminoCodec()).
|
||||
// WithHomeDir(home)
|
||||
|
||||
// ctx := context.Background()
|
||||
// ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
|
||||
// ctx = context.WithValue(ctx, corectx.ViperContextKey, viper)
|
||||
// ctx = context.WithValue(ctx, corectx.LoggerContextKey, logger)
|
||||
|
||||
// cmd := genutilcli.InitCmd(testMbm)
|
||||
// cmd.SetArgs([]string{"appnode-test"})
|
||||
|
||||
// require.NoError(t, cmd.ExecuteContext(ctx))
|
||||
|
||||
// old := os.Stdout
|
||||
// r, w, _ := os.Pipe()
|
||||
// os.Stdout = w
|
||||
|
||||
// cmd = genutilcli.ExportCmd(nil)
|
||||
// require.NoError(t, cmd.ExecuteContext(ctx))
|
||||
|
||||
// outC := make(chan string)
|
||||
// go func() {
|
||||
// var buf bytes.Buffer
|
||||
// _, err := io.Copy(&buf, r)
|
||||
// require.NoError(t, err)
|
||||
|
||||
// outC <- buf.String()
|
||||
// }()
|
||||
|
||||
// w.Close()
|
||||
// os.Stdout = old
|
||||
// out := <-outC
|
||||
|
||||
// require.Contains(t, out, "genesis_time")
|
||||
// require.Contains(t, out, "chain_id")
|
||||
// require.Contains(t, out, "consensus")
|
||||
// require.Contains(t, out, "app_hash")
|
||||
// require.Contains(t, out, "app_state")
|
||||
}
|
||||
|
||||
func TestStartStandAlone(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
interfaceRegistry := types.NewInterfaceRegistry()
|
||||
marshaler := codec.NewProtoCodec(interfaceRegistry)
|
||||
err := genutilhelpers.ExecInitCmd(testMbm, home, marshaler)
|
||||
require.NoError(t, err)
|
||||
|
||||
app, err := simtestutil.SetupWithConfiguration(
|
||||
depinject.Configs(
|
||||
configurator.NewAppConfig(
|
||||
configurator.AccountsModule(),
|
||||
configurator.AuthModule(),
|
||||
configurator.StakingModule(),
|
||||
configurator.TxModule(),
|
||||
configurator.ValidateModule(),
|
||||
configurator.ConsensusModule(),
|
||||
configurator.BankModule(),
|
||||
),
|
||||
depinject.Supply(log.NewNopLogger()),
|
||||
), simtestutil.DefaultStartUpConfig())
|
||||
require.NoError(t, err)
|
||||
|
||||
svrAddr, _, closeFn, err := freeTCPAddr()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, closeFn())
|
||||
|
||||
cmtApp := cometABCIWrapper{app}
|
||||
svr, err := abci_server.NewServer(svrAddr, "socket", cmtApp)
|
||||
require.NoError(t, err, "error creating listener")
|
||||
|
||||
err = svr.Start()
|
||||
require.NoError(t, err)
|
||||
|
||||
timer := time.NewTimer(time.Duration(2) * time.Second)
|
||||
for range timer.C {
|
||||
err = svr.Stop()
|
||||
require.NoError(t, err)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func TestInitNodeValidatorFiles(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
cfg, err := genutilhelpers.CreateDefaultCometConfig(home)
|
||||
require.NoError(t, err)
|
||||
|
||||
nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(cfg, ed25519.KeyType)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.NotEqual(t, "", nodeID)
|
||||
require.NotEqual(t, 0, len(valPubKey.Bytes()))
|
||||
}
|
||||
|
||||
func TestInitConfig(t *testing.T) {
|
||||
// TODO: rewrite for v2: https://github.com/cosmos/cosmos-sdk/issues/20799
|
||||
|
||||
// home := t.TempDir()
|
||||
// logger := log.NewNopLogger()
|
||||
// viper := viper.New()
|
||||
|
||||
// err := writeAndTrackDefaultConfig(viper, home)
|
||||
// require.NoError(t, err)
|
||||
// interfaceRegistry := types.NewInterfaceRegistry()
|
||||
// marshaler := codec.NewProtoCodec(interfaceRegistry)
|
||||
// clientCtx := client.Context{}.
|
||||
// WithCodec(marshaler).
|
||||
// WithLegacyAmino(makeAminoCodec()).
|
||||
// WithChainID("foo"). // add chain-id to clientCtx
|
||||
// WithHomeDir(home)
|
||||
|
||||
// ctx := context.Background()
|
||||
// ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
|
||||
// ctx = context.WithValue(ctx, corectx.ViperContextKey, viper)
|
||||
// ctx = context.WithValue(ctx, corectx.LoggerContextKey, logger)
|
||||
|
||||
// cmd := genutilcli.InitCmd(testMbm)
|
||||
// cmd.SetArgs([]string{"testnode"})
|
||||
|
||||
// err = cmd.ExecuteContext(ctx)
|
||||
// require.NoError(t, err)
|
||||
|
||||
// old := os.Stdout
|
||||
// r, w, _ := os.Pipe()
|
||||
// os.Stdout = w
|
||||
|
||||
// cmd = genutilcli.ExportCmd(nil)
|
||||
// require.NoError(t, cmd.ExecuteContext(ctx))
|
||||
|
||||
// outC := make(chan string)
|
||||
// go func() {
|
||||
// var buf bytes.Buffer
|
||||
// _, err := io.Copy(&buf, r)
|
||||
// require.NoError(t, err)
|
||||
// outC <- buf.String()
|
||||
// }()
|
||||
|
||||
// w.Close()
|
||||
// os.Stdout = old
|
||||
// out := <-outC
|
||||
|
||||
// require.Contains(t, out, "\"chain_id\": \"foo\"")
|
||||
}
|
||||
|
||||
func TestInitWithHeight(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
logger := log.NewNopLogger()
|
||||
viper := viper.New()
|
||||
cfg, err := genutilhelpers.CreateDefaultCometConfig(home)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = writeAndTrackDefaultConfig(viper, home)
|
||||
require.NoError(t, err)
|
||||
interfaceRegistry := types.NewInterfaceRegistry()
|
||||
marshaler := codec.NewProtoCodec(interfaceRegistry)
|
||||
clientCtx := client.Context{}.
|
||||
WithCodec(marshaler).
|
||||
WithLegacyAmino(makeAminoCodec()).
|
||||
WithChainID("foo"). // add chain-id to clientCtx
|
||||
WithHomeDir(home)
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
|
||||
ctx = context.WithValue(ctx, corectx.ViperContextKey, viper)
|
||||
ctx = context.WithValue(ctx, corectx.LoggerContextKey, logger)
|
||||
|
||||
testInitialHeight := int64(333)
|
||||
|
||||
cmd := genutilcli.InitCmd(testMbm)
|
||||
|
||||
fmt.Println("RootDir", viper.Get(flags.FlagHome))
|
||||
cmd.SetArgs([]string{"init-height-test", fmt.Sprintf("--%s=%d", flags.FlagInitHeight, testInitialHeight)})
|
||||
|
||||
require.NoError(t, cmd.ExecuteContext(ctx))
|
||||
|
||||
appGenesis, importErr := genutiltypes.AppGenesisFromFile(cfg.GenesisFile())
|
||||
require.NoError(t, importErr)
|
||||
|
||||
require.Equal(t, testInitialHeight, appGenesis.InitialHeight)
|
||||
}
|
||||
|
||||
func TestInitWithNegativeHeight(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
logger := log.NewNopLogger()
|
||||
viper := viper.New()
|
||||
cfg, err := genutilhelpers.CreateDefaultCometConfig(home)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = writeAndTrackDefaultConfig(viper, home)
|
||||
require.NoError(t, err)
|
||||
interfaceRegistry := types.NewInterfaceRegistry()
|
||||
marshaler := codec.NewProtoCodec(interfaceRegistry)
|
||||
clientCtx := client.Context{}.
|
||||
WithCodec(marshaler).
|
||||
WithLegacyAmino(makeAminoCodec()).
|
||||
WithChainID("foo"). // add chain-id to clientCtx
|
||||
WithHomeDir(home)
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
|
||||
ctx = context.WithValue(ctx, corectx.ViperContextKey, viper)
|
||||
ctx = context.WithValue(ctx, corectx.LoggerContextKey, logger)
|
||||
|
||||
testInitialHeight := int64(-333)
|
||||
|
||||
cmd := genutilcli.InitCmd(testMbm)
|
||||
cmd.SetArgs([]string{"init-height-test", fmt.Sprintf("--%s=%d", flags.FlagInitHeight, testInitialHeight)})
|
||||
|
||||
require.NoError(t, cmd.ExecuteContext(ctx))
|
||||
|
||||
appGenesis, importErr := genutiltypes.AppGenesisFromFile(cfg.GenesisFile())
|
||||
require.NoError(t, importErr)
|
||||
|
||||
require.Equal(t, int64(1), appGenesis.InitialHeight)
|
||||
}
|
||||
|
||||
// custom tx codec
|
||||
func makeAminoCodec() *codec.LegacyAmino {
|
||||
cdc := codec.NewLegacyAmino()
|
||||
sdk.RegisterLegacyAminoCodec(cdc)
|
||||
cryptocodec.RegisterCrypto(cdc)
|
||||
return cdc
|
||||
}
|
||||
|
||||
func makeCodec() codec.Codec {
|
||||
interfaceRegistry := types.NewInterfaceRegistry()
|
||||
return codec.NewProtoCodec(interfaceRegistry)
|
||||
}
|
||||
|
||||
func writeAndTrackDefaultConfig(v *viper.Viper, home string) error {
|
||||
cfg, err := genutilhelpers.CreateDefaultCometConfig(home)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return genutilhelpers.WriteAndTrackCometConfig(v, home, cfg)
|
||||
}
|
||||
|
||||
// Get a free address for a test CometBFT server
|
||||
// protocol is either tcp, http, etc
|
||||
func freeTCPAddr() (addr, port string, closeFn func() error, err error) {
|
||||
l, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
if err != nil {
|
||||
return "", "", nil, err
|
||||
}
|
||||
|
||||
closeFn = func() error {
|
||||
return l.Close()
|
||||
}
|
||||
|
||||
portI := l.Addr().(*net.TCPAddr).Port
|
||||
port = fmt.Sprintf("%d", portI)
|
||||
addr = fmt.Sprintf("tcp://127.0.0.1:%s", port)
|
||||
return
|
||||
}
|
||||
@ -2,8 +2,11 @@ package auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
|
||||
rpcclientmock "github.com/cometbft/cometbft/rpc/client/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"cosmossdk.io/core/router"
|
||||
@ -17,15 +20,26 @@ import (
|
||||
"cosmossdk.io/x/accounts"
|
||||
basedepinject "cosmossdk.io/x/accounts/defaults/base/depinject"
|
||||
accountsv1 "cosmossdk.io/x/accounts/v1"
|
||||
_ "cosmossdk.io/x/bank" // import as blank for app wiring
|
||||
"cosmossdk.io/x/bank"
|
||||
bankkeeper "cosmossdk.io/x/bank/keeper"
|
||||
banktypes "cosmossdk.io/x/bank/types"
|
||||
_ "cosmossdk.io/x/consensus" // import as blank for app wiring
|
||||
_ "cosmossdk.io/x/staking" // import as blank for app wirings
|
||||
"cosmossdk.io/x/gov"
|
||||
_ "cosmossdk.io/x/staking" // import as blank for app wirings
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
|
||||
codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/hd"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
"github.com/cosmos/cosmos-sdk/tests/integration/v2"
|
||||
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/configurator"
|
||||
_ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
testutilmod "github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring``
|
||||
_ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import as blank for app wiring
|
||||
@ -34,12 +48,14 @@ import (
|
||||
|
||||
type suite struct {
|
||||
app *integration.App
|
||||
|
||||
ctx context.Context
|
||||
|
||||
authKeeper authkeeper.AccountKeeper
|
||||
accountsKeeper accounts.Keeper
|
||||
bankKeeper bankkeeper.Keeper
|
||||
|
||||
clientCtx client.Context
|
||||
val, val1 sdk.AccAddress
|
||||
}
|
||||
|
||||
func (s suite) mustAddr(address []byte) string {
|
||||
@ -101,6 +117,53 @@ func createTestSuite(t *testing.T) *suite {
|
||||
|
||||
res.ctx = res.app.StateLatestContext(t)
|
||||
|
||||
// setup client context
|
||||
encCfg := testutilmod.MakeTestEncodingConfig(codectestutil.CodecOptions{}, auth.AppModule{}, bank.AppModule{}, gov.AppModule{})
|
||||
clientCtx := client.Context{}.
|
||||
WithKeyring(keyring.NewInMemory(encCfg.Codec)).
|
||||
WithTxConfig(encCfg.TxConfig).
|
||||
WithCodec(encCfg.Codec).
|
||||
WithClient(clitestutil.MockCometRPC{Client: rpcclientmock.Client{}}).
|
||||
WithAccountRetriever(client.MockAccountRetriever{}).
|
||||
WithOutput(io.Discard).
|
||||
WithChainID("test-chain").
|
||||
WithAddressCodec(addresscodec.NewBech32Codec("cosmos")).
|
||||
WithValidatorAddressCodec(addresscodec.NewBech32Codec("cosmosvaloper")).
|
||||
WithConsensusAddressCodec(addresscodec.NewBech32Codec("cosmosvalcons"))
|
||||
|
||||
ctxGen := func() client.Context {
|
||||
bz, _ := encCfg.Codec.Marshal(&sdk.TxResponse{})
|
||||
c := clitestutil.NewMockCometRPC(abci.QueryResponse{
|
||||
Value: bz,
|
||||
})
|
||||
return clientCtx.WithClient(c)
|
||||
}
|
||||
res.clientCtx = ctxGen()
|
||||
|
||||
// setup keyring
|
||||
valAcc, _, err := res.clientCtx.Keyring.NewMnemonic("newAccount", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1)
|
||||
require.NoError(t, err)
|
||||
account1, _, err := res.clientCtx.Keyring.NewMnemonic("newAccount1", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1)
|
||||
require.NoError(t, err)
|
||||
account2, _, err := res.clientCtx.Keyring.NewMnemonic("newAccount2", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1)
|
||||
require.NoError(t, err)
|
||||
_, _, err = res.clientCtx.Keyring.NewMnemonic("dummyAccount", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) // Create a dummy account for testing purpose
|
||||
require.NoError(t, err)
|
||||
|
||||
res.val, err = valAcc.GetAddress()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
res.val1, err = account1.GetAddress()
|
||||
require.NoError(t, err)
|
||||
pub1, err := account1.GetPubKey()
|
||||
require.NoError(t, err)
|
||||
pub2, err := account2.GetPubKey()
|
||||
require.NoError(t, err)
|
||||
|
||||
multi := kmultisig.NewLegacyAminoPubKey(2, []cryptotypes.PubKey{pub1, pub2})
|
||||
_, err = res.clientCtx.Keyring.SaveMultisig("multi", multi)
|
||||
require.NoError(t, err)
|
||||
|
||||
return &res
|
||||
}
|
||||
|
||||
|
||||
1089
tests/integration/v2/auth/client_test.go
Normal file
1089
tests/integration/v2/auth/client_test.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,8 @@ module github.com/cosmos/cosmos-sdk/tests/systemtests
|
||||
|
||||
go 1.23
|
||||
|
||||
replace cosmossdk.io/systemtests => ../../systemtests
|
||||
|
||||
require (
|
||||
cosmossdk.io/math v1.5.0
|
||||
cosmossdk.io/systemtests v1.0.0
|
||||
@ -9,11 +11,6 @@ require (
|
||||
github.com/fullstorydev/grpcurl v1.9.2
|
||||
)
|
||||
|
||||
require (
|
||||
golang.org/x/arch v0.13.0 // indirect
|
||||
golang.org/x/crypto v0.32.0 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect
|
||||
@ -58,7 +55,7 @@ require (
|
||||
github.com/cosmos/iavl v1.2.2 // indirect
|
||||
github.com/cosmos/ics23/go v0.11.0 // indirect
|
||||
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
|
||||
github.com/creachadair/tomledit v0.0.26 // indirect
|
||||
github.com/creachadair/tomledit v0.0.27 // indirect
|
||||
github.com/danieljoos/wincred v1.1.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
|
||||
@ -161,6 +158,8 @@ require (
|
||||
go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
golang.org/x/arch v0.13.0 // indirect
|
||||
golang.org/x/crypto v0.32.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
|
||||
golang.org/x/net v0.34.0 // indirect
|
||||
golang.org/x/sync v0.10.0 // indirect
|
||||
|
||||
@ -20,8 +20,6 @@ cosmossdk.io/math v1.5.0 h1:sbOASxee9Zxdjd6OkzogvBZ25/hP929vdcYcBJQbkLc=
|
||||
cosmossdk.io/math v1.5.0/go.mod h1:AAwwBmUhqtk2nlku174JwSll+/DepUXW3rWIXN5q+Nw=
|
||||
cosmossdk.io/store v1.1.1 h1:NA3PioJtWDVU7cHHeyvdva5J/ggyLDkyH0hGHl2804Y=
|
||||
cosmossdk.io/store v1.1.1/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM=
|
||||
cosmossdk.io/systemtests v1.0.0 h1:VuEj4aA//v1icbMoA6UMuWOwO6ejb6uK7PzSBT+Y460=
|
||||
cosmossdk.io/systemtests v1.0.0/go.mod h1:6kl2MKa7tLoW8vgKx4ZgwAqWVD1T7eAiL5mc/9R7XGY=
|
||||
cosmossdk.io/x/tx v1.1.0 h1:5C5XGNGYzbOTKbcf47oBI/VLObb5bmcMqH/C6H/sp1E=
|
||||
cosmossdk.io/x/tx v1.1.0/go.mod h1:QF15QyTcGH4wfKawfRdSihWwutf4OhgiA+HIwWhjle0=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
@ -174,8 +172,8 @@ github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5n
|
||||
github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creachadair/tomledit v0.0.26 h1:MoDdgHIHZ5PctBVsAZDjxdxreWUEa9ObPKTRkk5PPwA=
|
||||
github.com/creachadair/tomledit v0.0.26/go.mod h1:SJi1OxKpMyR141tq1lzsbPtIg3j8TeVPM/ZftfieD7o=
|
||||
github.com/creachadair/tomledit v0.0.27 h1:6xOpEnkKmcpT/gmKhabN0JXrqNX065lyje1/mXTSSIE=
|
||||
github.com/creachadair/tomledit v0.0.27/go.mod h1:v1EWpgCisD3ct1kO8Gq4o4pdgX5JXD0rBI2PJ4UnPoA=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0=
|
||||
|
||||
67
tests/systemtests/init_test.go
Normal file
67
tests/systemtests/init_test.go
Normal file
@ -0,0 +1,67 @@
|
||||
//go:build system_test
|
||||
|
||||
package systemtests
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
systest "cosmossdk.io/systemtests"
|
||||
|
||||
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||
)
|
||||
|
||||
func TestChainInit(t *testing.T) {
|
||||
systest.Sut.ResetChain(t)
|
||||
cli := systest.NewCLIWrapper(t, systest.Sut, systest.Verbose)
|
||||
|
||||
removeGenesis(t)
|
||||
// init with height
|
||||
testInitialHeight := int64(333)
|
||||
cli.RunCommandWithArgs("init", "test-height", "--initial-height", fmt.Sprintf("%d", testInitialHeight), "--home="+systest.Sut.NodeDir(0))
|
||||
appGenesis, err := genutiltypes.AppGenesisFromFile(systest.Sut.NodeDir(0) + "/config/genesis.json")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, testInitialHeight, appGenesis.InitialHeight)
|
||||
|
||||
removeGenesis(t)
|
||||
// init with negative height
|
||||
testInitialHeight = -333
|
||||
cli.RunCommandWithArgs("init", "test-height", "--initial-height", fmt.Sprintf("%d", testInitialHeight), "--home="+systest.Sut.NodeDir(0))
|
||||
appGenesis, err = genutiltypes.AppGenesisFromFile(systest.Sut.NodeDir(0) + "/config/genesis.json")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, int64(1), appGenesis.InitialHeight)
|
||||
|
||||
removeGenesis(t)
|
||||
// init with custom denom
|
||||
customDenom := "mydenom"
|
||||
cli.RunCommandWithArgs("init", "test-denom", "--default-denom", customDenom, "--home="+systest.Sut.NodeDir(0))
|
||||
appGenesis, err = genutiltypes.AppGenesisFromFile(systest.Sut.NodeDir(0) + "/config/genesis.json")
|
||||
require.NoError(t, err)
|
||||
var appState struct {
|
||||
Staking struct {
|
||||
Params struct {
|
||||
BondDenom string `json:"bond_denom"`
|
||||
} `json:"params"`
|
||||
} `json:"staking"`
|
||||
}
|
||||
err = json.Unmarshal(appGenesis.AppState, &appState)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, customDenom, appState.Staking.Params.BondDenom)
|
||||
|
||||
removeGenesis(t)
|
||||
// init with recover
|
||||
mnemonic := strings.NewReader("decide praise business actor peasant farm drastic weather extend front hurt later song give verb rhythm worry fun pond reform school tumble august one")
|
||||
cli.RunCommandWithInputAndArgs(mnemonic, "init", "test-denom", "--recover", "--home="+systest.Sut.NodeDir(0))
|
||||
_, err = os.Stat(path.Join(systest.Sut.NodeDir(0), "config", "genesis.json"))
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func removeGenesis(t *testing.T) {
|
||||
require.NoError(t, os.Remove(path.Join(systest.Sut.NodeDir(0), "config", "genesis.json")))
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package integration
|
||||
package tests
|
||||
|
||||
import (
|
||||
db "github.com/cosmos/cosmos-db"
|
||||
@ -1,74 +0,0 @@
|
||||
package genutil
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
cmtcfg "github.com/cometbft/cometbft/config"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
corectx "cosmossdk.io/core/context"
|
||||
"cosmossdk.io/log"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
|
||||
)
|
||||
|
||||
func ExecInitCmd(mm *module.Manager, home string, cdc codec.Codec) error {
|
||||
logger := log.NewNopLogger()
|
||||
viper := viper.New()
|
||||
cmd := genutilcli.InitCmd(mm)
|
||||
cfg, _ := CreateDefaultCometConfig(home)
|
||||
err := WriteAndTrackCometConfig(viper, home, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
clientCtx := client.Context{}.WithCodec(cdc).WithHomeDir(home)
|
||||
|
||||
_, out := testutil.ApplyMockIO(cmd)
|
||||
clientCtx = clientCtx.WithOutput(out)
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
|
||||
ctx = context.WithValue(ctx, corectx.ViperContextKey, viper)
|
||||
ctx = context.WithValue(ctx, corectx.LoggerContextKey, logger)
|
||||
|
||||
cmd.SetArgs([]string{"appnode-test"})
|
||||
|
||||
return cmd.ExecuteContext(ctx)
|
||||
}
|
||||
|
||||
func CreateDefaultCometConfig(rootDir string) (*cmtcfg.Config, error) {
|
||||
conf := cmtcfg.DefaultConfig()
|
||||
conf.SetRoot(rootDir)
|
||||
cmtcfg.EnsureRoot(rootDir)
|
||||
|
||||
if err := conf.ValidateBasic(); err != nil {
|
||||
return nil, fmt.Errorf("error in config file: %w", err)
|
||||
}
|
||||
|
||||
return conf, nil
|
||||
}
|
||||
|
||||
func WriteAndTrackCometConfig(v *viper.Viper, home string, cfg *cmtcfg.Config) error {
|
||||
cmtcfg.WriteConfigFile(filepath.Join(home, "config", "config.toml"), cfg)
|
||||
|
||||
v.Set(flags.FlagHome, home)
|
||||
v.SetConfigType("toml")
|
||||
v.SetConfigName("config")
|
||||
v.AddConfigPath(filepath.Join(home, "config"))
|
||||
return v.ReadInConfig()
|
||||
}
|
||||
|
||||
func TrackCometConfig(v *viper.Viper, home string) error {
|
||||
v.Set(flags.FlagHome, home)
|
||||
v.SetConfigType("toml")
|
||||
v.SetConfigName("config")
|
||||
v.AddConfigPath(filepath.Join(home, "config"))
|
||||
return v.ReadInConfig()
|
||||
}
|
||||
@ -20,7 +20,7 @@ require (
|
||||
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect
|
||||
cosmossdk.io/collections v1.1.0 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2 // indirect
|
||||
cosmossdk.io/errors v1.0.1 // indirect
|
||||
cosmossdk.io/math v1.5.0 // indirect
|
||||
cosmossdk.io/schema v1.0.0 // indirect
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -19,7 +19,7 @@ require (
|
||||
require (
|
||||
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2 // indirect
|
||||
cosmossdk.io/errors v1.0.1 // indirect
|
||||
cosmossdk.io/log v1.5.0 // indirect
|
||||
cosmossdk.io/math v1.5.0 // indirect
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -28,7 +28,7 @@ require (
|
||||
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect
|
||||
cosmossdk.io/api v0.8.2 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2 // indirect
|
||||
cosmossdk.io/depinject v1.1.0 // indirect
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/log v1.5.0
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -19,7 +19,7 @@ require (
|
||||
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect
|
||||
cosmossdk.io/api v0.8.2 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2 // indirect
|
||||
cosmossdk.io/depinject v1.1.0 // indirect
|
||||
cosmossdk.io/errors v1.0.1 // indirect
|
||||
cosmossdk.io/log v1.5.0 // indirect
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91
|
||||
cosmossdk.io/x/tx v1.1.0
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -149,7 +149,7 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000
|
||||
cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000
|
||||
)
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -30,7 +30,7 @@ require (
|
||||
require (
|
||||
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect
|
||||
cosmossdk.io/x/tx v1.1.0 // indirect
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/schema v1.0.0
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/schema v1.0.0
|
||||
cosmossdk.io/store v1.10.0-rc.1
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/math v1.5.0
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/store v1.10.0-rc.1
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/math v1.5.0
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/math v1.5.0
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -44,12 +44,41 @@ func AddGenesisAccounts(
|
||||
return fmt.Errorf("failed to unmarshal genesis state: %w", err)
|
||||
}
|
||||
|
||||
modifiedAppState, err := AddGenesisAccountsWithGenesis(
|
||||
cdc,
|
||||
addressCodec,
|
||||
accounts,
|
||||
appendAcct,
|
||||
appState,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
appStateJSON, err := json.Marshal(modifiedAppState)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal application genesis state: %w", err)
|
||||
}
|
||||
|
||||
appGenesis.AppState = appStateJSON
|
||||
return ExportGenesisFile(appGenesis, genesisFileURL)
|
||||
}
|
||||
|
||||
// AddGenesisAccountsWithGenesis modifies the provided appState by adding the provided genesis accounts.
|
||||
// It returns the modified appState.
|
||||
func AddGenesisAccountsWithGenesis(
|
||||
cdc codec.Codec,
|
||||
addressCodec address.Codec,
|
||||
accounts []GenesisAccount,
|
||||
appendAcct bool,
|
||||
appState map[string]json.RawMessage,
|
||||
) (map[string]json.RawMessage, error) {
|
||||
authGenState := authtypes.GetGenesisStateFromAppState(cdc, appState)
|
||||
bankGenState := banktypes.GetGenesisStateFromAppState(cdc, appState)
|
||||
|
||||
accs, err := authtypes.UnpackAccounts(authGenState.Accounts)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get accounts from any: %w", err)
|
||||
return nil, fmt.Errorf("failed to get accounts from any: %w", err)
|
||||
}
|
||||
|
||||
newSupplyCoinsCache := sdk.NewCoins()
|
||||
@ -62,13 +91,20 @@ func AddGenesisAccounts(
|
||||
}
|
||||
}
|
||||
|
||||
// check if provided accounts aren't duplicated
|
||||
mapAddr := make(map[string]struct{}, len(accounts))
|
||||
for _, acc := range accounts {
|
||||
if _, ok := mapAddr[acc.Address]; ok {
|
||||
return nil, fmt.Errorf("duplicate account address provided in arguments: %s", acc.Address)
|
||||
}
|
||||
mapAddr[acc.Address] = struct{}{}
|
||||
|
||||
addr := acc.Address
|
||||
coins := acc.Coins
|
||||
|
||||
accAddr, err := addressCodec.StringToBytes(addr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse account address %s: %w", addr, err)
|
||||
return nil, fmt.Errorf("failed to parse account address %s: %w", addr, err)
|
||||
}
|
||||
|
||||
// create concrete account type based on input parameters
|
||||
@ -84,12 +120,12 @@ func AddGenesisAccounts(
|
||||
|
||||
baseVestingAccount, err := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create base vesting account: %w", err)
|
||||
return nil, fmt.Errorf("failed to create base vesting account: %w", err)
|
||||
}
|
||||
|
||||
if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) ||
|
||||
baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) {
|
||||
return errors.New("vesting amount cannot be greater than total amount")
|
||||
return nil, errors.New("vesting amount cannot be greater than total amount")
|
||||
}
|
||||
|
||||
switch {
|
||||
@ -100,7 +136,7 @@ func AddGenesisAccounts(
|
||||
genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount)
|
||||
|
||||
default:
|
||||
return errors.New("invalid vesting parameters; must supply start and end time or end time")
|
||||
return nil, errors.New("invalid vesting parameters; must supply start and end time or end time")
|
||||
}
|
||||
} else if acc.ModuleName != "" {
|
||||
genAccount = authtypes.NewEmptyModuleAccount(acc.ModuleName, authtypes.Burner, authtypes.Minter)
|
||||
@ -109,12 +145,12 @@ func AddGenesisAccounts(
|
||||
}
|
||||
|
||||
if err := genAccount.Validate(); err != nil {
|
||||
return fmt.Errorf("failed to validate new genesis account: %w", err)
|
||||
return nil, fmt.Errorf("failed to validate new genesis account: %w", err)
|
||||
}
|
||||
|
||||
if _, ok := balanceCache[addr]; ok {
|
||||
if !appendAcct {
|
||||
return fmt.Errorf(" Account %s already exists\nUse `append` flag to append account at existing address", accAddr)
|
||||
return nil, fmt.Errorf(" Account %s already exists\nUse `append` flag to append account at existing address", accAddr)
|
||||
}
|
||||
|
||||
for idx, acc := range bankGenState.Balances {
|
||||
@ -138,31 +174,24 @@ func AddGenesisAccounts(
|
||||
|
||||
authGenState.Accounts, err = authtypes.PackAccounts(accs)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to convert accounts into any's: %w", err)
|
||||
return nil, fmt.Errorf("failed to convert accounts into any's: %w", err)
|
||||
}
|
||||
|
||||
appState[authtypes.ModuleName], err = cdc.MarshalJSON(&authGenState)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal auth genesis state: %w", err)
|
||||
return nil, fmt.Errorf("failed to marshal auth genesis state: %w", err)
|
||||
}
|
||||
|
||||
bankGenState.Balances, err = banktypes.SanitizeGenesisBalances(bankGenState.Balances, addressCodec)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to sanitize genesis bank Balances: %w", err)
|
||||
return nil, fmt.Errorf("failed to sanitize genesis bank Balances: %w", err)
|
||||
}
|
||||
|
||||
bankGenState.Supply = bankGenState.Supply.Add(newSupplyCoinsCache...)
|
||||
|
||||
appState[banktypes.ModuleName], err = cdc.MarshalJSON(bankGenState)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal bank genesis state: %w", err)
|
||||
return nil, fmt.Errorf("failed to marshal bank genesis state: %w", err)
|
||||
}
|
||||
|
||||
appStateJSON, err := json.Marshal(appState)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal application genesis state: %w", err)
|
||||
}
|
||||
|
||||
appGenesis.AppState = appStateJSON
|
||||
return ExportGenesisFile(appGenesis, genesisFileURL)
|
||||
return appState, nil
|
||||
}
|
||||
|
||||
177
x/genutil/genaccounts_test.go
Normal file
177
x/genutil/genaccounts_test.go
Normal file
@ -0,0 +1,177 @@
|
||||
package genutil_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"cosmossdk.io/x/bank"
|
||||
banktypes "cosmossdk.io/x/bank/types"
|
||||
|
||||
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
|
||||
codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil"
|
||||
)
|
||||
|
||||
func TestAddGenesisAccounts(t *testing.T) {
|
||||
addressCodec := addresscodec.NewBech32Codec("cosmos")
|
||||
cdc := testutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, auth.AppModule{}, bank.AppModule{})
|
||||
|
||||
addresses := []string{
|
||||
"cosmos1cxlt8kznps92fwu3j6npahx4mjfutydyene2qw",
|
||||
"cosmos1hd6fsrvnz6qkp87s3u86ludegq97agxsdkwzyh",
|
||||
}
|
||||
|
||||
appState := map[string]json.RawMessage{
|
||||
"auth": cdc.Codec.MustMarshalJSON(&authtypes.GenesisState{}),
|
||||
"bank": cdc.Codec.MustMarshalJSON(banktypes.DefaultGenesisState()),
|
||||
}
|
||||
|
||||
authState := authtypes.NewGenesisState(authtypes.DefaultParams(), []authtypes.GenesisAccount{
|
||||
&authtypes.BaseAccount{Address: addresses[0]},
|
||||
&authtypes.BaseAccount{Address: addresses[1]},
|
||||
})
|
||||
|
||||
bankState := banktypes.DefaultGenesisState()
|
||||
bankState.Balances = []banktypes.Balance{
|
||||
{
|
||||
Address: addresses[0],
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
},
|
||||
{
|
||||
Address: addresses[1],
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 4)),
|
||||
},
|
||||
}
|
||||
bankState.Supply = sdk.NewCoins(sdk.NewInt64Coin("test", 5))
|
||||
appStateWithAccounts := map[string]json.RawMessage{
|
||||
"auth": cdc.Codec.MustMarshalJSON(authState),
|
||||
"bank": cdc.Codec.MustMarshalJSON(bankState),
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
appState map[string]json.RawMessage
|
||||
genesisAccount []genutil.GenesisAccount
|
||||
expected map[string]sdk.Coins
|
||||
expectedError string
|
||||
appendFlag bool
|
||||
}{
|
||||
{
|
||||
name: "single addition without append",
|
||||
appState: appState,
|
||||
genesisAccount: []genutil.GenesisAccount{
|
||||
{
|
||||
Address: addresses[0],
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
},
|
||||
{
|
||||
Address: addresses[1],
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 2)),
|
||||
},
|
||||
},
|
||||
expected: map[string]sdk.Coins{
|
||||
addresses[0]: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
addresses[1]: sdk.NewCoins(sdk.NewInt64Coin("test", 2)),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "already existing account additions without append",
|
||||
appState: appStateWithAccounts,
|
||||
genesisAccount: []genutil.GenesisAccount{
|
||||
{
|
||||
Address: addresses[0],
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
},
|
||||
},
|
||||
expectedError: "already exists",
|
||||
},
|
||||
{
|
||||
name: "already existing account additions with append",
|
||||
appState: appStateWithAccounts,
|
||||
genesisAccount: []genutil.GenesisAccount{
|
||||
{
|
||||
Address: addresses[0],
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
},
|
||||
{
|
||||
Address: addresses[1],
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1), sdk.NewInt64Coin("stake", 1)),
|
||||
},
|
||||
},
|
||||
expected: map[string]sdk.Coins{
|
||||
addresses[0]: sdk.NewCoins(sdk.NewInt64Coin("test", 2)),
|
||||
addresses[1]: sdk.NewCoins(sdk.NewInt64Coin("test", 5), sdk.NewInt64Coin("stake", 1)),
|
||||
},
|
||||
appendFlag: true,
|
||||
},
|
||||
{
|
||||
name: "duplicate accounts",
|
||||
appState: appStateWithAccounts,
|
||||
genesisAccount: []genutil.GenesisAccount{
|
||||
{
|
||||
Address: addresses[0],
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
},
|
||||
{
|
||||
Address: addresses[0],
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
},
|
||||
{
|
||||
Address: addresses[1],
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 2)),
|
||||
},
|
||||
{
|
||||
Address: addresses[1],
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("stake", 1)),
|
||||
},
|
||||
{
|
||||
Address: addresses[1],
|
||||
Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1)),
|
||||
},
|
||||
},
|
||||
appendFlag: true,
|
||||
expectedError: "duplicate account",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
appState, err := genutil.AddGenesisAccountsWithGenesis(cdc.Codec, addressCodec, tc.genesisAccount, tc.appendFlag, tc.appState)
|
||||
if tc.expectedError != "" {
|
||||
require.ErrorContains(t, err, tc.expectedError)
|
||||
return
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
authGenState := authtypes.GetGenesisStateFromAppState(cdc.Codec, appState)
|
||||
bankGenState := banktypes.GetGenesisStateFromAppState(cdc.Codec, appState)
|
||||
|
||||
require.Len(t, authGenState.Accounts, len(tc.expected))
|
||||
for _, acc := range tc.genesisAccount {
|
||||
addr := acc.Address
|
||||
accounts, _ := authtypes.UnpackAccounts(authGenState.Accounts)
|
||||
found := false
|
||||
for _, a := range accounts {
|
||||
if a.GetAddress().String() == addr {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
require.True(t, found, "account %s not found", addr)
|
||||
}
|
||||
|
||||
expectedSupply := sdk.NewCoins()
|
||||
for _, coins := range tc.expected {
|
||||
expectedSupply = expectedSupply.Add(coins...)
|
||||
}
|
||||
require.Equal(t, expectedSupply.String(), bankGenState.Supply.String())
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -7,7 +7,7 @@ require (
|
||||
cosmossdk.io/client/v2 v2.0.0-beta.6
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/log v1.5.0
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -32,7 +32,7 @@ require (
|
||||
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect
|
||||
cosmossdk.io/collections v1.1.0 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2 // indirect
|
||||
cosmossdk.io/schema v1.0.0 // indirect
|
||||
cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect
|
||||
cosmossdk.io/x/tx v1.1.0 // indirect
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/log v1.5.0
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -25,7 +25,7 @@ require (
|
||||
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect
|
||||
cosmossdk.io/collections v1.1.0 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect
|
||||
cosmossdk.io/core/testing v0.0.2 // indirect
|
||||
cosmossdk.io/schema v1.0.0 // indirect
|
||||
cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 // indirect
|
||||
cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/math v1.5.0
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/math v1.5.0
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/collections v1.1.0
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/log v1.5.0
|
||||
|
||||
@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
@ -5,7 +5,7 @@ go 1.23.5
|
||||
require (
|
||||
cosmossdk.io/api v0.8.2
|
||||
cosmossdk.io/core v1.0.0
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47
|
||||
cosmossdk.io/core/testing v0.0.2
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/log v1.5.0
|
||||
|
||||
@ -616,8 +616,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM=
|
||||
cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4=
|
||||
cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U=
|
||||
cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA=
|
||||
cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/core/testing v0.0.2 h1:TXAmsnHa1C5lLiVN1z+rnkiyNS6sNwcGJCb6OouaNv8=
|
||||
cosmossdk.io/core/testing v0.0.2/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI=
|
||||
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
|
||||
|
||||
Loading…
Reference in New Issue
Block a user