Merge pull request #93 from planetmint/75-pop

add get machine by address capabilities and block proposer check
This commit is contained in:
Lorenz Herzberger 2023-09-26 10:33:31 +02:00 committed by GitHub
commit f64a9832f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 1053 additions and 82 deletions

View File

@ -29,7 +29,7 @@ func (cm CheckMachineDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate
case "/planetmintgo.asset.MsgNotarizeAsset": case "/planetmintgo.asset.MsgNotarizeAsset":
notarizeMsg, ok := msg.(*assettypes.MsgNotarizeAsset) notarizeMsg, ok := msg.(*assettypes.MsgNotarizeAsset)
if ok { if ok {
_, found := cm.mk.GetMachineIndex(ctx, notarizeMsg.PubKey) _, found := cm.mk.GetMachineIndexByPubKey(ctx, notarizeMsg.PubKey)
if !found { if !found {
return ctx, errorsmod.Wrapf(machinetypes.ErrMachineNotFound, "error during CheckTx or ReCheckTx") return ctx, errorsmod.Wrapf(machinetypes.ErrMachineNotFound, "error during CheckTx or ReCheckTx")
} }

View File

@ -8,7 +8,7 @@ import (
) )
type MachineKeeper interface { type MachineKeeper interface {
GetMachineIndex(ctx sdk.Context, pubKey string) (val types.MachineIndex, found bool) GetMachineIndexByPubKey(ctx sdk.Context, pubKey string) (val types.MachineIndex, found bool)
GetTrustAnchor(ctx sdk.Context, pubKey string) (val types.TrustAnchor, activated bool, found bool) GetTrustAnchor(ctx sdk.Context, pubKey string) (val types.TrustAnchor, activated bool, found bool)
} }

View File

@ -313,7 +313,7 @@ func New(
feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icahosttypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icahosttypes.StoreKey,
capabilitytypes.StoreKey, group.StoreKey, icacontrollertypes.StoreKey, consensusparamtypes.StoreKey, capabilitytypes.StoreKey, group.StoreKey, icacontrollertypes.StoreKey, consensusparamtypes.StoreKey,
machinemoduletypes.StoreKey, machinemoduletypes.TAIndexKey, machinemoduletypes.IssuerPlanetmintIndexKey, machinemoduletypes.IssuerLiquidIndexKey, machinemoduletypes.StoreKey, machinemoduletypes.TAIndexKey, machinemoduletypes.IssuerPlanetmintIndexKey, machinemoduletypes.IssuerLiquidIndexKey,
machinemoduletypes.TrustAnchorKey, machinemoduletypes.TrustAnchorKey, machinemoduletypes.AddressIndexKey,
assetmoduletypes.StoreKey, assetmoduletypes.StoreKey,
daomoduletypes.StoreKey, daomoduletypes.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey // this line is used by starport scaffolding # stargate/app/storeKey
@ -545,6 +545,7 @@ func New(
keys[machinemoduletypes.IssuerPlanetmintIndexKey], keys[machinemoduletypes.IssuerPlanetmintIndexKey],
keys[machinemoduletypes.IssuerLiquidIndexKey], keys[machinemoduletypes.IssuerLiquidIndexKey],
keys[machinemoduletypes.TrustAnchorKey], keys[machinemoduletypes.TrustAnchorKey],
keys[machinemoduletypes.AddressIndexKey],
keys[machinemoduletypes.MemStoreKey], keys[machinemoduletypes.MemStoreKey],
app.GetSubspace(machinemoduletypes.ModuleName), app.GetSubspace(machinemoduletypes.ModuleName),
) )

View File

@ -2,6 +2,8 @@ package config
import ( import (
"encoding/json" "encoding/json"
"os/user"
"path/filepath"
"sync" "sync"
) )
@ -17,6 +19,7 @@ watchmen-port = {{ .PlmntConfig.WatchmenPort }}
token-denom = "{{ .PlmntConfig.TokenDenom }}" token-denom = "{{ .PlmntConfig.TokenDenom }}"
stake-denom = "{{ .PlmntConfig.StakeDenom }}" stake-denom = "{{ .PlmntConfig.StakeDenom }}"
fee-denom = "{{ .PlmntConfig.FeeDenom }}" fee-denom = "{{ .PlmntConfig.FeeDenom }}"
config-root-dir = "{{ .PlmntConfig.ConfigRootDir }}"
` `
// Config defines Planetmint's top level configuration // Config defines Planetmint's top level configuration
@ -27,6 +30,7 @@ type Config struct {
TokenDenom string `mapstructure:"token-denom" json:"token-denom"` TokenDenom string `mapstructure:"token-denom" json:"token-denom"`
StakeDenom string `mapstructure:"stake-denom" json:"stake-denom"` StakeDenom string `mapstructure:"stake-denom" json:"stake-denom"`
FeeDenom string `mapstructure:"fee-denom" json:"fee-denom"` FeeDenom string `mapstructure:"fee-denom" json:"fee-denom"`
ConfigRootDir string `mapstructure:"config-root-dir" json:"config-root-dir"`
} }
// cosmos-sdk wide global singleton // cosmos-sdk wide global singleton
@ -37,6 +41,11 @@ var (
// DefaultConfig returns planetmint's default configuration. // DefaultConfig returns planetmint's default configuration.
func DefaultConfig() *Config { func DefaultConfig() *Config {
currentUser, err := user.Current()
if err != nil {
panic(err)
}
return &Config{ return &Config{
OSCServicePort: 8766, OSCServicePort: 8766,
WatchmenEndpoint: "lab.r3c.network", WatchmenEndpoint: "lab.r3c.network",
@ -44,6 +53,7 @@ func DefaultConfig() *Config {
TokenDenom: "plmnt", TokenDenom: "plmnt",
StakeDenom: "plmntstake", StakeDenom: "plmntstake",
FeeDenom: "plmnt", FeeDenom: "plmnt",
ConfigRootDir: filepath.Join(currentUser.HomeDir, ".planetmint-go"),
} }
} }

View File

@ -46558,6 +46558,8 @@ paths:
format: int64 format: int64
machineIdSignature: machineIdSignature:
type: string type: string
address:
type: string
default: default:
description: An unexpected error response. description: An unexpected error response.
schema: schema:
@ -46658,6 +46660,82 @@ paths:
additionalProperties: {} additionalProperties: {}
tags: tags:
- Query - Query
/planetmint-go/machine/get_machine_by_address/{address}:
get:
summary: Queries a list of GetMachineByAddress items.
operationId: PlanetmintgoMachineGetMachineByAddress
responses:
'200':
description: A successful response.
schema:
type: object
properties:
machine:
type: object
properties:
name:
type: string
ticker:
type: string
domain:
type: string
reissue:
type: boolean
amount:
type: string
format: uint64
precision:
type: string
format: uint64
issuerPlanetmint:
type: string
issuerLiquid:
type: string
machineId:
type: string
metadata:
type: object
properties:
gps:
type: string
device:
type: string
assetDefinition:
type: string
additionalDataCID:
type: string
type:
type: integer
format: int64
machineIdSignature:
type: string
address:
type: string
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
parameters:
- name: address
in: path
required: true
type: string
tags:
- Query
definitions: definitions:
cosmos.auth.v1beta1.AddressBytesToStringResponse: cosmos.auth.v1beta1.AddressBytesToStringResponse:
type: object type: object
@ -75458,6 +75536,8 @@ definitions:
format: int64 format: int64
machineIdSignature: machineIdSignature:
type: string type: string
address:
type: string
planetmintgo.machine.Metadata: planetmintgo.machine.Metadata:
type: object type: object
properties: properties:
@ -75476,6 +75556,50 @@ definitions:
planetmintgo.machine.Params: planetmintgo.machine.Params:
type: object type: object
description: Params defines the parameters for the module. description: Params defines the parameters for the module.
planetmintgo.machine.QueryGetMachineByAddressResponse:
type: object
properties:
machine:
type: object
properties:
name:
type: string
ticker:
type: string
domain:
type: string
reissue:
type: boolean
amount:
type: string
format: uint64
precision:
type: string
format: uint64
issuerPlanetmint:
type: string
issuerLiquid:
type: string
machineId:
type: string
metadata:
type: object
properties:
gps:
type: string
device:
type: string
assetDefinition:
type: string
additionalDataCID:
type: string
type:
type: integer
format: int64
machineIdSignature:
type: string
address:
type: string
planetmintgo.machine.QueryGetMachineByPublicKeyResponse: planetmintgo.machine.QueryGetMachineByPublicKeyResponse:
type: object type: object
properties: properties:
@ -75518,6 +75642,8 @@ definitions:
format: int64 format: int64
machineIdSignature: machineIdSignature:
type: string type: string
address:
type: string
planetmintgo.machine.QueryGetTrustAnchorStatusResponse: planetmintgo.machine.QueryGetTrustAnchorStatusResponse:
type: object type: object
properties: properties:

View File

@ -17,6 +17,7 @@ message Machine {
Metadata metadata = 10; Metadata metadata = 10;
uint32 type = 11; uint32 type = 11;
string machineIdSignature = 12; string machineIdSignature = 12;
string address = 13;
} }
message Metadata { message Metadata {
@ -31,4 +32,5 @@ message MachineIndex {
string machineId = 1; string machineId = 1;
string issuerPlanetmint = 2; string issuerPlanetmint = 2;
string issuerLiquid = 3; string issuerLiquid = 3;
string address = 4;
} }

View File

@ -30,6 +30,12 @@ service Query {
option (google.api.http).get = "/github.com/planetmint/planetmint-go/machine/get_trust_anchor_status/{machineid}"; option (google.api.http).get = "/github.com/planetmint/planetmint-go/machine/get_trust_anchor_status/{machineid}";
} }
// Queries a list of GetMachineByAddress items.
rpc GetMachineByAddress (QueryGetMachineByAddressRequest) returns (QueryGetMachineByAddressResponse) {
option (google.api.http).get = "/planetmint-go/machine/get_machine_by_address/{address}";
}
} }
// QueryParamsRequest is request type for the Query/Params RPC method. // QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {} message QueryParamsRequest {}
@ -58,3 +64,11 @@ message QueryGetTrustAnchorStatusResponse {
bool isactivated = 2; bool isactivated = 2;
} }
message QueryGetMachineByAddressRequest {
string address = 1;
}
message QueryGetMachineByAddressResponse {
Machine machine = 1;
}

View File

@ -38,6 +38,7 @@ func (s *E2ETestSuite) TestAttestMachineREST() {
// Create Attest Machine TX // Create Attest Machine TX
machine := sample.Machine(sample.Name, pubKey, prvKey) machine := sample.Machine(sample.Name, pubKey, prvKey)
machine.Address = addr.String()
msg := machinetypes.MsgAttestMachine{ msg := machinetypes.MsgAttestMachine{
Creator: addr.String(), Creator: addr.String(),
Machine: &machine, Machine: &machine,

View File

@ -52,9 +52,9 @@ func AssetKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
_, ppk := sample.ExtendedKeyPair(config.PlmntNetParams) _, ppk := sample.ExtendedKeyPair(config.PlmntNetParams)
_, lpk := sample.ExtendedKeyPair(config.LiquidNetParams) _, lpk := sample.ExtendedKeyPair(config.LiquidNetParams)
id := sample.MachineIndex(pk, ppk, lpk) id := sample.MachineIndex(pk, ppk, lpk)
mk.EXPECT().GetMachineIndex(ctx, pk).Return(id, true).AnyTimes() mk.EXPECT().GetMachineIndexByPubKey(ctx, pk).Return(id, true).AnyTimes()
mk.EXPECT().GetMachineIndex(ctx, ppk).Return(id, true).AnyTimes() mk.EXPECT().GetMachineIndexByPubKey(ctx, ppk).Return(id, true).AnyTimes()
mk.EXPECT().GetMachineIndex(ctx, sk).Return(id, false).AnyTimes() mk.EXPECT().GetMachineIndexByPubKey(ctx, sk).Return(id, false).AnyTimes()
mk.EXPECT().GetMachine(ctx, id).Return(sample.Machine(pk, pk, sk), true).AnyTimes() mk.EXPECT().GetMachine(ctx, id).Return(sample.Machine(pk, pk, sk), true).AnyTimes()
mk.EXPECT().GetMachine(ctx, sk).Return(sample.Machine(pk, pk, sk), false).AnyTimes() mk.EXPECT().GetMachine(ctx, sk).Return(sample.Machine(pk, pk, sk), false).AnyTimes()

View File

@ -24,6 +24,7 @@ func MachineKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
issuerPlanetmintIndexStoreKey := sdk.NewKVStoreKey(types.IssuerPlanetmintIndexKey) issuerPlanetmintIndexStoreKey := sdk.NewKVStoreKey(types.IssuerPlanetmintIndexKey)
issuerLiquidIndexStoreKey := sdk.NewKVStoreKey(types.IssuerLiquidIndexKey) issuerLiquidIndexStoreKey := sdk.NewKVStoreKey(types.IssuerLiquidIndexKey)
trustAnchorStoreKey := sdk.NewKVStoreKey(types.TrustAnchorKey) trustAnchorStoreKey := sdk.NewKVStoreKey(types.TrustAnchorKey)
addressStoreKey := sdk.NewKVStoreKey(types.AddressIndexKey)
memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)
db := tmdb.NewMemDB() db := tmdb.NewMemDB()
@ -33,6 +34,7 @@ func MachineKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
stateStore.MountStoreWithDB(issuerPlanetmintIndexStoreKey, storetypes.StoreTypeIAVL, db) stateStore.MountStoreWithDB(issuerPlanetmintIndexStoreKey, storetypes.StoreTypeIAVL, db)
stateStore.MountStoreWithDB(issuerLiquidIndexStoreKey, storetypes.StoreTypeIAVL, db) stateStore.MountStoreWithDB(issuerLiquidIndexStoreKey, storetypes.StoreTypeIAVL, db)
stateStore.MountStoreWithDB(trustAnchorStoreKey, storetypes.StoreTypeIAVL, db) stateStore.MountStoreWithDB(trustAnchorStoreKey, storetypes.StoreTypeIAVL, db)
stateStore.MountStoreWithDB(addressStoreKey, storetypes.StoreTypeIAVL, db)
stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil)
require.NoError(t, stateStore.LoadLatestVersion()) require.NoError(t, stateStore.LoadLatestVersion())
@ -53,6 +55,7 @@ func MachineKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
issuerPlanetmintIndexStoreKey, issuerPlanetmintIndexStoreKey,
issuerLiquidIndexStoreKey, issuerLiquidIndexStoreKey,
trustAnchorStoreKey, trustAnchorStoreKey,
addressStoreKey,
memStoreKey, memStoreKey,
paramsSubspace, paramsSubspace,
) )

View File

@ -59,6 +59,7 @@ func Secp256k1AccAddress() sdk.AccAddress {
return sdk.AccAddress(addr) return sdk.AccAddress(addr)
} }
// TODO: make address deterministic for test cases
func Machine(name, pubKey string, prvKey string) machinetypes.Machine { func Machine(name, pubKey string, prvKey string) machinetypes.Machine {
metadata := Metadata() metadata := Metadata()
_, liquidPubKey := ExtendedKeyPair(config.LiquidNetParams) _, liquidPubKey := ExtendedKeyPair(config.LiquidNetParams)
@ -70,6 +71,8 @@ func Machine(name, pubKey string, prvKey string) machinetypes.Machine {
sign, _ := sk.Sign(pubKeyBytes) sign, _ := sk.Sign(pubKeyBytes)
signatureHex := hex.EncodeToString(sign) signatureHex := hex.EncodeToString(sign)
addr := Secp256k1AccAddress()
m := machinetypes.Machine{ m := machinetypes.Machine{
Name: name, Name: name,
Ticker: name + "_ticker", Ticker: name + "_ticker",
@ -83,6 +86,7 @@ func Machine(name, pubKey string, prvKey string) machinetypes.Machine {
Metadata: &metadata, Metadata: &metadata,
Type: 1, Type: 1,
MachineIdSignature: signatureHex, MachineIdSignature: signatureHex,
Address: addr.String(),
} }
return m return m
} }

View File

@ -13,7 +13,7 @@ import (
func (k msgServer) NotarizeAsset(goCtx context.Context, msg *types.MsgNotarizeAsset) (*types.MsgNotarizeAssetResponse, error) { func (k msgServer) NotarizeAsset(goCtx context.Context, msg *types.MsgNotarizeAsset) (*types.MsgNotarizeAssetResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx) ctx := sdk.UnwrapSDKContext(goCtx)
_, found := k.machineKeeper.GetMachineIndex(ctx, msg.PubKey) _, found := k.machineKeeper.GetMachineIndexByPubKey(ctx, msg.PubKey)
if !found { if !found {
return nil, errors.New("machine not found") return nil, errors.New("machine not found")

View File

@ -125,17 +125,17 @@ func (mr *MockMachineKeeperMockRecorder) GetMachine(ctx, index interface{}) *gom
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMachine", reflect.TypeOf((*MockMachineKeeper)(nil).GetMachine), ctx, index) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMachine", reflect.TypeOf((*MockMachineKeeper)(nil).GetMachine), ctx, index)
} }
// GetMachineIndex mocks base method. // GetMachineIndexByPubKey mocks base method.
func (m *MockMachineKeeper) GetMachineIndex(ctx types.Context, pubKey string) (types1.MachineIndex, bool) { func (m *MockMachineKeeper) GetMachineIndexByPubKey(ctx types.Context, pubKey string) (types1.MachineIndex, bool) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetMachineIndex", ctx, pubKey) ret := m.ctrl.Call(m, "GetMachineIndexByPubKey", ctx, pubKey)
ret0, _ := ret[0].(types1.MachineIndex) ret0, _ := ret[0].(types1.MachineIndex)
ret1, _ := ret[1].(bool) ret1, _ := ret[1].(bool)
return ret0, ret1 return ret0, ret1
} }
// GetMachineIndex indicates an expected call of GetMachineIndex. // GetMachineIndexByPubKey indicates an expected call of GetMachineIndexByPubKey.
func (mr *MockMachineKeeperMockRecorder) GetMachineIndex(ctx, pubKey interface{}) *gomock.Call { func (mr *MockMachineKeeperMockRecorder) GetMachineIndexByPubKey(ctx, pubKey interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMachineIndex", reflect.TypeOf((*MockMachineKeeper)(nil).GetMachineIndex), ctx, pubKey) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMachineIndexByPubKey", reflect.TypeOf((*MockMachineKeeper)(nil).GetMachineIndexByPubKey), ctx, pubKey)
} }

View File

@ -10,7 +10,7 @@ import (
type MachineKeeper interface { type MachineKeeper interface {
// Methods imported from machine should be defined here // Methods imported from machine should be defined here
GetMachine(ctx sdk.Context, index machinetypes.MachineIndex) (val machinetypes.Machine, found bool) GetMachine(ctx sdk.Context, index machinetypes.MachineIndex) (val machinetypes.Machine, found bool)
GetMachineIndex(ctx sdk.Context, pubKey string) (val machinetypes.MachineIndex, found bool) GetMachineIndexByPubKey(ctx sdk.Context, pubKey string) (val machinetypes.MachineIndex, found bool)
} }
// AccountKeeper defines the expected account keeper used for simulations (noalias) // AccountKeeper defines the expected account keeper used for simulations (noalias)

View File

@ -1,12 +1,70 @@
package dao package dao
import ( import (
"encoding/hex"
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"github.com/planetmint/planetmint-go/config"
"github.com/planetmint/planetmint-go/x/dao/keeper" "github.com/planetmint/planetmint-go/x/dao/keeper"
abci "github.com/cometbft/cometbft/abci/types" abci "github.com/cometbft/cometbft/abci/types"
cometcfg "github.com/cometbft/cometbft/config"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
) )
type Key struct {
Type string `json:"type"`
Value string `json:"value"`
}
type KeyFile struct {
Address string `json:"address"`
PubKey Key `json:"pub_key"`
PrivKey Key `json:"priv_key"`
}
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) {
proposerAddress := req.Header.GetProposerAddress()
// Check if node is block proposer
if isValidatorBlockProposer(ctx, proposerAddress) {
// TODO: implement PoP trigger
fmt.Println("TODO: implement PoP trigger")
}
}
func isValidatorBlockProposer(ctx sdk.Context, proposerAddress []byte) bool {
logger := ctx.Logger()
conf := config.GetConfig()
cfg := cometcfg.DefaultConfig()
jsonFilePath := filepath.Join(conf.ConfigRootDir, cfg.PrivValidatorKey)
hexProposerAddress := hex.EncodeToString(proposerAddress)
jsonFile, err := os.Open(jsonFilePath)
if err != nil {
logger.Error("error while opening config", err)
}
jsonBytes, err := io.ReadAll(jsonFile)
if err != nil {
logger.Error("error while reading file", err)
}
var keyFile KeyFile
err = json.Unmarshal(jsonBytes, &keyFile)
if err != nil {
logger.Error("error while unmarshaling key file", err)
}
return hexProposerAddress == strings.ToLower(keyFile.Address)
}
func EndBlocker(ctx sdk.Context, req abci.RequestEndBlock, k keeper.Keeper) { func EndBlocker(ctx sdk.Context, req abci.RequestEndBlock, k keeper.Keeper) {
k.DistributeCollectedFees(ctx) k.DistributeCollectedFees(ctx)
} }

View File

@ -143,7 +143,9 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
func (AppModule) ConsensusVersion() uint64 { return 1 } func (AppModule) ConsensusVersion() uint64 { return 1 }
// BeginBlock contains the logic that is automatically triggered at the beginning of each block // BeginBlock contains the logic that is automatically triggered at the beginning of each block
func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
BeginBlocker(ctx, req, am.keeper)
}
// EndBlock contains the logic that is automatically triggered at the end of each block // EndBlock contains the logic that is automatically triggered at the end of each block
func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate {

View File

@ -18,5 +18,6 @@ type BankKeeper interface {
SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
BlockedAddr(addr sdk.AccAddress) bool BlockedAddr(addr sdk.AccAddress) bool
MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
// Methods imported from bank should be defined here // Methods imported from bank should be defined here
} }

View File

@ -28,6 +28,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
cmd.AddCommand(CmdGetMachineByPublicKey()) cmd.AddCommand(CmdGetMachineByPublicKey())
cmd.AddCommand(CmdGetTrustAnchorStatus()) cmd.AddCommand(CmdGetTrustAnchorStatus())
cmd.AddCommand(CmdGetMachineByAddress())
// this line is used by starport scaffolding # 1 // this line is used by starport scaffolding # 1

View File

@ -0,0 +1,46 @@
package cli
import (
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/planetmint/planetmint-go/x/machine/types"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdGetMachineByAddress() *cobra.Command {
cmd := &cobra.Command{
Use: "get-machine-by-address [address]",
Short: "Query get-machine-by-address",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
reqAddress := args[0]
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetMachineByAddressRequest{
Address: reqAddress,
}
res, err := queryClient.GetMachineByAddress(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}

View File

@ -20,6 +20,7 @@ type (
issuerPlanetmintIndexStoreKey storetypes.StoreKey issuerPlanetmintIndexStoreKey storetypes.StoreKey
issuerLiquidIndexStoreKey storetypes.StoreKey issuerLiquidIndexStoreKey storetypes.StoreKey
taStoreKey storetypes.StoreKey taStoreKey storetypes.StoreKey
addressIndexStoreKey storetypes.StoreKey
memKey storetypes.StoreKey memKey storetypes.StoreKey
paramstore paramtypes.Subspace paramstore paramtypes.Subspace
} }
@ -32,6 +33,7 @@ func NewKeeper(
issuerPlanetmintIndexStoreKey, issuerPlanetmintIndexStoreKey,
issuerLiquidIndexStoreKey, issuerLiquidIndexStoreKey,
taStoreKey, taStoreKey,
addressIndexStoreKey,
memKey storetypes.StoreKey, memKey storetypes.StoreKey,
ps paramtypes.Subspace, ps paramtypes.Subspace,
) *Keeper { ) *Keeper {
@ -47,6 +49,7 @@ func NewKeeper(
issuerPlanetmintIndexStoreKey: issuerPlanetmintIndexStoreKey, issuerPlanetmintIndexStoreKey: issuerPlanetmintIndexStoreKey,
issuerLiquidIndexStoreKey: issuerLiquidIndexStoreKey, issuerLiquidIndexStoreKey: issuerLiquidIndexStoreKey,
taStoreKey: taStoreKey, taStoreKey: taStoreKey,
addressIndexStoreKey: addressIndexStoreKey,
memKey: memKey, memKey: memKey,
paramstore: ps, paramstore: ps,
} }

View File

@ -30,23 +30,27 @@ func (k Keeper) StoreMachineIndex(ctx sdk.Context, machine types.Machine) {
taIndexStore := prefix.NewStore(ctx.KVStore(k.taIndexStoreKey), types.KeyPrefix(types.TAIndexKey)) taIndexStore := prefix.NewStore(ctx.KVStore(k.taIndexStoreKey), types.KeyPrefix(types.TAIndexKey))
issuerPlanetmintIndexStore := prefix.NewStore(ctx.KVStore(k.issuerPlanetmintIndexStoreKey), types.KeyPrefix(types.IssuerPlanetmintIndexKey)) issuerPlanetmintIndexStore := prefix.NewStore(ctx.KVStore(k.issuerPlanetmintIndexStoreKey), types.KeyPrefix(types.IssuerPlanetmintIndexKey))
issuerLiquidIndexStore := prefix.NewStore(ctx.KVStore(k.issuerLiquidIndexStoreKey), types.KeyPrefix(types.IssuerLiquidIndexKey)) issuerLiquidIndexStore := prefix.NewStore(ctx.KVStore(k.issuerLiquidIndexStoreKey), types.KeyPrefix(types.IssuerLiquidIndexKey))
addressIndexStore := prefix.NewStore(ctx.KVStore(k.addressIndexStoreKey), types.KeyPrefix(types.AddressIndexKey))
index := types.MachineIndex{ index := types.MachineIndex{
MachineId: machine.MachineId, MachineId: machine.MachineId,
IssuerPlanetmint: machine.IssuerPlanetmint, IssuerPlanetmint: machine.IssuerPlanetmint,
IssuerLiquid: machine.IssuerLiquid, IssuerLiquid: machine.IssuerLiquid,
Address: machine.Address,
} }
machineIdIndexKey := GetMachineBytes(machine.MachineId) machineIdIndexKey := GetMachineBytes(machine.MachineId)
issuerPlanetmintIndexKey := GetMachineBytes(machine.IssuerPlanetmint) issuerPlanetmintIndexKey := GetMachineBytes(machine.IssuerPlanetmint)
issuerLiquidIndexKey := GetMachineBytes(machine.IssuerLiquid) issuerLiquidIndexKey := GetMachineBytes(machine.IssuerLiquid)
addressIndexKey := GetMachineBytes(machine.Address)
indexAppendValue := k.cdc.MustMarshal(&index) indexAppendValue := k.cdc.MustMarshal(&index)
taIndexStore.Set(machineIdIndexKey, indexAppendValue) taIndexStore.Set(machineIdIndexKey, indexAppendValue)
issuerPlanetmintIndexStore.Set(issuerPlanetmintIndexKey, indexAppendValue) issuerPlanetmintIndexStore.Set(issuerPlanetmintIndexKey, indexAppendValue)
issuerLiquidIndexStore.Set(issuerLiquidIndexKey, indexAppendValue) issuerLiquidIndexStore.Set(issuerLiquidIndexKey, indexAppendValue)
addressIndexStore.Set(addressIndexKey, indexAppendValue)
} }
func (k Keeper) GetMachineIndex(ctx sdk.Context, pubKey string) (val types.MachineIndex, found bool) { func (k Keeper) GetMachineIndexByPubKey(ctx sdk.Context, pubKey string) (val types.MachineIndex, found bool) {
taIndexStore := prefix.NewStore(ctx.KVStore(k.taIndexStoreKey), types.KeyPrefix(types.TAIndexKey)) taIndexStore := prefix.NewStore(ctx.KVStore(k.taIndexStoreKey), types.KeyPrefix(types.TAIndexKey))
issuerPlanetmintIndexStore := prefix.NewStore(ctx.KVStore(k.issuerPlanetmintIndexStoreKey), types.KeyPrefix(types.IssuerPlanetmintIndexKey)) issuerPlanetmintIndexStore := prefix.NewStore(ctx.KVStore(k.issuerPlanetmintIndexStoreKey), types.KeyPrefix(types.IssuerPlanetmintIndexKey))
issuerLiquidIndexStore := prefix.NewStore(ctx.KVStore(k.issuerLiquidIndexStoreKey), types.KeyPrefix(types.IssuerLiquidIndexKey)) issuerLiquidIndexStore := prefix.NewStore(ctx.KVStore(k.issuerLiquidIndexStoreKey), types.KeyPrefix(types.IssuerLiquidIndexKey))
@ -80,6 +84,22 @@ func (k Keeper) GetMachineIndex(ctx sdk.Context, pubKey string) (val types.Machi
return val, false return val, false
} }
func (k Keeper) GetMachineIndexByAddress(ctx sdk.Context, address string) (val types.MachineIndex, found bool) {
addressIndexStore := prefix.NewStore(ctx.KVStore(k.addressIndexStoreKey), types.KeyPrefix(types.AddressIndexKey))
keyBytes := GetMachineBytes(address)
adIndex := addressIndexStore.Get(keyBytes)
if adIndex != nil {
if err := k.cdc.Unmarshal(adIndex, &val); err != nil {
return val, false
}
return val, true
}
return val, false
}
func GetMachineBytes(pubKey string) []byte { func GetMachineBytes(pubKey string) []byte {
return []byte(pubKey) return []byte(pubKey)
} }

View File

@ -18,6 +18,7 @@ func createNMachine(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Machi
items[i].MachineId = fmt.Sprintf("machineId%v", i) items[i].MachineId = fmt.Sprintf("machineId%v", i)
items[i].IssuerPlanetmint = fmt.Sprintf("issuerPlanetmint%v", i) items[i].IssuerPlanetmint = fmt.Sprintf("issuerPlanetmint%v", i)
items[i].IssuerLiquid = fmt.Sprintf("issuerLiquid%v", i) items[i].IssuerLiquid = fmt.Sprintf("issuerLiquid%v", i)
items[i].Address = fmt.Sprintf("address%v", i)
keeper.StoreMachine(ctx, items[i]) keeper.StoreMachine(ctx, items[i])
keeper.StoreMachineIndex(ctx, items[i]) keeper.StoreMachineIndex(ctx, items[i])
} }
@ -32,6 +33,7 @@ func TestGetMachine(t *testing.T) {
MachineId: item.MachineId, MachineId: item.MachineId,
IssuerPlanetmint: item.IssuerPlanetmint, IssuerPlanetmint: item.IssuerPlanetmint,
IssuerLiquid: item.IssuerLiquid, IssuerLiquid: item.IssuerLiquid,
Address: item.Address,
} }
machineById, found := keeper.GetMachine(ctx, index) machineById, found := keeper.GetMachine(ctx, index)
assert.True(t, found) assert.True(t, found)
@ -39,7 +41,7 @@ func TestGetMachine(t *testing.T) {
} }
} }
func TestGetMachineIndex(t *testing.T) { func TestGetMachineIndexByPubKey(t *testing.T) {
keeper, ctx := keepertest.MachineKeeper(t) keeper, ctx := keepertest.MachineKeeper(t)
items := createNMachine(keeper, ctx, 10) items := createNMachine(keeper, ctx, 10)
for _, item := range items { for _, item := range items {
@ -47,8 +49,9 @@ func TestGetMachineIndex(t *testing.T) {
MachineId: item.MachineId, MachineId: item.MachineId,
IssuerPlanetmint: item.IssuerPlanetmint, IssuerPlanetmint: item.IssuerPlanetmint,
IssuerLiquid: item.IssuerLiquid, IssuerLiquid: item.IssuerLiquid,
Address: item.Address,
} }
index, found := keeper.GetMachineIndex(ctx, item.MachineId) index, found := keeper.GetMachineIndexByPubKey(ctx, item.MachineId)
assert.True(t, found) assert.True(t, found)
assert.Equal(t, expectedIndex, index) assert.Equal(t, expectedIndex, index)
} }

View File

@ -0,0 +1,31 @@
package keeper
import (
"context"
"github.com/planetmint/planetmint-go/x/machine/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) GetMachineByAddress(goCtx context.Context, req *types.QueryGetMachineByAddressRequest) (*types.QueryGetMachineByAddressResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
machineIndex, found := k.GetMachineIndexByAddress(ctx, req.Address)
if !found {
return nil, status.Error(codes.NotFound, "machine not found")
}
machine, found := k.GetMachine(ctx, machineIndex)
if !found {
return nil, status.Error(codes.Internal, "error while fetching machine")
}
return &types.QueryGetMachineByAddressResponse{Machine: &machine}, nil
}

View File

@ -0,0 +1,44 @@
package keeper_test
import (
"testing"
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
"github.com/planetmint/planetmint-go/x/machine/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func TestGetMachineByAddress(t *testing.T) {
keeper, ctx := keepertest.MachineKeeper(t)
wctx := sdk.WrapSDKContext(ctx)
msgs := createNMachine(keeper, ctx, 1)
for _, tc := range []struct {
desc string
request *types.QueryGetMachineByAddressRequest
response *types.QueryGetMachineByAddressResponse
err error
}{
{
desc: "GetMachineByAddress",
request: &types.QueryGetMachineByAddressRequest{Address: msgs[0].Address},
response: &types.QueryGetMachineByAddressResponse{Machine: &msgs[0]},
}, {
desc: "MachineNotFound",
request: &types.QueryGetMachineByAddressRequest{Address: "invalid address"},
err: status.Error(codes.NotFound, "machine not found"),
},
} {
t.Run(tc.desc, func(t *testing.T) {
response, err := keeper.GetMachineByAddress(wctx, tc.request)
if tc.err != nil {
require.ErrorIs(t, err, tc.err)
} else {
require.Equal(t, tc.response, response)
}
})
}
}

View File

@ -17,12 +17,15 @@ func (k Keeper) GetMachineByPublicKey(goCtx context.Context, req *types.QueryGet
ctx := sdk.UnwrapSDKContext(goCtx) ctx := sdk.UnwrapSDKContext(goCtx)
machineIndex, found := k.GetMachineIndex(ctx, req.PublicKey) machineIndex, found := k.GetMachineIndexByPubKey(ctx, req.PublicKey)
if !found { if !found {
return nil, status.Error(codes.NotFound, "machine not found") return nil, status.Error(codes.NotFound, "machine not found")
} }
machine, _ := k.GetMachine(ctx, machineIndex) machine, found := k.GetMachine(ctx, machineIndex)
if !found {
return nil, status.Error(codes.Internal, "error while fetching machine")
}
return &types.QueryGetMachineByPublicKeyResponse{Machine: &machine}, nil return &types.QueryGetMachineByPublicKeyResponse{Machine: &machine}, nil
} }

View File

@ -22,6 +22,8 @@ const (
IssuerLiquidIndexKey = "Machine/IssuerLiquidIndex/" IssuerLiquidIndexKey = "Machine/IssuerLiquidIndex/"
TrustAnchorKey = "Machine/trustAnchor/" TrustAnchorKey = "Machine/trustAnchor/"
AddressIndexKey = "Machine/address"
) )
func KeyPrefix(p string) []byte { func KeyPrefix(p string) []byte {

View File

@ -35,6 +35,7 @@ type Machine struct {
Metadata *Metadata `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata,omitempty"` Metadata *Metadata `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata,omitempty"`
Type uint32 `protobuf:"varint,11,opt,name=type,proto3" json:"type,omitempty"` Type uint32 `protobuf:"varint,11,opt,name=type,proto3" json:"type,omitempty"`
MachineIdSignature string `protobuf:"bytes,12,opt,name=machineIdSignature,proto3" json:"machineIdSignature,omitempty"` MachineIdSignature string `protobuf:"bytes,12,opt,name=machineIdSignature,proto3" json:"machineIdSignature,omitempty"`
Address string `protobuf:"bytes,13,opt,name=address,proto3" json:"address,omitempty"`
} }
func (m *Machine) Reset() { *m = Machine{} } func (m *Machine) Reset() { *m = Machine{} }
@ -154,6 +155,13 @@ func (m *Machine) GetMachineIdSignature() string {
return "" return ""
} }
func (m *Machine) GetAddress() string {
if m != nil {
return m.Address
}
return ""
}
type Metadata struct { type Metadata struct {
Gps string `protobuf:"bytes,1,opt,name=gps,proto3" json:"gps,omitempty"` Gps string `protobuf:"bytes,1,opt,name=gps,proto3" json:"gps,omitempty"`
Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"`
@ -226,6 +234,7 @@ type MachineIndex struct {
MachineId string `protobuf:"bytes,1,opt,name=machineId,proto3" json:"machineId,omitempty"` MachineId string `protobuf:"bytes,1,opt,name=machineId,proto3" json:"machineId,omitempty"`
IssuerPlanetmint string `protobuf:"bytes,2,opt,name=issuerPlanetmint,proto3" json:"issuerPlanetmint,omitempty"` IssuerPlanetmint string `protobuf:"bytes,2,opt,name=issuerPlanetmint,proto3" json:"issuerPlanetmint,omitempty"`
IssuerLiquid string `protobuf:"bytes,3,opt,name=issuerLiquid,proto3" json:"issuerLiquid,omitempty"` IssuerLiquid string `protobuf:"bytes,3,opt,name=issuerLiquid,proto3" json:"issuerLiquid,omitempty"`
Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"`
} }
func (m *MachineIndex) Reset() { *m = MachineIndex{} } func (m *MachineIndex) Reset() { *m = MachineIndex{} }
@ -282,6 +291,13 @@ func (m *MachineIndex) GetIssuerLiquid() string {
return "" return ""
} }
func (m *MachineIndex) GetAddress() string {
if m != nil {
return m.Address
}
return ""
}
func init() { func init() {
proto.RegisterType((*Machine)(nil), "planetmintgo.machine.Machine") proto.RegisterType((*Machine)(nil), "planetmintgo.machine.Machine")
proto.RegisterType((*Metadata)(nil), "planetmintgo.machine.Metadata") proto.RegisterType((*Metadata)(nil), "planetmintgo.machine.Metadata")
@ -293,34 +309,35 @@ func init() {
} }
var fileDescriptor_1bb279745bef7c4b = []byte{ var fileDescriptor_1bb279745bef7c4b = []byte{
// 423 bytes of a gzipped FileDescriptorProto // 443 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x3f, 0x8f, 0xd3, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xbd, 0x8e, 0xd3, 0x40,
0x1c, 0xad, 0x9b, 0xd2, 0x26, 0xbf, 0x16, 0x51, 0x2c, 0x84, 0x3c, 0xa0, 0x28, 0xca, 0x14, 0x21, 0x18, 0xcc, 0x5e, 0x42, 0x7e, 0xbe, 0xcb, 0x89, 0x63, 0x85, 0xd0, 0x16, 0xc8, 0xb2, 0x5c, 0x59,
0x48, 0x25, 0xba, 0x31, 0x42, 0x97, 0x4a, 0x54, 0x42, 0x61, 0x63, 0x73, 0x13, 0x93, 0x5a, 0x34, 0x08, 0x1c, 0x89, 0xeb, 0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bd, 0xaa, 0x2f, 0x93, 0x4c, 0x17, 0x8b, 0x7d, 0xa7, 0x07, 0xf0, 0x55,
0xdd, 0x90, 0x62, 0x2c, 0x03, 0x00, 0x00, 0xae, 0x17, 0x37, 0xbb, 0xcb, 0xe3, 0xfa, 0x33, 0x97, 0x63, 0x7f, 0x77, 0x2e, 0xfe, 0x07, 0x00,
0x00, 0xff, 0xff, 0x44, 0x7f, 0xea, 0x9d, 0x61, 0x03, 0x00, 0x00,
} }
func (m *Machine) Marshal() (dAtA []byte, err error) { func (m *Machine) Marshal() (dAtA []byte, err error) {
@ -343,6 +360,13 @@ func (m *Machine) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintMachine(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0x6a
}
if len(m.MachineIdSignature) > 0 { if len(m.MachineIdSignature) > 0 {
i -= len(m.MachineIdSignature) i -= len(m.MachineIdSignature)
copy(dAtA[i:], m.MachineIdSignature) copy(dAtA[i:], m.MachineIdSignature)
@ -503,6 +527,13 @@ func (m *MachineIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintMachine(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0x22
}
if len(m.IssuerLiquid) > 0 { if len(m.IssuerLiquid) > 0 {
i -= len(m.IssuerLiquid) i -= len(m.IssuerLiquid)
copy(dAtA[i:], m.IssuerLiquid) copy(dAtA[i:], m.IssuerLiquid)
@ -588,6 +619,10 @@ func (m *Machine) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovMachine(uint64(l)) n += 1 + l + sovMachine(uint64(l))
} }
l = len(m.Address)
if l > 0 {
n += 1 + l + sovMachine(uint64(l))
}
return n return n
} }
@ -634,6 +669,10 @@ func (m *MachineIndex) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovMachine(uint64(l)) n += 1 + l + sovMachine(uint64(l))
} }
l = len(m.Address)
if l > 0 {
n += 1 + l + sovMachine(uint64(l))
}
return n return n
} }
@ -1009,6 +1048,38 @@ func (m *Machine) Unmarshal(dAtA []byte) error {
} }
m.MachineIdSignature = string(dAtA[iNdEx:postIndex]) m.MachineIdSignature = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 13:
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 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.Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipMachine(dAtA[iNdEx:]) skippy, err := skipMachine(dAtA[iNdEx:])
@ -1333,6 +1404,38 @@ func (m *MachineIndex) Unmarshal(dAtA []byte) error {
} }
m.IssuerLiquid = string(dAtA[iNdEx:postIndex]) m.IssuerLiquid = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 4:
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 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.Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipMachine(dAtA[iNdEx:]) skippy, err := skipMachine(dAtA[iNdEx:])

View File

@ -297,6 +297,94 @@ func (m *QueryGetTrustAnchorStatusResponse) GetIsactivated() bool {
return false return false
} }
type QueryGetMachineByAddressRequest struct {
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
}
func (m *QueryGetMachineByAddressRequest) Reset() { *m = QueryGetMachineByAddressRequest{} }
func (m *QueryGetMachineByAddressRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetMachineByAddressRequest) ProtoMessage() {}
func (*QueryGetMachineByAddressRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_bf7841d43d757203, []int{6}
}
func (m *QueryGetMachineByAddressRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetMachineByAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetMachineByAddressRequest.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 *QueryGetMachineByAddressRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetMachineByAddressRequest.Merge(m, src)
}
func (m *QueryGetMachineByAddressRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetMachineByAddressRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetMachineByAddressRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetMachineByAddressRequest proto.InternalMessageInfo
func (m *QueryGetMachineByAddressRequest) GetAddress() string {
if m != nil {
return m.Address
}
return ""
}
type QueryGetMachineByAddressResponse struct {
Machine *Machine `protobuf:"bytes,1,opt,name=machine,proto3" json:"machine,omitempty"`
}
func (m *QueryGetMachineByAddressResponse) Reset() { *m = QueryGetMachineByAddressResponse{} }
func (m *QueryGetMachineByAddressResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetMachineByAddressResponse) ProtoMessage() {}
func (*QueryGetMachineByAddressResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_bf7841d43d757203, []int{7}
}
func (m *QueryGetMachineByAddressResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetMachineByAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetMachineByAddressResponse.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 *QueryGetMachineByAddressResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetMachineByAddressResponse.Merge(m, src)
}
func (m *QueryGetMachineByAddressResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetMachineByAddressResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetMachineByAddressResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetMachineByAddressResponse proto.InternalMessageInfo
func (m *QueryGetMachineByAddressResponse) GetMachine() *Machine {
if m != nil {
return m.Machine
}
return nil
}
func init() { func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.machine.QueryParamsRequest") proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.machine.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.machine.QueryParamsResponse") proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.machine.QueryParamsResponse")
@ -304,45 +392,52 @@ func init() {
proto.RegisterType((*QueryGetMachineByPublicKeyResponse)(nil), "planetmintgo.machine.QueryGetMachineByPublicKeyResponse") proto.RegisterType((*QueryGetMachineByPublicKeyResponse)(nil), "planetmintgo.machine.QueryGetMachineByPublicKeyResponse")
proto.RegisterType((*QueryGetTrustAnchorStatusRequest)(nil), "planetmintgo.machine.QueryGetTrustAnchorStatusRequest") proto.RegisterType((*QueryGetTrustAnchorStatusRequest)(nil), "planetmintgo.machine.QueryGetTrustAnchorStatusRequest")
proto.RegisterType((*QueryGetTrustAnchorStatusResponse)(nil), "planetmintgo.machine.QueryGetTrustAnchorStatusResponse") proto.RegisterType((*QueryGetTrustAnchorStatusResponse)(nil), "planetmintgo.machine.QueryGetTrustAnchorStatusResponse")
proto.RegisterType((*QueryGetMachineByAddressRequest)(nil), "planetmintgo.machine.QueryGetMachineByAddressRequest")
proto.RegisterType((*QueryGetMachineByAddressResponse)(nil), "planetmintgo.machine.QueryGetMachineByAddressResponse")
} }
func init() { proto.RegisterFile("planetmintgo/machine/query.proto", fileDescriptor_bf7841d43d757203) } func init() { proto.RegisterFile("planetmintgo/machine/query.proto", fileDescriptor_bf7841d43d757203) }
var fileDescriptor_bf7841d43d757203 = []byte{ var fileDescriptor_bf7841d43d757203 = []byte{
// 524 bytes of a gzipped FileDescriptorProto // 593 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcf, 0x6a, 0xd4, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x41, 0x6b, 0x13, 0x41,
0x1c, 0xde, 0x94, 0x5a, 0xed, 0xf4, 0x36, 0xae, 0x50, 0xc2, 0x1a, 0xd3, 0x39, 0xad, 0x82, 0x19, 0x18, 0xcd, 0x16, 0x4d, 0xed, 0xf4, 0x36, 0x8d, 0x10, 0x96, 0xb8, 0x4d, 0xe7, 0x14, 0x05, 0x33,
0xda, 0x45, 0x57, 0xf4, 0x62, 0xf7, 0xe2, 0x41, 0x0a, 0xdb, 0xd8, 0x83, 0x14, 0x24, 0x4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0xa1, 0xff, 0x3d, 0xbd, 0xbf, 0x01, 0x5a, 0x44, 0x8a, 0x5a, 0x5c, 0xaa, 0xe2, 0xe1, 0x6c, 0x5d, 0x46, 0xf0, 0x9b, 0x06, 0x76, 0x32,
0x00, 0x00, 0xff, 0xff, 0xc0, 0xb6, 0xdb, 0x5a, 0x5c, 0x05, 0x00, 0x00, 0x86, 0x19, 0x1e, 0xae, 0xf9, 0x22, 0x37, 0x37, 0x47, 0x3f, 0xca, 0x4b, 0x53, 0x01, 0x9f, 0xcb,
0x80, 0x4f, 0x61, 0x73, 0xbd, 0x07, 0x53, 0xeb, 0x88, 0x87, 0xea, 0x30, 0x6a, 0x9f, 0x5c, 0x8d,
0x0d, 0xed, 0x7a, 0x6c, 0x68, 0xbf, 0xc6, 0x86, 0xf6, 0x69, 0x62, 0x14, 0xae, 0x27, 0x46, 0xe1,
0xc7, 0xc4, 0x28, 0x9c, 0x37, 0xd6, 0xb9, 0xb2, 0x0f, 0xb3, 0x4e, 0x22, 0x0e, 0x28, 0xb7, 0x8b,
0xf2, 0xdf, 0xbd, 0xf1, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x26, 0xcc, 0xd3, 0xe4, 0xbe, 0x06, 0x00,
0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -363,6 +458,8 @@ type QueryClient interface {
GetMachineByPublicKey(ctx context.Context, in *QueryGetMachineByPublicKeyRequest, opts ...grpc.CallOption) (*QueryGetMachineByPublicKeyResponse, error) GetMachineByPublicKey(ctx context.Context, in *QueryGetMachineByPublicKeyRequest, opts ...grpc.CallOption) (*QueryGetMachineByPublicKeyResponse, error)
// Queries a list of GetTrustAnchorStatus items. // Queries a list of GetTrustAnchorStatus items.
GetTrustAnchorStatus(ctx context.Context, in *QueryGetTrustAnchorStatusRequest, opts ...grpc.CallOption) (*QueryGetTrustAnchorStatusResponse, error) GetTrustAnchorStatus(ctx context.Context, in *QueryGetTrustAnchorStatusRequest, opts ...grpc.CallOption) (*QueryGetTrustAnchorStatusResponse, error)
// Queries a list of GetMachineByAddress items.
GetMachineByAddress(ctx context.Context, in *QueryGetMachineByAddressRequest, opts ...grpc.CallOption) (*QueryGetMachineByAddressResponse, error)
} }
type queryClient struct { type queryClient struct {
@ -400,6 +497,15 @@ func (c *queryClient) GetTrustAnchorStatus(ctx context.Context, in *QueryGetTrus
return out, nil return out, nil
} }
func (c *queryClient) GetMachineByAddress(ctx context.Context, in *QueryGetMachineByAddressRequest, opts ...grpc.CallOption) (*QueryGetMachineByAddressResponse, error) {
out := new(QueryGetMachineByAddressResponse)
err := c.cc.Invoke(ctx, "/planetmintgo.machine.Query/GetMachineByAddress", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service. // QueryServer is the server API for Query service.
type QueryServer interface { type QueryServer interface {
// Parameters queries the parameters of the module. // Parameters queries the parameters of the module.
@ -408,6 +514,8 @@ type QueryServer interface {
GetMachineByPublicKey(context.Context, *QueryGetMachineByPublicKeyRequest) (*QueryGetMachineByPublicKeyResponse, error) GetMachineByPublicKey(context.Context, *QueryGetMachineByPublicKeyRequest) (*QueryGetMachineByPublicKeyResponse, error)
// Queries a list of GetTrustAnchorStatus items. // Queries a list of GetTrustAnchorStatus items.
GetTrustAnchorStatus(context.Context, *QueryGetTrustAnchorStatusRequest) (*QueryGetTrustAnchorStatusResponse, error) GetTrustAnchorStatus(context.Context, *QueryGetTrustAnchorStatusRequest) (*QueryGetTrustAnchorStatusResponse, error)
// Queries a list of GetMachineByAddress items.
GetMachineByAddress(context.Context, *QueryGetMachineByAddressRequest) (*QueryGetMachineByAddressResponse, error)
} }
// UnimplementedQueryServer can be embedded to have forward compatible implementations. // UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -423,6 +531,9 @@ func (*UnimplementedQueryServer) GetMachineByPublicKey(ctx context.Context, req
func (*UnimplementedQueryServer) GetTrustAnchorStatus(ctx context.Context, req *QueryGetTrustAnchorStatusRequest) (*QueryGetTrustAnchorStatusResponse, error) { func (*UnimplementedQueryServer) GetTrustAnchorStatus(ctx context.Context, req *QueryGetTrustAnchorStatusRequest) (*QueryGetTrustAnchorStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTrustAnchorStatus not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetTrustAnchorStatus not implemented")
} }
func (*UnimplementedQueryServer) GetMachineByAddress(ctx context.Context, req *QueryGetMachineByAddressRequest) (*QueryGetMachineByAddressResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetMachineByAddress not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) { func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv) s.RegisterService(&_Query_serviceDesc, srv)
@ -482,6 +593,24 @@ func _Query_GetTrustAnchorStatus_Handler(srv interface{}, ctx context.Context, d
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Query_GetMachineByAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetMachineByAddressRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetMachineByAddress(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/planetmintgo.machine.Query/GetMachineByAddress",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetMachineByAddress(ctx, req.(*QueryGetMachineByAddressRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{ var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "planetmintgo.machine.Query", ServiceName: "planetmintgo.machine.Query",
HandlerType: (*QueryServer)(nil), HandlerType: (*QueryServer)(nil),
@ -498,6 +627,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "GetTrustAnchorStatus", MethodName: "GetTrustAnchorStatus",
Handler: _Query_GetTrustAnchorStatus_Handler, Handler: _Query_GetTrustAnchorStatus_Handler,
}, },
{
MethodName: "GetMachineByAddress",
Handler: _Query_GetMachineByAddress_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "planetmintgo/machine/query.proto", Metadata: "planetmintgo/machine/query.proto",
@ -694,6 +827,71 @@ func (m *QueryGetTrustAnchorStatusResponse) MarshalToSizedBuffer(dAtA []byte) (i
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *QueryGetMachineByAddressRequest) 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 *QueryGetMachineByAddressRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetMachineByAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetMachineByAddressResponse) 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 *QueryGetMachineByAddressResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetMachineByAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Machine != nil {
{
size, err := m.Machine.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v) offset -= sovQuery(v)
base := offset base := offset
@ -780,6 +978,32 @@ func (m *QueryGetTrustAnchorStatusResponse) Size() (n int) {
return n return n
} }
func (m *QueryGetMachineByAddressRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Address)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetMachineByAddressResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Machine != nil {
l = m.Machine.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func sovQuery(x uint64) (n int) { func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
@ -1271,6 +1495,174 @@ func (m *QueryGetTrustAnchorStatusResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *QueryGetMachineByAddressRequest) 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 ErrIntOverflowQuery
}
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: QueryGetMachineByAddressRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetMachineByAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
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 ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetMachineByAddressResponse) 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 ErrIntOverflowQuery
}
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: QueryGetMachineByAddressResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetMachineByAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Machine", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Machine == nil {
m.Machine = &Machine{}
}
if err := m.Machine.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) { func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0

View File

@ -159,6 +159,60 @@ func local_request_Query_GetTrustAnchorStatus_0(ctx context.Context, marshaler r
} }
func request_Query_GetMachineByAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetMachineByAddressRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["address"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
}
protoReq.Address, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
}
msg, err := client.GetMachineByAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetMachineByAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetMachineByAddressRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["address"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
}
protoReq.Address, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
}
msg, err := server.GetMachineByAddress(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly. // UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@ -234,6 +288,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
}) })
mux.Handle("GET", pattern_Query_GetMachineByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GetMachineByAddress_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetMachineByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
@ -335,6 +412,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}) })
mux.Handle("GET", pattern_Query_GetMachineByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GetMachineByAddress_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetMachineByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
@ -344,6 +441,8 @@ var (
pattern_Query_GetMachineByPublicKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"github.com", "planetmint", "planetmint-go", "machine", "get_machine_by_public_key", "publicKey"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_GetMachineByPublicKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"github.com", "planetmint", "planetmint-go", "machine", "get_machine_by_public_key", "publicKey"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_GetTrustAnchorStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"github.com", "planetmint", "planetmint-go", "machine", "get_trust_anchor_status", "machineid"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_GetTrustAnchorStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"github.com", "planetmint", "planetmint-go", "machine", "get_trust_anchor_status", "machineid"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_GetMachineByAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"planetmint-go", "machine", "get_machine_by_address", "address"}, "", runtime.AssumeColonVerbOpt(true)))
) )
var ( var (
@ -352,4 +451,6 @@ var (
forward_Query_GetMachineByPublicKey_0 = runtime.ForwardResponseMessage forward_Query_GetMachineByPublicKey_0 = runtime.ForwardResponseMessage
forward_Query_GetTrustAnchorStatus_0 = runtime.ForwardResponseMessage forward_Query_GetTrustAnchorStatus_0 = runtime.ForwardResponseMessage
forward_Query_GetMachineByAddress_0 = runtime.ForwardResponseMessage
) )