feat(accounts): Add codec.BinaryCodec and Gas to dependencies. (#19068)
Co-authored-by: unknown unknown <unknown@unknown>
This commit is contained in:
parent
822d90c4b1
commit
498cd6a533
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,11 @@ type protoMessage[T any] interface {
|
||||
}
|
||||
|
||||
// CollValue inits a collections.ValueCodec for a generic gogo protobuf message.
|
||||
func CollValue[T any, PT protoMessage[T]](cdc BinaryCodec) collcodec.ValueCodec[T] {
|
||||
func CollValue[T any, PT protoMessage[T]](cdc interface {
|
||||
Marshal(proto.Message) ([]byte, error)
|
||||
Unmarshal([]byte, proto.Message) error
|
||||
},
|
||||
) collcodec.ValueCodec[T] {
|
||||
return &collValue[T, PT]{cdc.(Codec), proto.MessageName(PT(new(T)))}
|
||||
}
|
||||
|
||||
|
||||
@ -26,6 +26,21 @@ message MsgIncreaseCounterResponse {
|
||||
uint64 new_amount = 1;
|
||||
}
|
||||
|
||||
// MsgTestDependencies is used to test the dependencies.
|
||||
message MsgTestDependencies {}
|
||||
|
||||
// MsgTestDependenciesResponse is used to test the dependencies.
|
||||
message MsgTestDependenciesResponse {
|
||||
// chain_id is used to test that the header service correctly works.
|
||||
string chain_id = 1;
|
||||
// address is used to test address codec.
|
||||
string address = 2;
|
||||
// before_gas is used to test the gas meter reporting.
|
||||
uint64 before_gas = 3;
|
||||
// after_gas is used to test gas meter increasing.
|
||||
uint64 after_gas = 4;
|
||||
}
|
||||
|
||||
// QueryCounterRequest is used to query the counter value.
|
||||
message QueryCounterRequest {}
|
||||
|
||||
|
||||
30
runtime/gas.go
Normal file
30
runtime/gas.go
Normal file
@ -0,0 +1,30 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"cosmossdk.io/core/gas"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
var _ gas.Service = (*GasService)(nil)
|
||||
|
||||
type GasService struct{}
|
||||
|
||||
func (g GasService) GetGasMeter(ctx context.Context) gas.Meter {
|
||||
sdkCtx := sdk.UnwrapSDKContext(ctx)
|
||||
return sdkCtx.GasMeter()
|
||||
}
|
||||
|
||||
func (g GasService) GetBlockGasMeter(ctx context.Context) gas.Meter {
|
||||
return sdk.UnwrapSDKContext(ctx).BlockGasMeter()
|
||||
}
|
||||
|
||||
func (g GasService) WithGasMeter(ctx context.Context, meter gas.Meter) context.Context {
|
||||
return sdk.UnwrapSDKContext(ctx).WithGasMeter(meter)
|
||||
}
|
||||
|
||||
func (g GasService) WithBlockGasMeter(ctx context.Context, meter gas.Meter) context.Context {
|
||||
return sdk.UnwrapSDKContext(ctx).WithBlockGasMeter(meter)
|
||||
}
|
||||
@ -281,16 +281,18 @@ func NewSimApp(
|
||||
app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{})
|
||||
bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore)
|
||||
|
||||
addressCodec := authcodec.NewBech32Codec(sdk.Bech32MainPrefix)
|
||||
|
||||
// add keepers
|
||||
|
||||
app.AuthKeeper = authkeeper.NewAccountKeeper(appCodec, runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
|
||||
accountsKeeper, err := accounts.NewKeeper(
|
||||
appCodec,
|
||||
runtime.NewKVStoreService(keys[accounts.StoreKey]),
|
||||
runtime.EventService{},
|
||||
runtime.HeaderService{},
|
||||
runtime.BranchService{},
|
||||
app.AuthKeeper.AddressCodec(),
|
||||
runtime.GasService{},
|
||||
addressCodec,
|
||||
appCodec,
|
||||
app.MsgServiceRouter(),
|
||||
app.GRPCQueryRouter(),
|
||||
@ -302,9 +304,10 @@ func NewSimApp(
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
app.AccountsKeeper = accountsKeeper
|
||||
|
||||
app.AuthKeeper = authkeeper.NewAccountKeeper(appCodec, runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, addressCodec, sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
|
||||
app.BankKeeper = bankkeeper.NewBaseKeeper(
|
||||
appCodec,
|
||||
runtime.NewKVStoreService(keys[banktypes.StoreKey]),
|
||||
|
||||
46
tests/e2e/accounts/wiring_test.go
Normal file
46
tests/e2e/accounts/wiring_test.go
Normal file
@ -0,0 +1,46 @@
|
||||
//go:build app_v1
|
||||
|
||||
package accounts
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"cosmossdk.io/core/header"
|
||||
counterv1 "cosmossdk.io/x/accounts/testing/counter/v1"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// TestDependencies aims to test wiring between different account components,
|
||||
// inherited from the runtime, specifically:
|
||||
// - address codec
|
||||
// - binary codec
|
||||
// - header service
|
||||
// - gas service
|
||||
func TestDependencies(t *testing.T) {
|
||||
app := setupApp(t)
|
||||
ak := app.AccountsKeeper
|
||||
ctx := sdk.NewContext(app.CommitMultiStore(), false, app.Logger()).WithHeaderInfo(header.Info{ChainID: "chain-id"})
|
||||
|
||||
_, counterAddr, err := ak.Init(ctx, "counter", accCreator, &counterv1.MsgInit{
|
||||
InitialValue: 0,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
// test dependencies
|
||||
r, err := ak.Execute(ctx, counterAddr, []byte("test"), &counterv1.MsgTestDependencies{})
|
||||
require.NoError(t, err)
|
||||
res := r.(*counterv1.MsgTestDependenciesResponse)
|
||||
|
||||
// test gas
|
||||
require.NotZero(t, res.BeforeGas)
|
||||
require.NotZero(t, res.AfterGas)
|
||||
require.Equal(t, uint64(10), res.AfterGas-res.BeforeGas)
|
||||
|
||||
// test header service
|
||||
require.Equal(t, ctx.HeaderInfo().ChainID, res.ChainId)
|
||||
|
||||
// test address codec
|
||||
wantAddr, err := app.AuthKeeper.AddressCodec().BytesToString(counterAddr)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, wantAddr, res.Address)
|
||||
}
|
||||
@ -5,6 +5,7 @@ import (
|
||||
"encoding/binary"
|
||||
|
||||
"cosmossdk.io/collections"
|
||||
"cosmossdk.io/core/gas"
|
||||
"cosmossdk.io/core/header"
|
||||
"cosmossdk.io/core/store"
|
||||
"cosmossdk.io/x/accounts/internal/prefixstore"
|
||||
@ -24,7 +25,7 @@ type contextValue struct {
|
||||
store store.KVStore // store is the prefixed store for the account.
|
||||
sender []byte // sender is the address of the entity invoking the account action.
|
||||
whoami []byte // whoami is the address of the account being invoked.
|
||||
originalContext context.Context // originalContext that was used to build the account context.
|
||||
parentContext context.Context // parentContext that was used to build the account context.
|
||||
moduleExec ModuleExecFunc // moduleExec is a function that executes a module message, when the resp type is known.
|
||||
moduleExecUntyped ModuleExecUntypedFunc // moduleExecUntyped is a function that executes a module message, when the resp type is unknown.
|
||||
moduleQuery ModuleQueryFunc // moduleQuery is a function that queries a module.
|
||||
@ -51,7 +52,7 @@ func MakeAccountContext(
|
||||
store: makeAccountStore(ctx, storeSvc, accNumber),
|
||||
sender: sender,
|
||||
whoami: accountAddr,
|
||||
originalContext: ctx,
|
||||
parentContext: ctx,
|
||||
moduleExec: moduleExec,
|
||||
moduleExecUntyped: moduleExecUntyped,
|
||||
moduleQuery: moduleQuery,
|
||||
@ -72,7 +73,7 @@ func ExecModuleUntyped(ctx context.Context, msg ProtoMsg) (ProtoMsg, error) {
|
||||
// get sender
|
||||
v := ctx.Value(contextKey{}).(contextValue)
|
||||
|
||||
resp, err := v.moduleExecUntyped(v.originalContext, v.whoami, msg)
|
||||
resp, err := v.moduleExecUntyped(v.parentContext, v.whoami, msg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -87,7 +88,7 @@ func ExecModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG
|
||||
|
||||
// execute module, unwrapping the original context.
|
||||
resp := RespProto(new(Resp))
|
||||
err := v.moduleExec(v.originalContext, v.whoami, msg, resp)
|
||||
err := v.moduleExec(v.parentContext, v.whoami, msg, resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -101,7 +102,7 @@ func QueryModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsg
|
||||
// we also unwrap the original context.
|
||||
v := ctx.Value(contextKey{}).(contextValue)
|
||||
resp := RespProto(new(Resp))
|
||||
err := v.moduleQuery(v.originalContext, req, resp)
|
||||
err := v.moduleQuery(v.parentContext, req, resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -123,9 +124,38 @@ func Whoami(ctx context.Context) []byte {
|
||||
return ctx.Value(contextKey{}).(contextValue).whoami
|
||||
}
|
||||
|
||||
type headerService struct{ header.Service }
|
||||
type headerService struct{ hs header.Service }
|
||||
|
||||
func (h headerService) GetHeaderInfo(ctx context.Context) header.Info {
|
||||
originalContext := ctx.Value(contextKey{}).(contextValue).originalContext
|
||||
return h.Service.GetHeaderInfo(originalContext)
|
||||
return h.hs.GetHeaderInfo(getParentContext(ctx))
|
||||
}
|
||||
|
||||
var _ gas.Service = (*gasService)(nil)
|
||||
|
||||
type gasService struct {
|
||||
gs gas.Service
|
||||
}
|
||||
|
||||
func (g gasService) GetGasMeter(ctx context.Context) gas.Meter {
|
||||
return g.gs.GetGasMeter(getParentContext(ctx))
|
||||
}
|
||||
|
||||
func (g gasService) GetBlockGasMeter(ctx context.Context) gas.Meter {
|
||||
return g.gs.GetBlockGasMeter(getParentContext(ctx))
|
||||
}
|
||||
|
||||
func (g gasService) WithGasMeter(ctx context.Context, meter gas.Meter) context.Context {
|
||||
v := ctx.Value(contextKey{}).(contextValue)
|
||||
v.parentContext = g.gs.WithGasMeter(v.parentContext, meter)
|
||||
return context.WithValue(v.parentContext, contextKey{}, v)
|
||||
}
|
||||
|
||||
func (g gasService) WithBlockGasMeter(ctx context.Context, meter gas.Meter) context.Context {
|
||||
v := ctx.Value(contextKey{}).(contextValue)
|
||||
v.parentContext = g.gs.WithBlockGasMeter(v.parentContext, meter)
|
||||
return context.WithValue(v.parentContext, contextKey{}, v)
|
||||
}
|
||||
|
||||
func getParentContext(ctx context.Context) context.Context {
|
||||
return ctx.Value(contextKey{}).(contextValue).parentContext
|
||||
}
|
||||
|
||||
@ -6,10 +6,19 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
)
|
||||
|
||||
type ProtoMsg = protoiface.MessageV1
|
||||
|
||||
// ProtoMsgG is a generic interface for protobuf messages.
|
||||
type ProtoMsgG[T any] interface {
|
||||
*T
|
||||
protoiface.MessageV1
|
||||
}
|
||||
|
||||
type Any = codectypes.Any
|
||||
|
||||
func FindMessageByName(name string) (ProtoMsg, error) {
|
||||
|
||||
@ -4,16 +4,26 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
|
||||
"cosmossdk.io/collections"
|
||||
"cosmossdk.io/core/address"
|
||||
"cosmossdk.io/core/gas"
|
||||
"cosmossdk.io/core/header"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
// Dependencies are passed to the constructor of a smart account.
|
||||
type Dependencies struct {
|
||||
SchemaBuilder *collections.SchemaBuilder
|
||||
AddressCodec address.Codec
|
||||
HeaderService header.Service
|
||||
SchemaBuilder *collections.SchemaBuilder
|
||||
AddressCodec address.Codec
|
||||
HeaderService header.Service
|
||||
GasService gas.Service
|
||||
LegacyStateCodec interface {
|
||||
Marshal(gogoproto.Message) ([]byte, error)
|
||||
Unmarshal([]byte, gogoproto.Message) error
|
||||
}
|
||||
}
|
||||
|
||||
// AccountCreatorFunc is a function that creates an account.
|
||||
@ -22,17 +32,21 @@ type AccountCreatorFunc = func(deps Dependencies) (string, Account, error)
|
||||
// MakeAccountsMap creates a map of account names to account implementations
|
||||
// from a list of account creator functions.
|
||||
func MakeAccountsMap(
|
||||
cdc codec.BinaryCodec,
|
||||
addressCodec address.Codec,
|
||||
hs header.Service,
|
||||
gs gas.Service,
|
||||
accounts []AccountCreatorFunc,
|
||||
) (map[string]Implementation, error) {
|
||||
accountsMap := make(map[string]Implementation, len(accounts))
|
||||
for _, makeAccount := range accounts {
|
||||
stateSchemaBuilder := collections.NewSchemaBuilderFromAccessor(openKVStore)
|
||||
deps := Dependencies{
|
||||
SchemaBuilder: stateSchemaBuilder,
|
||||
AddressCodec: addressCodec,
|
||||
HeaderService: headerService{hs},
|
||||
SchemaBuilder: stateSchemaBuilder,
|
||||
AddressCodec: addressCodec,
|
||||
HeaderService: headerService{hs},
|
||||
GasService: gasService{gs},
|
||||
LegacyStateCodec: cdc,
|
||||
}
|
||||
name, accountInterface, err := makeAccount(deps)
|
||||
if err != nil {
|
||||
|
||||
@ -5,17 +5,8 @@ import (
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
type ProtoMsg = protoiface.MessageV1
|
||||
|
||||
// ProtoMsgG is a generic interface for protobuf messages.
|
||||
type ProtoMsgG[T any] interface {
|
||||
*T
|
||||
protoiface.MessageV1
|
||||
}
|
||||
|
||||
// RegisterInitHandler registers an initialisation handler for a smart account that uses protobuf.
|
||||
func RegisterInitHandler[
|
||||
Req any, ProtoReq ProtoMsgG[Req], Resp any, ProtoResp ProtoMsgG[Resp],
|
||||
|
||||
@ -15,10 +15,13 @@ import (
|
||||
"cosmossdk.io/core/address"
|
||||
"cosmossdk.io/core/branch"
|
||||
"cosmossdk.io/core/event"
|
||||
"cosmossdk.io/core/gas"
|
||||
"cosmossdk.io/core/header"
|
||||
"cosmossdk.io/core/store"
|
||||
"cosmossdk.io/x/accounts/accountstd"
|
||||
"cosmossdk.io/x/accounts/internal/implementation"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -61,10 +64,12 @@ type InterfaceRegistry interface {
|
||||
}
|
||||
|
||||
func NewKeeper(
|
||||
cdc codec.BinaryCodec,
|
||||
ss store.KVStoreService,
|
||||
es event.Service,
|
||||
hs header.Service,
|
||||
bs branch.Service,
|
||||
gs gas.Service,
|
||||
addressCodec address.Codec,
|
||||
signerProvider SignerProvider,
|
||||
execRouter MsgRouter,
|
||||
@ -92,7 +97,7 @@ func NewKeeper(
|
||||
return Keeper{}, err
|
||||
}
|
||||
keeper.Schema = schema
|
||||
keeper.accounts, err = implementation.MakeAccountsMap(keeper.addressCodec, hs, accounts)
|
||||
keeper.accounts, err = implementation.MakeAccountsMap(cdc, keeper.addressCodec, hs, gs, accounts)
|
||||
if err != nil {
|
||||
return Keeper{}, err
|
||||
}
|
||||
|
||||
@ -6,13 +6,19 @@ import (
|
||||
"fmt"
|
||||
|
||||
"cosmossdk.io/collections"
|
||||
"cosmossdk.io/core/address"
|
||||
"cosmossdk.io/core/gas"
|
||||
"cosmossdk.io/core/header"
|
||||
"cosmossdk.io/x/accounts/accountstd"
|
||||
counterv1 "cosmossdk.io/x/accounts/testing/counter/v1"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
var (
|
||||
OwnerPrefix = collections.NewPrefix(0)
|
||||
CounterPrefix = collections.NewPrefix(1)
|
||||
OwnerPrefix = collections.NewPrefix(0)
|
||||
CounterPrefix = collections.NewPrefix(1)
|
||||
TestStateCodecPrefix = collections.NewPrefix(2)
|
||||
)
|
||||
|
||||
var _ accountstd.Interface = (*Account)(nil)
|
||||
@ -20,8 +26,12 @@ var _ accountstd.Interface = (*Account)(nil)
|
||||
// NewAccount creates a new account.
|
||||
func NewAccount(d accountstd.Dependencies) (Account, error) {
|
||||
return Account{
|
||||
Owner: collections.NewItem(d.SchemaBuilder, OwnerPrefix, "owner", collections.BytesValue),
|
||||
Counter: collections.NewItem(d.SchemaBuilder, CounterPrefix, "counter", collections.Uint64Value),
|
||||
Owner: collections.NewItem(d.SchemaBuilder, OwnerPrefix, "owner", collections.BytesValue),
|
||||
Counter: collections.NewItem(d.SchemaBuilder, CounterPrefix, "counter", collections.Uint64Value),
|
||||
TestStateCodec: collections.NewItem(d.SchemaBuilder, TestStateCodecPrefix, "test_state_codec", codec.CollValue[counterv1.MsgTestDependencies](d.LegacyStateCodec)),
|
||||
hs: d.HeaderService,
|
||||
addressCodec: d.AddressCodec,
|
||||
gs: d.GasService,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -32,6 +42,13 @@ type Account struct {
|
||||
Owner collections.Item[[]byte]
|
||||
// Counter is the counter value.
|
||||
Counter collections.Item[uint64]
|
||||
// TestStateCodec is used to test the binary codec provided by the runtime.
|
||||
// It simply stores the MsgInit.
|
||||
TestStateCodec collections.Item[counterv1.MsgTestDependencies]
|
||||
|
||||
hs header.Service
|
||||
addressCodec address.Codec
|
||||
gs gas.Service
|
||||
}
|
||||
|
||||
func (a Account) Init(ctx context.Context, msg *counterv1.MsgInit) (*counterv1.MsgInitResponse, error) {
|
||||
@ -79,12 +96,43 @@ func (a Account) QueryCounter(ctx context.Context, _ *counterv1.QueryCounterRequ
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a Account) TestDependencies(ctx context.Context, _ *counterv1.MsgTestDependencies) (*counterv1.MsgTestDependenciesResponse, error) {
|
||||
// test binary codec
|
||||
err := a.TestStateCodec.Set(ctx, counterv1.MsgTestDependencies{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// test address codec
|
||||
me := accountstd.Whoami(ctx)
|
||||
meStr, err := a.addressCodec.BytesToString(me)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// test header service
|
||||
chainID := a.hs.GetHeaderInfo(ctx).ChainID
|
||||
|
||||
// test gas meter
|
||||
gasBefore := a.gs.GetGasMeter(ctx).GasConsumedToLimit()
|
||||
a.gs.GetGasMeter(ctx).ConsumeGas(10, "test")
|
||||
gasAfter := a.gs.GetGasMeter(ctx).GasConsumedToLimit()
|
||||
|
||||
return &counterv1.MsgTestDependenciesResponse{
|
||||
ChainId: chainID,
|
||||
Address: meStr,
|
||||
BeforeGas: gasBefore,
|
||||
AfterGas: gasAfter,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a Account) RegisterInitHandler(builder *accountstd.InitBuilder) {
|
||||
accountstd.RegisterInitHandler(builder, a.Init)
|
||||
}
|
||||
|
||||
func (a Account) RegisterExecuteHandlers(builder *accountstd.ExecuteBuilder) {
|
||||
accountstd.RegisterExecuteHandler(builder, a.IncreaseCounter)
|
||||
accountstd.RegisterExecuteHandler(builder, a.TestDependencies)
|
||||
}
|
||||
|
||||
func (a Account) RegisterQueryHandlers(builder *accountstd.QueryBuilder) {
|
||||
|
||||
@ -198,6 +198,116 @@ func (m *MsgIncreaseCounterResponse) GetNewAmount() uint64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
// MsgTestDependencies is used to test the dependencies.
|
||||
type MsgTestDependencies struct {
|
||||
}
|
||||
|
||||
func (m *MsgTestDependencies) Reset() { *m = MsgTestDependencies{} }
|
||||
func (m *MsgTestDependencies) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgTestDependencies) ProtoMessage() {}
|
||||
func (*MsgTestDependencies) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_21c9320877186411, []int{4}
|
||||
}
|
||||
func (m *MsgTestDependencies) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgTestDependencies) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgTestDependencies.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *MsgTestDependencies) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgTestDependencies.Merge(m, src)
|
||||
}
|
||||
func (m *MsgTestDependencies) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgTestDependencies) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgTestDependencies.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgTestDependencies proto.InternalMessageInfo
|
||||
|
||||
// MsgTestDependenciesResponse is used to test the dependencies.
|
||||
type MsgTestDependenciesResponse struct {
|
||||
// chain_id is used to test that the header service correctly works.
|
||||
ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
|
||||
// address is used to test address codec.
|
||||
Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
|
||||
// before_gas is used to test the gas meter reporting.
|
||||
BeforeGas uint64 `protobuf:"varint,3,opt,name=before_gas,json=beforeGas,proto3" json:"before_gas,omitempty"`
|
||||
// after_gas is used to test gas meter increasing.
|
||||
AfterGas uint64 `protobuf:"varint,4,opt,name=after_gas,json=afterGas,proto3" json:"after_gas,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgTestDependenciesResponse) Reset() { *m = MsgTestDependenciesResponse{} }
|
||||
func (m *MsgTestDependenciesResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgTestDependenciesResponse) ProtoMessage() {}
|
||||
func (*MsgTestDependenciesResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_21c9320877186411, []int{5}
|
||||
}
|
||||
func (m *MsgTestDependenciesResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgTestDependenciesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgTestDependenciesResponse.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *MsgTestDependenciesResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgTestDependenciesResponse.Merge(m, src)
|
||||
}
|
||||
func (m *MsgTestDependenciesResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgTestDependenciesResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgTestDependenciesResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgTestDependenciesResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgTestDependenciesResponse) GetChainId() string {
|
||||
if m != nil {
|
||||
return m.ChainId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgTestDependenciesResponse) GetAddress() string {
|
||||
if m != nil {
|
||||
return m.Address
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgTestDependenciesResponse) GetBeforeGas() uint64 {
|
||||
if m != nil {
|
||||
return m.BeforeGas
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *MsgTestDependenciesResponse) GetAfterGas() uint64 {
|
||||
if m != nil {
|
||||
return m.AfterGas
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// QueryCounterRequest is used to query the counter value.
|
||||
type QueryCounterRequest struct {
|
||||
}
|
||||
@ -206,7 +316,7 @@ func (m *QueryCounterRequest) Reset() { *m = QueryCounterRequest{} }
|
||||
func (m *QueryCounterRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryCounterRequest) ProtoMessage() {}
|
||||
func (*QueryCounterRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_21c9320877186411, []int{4}
|
||||
return fileDescriptor_21c9320877186411, []int{6}
|
||||
}
|
||||
func (m *QueryCounterRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@ -245,7 +355,7 @@ func (m *QueryCounterResponse) Reset() { *m = QueryCounterResponse{} }
|
||||
func (m *QueryCounterResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryCounterResponse) ProtoMessage() {}
|
||||
func (*QueryCounterResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_21c9320877186411, []int{5}
|
||||
return fileDescriptor_21c9320877186411, []int{7}
|
||||
}
|
||||
func (m *QueryCounterResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@ -286,6 +396,8 @@ func init() {
|
||||
proto.RegisterType((*MsgInitResponse)(nil), "cosmos.accounts.testing.counter.v1.MsgInitResponse")
|
||||
proto.RegisterType((*MsgIncreaseCounter)(nil), "cosmos.accounts.testing.counter.v1.MsgIncreaseCounter")
|
||||
proto.RegisterType((*MsgIncreaseCounterResponse)(nil), "cosmos.accounts.testing.counter.v1.MsgIncreaseCounterResponse")
|
||||
proto.RegisterType((*MsgTestDependencies)(nil), "cosmos.accounts.testing.counter.v1.MsgTestDependencies")
|
||||
proto.RegisterType((*MsgTestDependenciesResponse)(nil), "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse")
|
||||
proto.RegisterType((*QueryCounterRequest)(nil), "cosmos.accounts.testing.counter.v1.QueryCounterRequest")
|
||||
proto.RegisterType((*QueryCounterResponse)(nil), "cosmos.accounts.testing.counter.v1.QueryCounterResponse")
|
||||
}
|
||||
@ -295,24 +407,30 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_21c9320877186411 = []byte{
|
||||
// 264 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x48, 0xce, 0x2f, 0xce,
|
||||
0xcd, 0x2f, 0xd6, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e,
|
||||
0xc9, 0xcc, 0x4b, 0xd7, 0x07, 0x73, 0x53, 0x8b, 0xf4, 0xcb, 0x0c, 0x61, 0x4c, 0xbd, 0x82, 0xa2,
|
||||
0xfc, 0x92, 0x7c, 0x21, 0x25, 0x88, 0x0e, 0x3d, 0x98, 0x0e, 0x3d, 0xa8, 0x0e, 0x3d, 0x98, 0xb2,
|
||||
0x32, 0x43, 0x25, 0x3d, 0x2e, 0x76, 0xdf, 0xe2, 0x74, 0xcf, 0xbc, 0xcc, 0x12, 0x21, 0x65, 0x2e,
|
||||
0xde, 0xcc, 0xbc, 0xcc, 0x92, 0xcc, 0xc4, 0x9c, 0xf8, 0xb2, 0xc4, 0x9c, 0xd2, 0x54, 0x09, 0x46,
|
||||
0x05, 0x46, 0x0d, 0x96, 0x20, 0x1e, 0xa8, 0x60, 0x18, 0x48, 0x4c, 0x49, 0x90, 0x8b, 0x1f, 0xaa,
|
||||
0x3e, 0x28, 0xb5, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0x49, 0x87, 0x4b, 0x08, 0x2c, 0x94, 0x5c,
|
||||
0x94, 0x9a, 0x58, 0x9c, 0xea, 0x0c, 0x31, 0x5b, 0x48, 0x8c, 0x8b, 0x2d, 0x31, 0x17, 0xc4, 0x86,
|
||||
0x1a, 0x03, 0xe5, 0x29, 0x59, 0x73, 0x49, 0x61, 0xaa, 0x86, 0x99, 0x25, 0x24, 0xcb, 0xc5, 0x95,
|
||||
0x97, 0x5a, 0x1e, 0x8f, 0xa2, 0x93, 0x33, 0x2f, 0xb5, 0xdc, 0x11, 0xa2, 0x59, 0x94, 0x4b, 0x38,
|
||||
0xb0, 0x34, 0xb5, 0xa8, 0x12, 0xae, 0xad, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x49, 0x87, 0x4b, 0x04,
|
||||
0x55, 0x18, 0x6a, 0x9a, 0x08, 0x17, 0x2b, 0xb2, 0x4f, 0x20, 0x1c, 0x27, 0x97, 0x13, 0x8f, 0xe4,
|
||||
0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f,
|
||||
0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x82, 0x04, 0x58, 0x71, 0x4a, 0xb6, 0x5e, 0x66,
|
||||
0xbe, 0x7e, 0x05, 0xbe, 0xa0, 0x4e, 0x62, 0x03, 0x87, 0xb1, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff,
|
||||
0x5e, 0xe6, 0x3d, 0x27, 0x97, 0x01, 0x00, 0x00,
|
||||
// 363 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x4f, 0x4f, 0xdb, 0x40,
|
||||
0x10, 0xc5, 0xe3, 0x36, 0xcd, 0x9f, 0x51, 0xab, 0xaa, 0x6e, 0x5a, 0xb9, 0x8d, 0x6a, 0x55, 0xee,
|
||||
0xa5, 0x42, 0x91, 0x4d, 0xc4, 0x91, 0x13, 0x10, 0x29, 0xca, 0x21, 0x07, 0x22, 0xc4, 0x81, 0x8b,
|
||||
0xb5, 0xb1, 0x27, 0x66, 0x45, 0xb2, 0x1b, 0x3c, 0xeb, 0x04, 0xbe, 0x04, 0xe2, 0x63, 0x71, 0xcc,
|
||||
0x91, 0x23, 0x4a, 0xbe, 0x08, 0xf2, 0xae, 0x1d, 0x11, 0x81, 0xb8, 0xed, 0xfb, 0xcd, 0xbc, 0xa7,
|
||||
0x67, 0xef, 0xc2, 0x7e, 0x24, 0x69, 0x26, 0x29, 0x60, 0x51, 0x24, 0x33, 0xa1, 0x28, 0x50, 0x48,
|
||||
0x8a, 0x8b, 0x24, 0xd0, 0x12, 0xd3, 0x60, 0xd1, 0x2d, 0x8f, 0xfe, 0x3c, 0x95, 0x4a, 0xda, 0x9e,
|
||||
0x71, 0xf8, 0xa5, 0xc3, 0x2f, 0x1c, 0x7e, 0xb9, 0xb6, 0xe8, 0x7a, 0x3e, 0xd4, 0x87, 0x94, 0x0c,
|
||||
0x04, 0x57, 0xf6, 0x3f, 0xf8, 0xc2, 0x05, 0x57, 0x9c, 0x4d, 0xc3, 0x05, 0x9b, 0x66, 0xe8, 0x58,
|
||||
0x7f, 0xad, 0xff, 0xd5, 0xd1, 0xe7, 0x02, 0x9e, 0xe7, 0xcc, 0xfb, 0x06, 0x5f, 0x8b, 0xfd, 0x11,
|
||||
0xd2, 0x5c, 0x0a, 0x42, 0xaf, 0x03, 0xb6, 0x46, 0x51, 0x8a, 0x8c, 0xf0, 0xc4, 0x64, 0xdb, 0x3f,
|
||||
0xa1, 0xc6, 0x66, 0xf9, 0xb9, 0x88, 0x29, 0x94, 0x77, 0x08, 0xbf, 0x5f, 0x6f, 0x97, 0x59, 0xf6,
|
||||
0x1f, 0x00, 0x81, 0xcb, 0x70, 0xc7, 0xd9, 0x14, 0xb8, 0x3c, 0x32, 0xe6, 0x1f, 0xf0, 0x7d, 0x48,
|
||||
0xc9, 0x19, 0x92, 0xea, 0xe1, 0x1c, 0x45, 0x8c, 0x22, 0xe2, 0x48, 0xde, 0x9d, 0x05, 0xed, 0x37,
|
||||
0xf8, 0x36, 0xf5, 0x17, 0x34, 0xa2, 0x4b, 0xc6, 0x45, 0xc8, 0x63, 0x9d, 0xd9, 0x1c, 0xd5, 0xb5,
|
||||
0x1e, 0xc4, 0xb6, 0x03, 0x75, 0x16, 0xc7, 0x29, 0x12, 0x39, 0x1f, 0xcc, 0xa4, 0x90, 0x79, 0x95,
|
||||
0x31, 0x4e, 0x64, 0x8a, 0x61, 0xc2, 0xc8, 0xf9, 0x68, 0xaa, 0x18, 0xd2, 0x67, 0x64, 0xb7, 0xa1,
|
||||
0xc9, 0x26, 0x0a, 0x53, 0x3d, 0xad, 0xea, 0x69, 0x43, 0x83, 0x3e, 0xa3, 0xbc, 0xe7, 0x69, 0x86,
|
||||
0xe9, 0xed, 0xf6, 0xf3, 0xae, 0x33, 0x24, 0xe5, 0x75, 0xa0, 0xb5, 0x8b, 0x8b, 0x7e, 0x2d, 0xf8,
|
||||
0xf4, 0xf2, 0x8f, 0x1b, 0x71, 0xdc, 0x7b, 0x58, 0xbb, 0xd6, 0x6a, 0xed, 0x5a, 0x4f, 0x6b, 0xd7,
|
||||
0xba, 0xdf, 0xb8, 0x95, 0xd5, 0xc6, 0xad, 0x3c, 0x6e, 0xdc, 0xca, 0xc5, 0x9e, 0xb9, 0x58, 0x8a,
|
||||
0xaf, 0x7c, 0x2e, 0x83, 0x9b, 0xf7, 0x9e, 0xc4, 0xb8, 0xa6, 0xdf, 0xc2, 0xc1, 0x73, 0x00, 0x00,
|
||||
0x00, 0xff, 0xff, 0xda, 0x84, 0xf8, 0xfc, 0x3f, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *MsgInit) Marshal() (dAtA []byte, err error) {
|
||||
@ -422,6 +540,76 @@ func (m *MsgIncreaseCounterResponse) MarshalToSizedBuffer(dAtA []byte) (int, err
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgTestDependencies) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *MsgTestDependencies) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgTestDependencies) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgTestDependenciesResponse) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *MsgTestDependenciesResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgTestDependenciesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.AfterGas != 0 {
|
||||
i = encodeVarintCounter(dAtA, i, uint64(m.AfterGas))
|
||||
i--
|
||||
dAtA[i] = 0x20
|
||||
}
|
||||
if m.BeforeGas != 0 {
|
||||
i = encodeVarintCounter(dAtA, i, uint64(m.BeforeGas))
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
}
|
||||
if len(m.Address) > 0 {
|
||||
i -= len(m.Address)
|
||||
copy(dAtA[i:], m.Address)
|
||||
i = encodeVarintCounter(dAtA, i, uint64(len(m.Address)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.ChainId) > 0 {
|
||||
i -= len(m.ChainId)
|
||||
copy(dAtA[i:], m.ChainId)
|
||||
i = encodeVarintCounter(dAtA, i, uint64(len(m.ChainId)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryCounterRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
@ -529,6 +717,38 @@ func (m *MsgIncreaseCounterResponse) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgTestDependencies) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgTestDependenciesResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.ChainId)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovCounter(uint64(l))
|
||||
}
|
||||
l = len(m.Address)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovCounter(uint64(l))
|
||||
}
|
||||
if m.BeforeGas != 0 {
|
||||
n += 1 + sovCounter(uint64(m.BeforeGas))
|
||||
}
|
||||
if m.AfterGas != 0 {
|
||||
n += 1 + sovCounter(uint64(m.AfterGas))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *QueryCounterRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
@ -813,6 +1033,208 @@ func (m *MsgIncreaseCounterResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgTestDependencies) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowCounter
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: MsgTestDependencies: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgTestDependencies: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipCounter(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthCounter
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgTestDependenciesResponse) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowCounter
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: MsgTestDependenciesResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgTestDependenciesResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowCounter
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthCounter
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthCounter
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ChainId = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowCounter
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthCounter
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthCounter
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Address = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field BeforeGas", wireType)
|
||||
}
|
||||
m.BeforeGas = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowCounter
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.BeforeGas |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 4:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field AfterGas", wireType)
|
||||
}
|
||||
m.AfterGas = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowCounter
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.AfterGas |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipCounter(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthCounter
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *QueryCounterRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
||||
@ -47,7 +47,7 @@ func (i interfaceRegistry) RegisterImplementations(any, ...gogoproto.Message) {}
|
||||
func newKeeper(t *testing.T, accounts ...implementation.AccountCreatorFunc) (Keeper, context.Context) {
|
||||
t.Helper()
|
||||
ss, ctx := colltest.MockStore()
|
||||
m, err := NewKeeper(ss, eventService{}, nil, nil, addressCodec{}, nil, nil, nil, interfaceRegistry{}, accounts...)
|
||||
m, err := NewKeeper(nil, ss, eventService{}, nil, nil, nil, addressCodec{}, nil, nil, nil, interfaceRegistry{}, accounts...)
|
||||
require.NoError(t, err)
|
||||
return m, ctx
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user