mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-07-02 19:02:29 +00:00
ignite scaffold message register-trust-anchor trust-anchor:TrustAnchor --module machine
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
51dfde22e1
commit
9f1ef39fec
7
docs/static/openapi.yml
vendored
7
docs/static/openapi.yml
vendored
@ -75382,6 +75382,8 @@ definitions:
|
||||
type: string
|
||||
planetmintgo.machine.MsgAttestMachineResponse:
|
||||
type: object
|
||||
planetmintgo.machine.MsgRegisterTrustAnchorResponse:
|
||||
type: object
|
||||
planetmintgo.machine.Params:
|
||||
type: object
|
||||
description: Params defines the parameters for the module.
|
||||
@ -75432,3 +75434,8 @@ definitions:
|
||||
description: params holds all the parameters of this module.
|
||||
type: object
|
||||
description: QueryParamsResponse is response type for the Query/Params RPC method.
|
||||
planetmintgo.machine.TrustAnchor:
|
||||
type: object
|
||||
properties:
|
||||
pubkey:
|
||||
type: string
|
||||
|
@ -31,7 +31,3 @@ message MachineIndex {
|
||||
string issuerPlanetmint = 2;
|
||||
string issuerLiquid = 3;
|
||||
}
|
||||
|
||||
message TrustAnchor {
|
||||
string pubkey = 1;
|
||||
}
|
||||
|
8
proto/planetmintgo/machine/trust_anchor.proto
Normal file
8
proto/planetmintgo/machine/trust_anchor.proto
Normal file
@ -0,0 +1,8 @@
|
||||
syntax = "proto3";
|
||||
package planetmintgo.machine;
|
||||
|
||||
option go_package = "planetmint-go/x/machine/types";
|
||||
|
||||
message TrustAnchor {
|
||||
string pubkey = 1;
|
||||
}
|
@ -3,12 +3,14 @@ syntax = "proto3";
|
||||
package planetmintgo.machine;
|
||||
|
||||
import "planetmintgo/machine/machine.proto";
|
||||
import "planetmintgo/machine/trust_anchor.proto";
|
||||
|
||||
option go_package = "planetmint-go/x/machine/types";
|
||||
|
||||
// Msg defines the Msg service.
|
||||
service Msg {
|
||||
rpc AttestMachine (MsgAttestMachine ) returns (MsgAttestMachineResponse );
|
||||
rpc RegisterTrustAnchor (MsgRegisterTrustAnchor) returns (MsgRegisterTrustAnchorResponse);
|
||||
}
|
||||
message MsgAttestMachine {
|
||||
string creator = 1;
|
||||
@ -17,3 +19,10 @@ message MsgAttestMachine {
|
||||
|
||||
message MsgAttestMachineResponse {}
|
||||
|
||||
message MsgRegisterTrustAnchor {
|
||||
string creator = 1;
|
||||
TrustAnchor trustAnchor = 2;
|
||||
}
|
||||
|
||||
message MsgRegisterTrustAnchorResponse {}
|
||||
|
||||
|
@ -26,6 +26,7 @@ func GetTxCmd() *cobra.Command {
|
||||
}
|
||||
|
||||
cmd.AddCommand(CmdAttestMachine())
|
||||
cmd.AddCommand(CmdRegisterTrustAnchor())
|
||||
// this line is used by starport scaffolding # 1
|
||||
|
||||
return cmd
|
||||
|
47
x/machine/client/cli/tx_register_trust_anchor.go
Normal file
47
x/machine/client/cli/tx_register_trust_anchor.go
Normal file
@ -0,0 +1,47 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"encoding/json"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
"github.com/spf13/cobra"
|
||||
"planetmint-go/x/machine/types"
|
||||
)
|
||||
|
||||
var _ = strconv.Itoa(0)
|
||||
|
||||
func CmdRegisterTrustAnchor() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "register-trust-anchor [trust-anchor]",
|
||||
Short: "Broadcast message register-trust-anchor",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
argTrustAnchor := new(types.TrustAnchor)
|
||||
err = json.Unmarshal([]byte(args[0]), argTrustAnchor)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
clientCtx, err := client.GetClientTxContext(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
msg := types.NewMsgRegisterTrustAnchor(
|
||||
clientCtx.GetFromAddress().String(),
|
||||
argTrustAnchor,
|
||||
)
|
||||
if err := msg.ValidateBasic(); err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
}
|
||||
|
||||
flags.AddTxFlagsToCmd(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
17
x/machine/keeper/msg_server_register_trust_anchor.go
Normal file
17
x/machine/keeper/msg_server_register_trust_anchor.go
Normal file
@ -0,0 +1,17 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"planetmint-go/x/machine/types"
|
||||
)
|
||||
|
||||
func (k msgServer) RegisterTrustAnchor(goCtx context.Context, msg *types.MsgRegisterTrustAnchor) (*types.MsgRegisterTrustAnchorResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
|
||||
// TODO: Handling the message
|
||||
_ = ctx
|
||||
|
||||
return &types.MsgRegisterTrustAnchorResponse{}, nil
|
||||
}
|
@ -27,6 +27,10 @@ const (
|
||||
// TODO: Determine the simulation weight value
|
||||
defaultWeightMsgAttestMachine int = 100
|
||||
|
||||
opWeightMsgRegisterTrustAnchor = "op_weight_msg_register_trust_anchor"
|
||||
// TODO: Determine the simulation weight value
|
||||
defaultWeightMsgRegisterTrustAnchor int = 100
|
||||
|
||||
// this line is used by starport scaffolding # simapp/module/const
|
||||
)
|
||||
|
||||
@ -68,6 +72,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
|
||||
machinesimulation.SimulateMsgAttestMachine(am.accountKeeper, am.bankKeeper, am.keeper),
|
||||
))
|
||||
|
||||
var weightMsgRegisterTrustAnchor int
|
||||
simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgRegisterTrustAnchor, &weightMsgRegisterTrustAnchor, nil,
|
||||
func(_ *rand.Rand) {
|
||||
weightMsgRegisterTrustAnchor = defaultWeightMsgRegisterTrustAnchor
|
||||
},
|
||||
)
|
||||
operations = append(operations, simulation.NewWeightedOperation(
|
||||
weightMsgRegisterTrustAnchor,
|
||||
machinesimulation.SimulateMsgRegisterTrustAnchor(am.accountKeeper, am.bankKeeper, am.keeper),
|
||||
))
|
||||
|
||||
// this line is used by starport scaffolding # simapp/module/operation
|
||||
|
||||
return operations
|
||||
@ -84,6 +99,14 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei
|
||||
return nil
|
||||
},
|
||||
),
|
||||
simulation.NewWeightedProposalMsg(
|
||||
opWeightMsgRegisterTrustAnchor,
|
||||
defaultWeightMsgRegisterTrustAnchor,
|
||||
func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg {
|
||||
machinesimulation.SimulateMsgRegisterTrustAnchor(am.accountKeeper, am.bankKeeper, am.keeper)
|
||||
return nil
|
||||
},
|
||||
),
|
||||
// this line is used by starport scaffolding # simapp/module/OpMsg
|
||||
}
|
||||
}
|
||||
|
29
x/machine/simulation/register_trust_anchor.go
Normal file
29
x/machine/simulation/register_trust_anchor.go
Normal file
@ -0,0 +1,29 @@
|
||||
package simulation
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
"planetmint-go/x/machine/keeper"
|
||||
"planetmint-go/x/machine/types"
|
||||
)
|
||||
|
||||
func SimulateMsgRegisterTrustAnchor(
|
||||
ak types.AccountKeeper,
|
||||
bk types.BankKeeper,
|
||||
k keeper.Keeper,
|
||||
) simtypes.Operation {
|
||||
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
||||
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
||||
simAccount, _ := simtypes.RandomAcc(r, accs)
|
||||
msg := &types.MsgRegisterTrustAnchor{
|
||||
Creator: simAccount.Address.String(),
|
||||
}
|
||||
|
||||
// TODO: Handling the RegisterTrustAnchor simulation
|
||||
|
||||
return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "RegisterTrustAnchor simulation not implemented"), nil, nil
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
func RegisterCodec(cdc *codec.LegacyAmino) {
|
||||
cdc.RegisterConcrete(&MsgAttestMachine{}, "machine/AttestMachine", nil)
|
||||
cdc.RegisterConcrete(&MsgRegisterTrustAnchor{}, "machine/RegisterTrustAnchor", nil)
|
||||
// this line is used by starport scaffolding # 2
|
||||
}
|
||||
|
||||
@ -16,6 +17,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
|
||||
registry.RegisterImplementations((*sdk.Msg)(nil),
|
||||
&MsgAttestMachine{},
|
||||
)
|
||||
registry.RegisterImplementations((*sdk.Msg)(nil),
|
||||
&MsgRegisterTrustAnchor{},
|
||||
)
|
||||
// this line is used by starport scaffolding # 3
|
||||
|
||||
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
|
||||
|
@ -274,55 +274,10 @@ func (m *MachineIndex) GetIssuerLiquid() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type TrustAnchor struct {
|
||||
Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
|
||||
}
|
||||
|
||||
func (m *TrustAnchor) Reset() { *m = TrustAnchor{} }
|
||||
func (m *TrustAnchor) String() string { return proto.CompactTextString(m) }
|
||||
func (*TrustAnchor) ProtoMessage() {}
|
||||
func (*TrustAnchor) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_1bb279745bef7c4b, []int{3}
|
||||
}
|
||||
func (m *TrustAnchor) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *TrustAnchor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_TrustAnchor.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 *TrustAnchor) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TrustAnchor.Merge(m, src)
|
||||
}
|
||||
func (m *TrustAnchor) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *TrustAnchor) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TrustAnchor.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TrustAnchor proto.InternalMessageInfo
|
||||
|
||||
func (m *TrustAnchor) GetPubkey() string {
|
||||
if m != nil {
|
||||
return m.Pubkey
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Machine)(nil), "planetmintgo.machine.Machine")
|
||||
proto.RegisterType((*Metadata)(nil), "planetmintgo.machine.Metadata")
|
||||
proto.RegisterType((*MachineIndex)(nil), "planetmintgo.machine.MachineIndex")
|
||||
proto.RegisterType((*TrustAnchor)(nil), "planetmintgo.machine.TrustAnchor")
|
||||
}
|
||||
|
||||
func init() {
|
||||
@ -330,34 +285,32 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_1bb279745bef7c4b = []byte{
|
||||
// 417 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x0b, 0xd3, 0x30,
|
||||
0x18, 0xc6, 0x97, 0x6d, 0x6e, 0xed, 0xbb, 0x89, 0x33, 0x88, 0xe4, 0xa0, 0xa5, 0x14, 0x84, 0x22,
|
||||
0xda, 0x81, 0x1e, 0x04, 0x6f, 0xea, 0x2e, 0x03, 0x07, 0x52, 0x3c, 0x79, 0xcb, 0xda, 0xb8, 0x85,
|
||||
0xad, 0x49, 0x6d, 0x52, 0xd9, 0xc0, 0x8f, 0xe0, 0xc1, 0x8f, 0xe5, 0x71, 0x47, 0xc1, 0x8b, 0x6c,
|
||||
0x5f, 0x44, 0x9a, 0xa6, 0x9b, 0xfb, 0x73, 0xf0, 0xd4, 0xf7, 0x79, 0xde, 0x27, 0xbc, 0xcd, 0x2f,
|
||||
0x2f, 0x04, 0xf9, 0x9a, 0x0a, 0xa6, 0x33, 0x2e, 0xf4, 0x42, 0x8e, 0x33, 0x9a, 0x2c, 0xb9, 0x60,
|
||||
0xcd, 0x37, 0xca, 0x0b, 0xa9, 0x25, 0x7e, 0xf0, 0x6f, 0x26, 0xb2, 0xbd, 0xe0, 0x77, 0x1b, 0xfa,
|
||||
0xb3, 0xba, 0xc6, 0x18, 0xba, 0x82, 0x66, 0x8c, 0x20, 0x1f, 0x85, 0x6e, 0x6c, 0x6a, 0xfc, 0x10,
|
||||
0x7a, 0x9a, 0x27, 0x2b, 0x56, 0x90, 0xb6, 0x71, 0xad, 0xaa, 0xfc, 0x54, 0x66, 0x94, 0x0b, 0xd2,
|
||||
0xa9, 0xfd, 0x5a, 0x61, 0x02, 0xfd, 0x82, 0x71, 0xa5, 0x4a, 0x46, 0xba, 0x3e, 0x0a, 0x9d, 0xb8,
|
||||
0x91, 0xd5, 0x09, 0x9a, 0xc9, 0x52, 0x68, 0x72, 0xc7, 0x47, 0x61, 0x37, 0xb6, 0x0a, 0x3f, 0x02,
|
||||
0x37, 0x2f, 0x58, 0xc2, 0x15, 0x97, 0x82, 0xf4, 0x4c, 0xeb, 0x64, 0xe0, 0xa7, 0x30, 0x32, 0xc7,
|
||||
0x8b, 0x0f, 0xc7, 0xbf, 0x27, 0x7d, 0x33, 0xf1, 0xca, 0xc7, 0x01, 0x0c, 0x6b, 0xef, 0x3d, 0xff,
|
||||
0x52, 0xf2, 0x94, 0x38, 0x26, 0x77, 0xe6, 0x55, 0xd3, 0xec, 0xd5, 0xa7, 0x29, 0x71, 0x4d, 0xe0,
|
||||
0x64, 0xe0, 0xd7, 0xe0, 0x64, 0x4c, 0xd3, 0x94, 0x6a, 0x4a, 0xc0, 0x47, 0xe1, 0xe0, 0x85, 0x17,
|
||||
0xdd, 0xc2, 0x16, 0xcd, 0x6c, 0x2a, 0x3e, 0xe6, 0x2b, 0x7a, 0x7a, 0x9b, 0x33, 0x32, 0xf0, 0x51,
|
||||
0x78, 0x37, 0x36, 0x75, 0xf0, 0x1d, 0x81, 0xd3, 0x44, 0xf1, 0x08, 0x3a, 0x8b, 0x5c, 0x59, 0xba,
|
||||
0x55, 0x69, 0x20, 0xb2, 0xaf, 0x3c, 0x61, 0x0d, 0xdc, 0x5a, 0xe1, 0x10, 0xee, 0x51, 0xa5, 0x98,
|
||||
0x9e, 0xb0, 0xcf, 0x5c, 0x70, 0x5d, 0x81, 0xa9, 0x29, 0x5f, 0xda, 0xf8, 0x19, 0xdc, 0xa7, 0x69,
|
||||
0x6a, 0x6a, 0xba, 0x9e, 0x50, 0x4d, 0xdf, 0x4d, 0x27, 0x06, 0xbc, 0x1b, 0x5f, 0x37, 0x82, 0x6f,
|
||||
0x30, 0xb4, 0x6f, 0x3d, 0x15, 0x29, 0xdb, 0x9c, 0xc3, 0x40, 0x97, 0x30, 0x6e, 0xa1, 0x6f, 0xff,
|
||||
0x27, 0xfa, 0xce, 0x35, 0xfa, 0xe0, 0x09, 0x0c, 0x3e, 0x16, 0xa5, 0xd2, 0x6f, 0x44, 0xb2, 0x94,
|
||||
0x66, 0x83, 0xf2, 0x72, 0xbe, 0x62, 0x5b, 0x3b, 0xd9, 0xaa, 0xb7, 0xaf, 0x7e, 0xee, 0x3d, 0xb4,
|
||||
0xdb, 0x7b, 0xe8, 0xcf, 0xde, 0x43, 0x3f, 0x0e, 0x5e, 0x6b, 0x77, 0xf0, 0x5a, 0xbf, 0x0e, 0x5e,
|
||||
0xeb, 0xd3, 0xe3, 0xd3, 0x53, 0x3c, 0x5f, 0xc8, 0xf1, 0xe6, 0xb8, 0xe8, 0x15, 0x6b, 0x35, 0xef,
|
||||
0x99, 0x3d, 0x7f, 0xf9, 0x37, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x0c, 0xb1, 0x11, 0x0d, 0x03, 0x00,
|
||||
0x00,
|
||||
// 394 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x4a, 0xf3, 0x40,
|
||||
0x14, 0xc5, 0x3b, 0x6d, 0xbf, 0x36, 0xb9, 0xed, 0x87, 0x75, 0x10, 0x99, 0x85, 0x86, 0x90, 0x55,
|
||||
0x10, 0x4d, 0x41, 0x17, 0x82, 0x4b, 0xed, 0xa6, 0x60, 0x41, 0xb2, 0x74, 0x37, 0x26, 0x63, 0x1d,
|
||||
0x6c, 0x26, 0x31, 0x99, 0x4a, 0x05, 0x1f, 0xc1, 0x85, 0x8f, 0xe5, 0xb2, 0x4b, 0xc1, 0x8d, 0xb4,
|
||||
0x2f, 0x22, 0x99, 0x4c, 0x5a, 0xfb, 0x67, 0xe1, 0x2a, 0xe7, 0x9c, 0x7b, 0x86, 0x49, 0x7e, 0xb9,
|
||||
0xe0, 0x24, 0x23, 0x2a, 0x98, 0x8c, 0xb8, 0x90, 0xc3, 0xb8, 0x1b, 0xd1, 0xe0, 0x81, 0x0b, 0x56,
|
||||
0x3e, 0xbd, 0x24, 0x8d, 0x65, 0x8c, 0xf7, 0x7e, 0x77, 0x3c, 0x3d, 0x73, 0xbe, 0xaa, 0xd0, 0x1c,
|
||||
0x14, 0x1a, 0x63, 0xa8, 0x0b, 0x1a, 0x31, 0x82, 0x6c, 0xe4, 0x9a, 0xbe, 0xd2, 0x78, 0x1f, 0x1a,
|
||||
0x92, 0x07, 0x8f, 0x2c, 0x25, 0x55, 0x95, 0x6a, 0x97, 0xe7, 0x61, 0x1c, 0x51, 0x2e, 0x48, 0xad,
|
||||
0xc8, 0x0b, 0x87, 0x09, 0x34, 0x53, 0xc6, 0xb3, 0x6c, 0xcc, 0x48, 0xdd, 0x46, 0xae, 0xe1, 0x97,
|
||||
0x36, 0x3f, 0x41, 0xa3, 0x78, 0x2c, 0x24, 0xf9, 0x67, 0x23, 0xb7, 0xee, 0x6b, 0x87, 0x0f, 0xc0,
|
||||
0x4c, 0x52, 0x16, 0xf0, 0x8c, 0xc7, 0x82, 0x34, 0xd4, 0x68, 0x19, 0xe0, 0x23, 0xe8, 0xa8, 0xe3,
|
||||
0xe9, 0xcd, 0xe2, 0xed, 0x49, 0x53, 0xdd, 0xb8, 0x91, 0x63, 0x07, 0xda, 0x45, 0x76, 0xcd, 0x9f,
|
||||
0xc6, 0x3c, 0x24, 0x86, 0xea, 0xad, 0x64, 0xf9, 0x6d, 0xfa, 0xd3, 0xfb, 0x21, 0x31, 0x55, 0x61,
|
||||
0x19, 0xe0, 0x0b, 0x30, 0x22, 0x26, 0x69, 0x48, 0x25, 0x25, 0x60, 0x23, 0xb7, 0x75, 0x6a, 0x79,
|
||||
0xdb, 0xb0, 0x79, 0x03, 0xdd, 0xf2, 0x17, 0xfd, 0x9c, 0x9e, 0x7c, 0x49, 0x18, 0x69, 0xd9, 0xc8,
|
||||
0xfd, 0xef, 0x2b, 0xed, 0xbc, 0x21, 0x30, 0xca, 0x2a, 0xee, 0x40, 0x6d, 0x98, 0x64, 0x9a, 0x6e,
|
||||
0x2e, 0x15, 0x44, 0xf6, 0xcc, 0x03, 0x56, 0xc2, 0x2d, 0x1c, 0x76, 0x61, 0x87, 0x66, 0x19, 0x93,
|
||||
0x3d, 0x76, 0xcf, 0x05, 0x97, 0x39, 0x98, 0x82, 0xf2, 0x7a, 0x8c, 0x8f, 0x61, 0x97, 0x86, 0xa1,
|
||||
0xd2, 0x74, 0xd4, 0xa3, 0x92, 0x5e, 0xf5, 0x7b, 0x0a, 0xbc, 0xe9, 0x6f, 0x0e, 0x9c, 0x57, 0x68,
|
||||
0xeb, 0x7f, 0xdd, 0x17, 0x21, 0x9b, 0xac, 0xc2, 0x40, 0xeb, 0x30, 0xb6, 0xa1, 0xaf, 0xfe, 0x11,
|
||||
0x7d, 0x6d, 0x13, 0xfd, 0xe5, 0xf9, 0xc7, 0xcc, 0x42, 0xd3, 0x99, 0x85, 0xbe, 0x67, 0x16, 0x7a,
|
||||
0x9f, 0x5b, 0x95, 0xe9, 0xdc, 0xaa, 0x7c, 0xce, 0xad, 0xca, 0xed, 0xe1, 0x92, 0xf1, 0xc9, 0x30,
|
||||
0xee, 0x4e, 0x16, 0x1b, 0x9c, 0x43, 0xcc, 0xee, 0x1a, 0x6a, 0x81, 0xcf, 0x7e, 0x02, 0x00, 0x00,
|
||||
0xff, 0xff, 0xb9, 0x18, 0x24, 0xb2, 0xe6, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *Machine) Marshal() (dAtA []byte, err error) {
|
||||
@ -557,36 +510,6 @@ func (m *MachineIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *TrustAnchor) 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 *TrustAnchor) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *TrustAnchor) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Pubkey) > 0 {
|
||||
i -= len(m.Pubkey)
|
||||
copy(dAtA[i:], m.Pubkey)
|
||||
i = encodeVarintMachine(dAtA, i, uint64(len(m.Pubkey)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintMachine(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovMachine(v)
|
||||
base := offset
|
||||
@ -693,19 +616,6 @@ func (m *MachineIndex) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *TrustAnchor) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Pubkey)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovMachine(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovMachine(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
@ -1391,88 +1301,6 @@ func (m *MachineIndex) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *TrustAnchor) 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 ErrIntOverflowMachine
|
||||
}
|
||||
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: TrustAnchor: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: TrustAnchor: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMachine
|
||||
}
|
||||
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 ErrInvalidLengthMachine
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthMachine
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Pubkey = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipMachine(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthMachine
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipMachine(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
46
x/machine/types/message_register_trust_anchor.go
Normal file
46
x/machine/types/message_register_trust_anchor.go
Normal file
@ -0,0 +1,46 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
|
||||
const TypeMsgRegisterTrustAnchor = "register_trust_anchor"
|
||||
|
||||
var _ sdk.Msg = &MsgRegisterTrustAnchor{}
|
||||
|
||||
func NewMsgRegisterTrustAnchor(creator string, trustAnchor *TrustAnchor) *MsgRegisterTrustAnchor {
|
||||
return &MsgRegisterTrustAnchor{
|
||||
Creator: creator,
|
||||
TrustAnchor: trustAnchor,
|
||||
}
|
||||
}
|
||||
|
||||
func (msg *MsgRegisterTrustAnchor) Route() string {
|
||||
return RouterKey
|
||||
}
|
||||
|
||||
func (msg *MsgRegisterTrustAnchor) Type() string {
|
||||
return TypeMsgRegisterTrustAnchor
|
||||
}
|
||||
|
||||
func (msg *MsgRegisterTrustAnchor) GetSigners() []sdk.AccAddress {
|
||||
creator, err := sdk.AccAddressFromBech32(msg.Creator)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return []sdk.AccAddress{creator}
|
||||
}
|
||||
|
||||
func (msg *MsgRegisterTrustAnchor) GetSignBytes() []byte {
|
||||
bz := ModuleCdc.MustMarshalJSON(msg)
|
||||
return sdk.MustSortJSON(bz)
|
||||
}
|
||||
|
||||
func (msg *MsgRegisterTrustAnchor) ValidateBasic() error {
|
||||
_, err := sdk.AccAddressFromBech32(msg.Creator)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
|
||||
}
|
||||
return nil
|
||||
}
|
40
x/machine/types/message_register_trust_anchor_test.go
Normal file
40
x/machine/types/message_register_trust_anchor_test.go
Normal file
@ -0,0 +1,40 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/stretchr/testify/require"
|
||||
"planetmint-go/testutil/sample"
|
||||
)
|
||||
|
||||
func TestMsgRegisterTrustAnchor_ValidateBasic(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
msg MsgRegisterTrustAnchor
|
||||
err error
|
||||
}{
|
||||
{
|
||||
name: "invalid address",
|
||||
msg: MsgRegisterTrustAnchor{
|
||||
Creator: "invalid_address",
|
||||
},
|
||||
err: sdkerrors.ErrInvalidAddress,
|
||||
}, {
|
||||
name: "valid address",
|
||||
msg: MsgRegisterTrustAnchor{
|
||||
Creator: sample.AccAddress(),
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
err := tt.msg.ValidateBasic()
|
||||
if tt.err != nil {
|
||||
require.ErrorIs(t, err, tt.err)
|
||||
return
|
||||
}
|
||||
require.NoError(t, err)
|
||||
})
|
||||
}
|
||||
}
|
316
x/machine/types/trust_anchor.pb.go
Normal file
316
x/machine/types/trust_anchor.pb.go
Normal file
@ -0,0 +1,316 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: planetmintgo/machine/trust_anchor.proto
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type TrustAnchor struct {
|
||||
Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
|
||||
}
|
||||
|
||||
func (m *TrustAnchor) Reset() { *m = TrustAnchor{} }
|
||||
func (m *TrustAnchor) String() string { return proto.CompactTextString(m) }
|
||||
func (*TrustAnchor) ProtoMessage() {}
|
||||
func (*TrustAnchor) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c743aa40c45e7aac, []int{0}
|
||||
}
|
||||
func (m *TrustAnchor) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *TrustAnchor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_TrustAnchor.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 *TrustAnchor) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TrustAnchor.Merge(m, src)
|
||||
}
|
||||
func (m *TrustAnchor) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *TrustAnchor) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TrustAnchor.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TrustAnchor proto.InternalMessageInfo
|
||||
|
||||
func (m *TrustAnchor) GetPubkey() string {
|
||||
if m != nil {
|
||||
return m.Pubkey
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*TrustAnchor)(nil), "planetmintgo.machine.TrustAnchor")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("planetmintgo/machine/trust_anchor.proto", fileDescriptor_c743aa40c45e7aac)
|
||||
}
|
||||
|
||||
var fileDescriptor_c743aa40c45e7aac = []byte{
|
||||
// 149 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2f, 0xc8, 0x49, 0xcc,
|
||||
0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0xcf, 0x4d, 0x4c, 0xce, 0xc8, 0xcc, 0x4b,
|
||||
0xd5, 0x2f, 0x29, 0x2a, 0x2d, 0x2e, 0x89, 0x4f, 0xcc, 0x4b, 0xce, 0xc8, 0x2f, 0xd2, 0x2b, 0x28,
|
||||
0xca, 0x2f, 0xc9, 0x17, 0x12, 0x41, 0x56, 0xa8, 0x07, 0x55, 0xa8, 0xa4, 0xca, 0xc5, 0x1d, 0x02,
|
||||
0x52, 0xeb, 0x08, 0x56, 0x2a, 0x24, 0xc6, 0xc5, 0x56, 0x50, 0x9a, 0x94, 0x9d, 0x5a, 0x29, 0xc1,
|
||||
0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe5, 0x39, 0x99, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91,
|
||||
0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3,
|
||||
0xb1, 0x1c, 0x43, 0x94, 0x2c, 0xc2, 0x58, 0xdd, 0xf4, 0x7c, 0xfd, 0x0a, 0x84, 0x13, 0x2a, 0x0b,
|
||||
0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x96, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x05, 0x42, 0xb6,
|
||||
0x02, 0xa7, 0x00, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *TrustAnchor) 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 *TrustAnchor) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *TrustAnchor) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Pubkey) > 0 {
|
||||
i -= len(m.Pubkey)
|
||||
copy(dAtA[i:], m.Pubkey)
|
||||
i = encodeVarintTrustAnchor(dAtA, i, uint64(len(m.Pubkey)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintTrustAnchor(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovTrustAnchor(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *TrustAnchor) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Pubkey)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTrustAnchor(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovTrustAnchor(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozTrustAnchor(x uint64) (n int) {
|
||||
return sovTrustAnchor(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *TrustAnchor) 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 ErrIntOverflowTrustAnchor
|
||||
}
|
||||
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: TrustAnchor: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: TrustAnchor: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTrustAnchor
|
||||
}
|
||||
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 ErrInvalidLengthTrustAnchor
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTrustAnchor
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Pubkey = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTrustAnchor(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTrustAnchor
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipTrustAnchor(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
depth := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowTrustAnchor
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowTrustAnchor
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowTrustAnchor
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthTrustAnchor
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupTrustAnchor
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthTrustAnchor
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthTrustAnchor = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowTrustAnchor = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupTrustAnchor = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
@ -115,29 +115,125 @@ func (m *MsgAttestMachineResponse) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_MsgAttestMachineResponse proto.InternalMessageInfo
|
||||
|
||||
type MsgRegisterTrustAnchor struct {
|
||||
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||
TrustAnchor *TrustAnchor `protobuf:"bytes,2,opt,name=trustAnchor,proto3" json:"trustAnchor,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgRegisterTrustAnchor) Reset() { *m = MsgRegisterTrustAnchor{} }
|
||||
func (m *MsgRegisterTrustAnchor) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgRegisterTrustAnchor) ProtoMessage() {}
|
||||
func (*MsgRegisterTrustAnchor) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_85ac37e5c8e5251d, []int{2}
|
||||
}
|
||||
func (m *MsgRegisterTrustAnchor) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgRegisterTrustAnchor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgRegisterTrustAnchor.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 *MsgRegisterTrustAnchor) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgRegisterTrustAnchor.Merge(m, src)
|
||||
}
|
||||
func (m *MsgRegisterTrustAnchor) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgRegisterTrustAnchor) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgRegisterTrustAnchor.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgRegisterTrustAnchor proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgRegisterTrustAnchor) GetCreator() string {
|
||||
if m != nil {
|
||||
return m.Creator
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgRegisterTrustAnchor) GetTrustAnchor() *TrustAnchor {
|
||||
if m != nil {
|
||||
return m.TrustAnchor
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type MsgRegisterTrustAnchorResponse struct {
|
||||
}
|
||||
|
||||
func (m *MsgRegisterTrustAnchorResponse) Reset() { *m = MsgRegisterTrustAnchorResponse{} }
|
||||
func (m *MsgRegisterTrustAnchorResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgRegisterTrustAnchorResponse) ProtoMessage() {}
|
||||
func (*MsgRegisterTrustAnchorResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_85ac37e5c8e5251d, []int{3}
|
||||
}
|
||||
func (m *MsgRegisterTrustAnchorResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgRegisterTrustAnchorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgRegisterTrustAnchorResponse.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 *MsgRegisterTrustAnchorResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgRegisterTrustAnchorResponse.Merge(m, src)
|
||||
}
|
||||
func (m *MsgRegisterTrustAnchorResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgRegisterTrustAnchorResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgRegisterTrustAnchorResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgRegisterTrustAnchorResponse proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MsgAttestMachine)(nil), "planetmintgo.machine.MsgAttestMachine")
|
||||
proto.RegisterType((*MsgAttestMachineResponse)(nil), "planetmintgo.machine.MsgAttestMachineResponse")
|
||||
proto.RegisterType((*MsgRegisterTrustAnchor)(nil), "planetmintgo.machine.MsgRegisterTrustAnchor")
|
||||
proto.RegisterType((*MsgRegisterTrustAnchorResponse)(nil), "planetmintgo.machine.MsgRegisterTrustAnchorResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("planetmintgo/machine/tx.proto", fileDescriptor_85ac37e5c8e5251d) }
|
||||
|
||||
var fileDescriptor_85ac37e5c8e5251d = []byte{
|
||||
// 216 bytes of a gzipped FileDescriptorProto
|
||||
// 305 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0xc8, 0x49, 0xcc,
|
||||
0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0xcf, 0x4d, 0x4c, 0xce, 0xc8, 0xcc, 0x4b,
|
||||
0xd5, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x41, 0x96, 0xd6, 0x83, 0x4a,
|
||||
0x4b, 0x29, 0x61, 0xd5, 0x04, 0xa5, 0x21, 0x3a, 0x95, 0x52, 0xb9, 0x04, 0x7c, 0x8b, 0xd3, 0x1d,
|
||||
0x4b, 0x4a, 0x52, 0x8b, 0x4b, 0x7c, 0x21, 0x32, 0x42, 0x12, 0x5c, 0xec, 0xc9, 0x45, 0xa9, 0x89,
|
||||
0x25, 0xf9, 0x45, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x30, 0xae, 0x90, 0x39, 0x17, 0x3b,
|
||||
0x54, 0xbb, 0x04, 0x93, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0xac, 0x1e, 0x36, 0x9b, 0xf5, 0xa0, 0x26,
|
||||
0x05, 0xc1, 0x54, 0x2b, 0x49, 0x71, 0x49, 0xa0, 0x5b, 0x13, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57,
|
||||
0x9c, 0x6a, 0x94, 0xc7, 0xc5, 0xec, 0x5b, 0x9c, 0x2e, 0x94, 0xce, 0xc5, 0x8b, 0xea, 0x0c, 0x35,
|
||||
0x1c, 0x66, 0xa3, 0x99, 0x23, 0xa5, 0x47, 0x9c, 0x3a, 0x98, 0x7d, 0x4e, 0xe6, 0x27, 0x1e, 0xc9,
|
||||
0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e,
|
||||
0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x85, 0x14, 0xca, 0xba, 0xe9, 0xf9, 0xfa, 0x15, 0x88,
|
||||
0x80, 0xae, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x07, 0x99, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff,
|
||||
0x78, 0x82, 0x2b, 0xac, 0x8d, 0x01, 0x00, 0x00,
|
||||
0x4b, 0x29, 0x61, 0xd5, 0x04, 0xa5, 0x21, 0x3a, 0xa5, 0xd4, 0xb1, 0x1b, 0x5c, 0x54, 0x5a, 0x5c,
|
||||
0x12, 0x9f, 0x98, 0x97, 0x9c, 0x91, 0x5f, 0x04, 0x51, 0xa8, 0x94, 0xca, 0x25, 0xe0, 0x5b, 0x9c,
|
||||
0xee, 0x58, 0x52, 0x92, 0x5a, 0x5c, 0xe2, 0x0b, 0x51, 0x26, 0x24, 0xc1, 0xc5, 0x9e, 0x5c, 0x94,
|
||||
0x9a, 0x58, 0x92, 0x5f, 0x24, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe3, 0x0a, 0x99, 0x73,
|
||||
0xb1, 0x43, 0xcd, 0x92, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd5, 0xc3, 0xe6, 0x44, 0x3d,
|
||||
0xa8, 0x49, 0x41, 0x30, 0xd5, 0x4a, 0x52, 0x5c, 0x12, 0xe8, 0xd6, 0x04, 0xa5, 0x16, 0x17, 0xe4,
|
||||
0xe7, 0x15, 0xa7, 0x2a, 0x95, 0x73, 0x89, 0xf9, 0x16, 0xa7, 0x07, 0xa5, 0xa6, 0x67, 0x16, 0x97,
|
||||
0xa4, 0x16, 0x85, 0x80, 0xdc, 0xe8, 0x08, 0x76, 0x22, 0x1e, 0x87, 0x38, 0x73, 0x71, 0x97, 0x20,
|
||||
0x14, 0x42, 0x1d, 0xa3, 0x88, 0xdd, 0x31, 0x48, 0x26, 0x06, 0x21, 0xeb, 0x52, 0x52, 0xe0, 0x92,
|
||||
0xc3, 0x6e, 0x31, 0xcc, 0x69, 0x46, 0x2f, 0x19, 0xb9, 0x98, 0x7d, 0x8b, 0xd3, 0x85, 0xd2, 0xb9,
|
||||
0x78, 0x51, 0x83, 0x48, 0x0d, 0x87, 0xbf, 0xd1, 0xfc, 0x28, 0xa5, 0x47, 0x9c, 0x3a, 0x98, 0x85,
|
||||
0x42, 0x95, 0x5c, 0xc2, 0xd8, 0x02, 0x42, 0x07, 0xa7, 0x31, 0x58, 0x54, 0x4b, 0x99, 0x90, 0xa2,
|
||||
0x1a, 0x66, 0xb5, 0x93, 0xf9, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24,
|
||||
0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x21,
|
||||
0xa5, 0x52, 0xdd, 0xf4, 0x7c, 0xfd, 0x0a, 0x44, 0x7a, 0xaa, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03,
|
||||
0xa7, 0x24, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x66, 0xa7, 0x9c, 0x05, 0xcd, 0x02, 0x00,
|
||||
0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -153,6 +249,7 @@ const _ = grpc.SupportPackageIsVersion4
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type MsgClient interface {
|
||||
AttestMachine(ctx context.Context, in *MsgAttestMachine, opts ...grpc.CallOption) (*MsgAttestMachineResponse, error)
|
||||
RegisterTrustAnchor(ctx context.Context, in *MsgRegisterTrustAnchor, opts ...grpc.CallOption) (*MsgRegisterTrustAnchorResponse, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
@ -172,9 +269,19 @@ func (c *msgClient) AttestMachine(ctx context.Context, in *MsgAttestMachine, opt
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) RegisterTrustAnchor(ctx context.Context, in *MsgRegisterTrustAnchor, opts ...grpc.CallOption) (*MsgRegisterTrustAnchorResponse, error) {
|
||||
out := new(MsgRegisterTrustAnchorResponse)
|
||||
err := c.cc.Invoke(ctx, "/planetmintgo.machine.Msg/RegisterTrustAnchor", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
type MsgServer interface {
|
||||
AttestMachine(context.Context, *MsgAttestMachine) (*MsgAttestMachineResponse, error)
|
||||
RegisterTrustAnchor(context.Context, *MsgRegisterTrustAnchor) (*MsgRegisterTrustAnchorResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
|
||||
@ -184,6 +291,9 @@ type UnimplementedMsgServer struct {
|
||||
func (*UnimplementedMsgServer) AttestMachine(ctx context.Context, req *MsgAttestMachine) (*MsgAttestMachineResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AttestMachine not implemented")
|
||||
}
|
||||
func (*UnimplementedMsgServer) RegisterTrustAnchor(ctx context.Context, req *MsgRegisterTrustAnchor) (*MsgRegisterTrustAnchorResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RegisterTrustAnchor not implemented")
|
||||
}
|
||||
|
||||
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
|
||||
s.RegisterService(&_Msg_serviceDesc, srv)
|
||||
@ -207,6 +317,24 @@ func _Msg_AttestMachine_Handler(srv interface{}, ctx context.Context, dec func(i
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_RegisterTrustAnchor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgRegisterTrustAnchor)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).RegisterTrustAnchor(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/planetmintgo.machine.Msg/RegisterTrustAnchor",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).RegisterTrustAnchor(ctx, req.(*MsgRegisterTrustAnchor))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "planetmintgo.machine.Msg",
|
||||
HandlerType: (*MsgServer)(nil),
|
||||
@ -215,6 +343,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "AttestMachine",
|
||||
Handler: _Msg_AttestMachine_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RegisterTrustAnchor",
|
||||
Handler: _Msg_RegisterTrustAnchor_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "planetmintgo/machine/tx.proto",
|
||||
@ -285,6 +417,71 @@ func (m *MsgAttestMachineResponse) MarshalToSizedBuffer(dAtA []byte) (int, error
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgRegisterTrustAnchor) 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 *MsgRegisterTrustAnchor) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgRegisterTrustAnchor) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.TrustAnchor != nil {
|
||||
{
|
||||
size, err := m.TrustAnchor.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Creator) > 0 {
|
||||
i -= len(m.Creator)
|
||||
copy(dAtA[i:], m.Creator)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgRegisterTrustAnchorResponse) 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 *MsgRegisterTrustAnchorResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgRegisterTrustAnchorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovTx(v)
|
||||
base := offset
|
||||
@ -322,6 +519,32 @@ func (m *MsgAttestMachineResponse) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgRegisterTrustAnchor) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Creator)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
if m.TrustAnchor != nil {
|
||||
l = m.TrustAnchor.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgRegisterTrustAnchorResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
return n
|
||||
}
|
||||
|
||||
func sovTx(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
@ -496,6 +719,174 @@ func (m *MsgAttestMachineResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgRegisterTrustAnchor) 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 ErrIntOverflowTx
|
||||
}
|
||||
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: MsgRegisterTrustAnchor: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgRegisterTrustAnchor: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
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 ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Creator = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field TrustAnchor", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.TrustAnchor == nil {
|
||||
m.TrustAnchor = &TrustAnchor{}
|
||||
}
|
||||
if err := m.TrustAnchor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTx(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgRegisterTrustAnchorResponse) 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 ErrIntOverflowTx
|
||||
}
|
||||
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: MsgRegisterTrustAnchorResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgRegisterTrustAnchorResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTx(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipTx(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user