mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-06 06:06:43 +00:00
Switch to revive
and fix findings (#171)
* [ci] Switch from `nosnakecase` to `revive` * [revive] Fix findings Signed-off-by: Julian Strobl <jmastr@mailbox.org>
This commit is contained in:
parent
c8bfb861f1
commit
1e1138d026
@ -8,7 +8,7 @@ linters:
|
|||||||
- gosimple
|
- gosimple
|
||||||
- govet
|
- govet
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- nosnakecase
|
- revive
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- unused
|
- unused
|
||||||
issues:
|
issues:
|
||||||
|
@ -909,7 +909,7 @@ func (app *App) GetSubspace(moduleName string) paramstypes.Subspace {
|
|||||||
|
|
||||||
// RegisterAPIRoutes registers all application module routes with the provided
|
// RegisterAPIRoutes registers all application module routes with the provided
|
||||||
// API server.
|
// API server.
|
||||||
func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
|
func (app *App) RegisterAPIRoutes(apiSvr *api.Server, _ config.APIConfig) {
|
||||||
clientCtx := apiSvr.ClientCtx
|
clientCtx := apiSvr.ClientCtx
|
||||||
// Register new tx routes from grpc-gateway.
|
// Register new tx routes from grpc-gateway.
|
||||||
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
|
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
|
||||||
|
@ -39,7 +39,7 @@ import (
|
|||||||
"github.com/planetmint/planetmint-go/app"
|
"github.com/planetmint/planetmint-go/app"
|
||||||
)
|
)
|
||||||
|
|
||||||
const SIMULATION_SETUP_FAILED = "simulation setup failed"
|
const SimulationSetupFailed = "simulation setup failed"
|
||||||
|
|
||||||
type storeKeysPrefixes struct {
|
type storeKeysPrefixes struct {
|
||||||
A storetypes.StoreKey
|
A storetypes.StoreKey
|
||||||
@ -78,7 +78,7 @@ func BenchmarkSimulation(b *testing.B) {
|
|||||||
simcli.FlagVerboseValue,
|
simcli.FlagVerboseValue,
|
||||||
simcli.FlagEnabledValue,
|
simcli.FlagEnabledValue,
|
||||||
)
|
)
|
||||||
require.NoError(b, err, SIMULATION_SETUP_FAILED)
|
require.NoError(b, err, SimulationSetupFailed)
|
||||||
|
|
||||||
b.Cleanup(func() {
|
b.Cleanup(func() {
|
||||||
require.NoError(b, db.Close())
|
require.NoError(b, db.Close())
|
||||||
@ -232,7 +232,7 @@ func TestAppImportExport(t *testing.T) {
|
|||||||
if skip {
|
if skip {
|
||||||
t.Skip("skipping application import/export simulation")
|
t.Skip("skipping application import/export simulation")
|
||||||
}
|
}
|
||||||
require.NoError(t, err, SIMULATION_SETUP_FAILED)
|
require.NoError(t, err, SimulationSetupFailed)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
require.NoError(t, db.Close())
|
require.NoError(t, db.Close())
|
||||||
@ -297,7 +297,7 @@ func TestAppImportExport(t *testing.T) {
|
|||||||
simcli.FlagVerboseValue,
|
simcli.FlagVerboseValue,
|
||||||
simcli.FlagEnabledValue,
|
simcli.FlagEnabledValue,
|
||||||
)
|
)
|
||||||
require.NoError(t, err, SIMULATION_SETUP_FAILED)
|
require.NoError(t, err, SimulationSetupFailed)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
require.NoError(t, newDB.Close())
|
require.NoError(t, newDB.Close())
|
||||||
@ -386,7 +386,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
|
|||||||
if skip {
|
if skip {
|
||||||
t.Skip("skipping application simulation after import")
|
t.Skip("skipping application simulation after import")
|
||||||
}
|
}
|
||||||
require.NoError(t, err, SIMULATION_SETUP_FAILED)
|
require.NoError(t, err, SimulationSetupFailed)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
require.NoError(t, db.Close())
|
require.NoError(t, db.Close())
|
||||||
@ -457,7 +457,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
|
|||||||
simcli.FlagVerboseValue,
|
simcli.FlagVerboseValue,
|
||||||
simcli.FlagEnabledValue,
|
simcli.FlagEnabledValue,
|
||||||
)
|
)
|
||||||
require.NoError(t, err, SIMULATION_SETUP_FAILED)
|
require.NoError(t, err, SimulationSetupFailed)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
require.NoError(t, newDB.Close())
|
require.NoError(t, newDB.Close())
|
||||||
|
@ -59,8 +59,8 @@ func (s *E2ETestSuite) TestAttestMachineREST() {
|
|||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Equal(uint32(0), txRes.TxResponse.Code)
|
s.Require().Equal(uint32(0), txRes.TxResponse.Code)
|
||||||
|
|
||||||
queryMachineUrl := fmt.Sprintf("%s/planetmint/machine/get_machine_by_public_key/%s", baseURL, pubKey)
|
queryMachineURL := fmt.Sprintf("%s/planetmint/machine/get_machine_by_public_key/%s", baseURL, pubKey)
|
||||||
queryMachineRes, err := testutil.GetRequest(queryMachineUrl)
|
queryMachineRes, err := testutil.GetRequest(queryMachineURL)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
var qmRes machinetypes.QueryGetMachineByPublicKeyResponse
|
var qmRes machinetypes.QueryGetMachineByPublicKeyResponse
|
||||||
|
@ -142,7 +142,7 @@ func PrepareTx(val *network.Validator, msg sdk.Msg, signer string) ([]byte, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
func BroadcastTx(val *network.Validator, txBytes []byte) (*txtypes.BroadcastTxResponse, error) {
|
func BroadcastTx(val *network.Validator, txBytes []byte) (*txtypes.BroadcastTxResponse, error) {
|
||||||
broadcastTxUrl := fmt.Sprintf("%s/cosmos/tx/v1beta1/txs", val.APIAddress)
|
broadcastTxURL := fmt.Sprintf("%s/cosmos/tx/v1beta1/txs", val.APIAddress)
|
||||||
req := txtypes.BroadcastTxRequest{
|
req := txtypes.BroadcastTxRequest{
|
||||||
TxBytes: txBytes,
|
TxBytes: txBytes,
|
||||||
Mode: txtypes.BroadcastMode_BROADCAST_MODE_SYNC,
|
Mode: txtypes.BroadcastMode_BROADCAST_MODE_SYNC,
|
||||||
@ -152,7 +152,7 @@ func BroadcastTx(val *network.Validator, txBytes []byte) (*txtypes.BroadcastTxRe
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
broadCastTxResponse, err := PostRequest(broadcastTxUrl, "application/json", broadCastTxBody)
|
broadCastTxResponse, err := PostRequest(broadcastTxURL, "application/json", broadCastTxBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,8 @@ func ValidateSignatureByteMsg(message []byte, signature string, publicKey string
|
|||||||
isValid := pubKey.VerifySignature(message, signatureBytes)
|
isValid := pubKey.VerifySignature(message, signatureBytes)
|
||||||
if !isValid {
|
if !isValid {
|
||||||
return false, errors.New("invalid signature")
|
return false, errors.New("invalid signature")
|
||||||
} else {
|
|
||||||
return isValid, nil
|
|
||||||
}
|
}
|
||||||
|
return isValid, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetHexPubKey(extPubKey string) (string, error) {
|
func GetHexPubKey(extPubKey string) (string, error) {
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// GetQueryCmd returns the cli query commands for this module
|
// GetQueryCmd returns the cli query commands for this module
|
||||||
func GetQueryCmd(queryRoute string) *cobra.Command {
|
func GetQueryCmd(_ string) *cobra.Command {
|
||||||
// Group asset queries under a subcommand
|
// Group asset queries under a subcommand
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: types.ModuleName,
|
Use: types.ModuleName,
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// GetParams get all parameters as types.Params
|
// GetParams get all parameters as types.Params
|
||||||
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
|
func (k Keeper) GetParams(_ sdk.Context) types.Params {
|
||||||
return types.NewParams()
|
return types.NewParams()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
// this line is used by starport scaffolding # 1
|
// this line is used by starport scaffolding # 1
|
||||||
|
|
||||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||||
@ -60,7 +61,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form
|
// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form
|
||||||
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error {
|
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
|
||||||
var genState types.GenesisState
|
var genState types.GenesisState
|
||||||
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
|
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
|
||||||
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
||||||
|
@ -74,7 +74,7 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ProposalMsgs returns msgs used for governance proposals for simulations.
|
// ProposalMsgs returns msgs used for governance proposals for simulations.
|
||||||
func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg {
|
func (am AppModule) ProposalMsgs(_ module.SimulationState) []simtypes.WeightedProposalMsg {
|
||||||
return []simtypes.WeightedProposalMsg{
|
return []simtypes.WeightedProposalMsg{
|
||||||
simulation.NewWeightedProposalMsg(
|
simulation.NewWeightedProposalMsg(
|
||||||
opWeightMsgNotarizeAsset,
|
opWeightMsgNotarizeAsset,
|
||||||
|
@ -11,9 +11,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func SimulateMsgNotarizeAsset(
|
func SimulateMsgNotarizeAsset(
|
||||||
ak types.AccountKeeper,
|
_ types.AccountKeeper,
|
||||||
bk types.BankKeeper,
|
_ types.BankKeeper,
|
||||||
k keeper.Keeper,
|
_ keeper.Keeper,
|
||||||
) simtypes.Operation {
|
) simtypes.Operation {
|
||||||
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
||||||
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) {
|
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, _ keeper.Keeper) {
|
||||||
logger := ctx.Logger()
|
logger := ctx.Logger()
|
||||||
proposerAddress := req.Header.GetProposerAddress()
|
proposerAddress := req.Header.GetProposerAddress()
|
||||||
|
|
||||||
@ -36,6 +36,6 @@ func isPoPHeight(height int64) bool {
|
|||||||
return height%int64(cfg.PoPEpochs) == 0
|
return height%int64(cfg.PoPEpochs) == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func EndBlocker(ctx sdk.Context, req abci.RequestEndBlock, k keeper.Keeper) {
|
func EndBlocker(ctx sdk.Context, _ abci.RequestEndBlock, k keeper.Keeper) {
|
||||||
k.DistributeCollectedFees(ctx)
|
k.DistributeCollectedFees(ctx)
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// GetQueryCmd returns the cli query commands for this module
|
// GetQueryCmd returns the cli query commands for this module
|
||||||
func GetQueryCmd(queryRoute string) *cobra.Command {
|
func GetQueryCmd(_ string) *cobra.Command {
|
||||||
// Group dao queries under a subcommand
|
// Group dao queries under a subcommand
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: types.ModuleName,
|
Use: types.ModuleName,
|
||||||
|
@ -20,7 +20,7 @@ func CmdReissueRDDLResult() *cobra.Command {
|
|||||||
Args: cobra.ExactArgs(3),
|
Args: cobra.ExactArgs(3),
|
||||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||||
argProposer := args[0]
|
argProposer := args[0]
|
||||||
argTxId := args[1]
|
argTxID := args[1]
|
||||||
argBlockHeight, err := cast.ToInt64E(args[2])
|
argBlockHeight, err := cast.ToInt64E(args[2])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -34,7 +34,7 @@ func CmdReissueRDDLResult() *cobra.Command {
|
|||||||
msg := types.NewMsgReissueRDDLResult(
|
msg := types.NewMsgReissueRDDLResult(
|
||||||
clientCtx.GetFromAddress().String(),
|
clientCtx.GetFromAddress().String(),
|
||||||
argProposer,
|
argProposer,
|
||||||
argTxId,
|
argTxID,
|
||||||
argBlockHeight,
|
argBlockHeight,
|
||||||
)
|
)
|
||||||
if err := msg.ValidateBasic(); err != nil {
|
if err := msg.ValidateBasic(); err != nil {
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// GetParams get all parameters as types.Params
|
// GetParams get all parameters as types.Params
|
||||||
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
|
func (k Keeper) GetParams(_ sdk.Context) types.Params {
|
||||||
return types.NewParams()
|
return types.NewParams()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,7 @@ func (k Keeper) GetReissuances(goCtx context.Context, req *types.QueryGetReissua
|
|||||||
|
|
||||||
if reissuances != nil {
|
if reissuances != nil {
|
||||||
return &types.QueryGetReissuancesResponse{Reissuance: &reissuances[0]}, nil
|
return &types.QueryGetReissuancesResponse{Reissuance: &reissuances[0]}, nil
|
||||||
} else {
|
|
||||||
return &types.QueryGetReissuancesResponse{}, nil
|
|
||||||
}
|
}
|
||||||
|
return &types.QueryGetReissuancesResponse{}, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ func (k Keeper) LookupReissuance(ctx sdk.Context, height int64) (val types.Reiss
|
|||||||
return val, true
|
return val, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k Keeper) getReissuancesPage(ctx sdk.Context, key []byte, offset uint64, pageSize uint64, all bool, reverse bool) (reissuances []types.Reissuance) {
|
func (k Keeper) getReissuancesPage(ctx sdk.Context, _ []byte, _ uint64, _ uint64, _ bool, reverse bool) (reissuances []types.Reissuance) {
|
||||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ReissuanceBlockHeightKey))
|
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ReissuanceBlockHeightKey))
|
||||||
|
|
||||||
iterator := store.Iterator(nil, nil)
|
iterator := store.Iterator(nil, nil)
|
||||||
|
@ -62,7 +62,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form
|
// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form
|
||||||
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error {
|
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
|
||||||
var genState types.GenesisState
|
var genState types.GenesisState
|
||||||
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
|
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
|
||||||
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
||||||
|
@ -88,7 +88,7 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ProposalMsgs returns msgs used for governance proposals for simulations.
|
// ProposalMsgs returns msgs used for governance proposals for simulations.
|
||||||
func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg {
|
func (am AppModule) ProposalMsgs(_ module.SimulationState) []simtypes.WeightedProposalMsg {
|
||||||
return []simtypes.WeightedProposalMsg{
|
return []simtypes.WeightedProposalMsg{
|
||||||
simulation.NewWeightedProposalMsg(
|
simulation.NewWeightedProposalMsg(
|
||||||
opWeightMsgReissueRDDLProposal,
|
opWeightMsgReissueRDDLProposal,
|
||||||
|
@ -11,9 +11,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func SimulateMsgMintToken(
|
func SimulateMsgMintToken(
|
||||||
ak types.AccountKeeper,
|
_ types.AccountKeeper,
|
||||||
bk types.BankKeeper,
|
_ types.BankKeeper,
|
||||||
k keeper.Keeper,
|
_ keeper.Keeper,
|
||||||
) simtypes.Operation {
|
) simtypes.Operation {
|
||||||
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
||||||
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
||||||
|
@ -11,9 +11,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func SimulateMsgReissueRDDLProposal(
|
func SimulateMsgReissueRDDLProposal(
|
||||||
ak types.AccountKeeper,
|
_ types.AccountKeeper,
|
||||||
bk types.BankKeeper,
|
_ types.BankKeeper,
|
||||||
k keeper.Keeper,
|
_ keeper.Keeper,
|
||||||
) simtypes.Operation {
|
) simtypes.Operation {
|
||||||
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
||||||
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
||||||
|
@ -11,9 +11,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func SimulateMsgReissueRDDLResult(
|
func SimulateMsgReissueRDDLResult(
|
||||||
ak types.AccountKeeper,
|
_ types.AccountKeeper,
|
||||||
bk types.BankKeeper,
|
_ types.BankKeeper,
|
||||||
k keeper.Keeper,
|
_ keeper.Keeper,
|
||||||
) simtypes.Operation {
|
) simtypes.Operation {
|
||||||
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
||||||
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
||||||
|
@ -10,11 +10,11 @@ const TypeMsgReissueRDDLResult = "reissue_rddl_result"
|
|||||||
|
|
||||||
var _ sdk.Msg = &MsgReissueRDDLResult{}
|
var _ sdk.Msg = &MsgReissueRDDLResult{}
|
||||||
|
|
||||||
func NewMsgReissueRDDLResult(creator string, proposer string, txId string, blockHeight int64) *MsgReissueRDDLResult {
|
func NewMsgReissueRDDLResult(creator string, proposer string, txID string, blockHeight int64) *MsgReissueRDDLResult {
|
||||||
return &MsgReissueRDDLResult{
|
return &MsgReissueRDDLResult{
|
||||||
Creator: creator,
|
Creator: creator,
|
||||||
Proposer: proposer,
|
Proposer: proposer,
|
||||||
TxId: txId,
|
TxId: txID,
|
||||||
BlockHeight: blockHeight,
|
BlockHeight: blockHeight,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package dao
|
package dao
|
||||||
|
|
||||||
func GetReissuanceCommand(assetID string, BlockHeight int64) string {
|
func GetReissuanceCommand(assetID string, _ int64) string {
|
||||||
return "reissueasset " + assetID + " 99869000000"
|
return "reissueasset " + assetID + " 99869000000"
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsValidReissuanceCommand(reissuanceStr string, assetID string, BlockHeight int64) bool {
|
func IsValidReissuanceCommand(reissuanceStr string, assetID string, _ int64) bool {
|
||||||
expected := "reissueasset " + assetID + " 99869000000"
|
expected := "reissueasset " + assetID + " 99869000000"
|
||||||
return reissuanceStr == expected
|
return reissuanceStr == expected
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// GetQueryCmd returns the cli query commands for this module
|
// GetQueryCmd returns the cli query commands for this module
|
||||||
func GetQueryCmd(queryRoute string) *cobra.Command {
|
func GetQueryCmd(_ string) *cobra.Command {
|
||||||
// Group machine queries under a subcommand
|
// Group machine queries under a subcommand
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: types.ModuleName,
|
Use: types.ModuleName,
|
||||||
|
@ -39,13 +39,13 @@ func (k Keeper) StoreMachineIndex(ctx sdk.Context, machine types.Machine) {
|
|||||||
Address: machine.Address,
|
Address: machine.Address,
|
||||||
}
|
}
|
||||||
|
|
||||||
machineIdIndexKey := GetMachineBytes(machine.MachineId)
|
machineIDIndexKey := GetMachineBytes(machine.MachineId)
|
||||||
issuerPlanetmintIndexKey := GetMachineBytes(machine.IssuerPlanetmint)
|
issuerPlanetmintIndexKey := GetMachineBytes(machine.IssuerPlanetmint)
|
||||||
issuerLiquidIndexKey := GetMachineBytes(machine.IssuerLiquid)
|
issuerLiquidIndexKey := GetMachineBytes(machine.IssuerLiquid)
|
||||||
addressIndexKey := GetMachineBytes(machine.Address)
|
addressIndexKey := GetMachineBytes(machine.Address)
|
||||||
|
|
||||||
indexAppendValue := k.cdc.MustMarshal(&index)
|
indexAppendValue := k.cdc.MustMarshal(&index)
|
||||||
taIndexStore.Set(machineIdIndexKey, indexAppendValue)
|
taIndexStore.Set(machineIDIndexKey, indexAppendValue)
|
||||||
issuerPlanetmintIndexStore.Set(issuerPlanetmintIndexKey, indexAppendValue)
|
issuerPlanetmintIndexStore.Set(issuerPlanetmintIndexKey, indexAppendValue)
|
||||||
issuerLiquidIndexStore.Set(issuerLiquidIndexKey, indexAppendValue)
|
issuerLiquidIndexStore.Set(issuerLiquidIndexKey, indexAppendValue)
|
||||||
addressIndexStore.Set(addressIndexKey, indexAppendValue)
|
addressIndexStore.Set(addressIndexKey, indexAppendValue)
|
||||||
|
@ -35,9 +35,9 @@ func TestGetMachine(t *testing.T) {
|
|||||||
IssuerLiquid: item.IssuerLiquid,
|
IssuerLiquid: item.IssuerLiquid,
|
||||||
Address: item.Address,
|
Address: item.Address,
|
||||||
}
|
}
|
||||||
machineById, found := keeper.GetMachine(ctx, index)
|
machineByID, found := keeper.GetMachine(ctx, index)
|
||||||
assert.True(t, found)
|
assert.True(t, found)
|
||||||
assert.Equal(t, item, machineById)
|
assert.Equal(t, item, machineByID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,8 +30,8 @@ func (k msgServer) AttestMachine(goCtx context.Context, msg *types.MsgAttestMach
|
|||||||
// and removed from here due to inconsistency or checking the same thing over and over again.
|
// and removed from here due to inconsistency or checking the same thing over and over again.
|
||||||
ta, _, _ := k.GetTrustAnchor(ctx, msg.Machine.MachineId)
|
ta, _, _ := k.GetTrustAnchor(ctx, msg.Machine.MachineId)
|
||||||
|
|
||||||
isValidMachineId, err := util.ValidateSignature(msg.Machine.MachineId, msg.Machine.MachineIdSignature, msg.Machine.MachineId)
|
isValidMachineID, err := util.ValidateSignature(msg.Machine.MachineId, msg.Machine.MachineIdSignature, msg.Machine.MachineId)
|
||||||
if !isValidMachineId {
|
if !isValidMachineID {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// GetParams get all parameters as types.Params
|
// GetParams get all parameters as types.Params
|
||||||
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
|
func (k Keeper) GetParams(_ sdk.Context) types.Params {
|
||||||
return types.NewParams()
|
return types.NewParams()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,9 +43,8 @@ func (k Keeper) GetTrustAnchor(ctx sdk.Context, pubKey string) (val types.TrustA
|
|||||||
val.Pubkey = pubKey
|
val.Pubkey = pubKey
|
||||||
if trustAnchorActivated[0] == 1 {
|
if trustAnchorActivated[0] == 1 {
|
||||||
return val, true, true
|
return val, true, true
|
||||||
} else {
|
|
||||||
return val, false, true
|
|
||||||
}
|
}
|
||||||
|
return val, false, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func getTrustAnchorBytes(pubKey string) ([]byte, error) {
|
func getTrustAnchorBytes(pubKey string) ([]byte, error) {
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
// this line is used by starport scaffolding # 1
|
// this line is used by starport scaffolding # 1
|
||||||
|
|
||||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||||
@ -60,7 +61,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form
|
// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form
|
||||||
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error {
|
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
|
||||||
var genState types.GenesisState
|
var genState types.GenesisState
|
||||||
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
|
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
|
||||||
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
||||||
|
@ -89,7 +89,7 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ProposalMsgs returns msgs used for governance proposals for simulations.
|
// ProposalMsgs returns msgs used for governance proposals for simulations.
|
||||||
func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg {
|
func (am AppModule) ProposalMsgs(_ module.SimulationState) []simtypes.WeightedProposalMsg {
|
||||||
return []simtypes.WeightedProposalMsg{
|
return []simtypes.WeightedProposalMsg{
|
||||||
simulation.NewWeightedProposalMsg(
|
simulation.NewWeightedProposalMsg(
|
||||||
opWeightMsgAttestMachine,
|
opWeightMsgAttestMachine,
|
||||||
|
@ -11,9 +11,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func SimulateMsgAttestMachine(
|
func SimulateMsgAttestMachine(
|
||||||
ak types.AccountKeeper,
|
_ types.AccountKeeper,
|
||||||
bk types.BankKeeper,
|
_ types.BankKeeper,
|
||||||
k keeper.Keeper,
|
_ keeper.Keeper,
|
||||||
) simtypes.Operation {
|
) simtypes.Operation {
|
||||||
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
||||||
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
||||||
|
@ -11,9 +11,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func SimulateMsgRegisterTrustAnchor(
|
func SimulateMsgRegisterTrustAnchor(
|
||||||
ak types.AccountKeeper,
|
_ types.AccountKeeper,
|
||||||
bk types.BankKeeper,
|
_ types.BankKeeper,
|
||||||
k keeper.Keeper,
|
_ keeper.Keeper,
|
||||||
) simtypes.Operation {
|
) simtypes.Operation {
|
||||||
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
||||||
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user