mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-07 14:46:39 +00:00
77 rename asset hash to asset cid (#97)
* initial asset notarization restructuring * adjusted test cases, two are still failing * removed obsolete data structures --------- Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
d978e9da56
commit
8fd9f213f3
@ -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.GetMachineIndexByPubKey(ctx, notarizeMsg.PubKey)
|
_, found := cm.mk.GetMachineIndexByAddress(ctx, notarizeMsg.GetCreator())
|
||||||
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")
|
||||||
}
|
}
|
||||||
@ -37,6 +37,9 @@ func (cm CheckMachineDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate
|
|||||||
case "/planetmintgo.machine.MsgAttestMachine":
|
case "/planetmintgo.machine.MsgAttestMachine":
|
||||||
attestMsg, ok := msg.(*machinetypes.MsgAttestMachine)
|
attestMsg, ok := msg.(*machinetypes.MsgAttestMachine)
|
||||||
if ok {
|
if ok {
|
||||||
|
if attestMsg.GetCreator() != attestMsg.Machine.GetAddress() {
|
||||||
|
return ctx, errorsmod.Wrapf(machinetypes.ErrMachineIsNotCreator, "error during CheckTx or ReCheckTx")
|
||||||
|
}
|
||||||
_, activated, found := cm.mk.GetTrustAnchor(ctx, attestMsg.Machine.MachineId)
|
_, activated, found := cm.mk.GetTrustAnchor(ctx, attestMsg.Machine.MachineId)
|
||||||
if !found {
|
if !found {
|
||||||
return ctx, errorsmod.Wrapf(machinetypes.ErrTrustAnchorNotFound, "error during CheckTx or ReCheckTx")
|
return ctx, errorsmod.Wrapf(machinetypes.ErrTrustAnchorNotFound, "error during CheckTx or ReCheckTx")
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
type MachineKeeper interface {
|
type MachineKeeper interface {
|
||||||
GetMachineIndexByPubKey(ctx sdk.Context, pubKey string) (val types.MachineIndex, found bool)
|
GetMachineIndexByPubKey(ctx sdk.Context, pubKey string) (val types.MachineIndex, found bool)
|
||||||
|
GetMachineIndexByAddress(ctx sdk.Context, address 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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
docs/static/openapi.yml
vendored
10
docs/static/openapi.yml
vendored
@ -46473,10 +46473,10 @@ paths:
|
|||||||
additionalProperties: {}
|
additionalProperties: {}
|
||||||
tags:
|
tags:
|
||||||
- Query
|
- Query
|
||||||
/planetmint/planetmint-go/asset/get_cids_by_pub_key/{extPubKey}/{lookupPeriodInMin}:
|
/planetmint/planetmint-go/asset/get_cids_by_address/{address}/{lookupPeriodInMin}:
|
||||||
get:
|
get:
|
||||||
summary: Queries a list of GetCIDsByPubKey items.
|
summary: Queries a list of GetCIDsByAddress items.
|
||||||
operationId: PlanetmintgoAssetGetCIDsByPubKey
|
operationId: PlanetmintgoAssetGetCIDsByAddress
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: A successful response.
|
description: A successful response.
|
||||||
@ -46534,7 +46534,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
additionalProperties: {}
|
additionalProperties: {}
|
||||||
parameters:
|
parameters:
|
||||||
- name: extPubKey
|
- name: address
|
||||||
in: path
|
in: path
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
@ -75649,7 +75649,7 @@ definitions:
|
|||||||
planetmintgo.asset.Params:
|
planetmintgo.asset.Params:
|
||||||
type: object
|
type: object
|
||||||
description: Params defines the parameters for the module.
|
description: Params defines the parameters for the module.
|
||||||
planetmintgo.asset.QueryGetCIDsByPubKeyResponse:
|
planetmintgo.asset.QueryGetCIDsByAddressResponse:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
cids:
|
cids:
|
||||||
|
@ -4,8 +4,5 @@ package planetmintgo.asset;
|
|||||||
option go_package = "github.com/planetmint/planetmint-go/x/asset/types";
|
option go_package = "github.com/planetmint/planetmint-go/x/asset/types";
|
||||||
|
|
||||||
message Asset {
|
message Asset {
|
||||||
|
string cid = 1;
|
||||||
string hash = 1;
|
|
||||||
string signature = 2;
|
|
||||||
string pubkey = 3;
|
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,9 @@ service Query {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Queries a list of GetCIDsByPubKey items.
|
// Queries a list of GetCIDsByAddress items.
|
||||||
rpc GetCIDsByPubKey (QueryGetCIDsByPubKeyRequest) returns (QueryGetCIDsByPubKeyResponse) {
|
rpc GetCIDsByAddress (QueryGetCIDsByAddressRequest) returns (QueryGetCIDsByAddressResponse) {
|
||||||
option (google.api.http).get = "/planetmint/planetmint-go/asset/get_cids_by_pub_key/{extPubKey}/{lookupPeriodInMin}";
|
option (google.api.http).get = "/planetmint/planetmint-go/asset/get_cids_by_address/{address}/{lookupPeriodInMin}";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,13 +40,13 @@ message QueryParamsResponse {
|
|||||||
Params params = 1 [(gogoproto.nullable) = false];
|
Params params = 1 [(gogoproto.nullable) = false];
|
||||||
}
|
}
|
||||||
|
|
||||||
message QueryGetCIDsByPubKeyRequest {
|
message QueryGetCIDsByAddressRequest {
|
||||||
string extPubKey = 1;
|
string address = 1;
|
||||||
uint64 lookupPeriodInMin = 2;
|
uint64 lookupPeriodInMin = 2;
|
||||||
cosmos.base.query.v1beta1.PageRequest pagination = 3;
|
cosmos.base.query.v1beta1.PageRequest pagination = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message QueryGetCIDsByPubKeyResponse {
|
message QueryGetCIDsByAddressResponse {
|
||||||
repeated string cids = 1;
|
repeated string cids = 1;
|
||||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||||
}
|
}
|
||||||
@ -57,7 +57,6 @@ message QueryGetNotarizedAssetRequest {
|
|||||||
|
|
||||||
message QueryGetNotarizedAssetResponse {
|
message QueryGetNotarizedAssetResponse {
|
||||||
string cid = 1;
|
string cid = 1;
|
||||||
string signature = 2;
|
string address = 2;
|
||||||
string pubkey = 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,9 +10,7 @@ service Msg {
|
|||||||
}
|
}
|
||||||
message MsgNotarizeAsset {
|
message MsgNotarizeAsset {
|
||||||
string creator = 1;
|
string creator = 1;
|
||||||
string hash = 2;
|
string cid = 2;
|
||||||
string signature = 3;
|
|
||||||
string pubKey = 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message MsgNotarizeAssetResponse {}
|
message MsgNotarizeAssetResponse {}
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
package asset
|
package asset
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/planetmint/planetmint-go/testutil"
|
"github.com/planetmint/planetmint-go/testutil"
|
||||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/btcutil/hdkeychain"
|
|
||||||
|
|
||||||
assettypes "github.com/planetmint/planetmint-go/x/asset/types"
|
assettypes "github.com/planetmint/planetmint-go/x/asset/types"
|
||||||
|
|
||||||
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
|
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
|
||||||
@ -23,62 +21,39 @@ func (s *E2ETestSuite) TestNotarizeAssetREST() {
|
|||||||
|
|
||||||
addr, err := k.GetAddress()
|
addr, err := k.GetAddress()
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
cid := sample.Asset()
|
||||||
xskKey, _ := hdkeychain.NewKeyFromString(xPrvKey)
|
|
||||||
privKey, _ := xskKey.ECPrivKey()
|
|
||||||
byte_key := privKey.Serialize()
|
|
||||||
sk := hex.EncodeToString(byte_key)
|
|
||||||
cid, signatureHex := sample.Asset(sk)
|
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
msg assettypes.MsgNotarizeAsset
|
msg assettypes.MsgNotarizeAsset
|
||||||
rawLog string
|
rawLog string
|
||||||
expectCheckTxErr bool
|
expectCheckTxErr bool
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
"invalid address",
|
||||||
|
assettypes.MsgNotarizeAsset{
|
||||||
|
Creator: "invalid creator address",
|
||||||
|
Cid: cid,
|
||||||
|
},
|
||||||
|
"invalid address",
|
||||||
|
true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"machine not found",
|
"machine not found",
|
||||||
assettypes.MsgNotarizeAsset{
|
assettypes.MsgNotarizeAsset{
|
||||||
Creator: addr.String(),
|
Creator: "cosmos12qydd0w5ff4sww54dxm0sreznxlex8wfrg86c5",
|
||||||
Hash: cid,
|
Cid: cid,
|
||||||
Signature: signatureHex,
|
|
||||||
PubKey: "human pubkey",
|
|
||||||
},
|
},
|
||||||
"machine not found",
|
"machine not found",
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"invalid signature hex string",
|
|
||||||
assettypes.MsgNotarizeAsset{
|
|
||||||
Creator: addr.String(),
|
|
||||||
Hash: cid,
|
|
||||||
Signature: "invalid signature",
|
|
||||||
PubKey: xPubKey,
|
|
||||||
},
|
|
||||||
"invalid signature hex string",
|
|
||||||
false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"invalid signature",
|
|
||||||
assettypes.MsgNotarizeAsset{
|
|
||||||
Creator: addr.String(),
|
|
||||||
Hash: cid,
|
|
||||||
Signature: hex.EncodeToString([]byte("invalid signature")),
|
|
||||||
PubKey: xPubKey,
|
|
||||||
},
|
|
||||||
"invalid signature",
|
|
||||||
false,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"valid notarization",
|
"valid notarization",
|
||||||
assettypes.MsgNotarizeAsset{
|
assettypes.MsgNotarizeAsset{
|
||||||
Creator: addr.String(),
|
Creator: addr.String(),
|
||||||
Hash: cid,
|
Cid: cid,
|
||||||
Signature: signatureHex,
|
|
||||||
PubKey: xPubKey,
|
|
||||||
},
|
},
|
||||||
"planetmintgo.asset.MsgNotarizeAsset",
|
"[]",
|
||||||
false,
|
true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package asset
|
package asset
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/planetmint/planetmint-go/config"
|
|
||||||
"github.com/planetmint/planetmint-go/testutil/network"
|
"github.com/planetmint/planetmint-go/testutil/network"
|
||||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||||
|
|
||||||
@ -13,7 +11,6 @@ import (
|
|||||||
assetcli "github.com/planetmint/planetmint-go/x/asset/client/cli"
|
assetcli "github.com/planetmint/planetmint-go/x/asset/client/cli"
|
||||||
machinecli "github.com/planetmint/planetmint-go/x/machine/client/cli"
|
machinecli "github.com/planetmint/planetmint-go/x/machine/client/cli"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/btcutil/hdkeychain"
|
|
||||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||||
"github.com/cosmos/cosmos-sdk/crypto/hd"
|
"github.com/cosmos/cosmos-sdk/crypto/hd"
|
||||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||||
@ -25,8 +22,6 @@ import (
|
|||||||
var (
|
var (
|
||||||
pubKey string
|
pubKey string
|
||||||
prvKey string
|
prvKey string
|
||||||
xPubKey string
|
|
||||||
xPrvKey string
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// E2ETestSuite struct definition of asset suite
|
// E2ETestSuite struct definition of asset suite
|
||||||
@ -63,6 +58,7 @@ func (s *E2ETestSuite) SetupSuite() {
|
|||||||
"--yes",
|
"--yes",
|
||||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees),
|
fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees),
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, bank.NewSendTxCmd(), args)
|
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, bank.NewSendTxCmd(), args)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
@ -78,14 +74,13 @@ func (s *E2ETestSuite) SetupSuite() {
|
|||||||
s.Require().NoError(s.network.WaitForNextBlock())
|
s.Require().NoError(s.network.WaitForNextBlock())
|
||||||
|
|
||||||
prvKey, pubKey = sample.KeyPair()
|
prvKey, pubKey = sample.KeyPair()
|
||||||
xPrvKey, xPubKey = sample.ExtendedKeyPair(config.PlmntNetParams)
|
|
||||||
|
|
||||||
ta := sample.TrustAnchor(pubKey)
|
ta := sample.TrustAnchor(pubKey)
|
||||||
taJSON, err := json.Marshal(&ta)
|
taJSON, err := json.Marshal(&ta)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
args = []string{
|
args = []string{
|
||||||
fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID),
|
fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID),
|
||||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, sample.Name),
|
fmt.Sprintf("--%s=%s", flags.FlagFrom, addr.String()),
|
||||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees),
|
fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees),
|
||||||
"--yes",
|
"--yes",
|
||||||
string(taJSON),
|
string(taJSON),
|
||||||
@ -95,7 +90,7 @@ func (s *E2ETestSuite) SetupSuite() {
|
|||||||
|
|
||||||
s.Require().NoError(s.network.WaitForNextBlock())
|
s.Require().NoError(s.network.WaitForNextBlock())
|
||||||
|
|
||||||
machine := sample.Machine(sample.Name, pubKey, prvKey)
|
machine := sample.Machine(sample.Name, pubKey, prvKey, addr.String())
|
||||||
machineJSON, err := json.Marshal(&machine)
|
machineJSON, err := json.Marshal(&machine)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
@ -127,12 +122,11 @@ func (s *E2ETestSuite) TearDownSuite() {
|
|||||||
// TestNotarizeAsset notarizes asset over cli
|
// TestNotarizeAsset notarizes asset over cli
|
||||||
func (s *E2ETestSuite) TestNotarizeAsset() {
|
func (s *E2ETestSuite) TestNotarizeAsset() {
|
||||||
val := s.network.Validators[0]
|
val := s.network.Validators[0]
|
||||||
|
k, err := val.ClientCtx.Keyring.Key(sample.Name)
|
||||||
|
s.Require().NoError(err)
|
||||||
|
|
||||||
xskKey, _ := hdkeychain.NewKeyFromString(xPrvKey)
|
addr, _ := k.GetAddress()
|
||||||
privKey, _ := xskKey.ECPrivKey()
|
cid := sample.Asset()
|
||||||
byte_key := privKey.Serialize()
|
|
||||||
sk := hex.EncodeToString(byte_key)
|
|
||||||
cid, signatureHex := sample.Asset(sk)
|
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
@ -140,57 +134,16 @@ func (s *E2ETestSuite) TestNotarizeAsset() {
|
|||||||
rawLog string
|
rawLog string
|
||||||
expectCheckTxErr bool
|
expectCheckTxErr bool
|
||||||
}{
|
}{
|
||||||
{
|
|
||||||
"machine not found",
|
|
||||||
[]string{
|
|
||||||
cid,
|
|
||||||
signatureHex,
|
|
||||||
"pubkey",
|
|
||||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, sample.Name),
|
|
||||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees),
|
|
||||||
"--yes",
|
|
||||||
},
|
|
||||||
"machine not found",
|
|
||||||
true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"invalid signature hex string",
|
|
||||||
[]string{
|
|
||||||
cid,
|
|
||||||
"signature",
|
|
||||||
xPubKey,
|
|
||||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, sample.Name),
|
|
||||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees),
|
|
||||||
"--yes",
|
|
||||||
},
|
|
||||||
"invalid signature hex string",
|
|
||||||
false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"invalid signature",
|
|
||||||
[]string{
|
|
||||||
cid,
|
|
||||||
hex.EncodeToString([]byte("signature")),
|
|
||||||
xPubKey,
|
|
||||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, sample.Name),
|
|
||||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees),
|
|
||||||
"--yes",
|
|
||||||
},
|
|
||||||
"invalid signature",
|
|
||||||
false,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"valid notarization",
|
"valid notarization",
|
||||||
[]string{
|
[]string{
|
||||||
cid,
|
cid,
|
||||||
signatureHex,
|
fmt.Sprintf("--%s=%s", flags.FlagFrom, addr.String()),
|
||||||
xPubKey,
|
|
||||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, sample.Name),
|
|
||||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees),
|
fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees),
|
||||||
"--yes",
|
"--yes",
|
||||||
},
|
},
|
||||||
"planetmintgo.asset.MsgNotarizeAsset",
|
"[]",
|
||||||
false,
|
true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package machine
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/planetmint/planetmint-go/testutil"
|
"github.com/planetmint/planetmint-go/testutil"
|
||||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||||
machinetypes "github.com/planetmint/planetmint-go/x/machine/types"
|
machinetypes "github.com/planetmint/planetmint-go/x/machine/types"
|
||||||
@ -37,8 +38,7 @@ func (s *E2ETestSuite) TestAttestMachineREST() {
|
|||||||
s.Require().NoError(s.network.WaitForNextBlock())
|
s.Require().NoError(s.network.WaitForNextBlock())
|
||||||
|
|
||||||
// Create Attest Machine TX
|
// Create Attest Machine TX
|
||||||
machine := sample.Machine(sample.Name, pubKey, prvKey)
|
machine := sample.Machine(sample.Name, pubKey, prvKey, addr.String())
|
||||||
machine.Address = addr.String()
|
|
||||||
msg := machinetypes.MsgAttestMachine{
|
msg := machinetypes.MsgAttestMachine{
|
||||||
Creator: addr.String(),
|
Creator: addr.String(),
|
||||||
Machine: &machine,
|
Machine: &machine,
|
||||||
|
@ -3,6 +3,7 @@ package machine
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
|
clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
|
||||||
"github.com/planetmint/planetmint-go/testutil/network"
|
"github.com/planetmint/planetmint-go/testutil/network"
|
||||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||||
@ -97,7 +98,11 @@ func (s *E2ETestSuite) TestAttestMachine() {
|
|||||||
|
|
||||||
assert.Contains(s.T(), rawLog, "planetmintgo.machine.MsgRegisterTrustAnchor")
|
assert.Contains(s.T(), rawLog, "planetmintgo.machine.MsgRegisterTrustAnchor")
|
||||||
|
|
||||||
machine := sample.Machine(sample.Name, pubKey, prvKey)
|
k, err := val.ClientCtx.Keyring.Key(sample.Name)
|
||||||
|
s.Require().NoError(err)
|
||||||
|
addr, _ := k.GetAddress()
|
||||||
|
|
||||||
|
machine := sample.Machine(sample.Name, pubKey, prvKey, addr.String())
|
||||||
machineJSON, err := json.Marshal(&machine)
|
machineJSON, err := json.Marshal(&machine)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -51,12 +51,13 @@ func AssetKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
|
|||||||
sk, pk := sample.KeyPair()
|
sk, pk := sample.KeyPair()
|
||||||
_, 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().GetMachineIndexByPubKey(ctx, pk).Return(id, true).AnyTimes()
|
mk.EXPECT().GetMachineIndexByPubKey(ctx, pk).Return(id, true).AnyTimes()
|
||||||
mk.EXPECT().GetMachineIndexByPubKey(ctx, ppk).Return(id, true).AnyTimes()
|
mk.EXPECT().GetMachineIndexByPubKey(ctx, ppk).Return(id, true).AnyTimes()
|
||||||
mk.EXPECT().GetMachineIndexByPubKey(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()
|
||||||
|
|
||||||
k := keeper.NewKeeper(
|
k := keeper.NewKeeper(
|
||||||
cdc,
|
cdc,
|
||||||
|
@ -60,7 +60,7 @@ func Secp256k1AccAddress() sdk.AccAddress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: make address deterministic for test cases
|
// TODO: make address deterministic for test cases
|
||||||
func Machine(name, pubKey string, prvKey string) machinetypes.Machine {
|
func Machine(name, pubKey string, prvKey string, address string) machinetypes.Machine {
|
||||||
metadata := Metadata()
|
metadata := Metadata()
|
||||||
_, liquidPubKey := ExtendedKeyPair(config.LiquidNetParams)
|
_, liquidPubKey := ExtendedKeyPair(config.LiquidNetParams)
|
||||||
_, planetmintPubKey := ExtendedKeyPair(config.PlmntNetParams)
|
_, planetmintPubKey := ExtendedKeyPair(config.PlmntNetParams)
|
||||||
@ -71,7 +71,9 @@ 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()
|
if address == "" {
|
||||||
|
address = Secp256k1AccAddress().String()
|
||||||
|
}
|
||||||
|
|
||||||
m := machinetypes.Machine{
|
m := machinetypes.Machine{
|
||||||
Name: name,
|
Name: name,
|
||||||
@ -86,7 +88,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(),
|
Address: address,
|
||||||
}
|
}
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
@ -108,16 +110,9 @@ func Metadata() machinetypes.Metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Asset(sk string) (string, string) {
|
func Asset() string {
|
||||||
cid := "cid"
|
cid := "cid0"
|
||||||
|
return cid
|
||||||
skBytes, _ := hex.DecodeString(sk)
|
|
||||||
privKey := &secp256k1.PrivKey{Key: skBytes}
|
|
||||||
|
|
||||||
sign, _ := privKey.Sign([]byte(cid))
|
|
||||||
signatureHex := hex.EncodeToString(sign)
|
|
||||||
|
|
||||||
return cid, signatureHex
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExtendedKeyPair(cfg chaincfg.Params) (string, string) {
|
func ExtendedKeyPair(cfg chaincfg.Params) (string, string) {
|
||||||
|
@ -25,7 +25,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd.AddCommand(CmdQueryParams())
|
cmd.AddCommand(CmdQueryParams())
|
||||||
cmd.AddCommand(CmdGetCIDsByPubKey())
|
cmd.AddCommand(CmdGetCIDsByAddress())
|
||||||
|
|
||||||
cmd.AddCommand(CmdGetNotarizedAsset())
|
cmd.AddCommand(CmdGetNotarizedAsset())
|
||||||
|
|
||||||
|
@ -12,13 +12,13 @@ import (
|
|||||||
|
|
||||||
var _ = strconv.Itoa(0)
|
var _ = strconv.Itoa(0)
|
||||||
|
|
||||||
func CmdGetCIDsByPubKey() *cobra.Command {
|
func CmdGetCIDsByAddress() *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "get-assets-by-pub-key [ext-pub-key] [lookup-period-in-min]",
|
Use: "get-assets-by-pub-key [ext-pub-key] [lookup-period-in-min]",
|
||||||
Short: "Query get_cids_by_pub_key",
|
Short: "Query get_cids_by_address",
|
||||||
Args: cobra.ExactArgs(2),
|
Args: cobra.ExactArgs(2),
|
||||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||||
reqExtPubKey := args[0]
|
reqAddress := args[0]
|
||||||
reqLookupPeriodInMin, err := cast.ToUint64E(args[1])
|
reqLookupPeriodInMin, err := cast.ToUint64E(args[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -31,9 +31,9 @@ func CmdGetCIDsByPubKey() *cobra.Command {
|
|||||||
|
|
||||||
queryClient := types.NewQueryClient(clientCtx)
|
queryClient := types.NewQueryClient(clientCtx)
|
||||||
|
|
||||||
params := &types.QueryGetCIDsByPubKeyRequest{
|
params := &types.QueryGetCIDsByAddressRequest{
|
||||||
|
|
||||||
ExtPubKey: reqExtPubKey,
|
Address: reqAddress,
|
||||||
LookupPeriodInMin: reqLookupPeriodInMin,
|
LookupPeriodInMin: reqLookupPeriodInMin,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ func CmdGetCIDsByPubKey() *cobra.Command {
|
|||||||
}
|
}
|
||||||
params.Pagination = pageReq
|
params.Pagination = pageReq
|
||||||
|
|
||||||
res, err := queryClient.GetCIDsByPubKey(cmd.Context(), params)
|
res, err := queryClient.GetCIDsByAddress(cmd.Context(), params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,11 @@ var _ = strconv.Itoa(0)
|
|||||||
|
|
||||||
func CmdNotarizeAsset() *cobra.Command {
|
func CmdNotarizeAsset() *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "notarize-asset [hash] [signature] [pub-key]",
|
Use: "notarize-asset [cid] ",
|
||||||
Short: "Broadcast message notarize-asset",
|
Short: "Broadcast message notarize-asset",
|
||||||
Args: cobra.ExactArgs(3),
|
Args: cobra.ExactArgs(1),
|
||||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||||
argHash := args[0]
|
argCid := args[0]
|
||||||
argSignature := args[1]
|
|
||||||
argPubKey := args[2]
|
|
||||||
|
|
||||||
clientCtx, err := client.GetClientTxContext(cmd)
|
clientCtx, err := client.GetClientTxContext(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -29,9 +27,7 @@ func CmdNotarizeAsset() *cobra.Command {
|
|||||||
|
|
||||||
msg := types.NewMsgNotarizeAsset(
|
msg := types.NewMsgNotarizeAsset(
|
||||||
clientCtx.GetFromAddress().String(),
|
clientCtx.GetFromAddress().String(),
|
||||||
argHash,
|
argCid,
|
||||||
argSignature,
|
|
||||||
argPubKey,
|
|
||||||
)
|
)
|
||||||
if err := msg.ValidateBasic(); err != nil {
|
if err := msg.ValidateBasic(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -7,57 +7,39 @@ import (
|
|||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (k Keeper) StoreAsset(ctx sdk.Context, asset types.Asset) {
|
func (k Keeper) StoreAsset(ctx sdk.Context, msg types.MsgNotarizeAsset) {
|
||||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AssetKey))
|
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AssetKey))
|
||||||
appendValue := k.cdc.MustMarshal(&asset)
|
store.Set(GetAssetCIDBytes(msg.GetCid()), []byte(msg.GetCreator()))
|
||||||
store.Set(GetAssetHashBytes(asset.Hash), appendValue)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k Keeper) GetAsset(ctx sdk.Context, hash string) (val types.Asset, found bool) {
|
func (k Keeper) GetAsset(ctx sdk.Context, cid string) (msg types.MsgNotarizeAsset, found bool) {
|
||||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AssetKey))
|
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AssetKey))
|
||||||
asset := store.Get(GetAssetHashBytes(hash))
|
creator_bytes := store.Get(GetAssetCIDBytes(cid))
|
||||||
if asset == nil {
|
if creator_bytes == nil {
|
||||||
return val, false
|
return msg, false
|
||||||
}
|
}
|
||||||
k.cdc.MustUnmarshal(asset, &val)
|
msg.Cid = cid
|
||||||
return val, true
|
msg.Creator = string(creator_bytes)
|
||||||
|
return msg, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k Keeper) GetCIDsByPublicKey(ctx sdk.Context, pubkey string) (assetArray []types.Asset, found bool) {
|
func (k Keeper) GetCidsByAddress(ctx sdk.Context, address string) (cids []string, found bool) {
|
||||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AssetKey))
|
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AssetKey))
|
||||||
|
|
||||||
reverseIterator := store.ReverseIterator(nil, nil)
|
reverseIterator := store.ReverseIterator(nil, nil)
|
||||||
defer reverseIterator.Close()
|
defer reverseIterator.Close()
|
||||||
var asset types.Asset
|
|
||||||
for ; reverseIterator.Valid(); reverseIterator.Next() {
|
for ; reverseIterator.Valid(); reverseIterator.Next() {
|
||||||
lastValue := reverseIterator.Value()
|
address_bytes := reverseIterator.Value()
|
||||||
|
cid_bytes := reverseIterator.Key()
|
||||||
|
|
||||||
k.cdc.MustUnmarshal(lastValue, &asset)
|
if string(address_bytes) == address {
|
||||||
if asset.GetPubkey() == pubkey {
|
cids = append(cids, string(cid_bytes))
|
||||||
assetArray = append(assetArray, asset)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return assetArray, len(assetArray) > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (k Keeper) GetCidsByPublicKey(ctx sdk.Context, pubkey string) (cids []string, found bool) {
|
|
||||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AssetKey))
|
|
||||||
|
|
||||||
reverseIterator := store.ReverseIterator(nil, nil)
|
|
||||||
defer reverseIterator.Close()
|
|
||||||
var asset types.Asset
|
|
||||||
for ; reverseIterator.Valid(); reverseIterator.Next() {
|
|
||||||
lastValue := reverseIterator.Value()
|
|
||||||
|
|
||||||
k.cdc.MustUnmarshal(lastValue, &asset)
|
|
||||||
if asset.GetPubkey() == pubkey {
|
|
||||||
cids = append(cids, asset.GetHash())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cids, len(cids) > 0
|
return cids, len(cids) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAssetHashBytes(hash string) []byte {
|
func GetAssetCIDBytes(cid string) []byte {
|
||||||
bz := []byte(hash)
|
bz := []byte(cid)
|
||||||
return bz
|
return bz
|
||||||
}
|
}
|
||||||
|
@ -13,17 +13,15 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func createNAsset(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Asset {
|
func createNAsset(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.MsgNotarizeAsset {
|
||||||
items := make([]types.Asset, n)
|
items := make([]types.MsgNotarizeAsset, n)
|
||||||
for i := range items {
|
for i := range items {
|
||||||
hash := sha256.Sum256([]byte(strconv.FormatInt(int64(i), 2)))
|
hash := sha256.Sum256([]byte(strconv.FormatInt(int64(i), 2)))
|
||||||
hashStr := string(hash[:])
|
hashStr := string(hash[:])
|
||||||
|
items[i].Cid = hashStr
|
||||||
items[i].Hash = hashStr
|
items[i].Creator = "plmnt_address"
|
||||||
items[i].Pubkey = "pubkey"
|
if i%2 == 0 {
|
||||||
items[i].Signature = "sign"
|
items[i].Creator = "plmnt_address1"
|
||||||
if i%2 == 1 {
|
|
||||||
items[i].Pubkey = "pubkey_search"
|
|
||||||
}
|
}
|
||||||
keeper.StoreAsset(ctx, items[i])
|
keeper.StoreAsset(ctx, items[i])
|
||||||
}
|
}
|
||||||
@ -34,7 +32,7 @@ func TestGetAsset(t *testing.T) {
|
|||||||
keeper, ctx := keepertest.AssetKeeper(t)
|
keeper, ctx := keepertest.AssetKeeper(t)
|
||||||
items := createNAsset(keeper, ctx, 10)
|
items := createNAsset(keeper, ctx, 10)
|
||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
asset, found := keeper.GetAsset(ctx, item.Hash)
|
asset, found := keeper.GetAsset(ctx, item.Cid)
|
||||||
assert.True(t, found)
|
assert.True(t, found)
|
||||||
assert.Equal(t, item, asset)
|
assert.Equal(t, item, asset)
|
||||||
}
|
}
|
||||||
@ -43,7 +41,7 @@ func TestGetCids(t *testing.T) {
|
|||||||
keeper, ctx := keepertest.AssetKeeper(t)
|
keeper, ctx := keepertest.AssetKeeper(t)
|
||||||
items := createNAsset(keeper, ctx, 10)
|
items := createNAsset(keeper, ctx, 10)
|
||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
asset, found := keeper.GetAsset(ctx, item.Hash)
|
asset, found := keeper.GetAsset(ctx, item.Cid)
|
||||||
assert.True(t, found)
|
assert.True(t, found)
|
||||||
assert.Equal(t, item, asset)
|
assert.Equal(t, item, asset)
|
||||||
}
|
}
|
||||||
@ -52,21 +50,10 @@ func TestGetCids(t *testing.T) {
|
|||||||
func TestGetAssetByPubKeys(t *testing.T) {
|
func TestGetAssetByPubKeys(t *testing.T) {
|
||||||
keeper, ctx := keepertest.AssetKeeper(t)
|
keeper, ctx := keepertest.AssetKeeper(t)
|
||||||
_ = createNAsset(keeper, ctx, 10)
|
_ = createNAsset(keeper, ctx, 10)
|
||||||
assets, found := keeper.GetCIDsByPublicKey(ctx, "pubkey_search")
|
assets, found := keeper.GetCidsByAddress(ctx, "plmnt_address")
|
||||||
assert.True(t, found)
|
assert.True(t, found)
|
||||||
assert.Equal(t, len(assets), 5)
|
assert.Equal(t, len(assets), 5)
|
||||||
assets, found = keeper.GetCIDsByPublicKey(ctx, "pubkey")
|
assets, found = keeper.GetCidsByAddress(ctx, "plmnt_address1")
|
||||||
assert.True(t, found)
|
|
||||||
assert.Equal(t, len(assets), 5)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetCidsByPubKeys(t *testing.T) {
|
|
||||||
keeper, ctx := keepertest.AssetKeeper(t)
|
|
||||||
_ = createNAsset(keeper, ctx, 10)
|
|
||||||
assets, found := keeper.GetCidsByPublicKey(ctx, "pubkey_search")
|
|
||||||
assert.True(t, found)
|
|
||||||
assert.Equal(t, len(assets), 5)
|
|
||||||
assets, found = keeper.GetCidsByPublicKey(ctx, "pubkey")
|
|
||||||
assert.True(t, found)
|
assert.True(t, found)
|
||||||
assert.Equal(t, len(assets), 5)
|
assert.Equal(t, len(assets), 5)
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,7 @@ package keeper
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
|
|
||||||
"github.com/planetmint/planetmint-go/util"
|
|
||||||
"github.com/planetmint/planetmint-go/x/asset/types"
|
"github.com/planetmint/planetmint-go/x/asset/types"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
@ -13,27 +11,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.GetMachineIndexByPubKey(ctx, msg.PubKey)
|
k.StoreAsset(ctx, *msg)
|
||||||
|
|
||||||
if !found {
|
|
||||||
return nil, errors.New("machine not found")
|
|
||||||
}
|
|
||||||
hex_pub_key, err := util.GetHexPubKey(msg.PubKey)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.New("could not convert xpub key to hex pub key")
|
|
||||||
}
|
|
||||||
valid, err := util.ValidateSignatureByteMsg([]byte(msg.Hash), msg.Signature, hex_pub_key)
|
|
||||||
if !valid {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var asset = types.Asset{
|
|
||||||
Hash: msg.Hash,
|
|
||||||
Signature: msg.Signature,
|
|
||||||
Pubkey: msg.PubKey,
|
|
||||||
}
|
|
||||||
|
|
||||||
k.StoreAsset(ctx, asset)
|
|
||||||
|
|
||||||
return &types.MsgNotarizeAssetResponse{}, nil
|
return &types.MsgNotarizeAssetResponse{}, nil
|
||||||
}
|
}
|
||||||
|
@ -29,52 +29,17 @@ func TestMsgServer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMsgServerNotarizeAsset(t *testing.T) {
|
func TestMsgServerNotarizeAsset(t *testing.T) {
|
||||||
ext_sk, ppk := sample.ExtendedKeyPair(config.PlmntNetParams)
|
ext_sk, _ := sample.ExtendedKeyPair(config.PlmntNetParams)
|
||||||
xskKey, _ := hdkeychain.NewKeyFromString(ext_sk)
|
xskKey, _ := hdkeychain.NewKeyFromString(ext_sk)
|
||||||
privKey, _ := xskKey.ECPrivKey()
|
privKey, _ := xskKey.ECPrivKey()
|
||||||
byte_key := privKey.Serialize()
|
byte_key := privKey.Serialize()
|
||||||
sk := hex.EncodeToString(byte_key)
|
sk := hex.EncodeToString(byte_key)
|
||||||
cid, signatureHex := sample.Asset(sk)
|
cid := sample.Asset()
|
||||||
|
|
||||||
msg := types.NewMsgNotarizeAsset(sk, cid, signatureHex, ppk)
|
msg := types.NewMsgNotarizeAsset(sk, cid)
|
||||||
msgServer, ctx := setupMsgServer(t)
|
msgServer, ctx := setupMsgServer(t)
|
||||||
res, err := msgServer.NotarizeAsset(ctx, msg)
|
res, err := msgServer.NotarizeAsset(ctx, msg)
|
||||||
if assert.NoError(t, err) {
|
if assert.NoError(t, err) {
|
||||||
assert.Equal(t, &types.MsgNotarizeAssetResponse{}, res)
|
assert.Equal(t, &types.MsgNotarizeAssetResponse{}, res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMsgServerNotarizeAssetMachineNotFound(t *testing.T) {
|
|
||||||
sk, _ := sample.KeyPair()
|
|
||||||
msg := types.NewMsgNotarizeAsset(sk, "cid", "sign", sk)
|
|
||||||
msgServer, ctx := setupMsgServer(t)
|
|
||||||
_, err := msgServer.NotarizeAsset(ctx, msg)
|
|
||||||
assert.EqualError(t, err, "machine not found")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMsgServerNotarizeAssetInvalidAssetSignatureType(t *testing.T) {
|
|
||||||
_, pk := sample.ExtendedKeyPair(config.PlmntNetParams)
|
|
||||||
hex_string := hex.EncodeToString([]byte("cid"))
|
|
||||||
msg := types.NewMsgNotarizeAsset(pk, hex_string, "sign", pk)
|
|
||||||
msgServer, ctx := setupMsgServer(t)
|
|
||||||
_, err := msgServer.NotarizeAsset(ctx, msg)
|
|
||||||
assert.EqualError(t, err, "invalid signature hex string")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMsgServerNotarizeAssetInvalidAssetSignature(t *testing.T) {
|
|
||||||
_, pk := sample.ExtendedKeyPair(config.PlmntNetParams)
|
|
||||||
hex_string_cid := hex.EncodeToString([]byte("cid"))
|
|
||||||
hex_string_sid := hex.EncodeToString([]byte("sign"))
|
|
||||||
msg := types.NewMsgNotarizeAsset(pk, hex_string_cid, hex_string_sid, pk)
|
|
||||||
msgServer, ctx := setupMsgServer(t)
|
|
||||||
_, err := msgServer.NotarizeAsset(ctx, msg)
|
|
||||||
assert.EqualError(t, err, "invalid signature")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMsgServerNotarizeAssetInvalidXPubKey(t *testing.T) {
|
|
||||||
_, pk := sample.KeyPair()
|
|
||||||
msg := types.NewMsgNotarizeAsset(pk, "cid", "sign", pk)
|
|
||||||
msgServer, ctx := setupMsgServer(t)
|
|
||||||
_, err := msgServer.NotarizeAsset(ctx, msg)
|
|
||||||
assert.EqualError(t, err, "could not convert xpub key to hex pub key")
|
|
||||||
}
|
|
||||||
|
@ -9,17 +9,17 @@ import (
|
|||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (k Keeper) GetCIDsByPubKey(goCtx context.Context, req *types.QueryGetCIDsByPubKeyRequest) (*types.QueryGetCIDsByPubKeyResponse, error) {
|
func (k Keeper) GetCIDsByAddress(goCtx context.Context, req *types.QueryGetCIDsByAddressRequest) (*types.QueryGetCIDsByAddressResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|
||||||
cids, found := k.GetCidsByPublicKey(ctx, req.GetExtPubKey())
|
cids, found := k.GetCidsByAddress(ctx, req.GetAddress())
|
||||||
if !found {
|
if !found {
|
||||||
return nil, status.Error(codes.NotFound, "no CIDs found")
|
return nil, status.Error(codes.NotFound, "no CIDs found")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &types.QueryGetCIDsByPubKeyResponse{CIDs: cids}, nil
|
return &types.QueryGetCIDsByAddressResponse{Cids: cids}, nil
|
||||||
}
|
}
|
@ -12,31 +12,31 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetNotarizedAssetByPubKey(t *testing.T) {
|
func TestGetNotarizedAssetByAddress(t *testing.T) {
|
||||||
keeper, ctx := keepertest.AssetKeeper(t)
|
keeper, ctx := keepertest.AssetKeeper(t)
|
||||||
wctx := sdk.WrapSDKContext(ctx)
|
wctx := sdk.WrapSDKContext(ctx)
|
||||||
_ = createNAsset(keeper, ctx, 10)
|
_ = createNAsset(keeper, ctx, 10)
|
||||||
assets, _ := keeper.GetCidsByPublicKey(ctx, "pubkey_search")
|
assets, _ := keeper.GetCidsByAddress(ctx, "plmnt_address")
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
desc string
|
desc string
|
||||||
request *types.QueryGetCIDsByPubKeyRequest
|
request *types.QueryGetCIDsByAddressRequest
|
||||||
response *types.QueryGetCIDsByPubKeyResponse
|
response *types.QueryGetCIDsByAddressResponse
|
||||||
err error
|
err error
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
desc: "cid found",
|
desc: "cid found",
|
||||||
request: &types.QueryGetCIDsByPubKeyRequest{ExtPubKey: "pubkey_search"},
|
request: &types.QueryGetCIDsByAddressRequest{Address: "plmnt_address"},
|
||||||
response: &types.QueryGetCIDsByPubKeyResponse{CIDs: assets},
|
response: &types.QueryGetCIDsByAddressResponse{Cids: assets},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "cid not found",
|
desc: "cid not found",
|
||||||
request: &types.QueryGetCIDsByPubKeyRequest{ExtPubKey: "invalid key"},
|
request: &types.QueryGetCIDsByAddressRequest{Address: "invalid key"},
|
||||||
err: status.Error(codes.NotFound, "no CIDs found"),
|
err: status.Error(codes.NotFound, "no CIDs found"),
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
tc := tc
|
tc := tc
|
||||||
t.Run(tc.desc, func(t *testing.T) {
|
t.Run(tc.desc, func(t *testing.T) {
|
||||||
response, err := keeper.GetCIDsByPubKey(wctx, tc.request)
|
response, err := keeper.GetCIDsByAddress(wctx, tc.request)
|
||||||
if tc.err != nil {
|
if tc.err != nil {
|
||||||
require.ErrorIs(t, err, tc.err)
|
require.ErrorIs(t, err, tc.err)
|
||||||
} else {
|
} else {
|
@ -21,5 +21,5 @@ func (k Keeper) GetNotarizedAsset(goCtx context.Context, req *types.QueryGetNota
|
|||||||
return nil, status.Error(codes.NotFound, "cid not found")
|
return nil, status.Error(codes.NotFound, "cid not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &types.QueryGetNotarizedAssetResponse{Cid: asset.GetHash(), Signature: asset.GetSignature(), Pubkey: asset.GetPubkey()}, nil
|
return &types.QueryGetNotarizedAssetResponse{Cid: asset.GetCid()}, nil
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@ func TestGetNotarizedAsset(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
desc: "cid found",
|
desc: "cid found",
|
||||||
request: &types.QueryGetNotarizedAssetRequest{Cid: msgs[0].GetHash()},
|
request: &types.QueryGetNotarizedAssetRequest{Cid: msgs[0].GetCid()},
|
||||||
response: &types.QueryGetNotarizedAssetResponse{Cid: msgs[0].GetHash(), Signature: msgs[0].GetSignature(), Pubkey: msgs[0].GetPubkey()},
|
response: &types.QueryGetNotarizedAssetResponse{Cid: msgs[0].GetCid()},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "cid not found",
|
desc: "cid not found",
|
||||||
|
@ -139,3 +139,18 @@ func (mr *MockMachineKeeperMockRecorder) GetMachineIndexByPubKey(ctx, pubKey int
|
|||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMachineIndexByPubKey", reflect.TypeOf((*MockMachineKeeper)(nil).GetMachineIndexByPubKey), ctx, pubKey)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMachineIndexByPubKey", reflect.TypeOf((*MockMachineKeeper)(nil).GetMachineIndexByPubKey), ctx, pubKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetMachineIndexByPubKey mocks base method.
|
||||||
|
func (m *MockMachineKeeper) GetMachineIndexByAddress(ctx types.Context, pubKey string) (types1.MachineIndex, bool) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetMachineIndexByAddress", ctx, pubKey)
|
||||||
|
ret0, _ := ret[0].(types1.MachineIndex)
|
||||||
|
ret1, _ := ret[1].(bool)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMachineIndexByPubKey indicates an expected call of GetMachineIndexByPubKey.
|
||||||
|
func (mr *MockMachineKeeperMockRecorder) GetMachineIndexByAddress(ctx, address interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMachineIndexByAddress", reflect.TypeOf((*MockMachineKeeper)(nil).GetMachineIndexByAddress), ctx, address)
|
||||||
|
}
|
||||||
|
@ -23,9 +23,7 @@ var _ = math.Inf
|
|||||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
type Asset struct {
|
type Asset struct {
|
||||||
Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
|
Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"`
|
||||||
Signature string `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
|
|
||||||
Pubkey string `protobuf:"bytes,3,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Asset) Reset() { *m = Asset{} }
|
func (m *Asset) Reset() { *m = Asset{} }
|
||||||
@ -61,23 +59,9 @@ func (m *Asset) XXX_DiscardUnknown() {
|
|||||||
|
|
||||||
var xxx_messageInfo_Asset proto.InternalMessageInfo
|
var xxx_messageInfo_Asset proto.InternalMessageInfo
|
||||||
|
|
||||||
func (m *Asset) GetHash() string {
|
func (m *Asset) GetCid() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Hash
|
return m.Cid
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Asset) GetSignature() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.Signature
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Asset) GetPubkey() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.Pubkey
|
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -89,19 +73,16 @@ func init() {
|
|||||||
func init() { proto.RegisterFile("planetmintgo/asset/asset.proto", fileDescriptor_03dd37a25f684e6e) }
|
func init() { proto.RegisterFile("planetmintgo/asset/asset.proto", fileDescriptor_03dd37a25f684e6e) }
|
||||||
|
|
||||||
var fileDescriptor_03dd37a25f684e6e = []byte{
|
var fileDescriptor_03dd37a25f684e6e = []byte{
|
||||||
// 179 bytes of a gzipped FileDescriptorProto
|
// 143 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0xc8, 0x49, 0xcc,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0xc8, 0x49, 0xcc,
|
||||||
0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x2c, 0x2e, 0x4e, 0x2d, 0x81, 0x90,
|
0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x2c, 0x2e, 0x4e, 0x2d, 0x81, 0x90,
|
||||||
0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x42, 0xc8, 0xf2, 0x7a, 0x60, 0x19, 0xa5, 0x40, 0x2e,
|
0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x42, 0xc8, 0xf2, 0x7a, 0x60, 0x19, 0x25, 0x49, 0x2e,
|
||||||
0x56, 0x47, 0x10, 0x43, 0x48, 0x88, 0x8b, 0x25, 0x23, 0xb1, 0x38, 0x43, 0x82, 0x51, 0x81, 0x51,
|
0x56, 0x47, 0x10, 0x43, 0x48, 0x80, 0x8b, 0x39, 0x39, 0x33, 0x45, 0x82, 0x51, 0x81, 0x51, 0x83,
|
||||||
0x83, 0x33, 0x08, 0xcc, 0x16, 0x92, 0xe1, 0xe2, 0x2c, 0xce, 0x4c, 0xcf, 0x4b, 0x2c, 0x29, 0x2d,
|
0x33, 0x08, 0xc4, 0x74, 0xf2, 0x3e, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f,
|
||||||
0x4a, 0x95, 0x60, 0x02, 0x4b, 0x20, 0x04, 0x84, 0xc4, 0xb8, 0xd8, 0x0a, 0x4a, 0x93, 0xb2, 0x53,
|
0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28,
|
||||||
0x2b, 0x25, 0x98, 0xc1, 0x52, 0x50, 0x9e, 0x93, 0xf7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9,
|
0xc3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x84, 0x99, 0x48, 0x4c,
|
||||||
0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e,
|
0xdd, 0xf4, 0x7c, 0xfd, 0x0a, 0xa8, 0x0b, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x4e,
|
||||||
0xcb, 0x31, 0x44, 0x19, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x23,
|
0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x38, 0x8c, 0xdf, 0xa4, 0x00, 0x00, 0x00,
|
||||||
0xdc, 0x82, 0xc4, 0xd4, 0x4d, 0xcf, 0xd7, 0xaf, 0x80, 0xba, 0xbc, 0xa4, 0xb2, 0x20, 0xb5, 0x38,
|
|
||||||
0x89, 0x0d, 0xec, 0x74, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xe4, 0xfc, 0x55, 0xdc,
|
|
||||||
0x00, 0x00, 0x00,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Asset) Marshal() (dAtA []byte, err error) {
|
func (m *Asset) Marshal() (dAtA []byte, err error) {
|
||||||
@ -124,24 +105,10 @@ func (m *Asset) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.Pubkey) > 0 {
|
if len(m.Cid) > 0 {
|
||||||
i -= len(m.Pubkey)
|
i -= len(m.Cid)
|
||||||
copy(dAtA[i:], m.Pubkey)
|
copy(dAtA[i:], m.Cid)
|
||||||
i = encodeVarintAsset(dAtA, i, uint64(len(m.Pubkey)))
|
i = encodeVarintAsset(dAtA, i, uint64(len(m.Cid)))
|
||||||
i--
|
|
||||||
dAtA[i] = 0x1a
|
|
||||||
}
|
|
||||||
if len(m.Signature) > 0 {
|
|
||||||
i -= len(m.Signature)
|
|
||||||
copy(dAtA[i:], m.Signature)
|
|
||||||
i = encodeVarintAsset(dAtA, i, uint64(len(m.Signature)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x12
|
|
||||||
}
|
|
||||||
if len(m.Hash) > 0 {
|
|
||||||
i -= len(m.Hash)
|
|
||||||
copy(dAtA[i:], m.Hash)
|
|
||||||
i = encodeVarintAsset(dAtA, i, uint64(len(m.Hash)))
|
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0xa
|
dAtA[i] = 0xa
|
||||||
}
|
}
|
||||||
@ -165,15 +132,7 @@ func (m *Asset) Size() (n int) {
|
|||||||
}
|
}
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
l = len(m.Hash)
|
l = len(m.Cid)
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovAsset(uint64(l))
|
|
||||||
}
|
|
||||||
l = len(m.Signature)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovAsset(uint64(l))
|
|
||||||
}
|
|
||||||
l = len(m.Pubkey)
|
|
||||||
if l > 0 {
|
if l > 0 {
|
||||||
n += 1 + l + sovAsset(uint64(l))
|
n += 1 + l + sovAsset(uint64(l))
|
||||||
}
|
}
|
||||||
@ -217,7 +176,7 @@ func (m *Asset) Unmarshal(dAtA []byte) error {
|
|||||||
switch fieldNum {
|
switch fieldNum {
|
||||||
case 1:
|
case 1:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field Cid", wireType)
|
||||||
}
|
}
|
||||||
var stringLen uint64
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -245,71 +204,7 @@ func (m *Asset) Unmarshal(dAtA []byte) error {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
m.Hash = string(dAtA[iNdEx:postIndex])
|
m.Cid = string(dAtA[iNdEx:postIndex])
|
||||||
iNdEx = postIndex
|
|
||||||
case 2:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType)
|
|
||||||
}
|
|
||||||
var stringLen uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowAsset
|
|
||||||
}
|
|
||||||
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 ErrInvalidLengthAsset
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + intStringLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthAsset
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.Signature = string(dAtA[iNdEx:postIndex])
|
|
||||||
iNdEx = postIndex
|
|
||||||
case 3:
|
|
||||||
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 ErrIntOverflowAsset
|
|
||||||
}
|
|
||||||
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 ErrInvalidLengthAsset
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + intStringLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthAsset
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.Pubkey = string(dAtA[iNdEx:postIndex])
|
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
|
@ -10,12 +10,10 @@ const TypeMsgNotarizeAsset = "notarize_asset"
|
|||||||
|
|
||||||
var _ sdk.Msg = &MsgNotarizeAsset{}
|
var _ sdk.Msg = &MsgNotarizeAsset{}
|
||||||
|
|
||||||
func NewMsgNotarizeAsset(creator string, hash string, signature string, pubKey string) *MsgNotarizeAsset {
|
func NewMsgNotarizeAsset(creator string, cid string) *MsgNotarizeAsset {
|
||||||
return &MsgNotarizeAsset{
|
return &MsgNotarizeAsset{
|
||||||
Creator: creator,
|
Creator: creator,
|
||||||
Hash: hash,
|
Cid: cid,
|
||||||
Signature: signature,
|
|
||||||
PubKey: pubKey,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,24 +113,24 @@ func (m *QueryParamsResponse) GetParams() Params {
|
|||||||
return Params{}
|
return Params{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type QueryGetCIDsByPubKeyRequest struct {
|
type QueryGetCIDsByAddressRequest struct {
|
||||||
ExtPubKey string `protobuf:"bytes,1,opt,name=extPubKey,proto3" json:"extPubKey,omitempty"`
|
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||||
LookupPeriodInMin uint64 `protobuf:"varint,2,opt,name=lookupPeriodInMin,proto3" json:"lookupPeriodInMin,omitempty"`
|
LookupPeriodInMin uint64 `protobuf:"varint,2,opt,name=lookupPeriodInMin,proto3" json:"lookupPeriodInMin,omitempty"`
|
||||||
Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) Reset() { *m = QueryGetCIDsByPubKeyRequest{} }
|
func (m *QueryGetCIDsByAddressRequest) Reset() { *m = QueryGetCIDsByAddressRequest{} }
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) String() string { return proto.CompactTextString(m) }
|
func (m *QueryGetCIDsByAddressRequest) String() string { return proto.CompactTextString(m) }
|
||||||
func (*QueryGetCIDsByPubKeyRequest) ProtoMessage() {}
|
func (*QueryGetCIDsByAddressRequest) ProtoMessage() {}
|
||||||
func (*QueryGetCIDsByPubKeyRequest) Descriptor() ([]byte, []int) {
|
func (*QueryGetCIDsByAddressRequest) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_5832a953a81817c0, []int{2}
|
return fileDescriptor_5832a953a81817c0, []int{2}
|
||||||
}
|
}
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) XXX_Unmarshal(b []byte) error {
|
func (m *QueryGetCIDsByAddressRequest) XXX_Unmarshal(b []byte) error {
|
||||||
return m.Unmarshal(b)
|
return m.Unmarshal(b)
|
||||||
}
|
}
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
func (m *QueryGetCIDsByAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
if deterministic {
|
if deterministic {
|
||||||
return xxx_messageInfo_QueryGetCIDsByPubKeyRequest.Marshal(b, m, deterministic)
|
return xxx_messageInfo_QueryGetCIDsByAddressRequest.Marshal(b, m, deterministic)
|
||||||
} else {
|
} else {
|
||||||
b = b[:cap(b)]
|
b = b[:cap(b)]
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
n, err := m.MarshalToSizedBuffer(b)
|
||||||
@ -140,56 +140,56 @@ func (m *QueryGetCIDsByPubKeyRequest) XXX_Marshal(b []byte, deterministic bool)
|
|||||||
return b[:n], nil
|
return b[:n], nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) XXX_Merge(src proto.Message) {
|
func (m *QueryGetCIDsByAddressRequest) XXX_Merge(src proto.Message) {
|
||||||
xxx_messageInfo_QueryGetCIDsByPubKeyRequest.Merge(m, src)
|
xxx_messageInfo_QueryGetCIDsByAddressRequest.Merge(m, src)
|
||||||
}
|
}
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) XXX_Size() int {
|
func (m *QueryGetCIDsByAddressRequest) XXX_Size() int {
|
||||||
return m.Size()
|
return m.Size()
|
||||||
}
|
}
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) XXX_DiscardUnknown() {
|
func (m *QueryGetCIDsByAddressRequest) XXX_DiscardUnknown() {
|
||||||
xxx_messageInfo_QueryGetCIDsByPubKeyRequest.DiscardUnknown(m)
|
xxx_messageInfo_QueryGetCIDsByAddressRequest.DiscardUnknown(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
var xxx_messageInfo_QueryGetCIDsByPubKeyRequest proto.InternalMessageInfo
|
var xxx_messageInfo_QueryGetCIDsByAddressRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) GetExtPubKey() string {
|
func (m *QueryGetCIDsByAddressRequest) GetAddress() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.ExtPubKey
|
return m.Address
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) GetLookupPeriodInMin() uint64 {
|
func (m *QueryGetCIDsByAddressRequest) GetLookupPeriodInMin() uint64 {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.LookupPeriodInMin
|
return m.LookupPeriodInMin
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) GetPagination() *query.PageRequest {
|
func (m *QueryGetCIDsByAddressRequest) GetPagination() *query.PageRequest {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Pagination
|
return m.Pagination
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type QueryGetCIDsByPubKeyResponse struct {
|
type QueryGetCIDsByAddressResponse struct {
|
||||||
CIDs []string `protobuf:"bytes,1,rep,name=cids,proto3" json:"cids,omitempty"`
|
Cids []string `protobuf:"bytes,1,rep,name=cids,proto3" json:"cids,omitempty"`
|
||||||
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) Reset() { *m = QueryGetCIDsByPubKeyResponse{} }
|
func (m *QueryGetCIDsByAddressResponse) Reset() { *m = QueryGetCIDsByAddressResponse{} }
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) String() string { return proto.CompactTextString(m) }
|
func (m *QueryGetCIDsByAddressResponse) String() string { return proto.CompactTextString(m) }
|
||||||
func (*QueryGetCIDsByPubKeyResponse) ProtoMessage() {}
|
func (*QueryGetCIDsByAddressResponse) ProtoMessage() {}
|
||||||
func (*QueryGetCIDsByPubKeyResponse) Descriptor() ([]byte, []int) {
|
func (*QueryGetCIDsByAddressResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_5832a953a81817c0, []int{3}
|
return fileDescriptor_5832a953a81817c0, []int{3}
|
||||||
}
|
}
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) XXX_Unmarshal(b []byte) error {
|
func (m *QueryGetCIDsByAddressResponse) XXX_Unmarshal(b []byte) error {
|
||||||
return m.Unmarshal(b)
|
return m.Unmarshal(b)
|
||||||
}
|
}
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
func (m *QueryGetCIDsByAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
if deterministic {
|
if deterministic {
|
||||||
return xxx_messageInfo_QueryGetCIDsByPubKeyResponse.Marshal(b, m, deterministic)
|
return xxx_messageInfo_QueryGetCIDsByAddressResponse.Marshal(b, m, deterministic)
|
||||||
} else {
|
} else {
|
||||||
b = b[:cap(b)]
|
b = b[:cap(b)]
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
n, err := m.MarshalToSizedBuffer(b)
|
||||||
@ -199,26 +199,26 @@ func (m *QueryGetCIDsByPubKeyResponse) XXX_Marshal(b []byte, deterministic bool)
|
|||||||
return b[:n], nil
|
return b[:n], nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) XXX_Merge(src proto.Message) {
|
func (m *QueryGetCIDsByAddressResponse) XXX_Merge(src proto.Message) {
|
||||||
xxx_messageInfo_QueryGetCIDsByPubKeyResponse.Merge(m, src)
|
xxx_messageInfo_QueryGetCIDsByAddressResponse.Merge(m, src)
|
||||||
}
|
}
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) XXX_Size() int {
|
func (m *QueryGetCIDsByAddressResponse) XXX_Size() int {
|
||||||
return m.Size()
|
return m.Size()
|
||||||
}
|
}
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) XXX_DiscardUnknown() {
|
func (m *QueryGetCIDsByAddressResponse) XXX_DiscardUnknown() {
|
||||||
xxx_messageInfo_QueryGetCIDsByPubKeyResponse.DiscardUnknown(m)
|
xxx_messageInfo_QueryGetCIDsByAddressResponse.DiscardUnknown(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
var xxx_messageInfo_QueryGetCIDsByPubKeyResponse proto.InternalMessageInfo
|
var xxx_messageInfo_QueryGetCIDsByAddressResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) GetCIDs() []string {
|
func (m *QueryGetCIDsByAddressResponse) GetCids() []string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.CIDs
|
return m.Cids
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) GetPagination() *query.PageResponse {
|
func (m *QueryGetCIDsByAddressResponse) GetPagination() *query.PageResponse {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Pagination
|
return m.Pagination
|
||||||
}
|
}
|
||||||
@ -271,8 +271,7 @@ func (m *QueryGetNotarizedAssetRequest) GetCid() string {
|
|||||||
|
|
||||||
type QueryGetNotarizedAssetResponse struct {
|
type QueryGetNotarizedAssetResponse struct {
|
||||||
Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"`
|
Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"`
|
||||||
Signature string `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
|
Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
|
||||||
Pubkey string `protobuf:"bytes,3,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetNotarizedAssetResponse) Reset() { *m = QueryGetNotarizedAssetResponse{} }
|
func (m *QueryGetNotarizedAssetResponse) Reset() { *m = QueryGetNotarizedAssetResponse{} }
|
||||||
@ -315,16 +314,9 @@ func (m *QueryGetNotarizedAssetResponse) GetCid() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetNotarizedAssetResponse) GetSignature() string {
|
func (m *QueryGetNotarizedAssetResponse) GetAddress() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Signature
|
return m.Address
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *QueryGetNotarizedAssetResponse) GetPubkey() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.Pubkey
|
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -332,8 +324,8 @@ func (m *QueryGetNotarizedAssetResponse) GetPubkey() string {
|
|||||||
func init() {
|
func init() {
|
||||||
proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.asset.QueryParamsRequest")
|
proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.asset.QueryParamsRequest")
|
||||||
proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.asset.QueryParamsResponse")
|
proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.asset.QueryParamsResponse")
|
||||||
proto.RegisterType((*QueryGetCIDsByPubKeyRequest)(nil), "planetmintgo.asset.QueryGetCIDsByPubKeyRequest")
|
proto.RegisterType((*QueryGetCIDsByAddressRequest)(nil), "planetmintgo.asset.QueryGetCIDsByAddressRequest")
|
||||||
proto.RegisterType((*QueryGetCIDsByPubKeyResponse)(nil), "planetmintgo.asset.QueryGetCIDsByPubKeyResponse")
|
proto.RegisterType((*QueryGetCIDsByAddressResponse)(nil), "planetmintgo.asset.QueryGetCIDsByAddressResponse")
|
||||||
proto.RegisterType((*QueryGetNotarizedAssetRequest)(nil), "planetmintgo.asset.QueryGetNotarizedAssetRequest")
|
proto.RegisterType((*QueryGetNotarizedAssetRequest)(nil), "planetmintgo.asset.QueryGetNotarizedAssetRequest")
|
||||||
proto.RegisterType((*QueryGetNotarizedAssetResponse)(nil), "planetmintgo.asset.QueryGetNotarizedAssetResponse")
|
proto.RegisterType((*QueryGetNotarizedAssetResponse)(nil), "planetmintgo.asset.QueryGetNotarizedAssetResponse")
|
||||||
}
|
}
|
||||||
@ -341,45 +333,43 @@ func init() {
|
|||||||
func init() { proto.RegisterFile("planetmintgo/asset/query.proto", fileDescriptor_5832a953a81817c0) }
|
func init() { proto.RegisterFile("planetmintgo/asset/query.proto", fileDescriptor_5832a953a81817c0) }
|
||||||
|
|
||||||
var fileDescriptor_5832a953a81817c0 = []byte{
|
var fileDescriptor_5832a953a81817c0 = []byte{
|
||||||
// 595 bytes of a gzipped FileDescriptorProto
|
// 562 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcf, 0x6b, 0x13, 0x4f,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xbf, 0x6f, 0xd3, 0x40,
|
||||||
0x1c, 0xcd, 0x26, 0xf9, 0x06, 0x32, 0x5f, 0x0f, 0x76, 0x2c, 0x12, 0x42, 0xdd, 0x86, 0x3d, 0xb4,
|
0x14, 0x8e, 0x93, 0x10, 0xd4, 0x63, 0x69, 0x8f, 0x0e, 0x91, 0x55, 0xdc, 0xca, 0x43, 0x1b, 0x21,
|
||||||
0x41, 0x74, 0x87, 0x4d, 0x2f, 0x16, 0x4f, 0xcd, 0xc1, 0x22, 0x45, 0x8d, 0x0b, 0x22, 0x08, 0x12,
|
0xf0, 0xe1, 0x74, 0xa1, 0x62, 0x4a, 0x40, 0x54, 0x15, 0xbf, 0x52, 0x33, 0xc1, 0x12, 0x5d, 0xe2,
|
||||||
0x66, 0x93, 0x61, 0xbb, 0x24, 0x99, 0xd9, 0xee, 0xcc, 0x4a, 0xd7, 0x90, 0x8b, 0x77, 0x41, 0xd0,
|
0x93, 0x39, 0x91, 0xdc, 0xb9, 0xbe, 0x0b, 0x22, 0x84, 0x2c, 0xfc, 0x05, 0x48, 0xf0, 0x77, 0xb0,
|
||||||
0xff, 0xc4, 0x9b, 0xe0, 0xbd, 0xc7, 0x82, 0x17, 0xbd, 0x88, 0x24, 0xfe, 0x21, 0xb2, 0x33, 0x53,
|
0x30, 0xb3, 0x77, 0xac, 0x60, 0x61, 0x42, 0x28, 0xe1, 0x0f, 0x41, 0xbe, 0xbb, 0x28, 0x49, 0x9d,
|
||||||
0x37, 0xe9, 0x26, 0x4d, 0xbd, 0x4d, 0x3e, 0x3f, 0xdf, 0x7b, 0x9f, 0x97, 0x05, 0x66, 0x38, 0xc4,
|
0x34, 0xed, 0xf6, 0x7c, 0xef, 0x7d, 0xef, 0xfb, 0xde, 0xf7, 0x9e, 0x0c, 0x9c, 0xb8, 0x83, 0x19,
|
||||||
0x94, 0x88, 0x51, 0x40, 0x85, 0xcf, 0x10, 0xe6, 0x9c, 0x08, 0x74, 0x12, 0x93, 0x28, 0xb1, 0xc3,
|
0x91, 0x5d, 0xca, 0x64, 0xc4, 0x11, 0x16, 0x82, 0x48, 0x74, 0xd2, 0x23, 0x49, 0xdf, 0x8b, 0x13,
|
||||||
0x88, 0x09, 0x06, 0xe1, 0x7c, 0xde, 0x96, 0xf9, 0xfa, 0xa6, 0xcf, 0x7c, 0x26, 0xd3, 0x28, 0x7d,
|
0x2e, 0x39, 0x84, 0xb3, 0x79, 0x4f, 0xe5, 0xed, 0xcd, 0x88, 0x47, 0x5c, 0xa5, 0x51, 0x1a, 0xe9,
|
||||||
0xa9, 0xca, 0xfa, 0x96, 0xcf, 0x98, 0x3f, 0x24, 0x08, 0x87, 0x01, 0xc2, 0x94, 0x32, 0x81, 0x45,
|
0x4a, 0x7b, 0x2b, 0xe2, 0x3c, 0xea, 0x10, 0x84, 0x63, 0x8a, 0x30, 0x63, 0x5c, 0x62, 0x49, 0x39,
|
||||||
0xc0, 0x28, 0xd7, 0xd9, 0xbb, 0x3d, 0xc6, 0x47, 0x8c, 0x23, 0x0f, 0x73, 0xa2, 0x16, 0xa0, 0x37,
|
0x13, 0x26, 0x7b, 0xbb, 0xcd, 0x45, 0x97, 0x0b, 0xd4, 0xc2, 0x82, 0x68, 0x02, 0xf4, 0xce, 0x6f,
|
||||||
0x8e, 0x47, 0x04, 0x76, 0x50, 0x88, 0xfd, 0x80, 0xca, 0x62, 0x5d, 0xbb, 0xbd, 0x04, 0x53, 0x88,
|
0x11, 0x89, 0x7d, 0x14, 0xe3, 0x88, 0x32, 0x55, 0x6c, 0x6a, 0xb7, 0x17, 0x68, 0x8a, 0x71, 0x82,
|
||||||
0x23, 0x3c, 0xd2, 0xc3, 0xac, 0x4d, 0x00, 0x9f, 0xa7, 0x23, 0x3a, 0x32, 0xe8, 0x92, 0x93, 0x98,
|
0xbb, 0xa6, 0x99, 0xbb, 0x09, 0xe0, 0x71, 0xda, 0xa2, 0xa1, 0x1e, 0x03, 0x72, 0xd2, 0x23, 0x42,
|
||||||
0x70, 0x61, 0x3d, 0x03, 0xb7, 0x16, 0xa2, 0x3c, 0x64, 0x94, 0x13, 0xf8, 0x00, 0x54, 0x54, 0x73,
|
0xba, 0x2f, 0xc0, 0xcd, 0xb9, 0x57, 0x11, 0x73, 0x26, 0x08, 0xbc, 0x0f, 0x4a, 0x1a, 0x5c, 0xb6,
|
||||||
0xcd, 0x68, 0x18, 0xcd, 0xff, 0x5b, 0x75, 0x3b, 0x4f, 0xc9, 0x56, 0x3d, 0xed, 0xf2, 0xd9, 0xcf,
|
0x76, 0xac, 0xca, 0x8d, 0xaa, 0xed, 0x65, 0x47, 0xf2, 0x34, 0xa6, 0x5e, 0x3c, 0xfd, 0xb3, 0x9d,
|
||||||
0xed, 0x82, 0xab, 0xeb, 0xad, 0xcf, 0x06, 0xb8, 0x23, 0x27, 0x1e, 0x12, 0x71, 0x90, 0x96, 0xf1,
|
0x0b, 0x4c, 0xbd, 0xfb, 0xcd, 0x02, 0x5b, 0xaa, 0xe3, 0x21, 0x91, 0x0f, 0x8f, 0x1e, 0x89, 0x7a,
|
||||||
0x76, 0xd2, 0x89, 0xbd, 0x23, 0x92, 0xe8, 0x95, 0x70, 0x0b, 0x54, 0xc9, 0xa9, 0x50, 0x31, 0x39,
|
0xbf, 0x16, 0x86, 0x09, 0x11, 0x13, 0x46, 0x58, 0x06, 0xd7, 0xb1, 0x7e, 0x51, 0xbd, 0xd7, 0x82,
|
||||||
0xbe, 0xea, 0x66, 0x01, 0x78, 0x0f, 0x6c, 0x0c, 0x19, 0x1b, 0xc4, 0x61, 0x87, 0x44, 0x01, 0xeb,
|
0xc9, 0x27, 0xbc, 0x03, 0x36, 0x3a, 0x9c, 0xbf, 0xed, 0xc5, 0x0d, 0x92, 0x50, 0x1e, 0x1e, 0xb1,
|
||||||
0x3f, 0xa6, 0x4f, 0x02, 0x5a, 0x2b, 0x36, 0x8c, 0x66, 0xd9, 0xcd, 0x27, 0xe0, 0x23, 0x00, 0x32,
|
0x67, 0x94, 0x95, 0xf3, 0x3b, 0x56, 0xa5, 0x18, 0x64, 0x13, 0xf0, 0x31, 0x00, 0x53, 0x13, 0xca,
|
||||||
0x25, 0x6a, 0x25, 0x89, 0x75, 0xc7, 0x56, 0xb2, 0xd9, 0xa9, 0x6c, 0xb6, 0xba, 0x8b, 0x96, 0xcd,
|
0x05, 0x25, 0x73, 0xd7, 0xd3, 0x8e, 0x79, 0xa9, 0x63, 0x9e, 0x5e, 0x89, 0x71, 0xcc, 0x6b, 0xe0,
|
||||||
0xee, 0x60, 0x9f, 0x68, 0x1c, 0xee, 0x5c, 0xa7, 0xf5, 0xde, 0x00, 0xe6, 0x2a, 0xd4, 0x5a, 0x12,
|
0x88, 0x18, 0x0d, 0xc1, 0x0c, 0xd2, 0xfd, 0x08, 0x6e, 0x2d, 0xd1, 0x6b, 0xbc, 0x80, 0xa0, 0xd8,
|
||||||
0x0b, 0xdc, 0x10, 0x11, 0xa6, 0x1c, 0xf7, 0xe4, 0x89, 0x6a, 0x46, 0xa3, 0xd4, 0xac, 0xba, 0x0b,
|
0xa6, 0x61, 0xaa, 0xb6, 0x50, 0x59, 0x0b, 0x54, 0x0c, 0x0f, 0xe7, 0xc8, 0xf3, 0x8a, 0x7c, 0x6f,
|
||||||
0x31, 0x78, 0xb8, 0x00, 0xa7, 0x28, 0xe1, 0xec, 0xae, 0x85, 0xa3, 0x16, 0x2c, 0xe0, 0x71, 0x32,
|
0x25, 0xb9, 0x6e, 0x38, 0xc7, 0xee, 0x4f, 0xd9, 0x9f, 0x73, 0x89, 0x13, 0xfa, 0x81, 0x84, 0xb5,
|
||||||
0x11, 0x9f, 0x32, 0x81, 0xa3, 0xe0, 0x2d, 0xe9, 0x4b, 0x5c, 0x17, 0x22, 0xde, 0x04, 0xa5, 0x5e,
|
0xd4, 0xdd, 0x89, 0x5d, 0xeb, 0xa0, 0xd0, 0xa6, 0xa1, 0xb1, 0x2a, 0x0d, 0xdd, 0xa7, 0xc0, 0x59,
|
||||||
0xd0, 0xd7, 0xf2, 0xa5, 0x4f, 0xeb, 0x38, 0x63, 0x70, 0xb9, 0x45, 0x33, 0xc8, 0xf5, 0xa4, 0xa7,
|
0x06, 0x31, 0x8a, 0x33, 0x98, 0x59, 0xd3, 0xf3, 0x73, 0xa6, 0x57, 0xbf, 0x17, 0xc1, 0x35, 0xd5,
|
||||||
0xe0, 0x81, 0x4f, 0xb1, 0x88, 0x23, 0x22, 0xe1, 0x56, 0xdd, 0x2c, 0x00, 0x6f, 0x83, 0x4a, 0x18,
|
0x0e, 0x7e, 0xb5, 0x40, 0x49, 0xaf, 0x14, 0xee, 0x2e, 0x5a, 0x77, 0xf6, 0x7a, 0xec, 0xbd, 0x95,
|
||||||
0x7b, 0x03, 0x92, 0x48, 0x61, 0xab, 0xae, 0xfe, 0xd5, 0xfa, 0x52, 0x06, 0xff, 0xc9, 0x55, 0xf0,
|
0x75, 0x5a, 0x91, 0x7b, 0xf0, 0xe9, 0xd7, 0xbf, 0x2f, 0xf9, 0x7d, 0xe8, 0xa3, 0x88, 0xca, 0x37,
|
||||||
0x93, 0x01, 0x2a, 0xca, 0x05, 0x70, 0x67, 0x99, 0x43, 0xf2, 0x86, 0xab, 0xef, 0xae, 0xad, 0x53,
|
0xbd, 0x96, 0xd7, 0xe6, 0x5d, 0x34, 0xc5, 0xce, 0x84, 0x77, 0xcf, 0x5d, 0x2f, 0xfc, 0x69, 0x81,
|
||||||
0x68, 0xad, 0xfd, 0x77, 0xdf, 0x7e, 0x7f, 0x2c, 0xee, 0x41, 0x07, 0xf9, 0x81, 0x38, 0x8e, 0x3d,
|
0xf5, 0xf3, 0xbb, 0x81, 0xf7, 0x96, 0x12, 0x2f, 0x39, 0x3b, 0xdb, 0xbf, 0x02, 0xc2, 0x88, 0x7e,
|
||||||
0xbb, 0xc7, 0x46, 0x28, 0xeb, 0x9d, 0x7b, 0xde, 0xbf, 0x64, 0x78, 0xf8, 0xc3, 0x00, 0x1b, 0xb9,
|
0xa5, 0x44, 0xbf, 0x84, 0xc7, 0xab, 0x94, 0x46, 0x44, 0x36, 0xd3, 0xb3, 0x68, 0xb6, 0xfa, 0x4d,
|
||||||
0x43, 0x42, 0x67, 0xe5, 0xe6, 0x55, 0x56, 0xad, 0xb7, 0xfe, 0xa5, 0x45, 0xe3, 0x7e, 0x2d, 0x71,
|
0xe3, 0x2b, 0x1a, 0x98, 0x60, 0x88, 0x06, 0x99, 0xdb, 0x1d, 0xc2, 0x1f, 0x16, 0xd8, 0xc8, 0xec,
|
||||||
0xbf, 0x84, 0x2f, 0xd6, 0x81, 0xf5, 0x89, 0xe8, 0xca, 0x17, 0xef, 0x7a, 0x49, 0x37, 0x8c, 0xbd,
|
0x0f, 0x5e, 0xa8, 0x71, 0xe1, 0x79, 0xd8, 0xd5, 0xab, 0x40, 0xcc, 0x5c, 0x35, 0x35, 0xd7, 0x03,
|
||||||
0xee, 0x80, 0x24, 0x68, 0xfc, 0xf7, 0xaf, 0x30, 0x41, 0xe3, 0x9c, 0xe1, 0x27, 0xf0, 0xab, 0xe2,
|
0x78, 0x70, 0x99, 0xb9, 0xd8, 0xa4, 0x47, 0x53, 0xbf, 0x0d, 0xda, 0x34, 0x1c, 0xd6, 0x9f, 0x9c,
|
||||||
0xb6, 0x78, 0xe2, 0xab, 0xb9, 0x2d, 0x75, 0xd0, 0xd5, 0xdc, 0x96, 0x3b, 0xc8, 0x3a, 0x90, 0xdc,
|
0x8e, 0x1c, 0xeb, 0x6c, 0xe4, 0x58, 0x7f, 0x47, 0x8e, 0xf5, 0x79, 0xec, 0xe4, 0xce, 0xc6, 0x4e,
|
||||||
0x1e, 0xc2, 0xfd, 0xeb, 0x70, 0xa3, 0x17, 0x33, 0x14, 0x4b, 0x34, 0xee, 0x05, 0xfd, 0x49, 0xfb,
|
0xee, 0xf7, 0xd8, 0xc9, 0xbd, 0xf6, 0x2f, 0xb3, 0xe0, 0xf7, 0x86, 0x40, 0xf6, 0x63, 0x22, 0x5a,
|
||||||
0xe8, 0x6c, 0x6a, 0x1a, 0xe7, 0x53, 0xd3, 0xf8, 0x35, 0x35, 0x8d, 0x0f, 0x33, 0xb3, 0x70, 0x3e,
|
0x25, 0xf5, 0x83, 0xda, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x21, 0x7d, 0xdb, 0xca, 0x57, 0x05,
|
||||||
0x33, 0x0b, 0xdf, 0x67, 0x66, 0xe1, 0x95, 0x73, 0x9d, 0x3b, 0x9f, 0xea, 0x05, 0x22, 0x09, 0x09,
|
0x00, 0x00,
|
||||||
0xf7, 0x2a, 0xf2, 0xd3, 0xb6, 0xf7, 0x27, 0x00, 0x00, 0xff, 0xff, 0x94, 0x73, 0x54, 0x1f, 0x91,
|
|
||||||
0x05, 0x00, 0x00,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
@ -396,8 +386,8 @@ const _ = grpc.SupportPackageIsVersion4
|
|||||||
type QueryClient interface {
|
type QueryClient interface {
|
||||||
// Parameters queries the parameters of the module.
|
// Parameters queries the parameters of the module.
|
||||||
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
||||||
// Queries a list of GetCIDsByPubKey items.
|
// Queries a list of GetCIDsByAddress items.
|
||||||
GetCIDsByPubKey(ctx context.Context, in *QueryGetCIDsByPubKeyRequest, opts ...grpc.CallOption) (*QueryGetCIDsByPubKeyResponse, error)
|
GetCIDsByAddress(ctx context.Context, in *QueryGetCIDsByAddressRequest, opts ...grpc.CallOption) (*QueryGetCIDsByAddressResponse, error)
|
||||||
// Queries a list of GetNotarizedAsset items.
|
// Queries a list of GetNotarizedAsset items.
|
||||||
GetNotarizedAsset(ctx context.Context, in *QueryGetNotarizedAssetRequest, opts ...grpc.CallOption) (*QueryGetNotarizedAssetResponse, error)
|
GetNotarizedAsset(ctx context.Context, in *QueryGetNotarizedAssetRequest, opts ...grpc.CallOption) (*QueryGetNotarizedAssetResponse, error)
|
||||||
}
|
}
|
||||||
@ -419,9 +409,9 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *queryClient) GetCIDsByPubKey(ctx context.Context, in *QueryGetCIDsByPubKeyRequest, opts ...grpc.CallOption) (*QueryGetCIDsByPubKeyResponse, error) {
|
func (c *queryClient) GetCIDsByAddress(ctx context.Context, in *QueryGetCIDsByAddressRequest, opts ...grpc.CallOption) (*QueryGetCIDsByAddressResponse, error) {
|
||||||
out := new(QueryGetCIDsByPubKeyResponse)
|
out := new(QueryGetCIDsByAddressResponse)
|
||||||
err := c.cc.Invoke(ctx, "/planetmintgo.asset.Query/GetCIDsByPubKey", in, out, opts...)
|
err := c.cc.Invoke(ctx, "/planetmintgo.asset.Query/GetCIDsByAddress", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -441,8 +431,8 @@ func (c *queryClient) GetNotarizedAsset(ctx context.Context, in *QueryGetNotariz
|
|||||||
type QueryServer interface {
|
type QueryServer interface {
|
||||||
// Parameters queries the parameters of the module.
|
// Parameters queries the parameters of the module.
|
||||||
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
||||||
// Queries a list of GetCIDsByPubKey items.
|
// Queries a list of GetCIDsByAddress items.
|
||||||
GetCIDsByPubKey(context.Context, *QueryGetCIDsByPubKeyRequest) (*QueryGetCIDsByPubKeyResponse, error)
|
GetCIDsByAddress(context.Context, *QueryGetCIDsByAddressRequest) (*QueryGetCIDsByAddressResponse, error)
|
||||||
// Queries a list of GetNotarizedAsset items.
|
// Queries a list of GetNotarizedAsset items.
|
||||||
GetNotarizedAsset(context.Context, *QueryGetNotarizedAssetRequest) (*QueryGetNotarizedAssetResponse, error)
|
GetNotarizedAsset(context.Context, *QueryGetNotarizedAssetRequest) (*QueryGetNotarizedAssetResponse, error)
|
||||||
}
|
}
|
||||||
@ -454,8 +444,8 @@ type UnimplementedQueryServer struct {
|
|||||||
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
|
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
||||||
}
|
}
|
||||||
func (*UnimplementedQueryServer) GetCIDsByPubKey(ctx context.Context, req *QueryGetCIDsByPubKeyRequest) (*QueryGetCIDsByPubKeyResponse, error) {
|
func (*UnimplementedQueryServer) GetCIDsByAddress(ctx context.Context, req *QueryGetCIDsByAddressRequest) (*QueryGetCIDsByAddressResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetCIDsByPubKey not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetCIDsByAddress not implemented")
|
||||||
}
|
}
|
||||||
func (*UnimplementedQueryServer) GetNotarizedAsset(ctx context.Context, req *QueryGetNotarizedAssetRequest) (*QueryGetNotarizedAssetResponse, error) {
|
func (*UnimplementedQueryServer) GetNotarizedAsset(ctx context.Context, req *QueryGetNotarizedAssetRequest) (*QueryGetNotarizedAssetResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetNotarizedAsset not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetNotarizedAsset not implemented")
|
||||||
@ -483,20 +473,20 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _Query_GetCIDsByPubKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _Query_GetCIDsByAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(QueryGetCIDsByPubKeyRequest)
|
in := new(QueryGetCIDsByAddressRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if interceptor == nil {
|
if interceptor == nil {
|
||||||
return srv.(QueryServer).GetCIDsByPubKey(ctx, in)
|
return srv.(QueryServer).GetCIDsByAddress(ctx, in)
|
||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/planetmintgo.asset.Query/GetCIDsByPubKey",
|
FullMethod: "/planetmintgo.asset.Query/GetCIDsByAddress",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(QueryServer).GetCIDsByPubKey(ctx, req.(*QueryGetCIDsByPubKeyRequest))
|
return srv.(QueryServer).GetCIDsByAddress(ctx, req.(*QueryGetCIDsByAddressRequest))
|
||||||
}
|
}
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
@ -528,8 +518,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{
|
|||||||
Handler: _Query_Params_Handler,
|
Handler: _Query_Params_Handler,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
MethodName: "GetCIDsByPubKey",
|
MethodName: "GetCIDsByAddress",
|
||||||
Handler: _Query_GetCIDsByPubKey_Handler,
|
Handler: _Query_GetCIDsByAddress_Handler,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
MethodName: "GetNotarizedAsset",
|
MethodName: "GetNotarizedAsset",
|
||||||
@ -596,7 +586,7 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
return len(dAtA) - i, nil
|
return len(dAtA) - i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) Marshal() (dAtA []byte, err error) {
|
func (m *QueryGetCIDsByAddressRequest) Marshal() (dAtA []byte, err error) {
|
||||||
size := m.Size()
|
size := m.Size()
|
||||||
dAtA = make([]byte, size)
|
dAtA = make([]byte, size)
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
@ -606,12 +596,12 @@ func (m *QueryGetCIDsByPubKeyRequest) Marshal() (dAtA []byte, err error) {
|
|||||||
return dAtA[:n], nil
|
return dAtA[:n], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) MarshalTo(dAtA []byte) (int, error) {
|
func (m *QueryGetCIDsByAddressRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||||
size := m.Size()
|
size := m.Size()
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
func (m *QueryGetCIDsByAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
i := len(dAtA)
|
i := len(dAtA)
|
||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
@ -633,17 +623,17 @@ func (m *QueryGetCIDsByPubKeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, er
|
|||||||
i--
|
i--
|
||||||
dAtA[i] = 0x10
|
dAtA[i] = 0x10
|
||||||
}
|
}
|
||||||
if len(m.ExtPubKey) > 0 {
|
if len(m.Address) > 0 {
|
||||||
i -= len(m.ExtPubKey)
|
i -= len(m.Address)
|
||||||
copy(dAtA[i:], m.ExtPubKey)
|
copy(dAtA[i:], m.Address)
|
||||||
i = encodeVarintQuery(dAtA, i, uint64(len(m.ExtPubKey)))
|
i = encodeVarintQuery(dAtA, i, uint64(len(m.Address)))
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0xa
|
dAtA[i] = 0xa
|
||||||
}
|
}
|
||||||
return len(dAtA) - i, nil
|
return len(dAtA) - i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) Marshal() (dAtA []byte, err error) {
|
func (m *QueryGetCIDsByAddressResponse) Marshal() (dAtA []byte, err error) {
|
||||||
size := m.Size()
|
size := m.Size()
|
||||||
dAtA = make([]byte, size)
|
dAtA = make([]byte, size)
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
@ -653,12 +643,12 @@ func (m *QueryGetCIDsByPubKeyResponse) Marshal() (dAtA []byte, err error) {
|
|||||||
return dAtA[:n], nil
|
return dAtA[:n], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) MarshalTo(dAtA []byte) (int, error) {
|
func (m *QueryGetCIDsByAddressResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||||
size := m.Size()
|
size := m.Size()
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
func (m *QueryGetCIDsByAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
i := len(dAtA)
|
i := len(dAtA)
|
||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
@ -675,11 +665,11 @@ func (m *QueryGetCIDsByPubKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, e
|
|||||||
i--
|
i--
|
||||||
dAtA[i] = 0x12
|
dAtA[i] = 0x12
|
||||||
}
|
}
|
||||||
if len(m.CIDs) > 0 {
|
if len(m.Cids) > 0 {
|
||||||
for iNdEx := len(m.CIDs) - 1; iNdEx >= 0; iNdEx-- {
|
for iNdEx := len(m.Cids) - 1; iNdEx >= 0; iNdEx-- {
|
||||||
i -= len(m.CIDs[iNdEx])
|
i -= len(m.Cids[iNdEx])
|
||||||
copy(dAtA[i:], m.CIDs[iNdEx])
|
copy(dAtA[i:], m.Cids[iNdEx])
|
||||||
i = encodeVarintQuery(dAtA, i, uint64(len(m.CIDs[iNdEx])))
|
i = encodeVarintQuery(dAtA, i, uint64(len(m.Cids[iNdEx])))
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0xa
|
dAtA[i] = 0xa
|
||||||
}
|
}
|
||||||
@ -737,17 +727,10 @@ func (m *QueryGetNotarizedAssetResponse) MarshalToSizedBuffer(dAtA []byte) (int,
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.Pubkey) > 0 {
|
if len(m.Address) > 0 {
|
||||||
i -= len(m.Pubkey)
|
i -= len(m.Address)
|
||||||
copy(dAtA[i:], m.Pubkey)
|
copy(dAtA[i:], m.Address)
|
||||||
i = encodeVarintQuery(dAtA, i, uint64(len(m.Pubkey)))
|
i = encodeVarintQuery(dAtA, i, uint64(len(m.Address)))
|
||||||
i--
|
|
||||||
dAtA[i] = 0x1a
|
|
||||||
}
|
|
||||||
if len(m.Signature) > 0 {
|
|
||||||
i -= len(m.Signature)
|
|
||||||
copy(dAtA[i:], m.Signature)
|
|
||||||
i = encodeVarintQuery(dAtA, i, uint64(len(m.Signature)))
|
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0x12
|
dAtA[i] = 0x12
|
||||||
}
|
}
|
||||||
@ -792,13 +775,13 @@ func (m *QueryParamsResponse) Size() (n int) {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) Size() (n int) {
|
func (m *QueryGetCIDsByAddressRequest) Size() (n int) {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
l = len(m.ExtPubKey)
|
l = len(m.Address)
|
||||||
if l > 0 {
|
if l > 0 {
|
||||||
n += 1 + l + sovQuery(uint64(l))
|
n += 1 + l + sovQuery(uint64(l))
|
||||||
}
|
}
|
||||||
@ -812,14 +795,14 @@ func (m *QueryGetCIDsByPubKeyRequest) Size() (n int) {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) Size() (n int) {
|
func (m *QueryGetCIDsByAddressResponse) Size() (n int) {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.CIDs) > 0 {
|
if len(m.Cids) > 0 {
|
||||||
for _, s := range m.CIDs {
|
for _, s := range m.Cids {
|
||||||
l = len(s)
|
l = len(s)
|
||||||
n += 1 + l + sovQuery(uint64(l))
|
n += 1 + l + sovQuery(uint64(l))
|
||||||
}
|
}
|
||||||
@ -854,11 +837,7 @@ func (m *QueryGetNotarizedAssetResponse) Size() (n int) {
|
|||||||
if l > 0 {
|
if l > 0 {
|
||||||
n += 1 + l + sovQuery(uint64(l))
|
n += 1 + l + sovQuery(uint64(l))
|
||||||
}
|
}
|
||||||
l = len(m.Signature)
|
l = len(m.Address)
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovQuery(uint64(l))
|
|
||||||
}
|
|
||||||
l = len(m.Pubkey)
|
|
||||||
if l > 0 {
|
if l > 0 {
|
||||||
n += 1 + l + sovQuery(uint64(l))
|
n += 1 + l + sovQuery(uint64(l))
|
||||||
}
|
}
|
||||||
@ -1004,7 +983,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (m *QueryGetCIDsByPubKeyRequest) Unmarshal(dAtA []byte) error {
|
func (m *QueryGetCIDsByAddressRequest) Unmarshal(dAtA []byte) error {
|
||||||
l := len(dAtA)
|
l := len(dAtA)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
for iNdEx < l {
|
for iNdEx < l {
|
||||||
@ -1027,15 +1006,15 @@ func (m *QueryGetCIDsByPubKeyRequest) Unmarshal(dAtA []byte) error {
|
|||||||
fieldNum := int32(wire >> 3)
|
fieldNum := int32(wire >> 3)
|
||||||
wireType := int(wire & 0x7)
|
wireType := int(wire & 0x7)
|
||||||
if wireType == 4 {
|
if wireType == 4 {
|
||||||
return fmt.Errorf("proto: QueryGetCIDsByPubKeyRequest: wiretype end group for non-group")
|
return fmt.Errorf("proto: QueryGetCIDsByAddressRequest: wiretype end group for non-group")
|
||||||
}
|
}
|
||||||
if fieldNum <= 0 {
|
if fieldNum <= 0 {
|
||||||
return fmt.Errorf("proto: QueryGetCIDsByPubKeyRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
return fmt.Errorf("proto: QueryGetCIDsByAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
}
|
}
|
||||||
switch fieldNum {
|
switch fieldNum {
|
||||||
case 1:
|
case 1:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field ExtPubKey", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||||
}
|
}
|
||||||
var stringLen uint64
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -1063,7 +1042,7 @@ func (m *QueryGetCIDsByPubKeyRequest) Unmarshal(dAtA []byte) error {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
m.ExtPubKey = string(dAtA[iNdEx:postIndex])
|
m.Address = string(dAtA[iNdEx:postIndex])
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
case 2:
|
case 2:
|
||||||
if wireType != 0 {
|
if wireType != 0 {
|
||||||
@ -1141,7 +1120,7 @@ func (m *QueryGetCIDsByPubKeyRequest) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (m *QueryGetCIDsByPubKeyResponse) Unmarshal(dAtA []byte) error {
|
func (m *QueryGetCIDsByAddressResponse) Unmarshal(dAtA []byte) error {
|
||||||
l := len(dAtA)
|
l := len(dAtA)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
for iNdEx < l {
|
for iNdEx < l {
|
||||||
@ -1164,15 +1143,15 @@ func (m *QueryGetCIDsByPubKeyResponse) Unmarshal(dAtA []byte) error {
|
|||||||
fieldNum := int32(wire >> 3)
|
fieldNum := int32(wire >> 3)
|
||||||
wireType := int(wire & 0x7)
|
wireType := int(wire & 0x7)
|
||||||
if wireType == 4 {
|
if wireType == 4 {
|
||||||
return fmt.Errorf("proto: QueryGetCIDsByPubKeyResponse: wiretype end group for non-group")
|
return fmt.Errorf("proto: QueryGetCIDsByAddressResponse: wiretype end group for non-group")
|
||||||
}
|
}
|
||||||
if fieldNum <= 0 {
|
if fieldNum <= 0 {
|
||||||
return fmt.Errorf("proto: QueryGetCIDsByPubKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
return fmt.Errorf("proto: QueryGetCIDsByAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
}
|
}
|
||||||
switch fieldNum {
|
switch fieldNum {
|
||||||
case 1:
|
case 1:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field CIDs", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field Cids", wireType)
|
||||||
}
|
}
|
||||||
var stringLen uint64
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -1200,7 +1179,7 @@ func (m *QueryGetCIDsByPubKeyResponse) Unmarshal(dAtA []byte) error {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
m.CIDs = append(m.CIDs, string(dAtA[iNdEx:postIndex]))
|
m.Cids = append(m.Cids, string(dAtA[iNdEx:postIndex]))
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
case 2:
|
case 2:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
@ -1404,7 +1383,7 @@ func (m *QueryGetNotarizedAssetResponse) Unmarshal(dAtA []byte) error {
|
|||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
case 2:
|
case 2:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||||
}
|
}
|
||||||
var stringLen uint64
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -1432,39 +1411,7 @@ func (m *QueryGetNotarizedAssetResponse) Unmarshal(dAtA []byte) error {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
m.Signature = string(dAtA[iNdEx:postIndex])
|
m.Address = string(dAtA[iNdEx:postIndex])
|
||||||
iNdEx = postIndex
|
|
||||||
case 3:
|
|
||||||
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 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.Pubkey = string(dAtA[iNdEx:postIndex])
|
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
|
@ -52,11 +52,11 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
filter_Query_GetCIDsByPubKey_0 = &utilities.DoubleArray{Encoding: map[string]int{"extPubKey": 0, "lookupPeriodInMin": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
|
filter_Query_GetCIDsByAddress_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0, "lookupPeriodInMin": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
|
||||||
)
|
)
|
||||||
|
|
||||||
func request_Query_GetCIDsByPubKey_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_Query_GetCIDsByAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq QueryGetCIDsByPubKeyRequest
|
var protoReq QueryGetCIDsByAddressRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -66,15 +66,15 @@ func request_Query_GetCIDsByPubKey_0(ctx context.Context, marshaler runtime.Mars
|
|||||||
_ = err
|
_ = err
|
||||||
)
|
)
|
||||||
|
|
||||||
val, ok = pathParams["extPubKey"]
|
val, ok = pathParams["address"]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "extPubKey")
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||||
}
|
}
|
||||||
|
|
||||||
protoReq.ExtPubKey, err = runtime.String(val)
|
protoReq.Address, err = runtime.String(val)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "extPubKey", err)
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
val, ok = pathParams["lookupPeriodInMin"]
|
val, ok = pathParams["lookupPeriodInMin"]
|
||||||
@ -91,17 +91,17 @@ func request_Query_GetCIDsByPubKey_0(ctx context.Context, marshaler runtime.Mars
|
|||||||
if err := req.ParseForm(); err != nil {
|
if err := req.ParseForm(); err != nil {
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
}
|
}
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetCIDsByPubKey_0); err != nil {
|
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetCIDsByAddress_0); err != nil {
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, err := client.GetCIDsByPubKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
msg, err := client.GetCIDsByAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
return msg, metadata, err
|
return msg, metadata, err
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_Query_GetCIDsByPubKey_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func local_request_Query_GetCIDsByAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq QueryGetCIDsByPubKeyRequest
|
var protoReq QueryGetCIDsByAddressRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -111,15 +111,15 @@ func local_request_Query_GetCIDsByPubKey_0(ctx context.Context, marshaler runtim
|
|||||||
_ = err
|
_ = err
|
||||||
)
|
)
|
||||||
|
|
||||||
val, ok = pathParams["extPubKey"]
|
val, ok = pathParams["address"]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "extPubKey")
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||||
}
|
}
|
||||||
|
|
||||||
protoReq.ExtPubKey, err = runtime.String(val)
|
protoReq.Address, err = runtime.String(val)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "extPubKey", err)
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
val, ok = pathParams["lookupPeriodInMin"]
|
val, ok = pathParams["lookupPeriodInMin"]
|
||||||
@ -136,11 +136,11 @@ func local_request_Query_GetCIDsByPubKey_0(ctx context.Context, marshaler runtim
|
|||||||
if err := req.ParseForm(); err != nil {
|
if err := req.ParseForm(); err != nil {
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
}
|
}
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetCIDsByPubKey_0); err != nil {
|
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetCIDsByAddress_0); err != nil {
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, err := server.GetCIDsByPubKey(ctx, &protoReq)
|
msg, err := server.GetCIDsByAddress(ctx, &protoReq)
|
||||||
return msg, metadata, err
|
return msg, metadata, err
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
mux.Handle("GET", pattern_Query_GetCIDsByPubKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
mux.Handle("GET", pattern_Query_GetCIDsByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
var stream runtime.ServerTransportStream
|
var stream runtime.ServerTransportStream
|
||||||
@ -239,7 +239,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
resp, md, err := local_request_Query_GetCIDsByPubKey_0(rctx, inboundMarshaler, server, req, pathParams)
|
resp, md, err := local_request_Query_GetCIDsByAddress_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -247,7 +247,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
forward_Query_GetCIDsByPubKey_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
forward_Query_GetCIDsByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
mux.Handle("GET", pattern_Query_GetCIDsByPubKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
mux.Handle("GET", pattern_Query_GetCIDsByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
@ -344,14 +344,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
resp, md, err := request_Query_GetCIDsByPubKey_0(rctx, inboundMarshaler, client, req, pathParams)
|
resp, md, err := request_Query_GetCIDsByAddress_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
forward_Query_GetCIDsByPubKey_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
forward_Query_GetCIDsByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||||||
var (
|
var (
|
||||||
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"github.com", "planetmint", "planetmint-go", "asset", "params"}, "", runtime.AssumeColonVerbOpt(true)))
|
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"github.com", "planetmint", "planetmint-go", "asset", "params"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||||
|
|
||||||
pattern_Query_GetCIDsByPubKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"planetmint", "planetmint-go", "asset", "get_cids_by_pub_key", "extPubKey", "lookupPeriodInMin"}, "", runtime.AssumeColonVerbOpt(true)))
|
pattern_Query_GetCIDsByAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"planetmint", "planetmint-go", "asset", "get_cids_by_address", "address", "lookupPeriodInMin"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||||
|
|
||||||
pattern_Query_GetNotarizedAsset_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"planetmint", "planetmint-go", "asset", "get_notarized_asset", "cid"}, "", runtime.AssumeColonVerbOpt(true)))
|
pattern_Query_GetNotarizedAsset_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"planetmint", "planetmint-go", "asset", "get_notarized_asset", "cid"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||||
)
|
)
|
||||||
@ -389,7 +389,7 @@ var (
|
|||||||
var (
|
var (
|
||||||
forward_Query_Params_0 = runtime.ForwardResponseMessage
|
forward_Query_Params_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
forward_Query_GetCIDsByPubKey_0 = runtime.ForwardResponseMessage
|
forward_Query_GetCIDsByAddress_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
forward_Query_GetNotarizedAsset_0 = runtime.ForwardResponseMessage
|
forward_Query_GetNotarizedAsset_0 = runtime.ForwardResponseMessage
|
||||||
)
|
)
|
||||||
|
@ -29,9 +29,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
|||||||
|
|
||||||
type MsgNotarizeAsset struct {
|
type MsgNotarizeAsset struct {
|
||||||
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
|
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||||
Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
|
Cid string `protobuf:"bytes,2,opt,name=cid,proto3" json:"cid,omitempty"`
|
||||||
Signature string `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
|
|
||||||
PubKey string `protobuf:"bytes,4,opt,name=pubKey,proto3" json:"pubKey,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MsgNotarizeAsset) Reset() { *m = MsgNotarizeAsset{} }
|
func (m *MsgNotarizeAsset) Reset() { *m = MsgNotarizeAsset{} }
|
||||||
@ -74,23 +72,9 @@ func (m *MsgNotarizeAsset) GetCreator() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MsgNotarizeAsset) GetHash() string {
|
func (m *MsgNotarizeAsset) GetCid() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Hash
|
return m.Cid
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *MsgNotarizeAsset) GetSignature() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.Signature
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *MsgNotarizeAsset) GetPubKey() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.PubKey
|
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -139,23 +123,21 @@ func init() {
|
|||||||
func init() { proto.RegisterFile("planetmintgo/asset/tx.proto", fileDescriptor_1b35a44a96ae014b) }
|
func init() { proto.RegisterFile("planetmintgo/asset/tx.proto", fileDescriptor_1b35a44a96ae014b) }
|
||||||
|
|
||||||
var fileDescriptor_1b35a44a96ae014b = []byte{
|
var fileDescriptor_1b35a44a96ae014b = []byte{
|
||||||
// 249 bytes of a gzipped FileDescriptorProto
|
// 213 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0xc8, 0x49, 0xcc,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0xc8, 0x49, 0xcc,
|
||||||
0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x2c, 0x2e, 0x4e, 0x2d, 0xd1, 0x2f,
|
0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x2c, 0x2e, 0x4e, 0x2d, 0xd1, 0x2f,
|
||||||
0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x42, 0x96, 0xd4, 0x03, 0x4b, 0x2a, 0x95,
|
0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x42, 0x96, 0xd4, 0x03, 0x4b, 0x2a, 0xd9,
|
||||||
0x71, 0x09, 0xf8, 0x16, 0xa7, 0xfb, 0xe5, 0x97, 0x24, 0x16, 0x65, 0x56, 0xa5, 0x3a, 0x82, 0xc4,
|
0x71, 0x09, 0xf8, 0x16, 0xa7, 0xfb, 0xe5, 0x97, 0x24, 0x16, 0x65, 0x56, 0xa5, 0x3a, 0x82, 0xc4,
|
||||||
0x84, 0x24, 0xb8, 0xd8, 0x93, 0x8b, 0x52, 0x13, 0x4b, 0xf2, 0x8b, 0x24, 0x18, 0x15, 0x18, 0x35,
|
0x84, 0x24, 0xb8, 0xd8, 0x93, 0x8b, 0x52, 0x13, 0x4b, 0xf2, 0x8b, 0x24, 0x18, 0x15, 0x18, 0x35,
|
||||||
0x38, 0x83, 0x60, 0x5c, 0x21, 0x21, 0x2e, 0x96, 0x8c, 0xc4, 0xe2, 0x0c, 0x09, 0x26, 0xb0, 0x30,
|
0x38, 0x83, 0x60, 0x5c, 0x21, 0x01, 0x2e, 0xe6, 0xe4, 0xcc, 0x14, 0x09, 0x26, 0xb0, 0x28, 0x88,
|
||||||
0x98, 0x2d, 0x24, 0xc3, 0xc5, 0x59, 0x9c, 0x99, 0x9e, 0x97, 0x58, 0x52, 0x5a, 0x94, 0x2a, 0xc1,
|
0xa9, 0x24, 0xc5, 0x25, 0x81, 0xae, 0x3f, 0x28, 0xb5, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0xd5, 0x28,
|
||||||
0x0c, 0x96, 0x40, 0x08, 0x08, 0x89, 0x71, 0xb1, 0x15, 0x94, 0x26, 0x79, 0xa7, 0x56, 0x4a, 0xb0,
|
0x8b, 0x8b, 0xd9, 0xb7, 0x38, 0x5d, 0x28, 0x99, 0x8b, 0x17, 0xd5, 0x7c, 0x15, 0x3d, 0x4c, 0x87,
|
||||||
0x80, 0xa5, 0xa0, 0x3c, 0x25, 0x29, 0x2e, 0x09, 0x74, 0x7b, 0x83, 0x52, 0x8b, 0x0b, 0xf2, 0xf3,
|
0xe8, 0xa1, 0x9b, 0x22, 0xa5, 0x43, 0x8c, 0x2a, 0x98, 0x5d, 0x4e, 0xde, 0x27, 0x1e, 0xc9, 0x31,
|
||||||
0x8a, 0x53, 0x8d, 0xb2, 0xb8, 0x98, 0x7d, 0x8b, 0xd3, 0x85, 0x92, 0xb9, 0x78, 0x51, 0xdd, 0xa5,
|
0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb,
|
||||||
0xa2, 0x87, 0xe9, 0x01, 0x3d, 0x74, 0x53, 0xa4, 0x74, 0x88, 0x51, 0x05, 0xb3, 0xcb, 0xc9, 0xfb,
|
0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x98, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c,
|
||||||
0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e,
|
0x9f, 0xab, 0x8f, 0x30, 0x11, 0x89, 0xa9, 0x9b, 0x9e, 0xaf, 0x5f, 0x01, 0x0b, 0xab, 0xca, 0x82,
|
||||||
0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x0c, 0xd3, 0x33, 0x4b, 0x32, 0x4a,
|
0xd4, 0xe2, 0x24, 0x36, 0x70, 0x78, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xcd, 0x3f, 0xf0,
|
||||||
0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x11, 0x26, 0x22, 0x31, 0x75, 0xd3, 0xf3, 0xf5, 0x2b, 0x60,
|
0xac, 0x4e, 0x01, 0x00, 0x00,
|
||||||
0x61, 0x5c, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x67, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff,
|
|
||||||
0xff, 0x74, 0x66, 0x6a, 0x3f, 0x86, 0x01, 0x00, 0x00,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
@ -258,24 +240,10 @@ func (m *MsgNotarizeAsset) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.PubKey) > 0 {
|
if len(m.Cid) > 0 {
|
||||||
i -= len(m.PubKey)
|
i -= len(m.Cid)
|
||||||
copy(dAtA[i:], m.PubKey)
|
copy(dAtA[i:], m.Cid)
|
||||||
i = encodeVarintTx(dAtA, i, uint64(len(m.PubKey)))
|
i = encodeVarintTx(dAtA, i, uint64(len(m.Cid)))
|
||||||
i--
|
|
||||||
dAtA[i] = 0x22
|
|
||||||
}
|
|
||||||
if len(m.Signature) > 0 {
|
|
||||||
i -= len(m.Signature)
|
|
||||||
copy(dAtA[i:], m.Signature)
|
|
||||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Signature)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x1a
|
|
||||||
}
|
|
||||||
if len(m.Hash) > 0 {
|
|
||||||
i -= len(m.Hash)
|
|
||||||
copy(dAtA[i:], m.Hash)
|
|
||||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Hash)))
|
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0x12
|
dAtA[i] = 0x12
|
||||||
}
|
}
|
||||||
@ -333,15 +301,7 @@ func (m *MsgNotarizeAsset) Size() (n int) {
|
|||||||
if l > 0 {
|
if l > 0 {
|
||||||
n += 1 + l + sovTx(uint64(l))
|
n += 1 + l + sovTx(uint64(l))
|
||||||
}
|
}
|
||||||
l = len(m.Hash)
|
l = len(m.Cid)
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovTx(uint64(l))
|
|
||||||
}
|
|
||||||
l = len(m.Signature)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovTx(uint64(l))
|
|
||||||
}
|
|
||||||
l = len(m.PubKey)
|
|
||||||
if l > 0 {
|
if l > 0 {
|
||||||
n += 1 + l + sovTx(uint64(l))
|
n += 1 + l + sovTx(uint64(l))
|
||||||
}
|
}
|
||||||
@ -426,7 +386,7 @@ func (m *MsgNotarizeAsset) Unmarshal(dAtA []byte) error {
|
|||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
case 2:
|
case 2:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field Cid", wireType)
|
||||||
}
|
}
|
||||||
var stringLen uint64
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -454,71 +414,7 @@ func (m *MsgNotarizeAsset) Unmarshal(dAtA []byte) error {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
m.Hash = string(dAtA[iNdEx:postIndex])
|
m.Cid = string(dAtA[iNdEx:postIndex])
|
||||||
iNdEx = postIndex
|
|
||||||
case 3:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Signature", 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.Signature = string(dAtA[iNdEx:postIndex])
|
|
||||||
iNdEx = postIndex
|
|
||||||
case 4:
|
|
||||||
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 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.PubKey = string(dAtA[iNdEx:postIndex])
|
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
|
@ -43,6 +43,7 @@ func (k Keeper) StoreMachineIndex(ctx sdk.Context, machine types.Machine) {
|
|||||||
issuerPlanetmintIndexKey := GetMachineBytes(machine.IssuerPlanetmint)
|
issuerPlanetmintIndexKey := GetMachineBytes(machine.IssuerPlanetmint)
|
||||||
issuerLiquidIndexKey := GetMachineBytes(machine.IssuerLiquid)
|
issuerLiquidIndexKey := GetMachineBytes(machine.IssuerLiquid)
|
||||||
addressIndexKey := GetMachineBytes(machine.Address)
|
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)
|
||||||
|
@ -30,7 +30,7 @@ func TestMsgServerAttestMachine(t *testing.T) {
|
|||||||
sk, pk := sample.KeyPair()
|
sk, pk := sample.KeyPair()
|
||||||
ta := sample.TrustAnchor(pk)
|
ta := sample.TrustAnchor(pk)
|
||||||
taMsg := types.NewMsgRegisterTrustAnchor(pk, &ta)
|
taMsg := types.NewMsgRegisterTrustAnchor(pk, &ta)
|
||||||
machine := sample.Machine(pk, pk, sk)
|
machine := sample.Machine(pk, pk, sk, "")
|
||||||
msg := types.NewMsgAttestMachine(pk, &machine)
|
msg := types.NewMsgAttestMachine(pk, &machine)
|
||||||
msgServer, ctx := setupMsgServer(t)
|
msgServer, ctx := setupMsgServer(t)
|
||||||
_, err := msgServer.RegisterTrustAnchor(ctx, taMsg)
|
_, err := msgServer.RegisterTrustAnchor(ctx, taMsg)
|
||||||
@ -45,7 +45,7 @@ func TestMsgServerAttestMachineInvalidLiquidKey(t *testing.T) {
|
|||||||
sk, pk := sample.KeyPair()
|
sk, pk := sample.KeyPair()
|
||||||
ta := sample.TrustAnchor(pk)
|
ta := sample.TrustAnchor(pk)
|
||||||
taMsg := types.NewMsgRegisterTrustAnchor(pk, &ta)
|
taMsg := types.NewMsgRegisterTrustAnchor(pk, &ta)
|
||||||
machine := sample.Machine(pk, pk, sk)
|
machine := sample.Machine(pk, pk, sk, "")
|
||||||
machine.IssuerLiquid = "invalidkey"
|
machine.IssuerLiquid = "invalidkey"
|
||||||
msg := types.NewMsgAttestMachine(pk, &machine)
|
msg := types.NewMsgAttestMachine(pk, &machine)
|
||||||
msgServer, ctx := setupMsgServer(t)
|
msgServer, ctx := setupMsgServer(t)
|
||||||
|
@ -11,4 +11,5 @@ var (
|
|||||||
ErrMachineNotFound = errorsmod.Register(ModuleName, 2, "machine not found")
|
ErrMachineNotFound = errorsmod.Register(ModuleName, 2, "machine not found")
|
||||||
ErrTrustAnchorNotFound = errorsmod.Register(ModuleName, 3, "trust anchor not found")
|
ErrTrustAnchorNotFound = errorsmod.Register(ModuleName, 3, "trust anchor not found")
|
||||||
ErrTrustAnchorAlreadyInUse = errorsmod.Register(ModuleName, 4, "trust anchor already in use")
|
ErrTrustAnchorAlreadyInUse = errorsmod.Register(ModuleName, 4, "trust anchor already in use")
|
||||||
|
ErrMachineIsNotCreator = errorsmod.Register(ModuleName, 5, "the machine.address is no the message creator address")
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user