gofumpt and ignore duplicates
This commit is contained in:
parent
ec3e8f7ce3
commit
a4f2cb5731
@ -344,7 +344,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
|
||||
coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20))
|
||||
gasAmount := sdk.NewCoins(coinAmount)
|
||||
gas := uint64(200000)
|
||||
//reusing the gasAmount for deposit
|
||||
// reusing the gasAmount for deposit
|
||||
deposit := sdk.NewCoins(coinAmount)
|
||||
txBuilder := suite.CreateTestEIP712SubmitProposal(from, privKey, "ethermint_9000-1", gas, gasAmount, deposit)
|
||||
return txBuilder.GetTx()
|
||||
|
@ -23,9 +23,11 @@ import (
|
||||
)
|
||||
|
||||
// Testing Constants
|
||||
var chainId = "ethermint_9000-1"
|
||||
var ctx = client.Context{}.WithTxConfig(
|
||||
var (
|
||||
chainId = "ethermint_9000-1"
|
||||
ctx = client.Context{}.WithTxConfig(
|
||||
encoding.MakeConfig(app.ModuleBasics).TxConfig,
|
||||
)
|
||||
)
|
||||
var feePayerAddress = "ethm17xpfvakm2amg962yls6f84z3kell8c5lthdzgl"
|
||||
|
||||
|
@ -125,7 +125,6 @@ func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueI
|
||||
All: (all != nil && *all),
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -142,7 +141,6 @@ func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueI
|
||||
}
|
||||
|
||||
return gqlResponse, nil
|
||||
|
||||
}
|
||||
|
||||
func (q queryResolver) GetRecordsByIds(ctx context.Context, ids []string) ([]*Record, error) {
|
||||
|
21
gql/util.go
21
gql/util.go
@ -38,6 +38,7 @@ func getGQLCoins(coins sdk.Coins) []*Coin {
|
||||
|
||||
return gqlCoins
|
||||
}
|
||||
|
||||
func GetGQLNameAuthorityRecord(record *nstypes.NameAuthority) (*AuthorityRecord, error) {
|
||||
if record == nil {
|
||||
return nil, nil
|
||||
@ -118,26 +119,6 @@ func getGQLBond(bondObj *bondtypes.Bond) (*Bond, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func matchBondOnAttributes(bondObj *bondtypes.Bond, attributes []*KeyValueInput) bool {
|
||||
for _, attr := range attributes {
|
||||
switch attr.Key {
|
||||
case OwnerAttributeName:
|
||||
{
|
||||
if attr.Value.String == nil || bondObj.Owner != *attr.Value.String {
|
||||
return false
|
||||
}
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Only attributes explicitly listed in the switch are queryable.
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func getAuctionBid(bid *auctiontypes.Bid) *AuctionBid {
|
||||
return &AuctionBid{
|
||||
BidderAddress: bid.BidderAddress,
|
||||
|
@ -3,13 +3,14 @@ package rpc
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/stretchr/testify/require"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -134,7 +134,7 @@ func GetCmdCommitBid() *cobra.Command {
|
||||
}
|
||||
|
||||
// Save reveal file.
|
||||
ioutil.WriteFile(fmt.Sprintf("%s-%s.json", clientCtx.GetFromName(), commitHash), content, 0600)
|
||||
ioutil.WriteFile(fmt.Sprintf("%s-%s.json", clientCtx.GetFromName(), commitHash), content, 0o600)
|
||||
|
||||
msg := types.NewMsgCommitBid(auctionID, commitHash, clientCtx.GetFromAddress())
|
||||
err = msg.ValidateBasic()
|
||||
|
@ -13,9 +13,7 @@ import (
|
||||
|
||||
const testCommitHash = "71D8CF34026E32A3A34C2C2D4ADF25ABC8D7943A4619761BE27F196603D91B9D"
|
||||
|
||||
var (
|
||||
seed = int64(233)
|
||||
)
|
||||
var seed = int64(233)
|
||||
|
||||
func (suite *KeeperTestSuite) TestGrpcGetAllAuctions() {
|
||||
client, ctx, k := suite.queryClient, suite.ctx, suite.app.AuctionKeeper
|
||||
|
@ -50,6 +50,7 @@ func (s msgServer) CreateAuction(c context.Context, msg *types.MsgCreateAuction)
|
||||
}
|
||||
|
||||
// CommitBid is the command for committing a bid
|
||||
//nolint: all
|
||||
func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types.MsgCommitBidResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
|
||||
@ -80,6 +81,7 @@ func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types
|
||||
}
|
||||
|
||||
//RevealBid is the command for revealing a bid
|
||||
//nolint: all
|
||||
func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types.MsgRevealBidResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
|
||||
|
@ -63,7 +63,6 @@ func (msg MsgCreateAuction) GetSigners() []sdk.AccAddress {
|
||||
|
||||
// NewMsgCommitBid is the constructor function for MsgCommitBid.
|
||||
func NewMsgCommitBid(auctionID string, commitHash string, signer sdk.AccAddress) MsgCommitBid {
|
||||
|
||||
return MsgCommitBid{
|
||||
AuctionId: auctionID,
|
||||
CommitHash: commitHash,
|
||||
@ -107,7 +106,6 @@ func (msg MsgCommitBid) GetSigners() []sdk.AccAddress {
|
||||
|
||||
// NewMsgRevealBid is the constructor function for MsgRevealBid.
|
||||
func NewMsgRevealBid(auctionID string, reveal string, signer sdk.AccAddress) MsgRevealBid {
|
||||
|
||||
return MsgRevealBid{
|
||||
AuctionId: auctionID,
|
||||
Reveal: reveal,
|
||||
|
@ -28,7 +28,6 @@ func (s *IntegrationTestSuite) TestGRPCGetBonds() {
|
||||
true,
|
||||
"",
|
||||
func() {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -87,7 +86,6 @@ func (s *IntegrationTestSuite) TestGRPCGetBondsByOwner() {
|
||||
fmt.Sprintf(reqUrl, "asdasd"),
|
||||
true,
|
||||
func() {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -251,7 +251,6 @@ func (s *IntegrationTestSuite) TestGetQueryBondListsByOwner() {
|
||||
},
|
||||
true,
|
||||
func() {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -63,6 +63,7 @@ func (s *IntegrationTestSuite) TestTxCreateBond() {
|
||||
}
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (s *IntegrationTestSuite) TestTxRefillBond() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
@ -148,6 +149,7 @@ func (s *IntegrationTestSuite) TestTxRefillBond() {
|
||||
}
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (s *IntegrationTestSuite) TestTxWithdrawAmountFromBond() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
// InitGenesis initializes genesis state based on exported genesis
|
||||
func InitGenesis(
|
||||
ctx sdk.Context,
|
||||
k keeper.Keeper, data types.GenesisState) []abci.ValidatorUpdate {
|
||||
|
||||
k keeper.Keeper, data types.GenesisState,
|
||||
) []abci.ValidatorUpdate {
|
||||
k.SetParams(ctx, data.Params)
|
||||
|
||||
for _, bond := range data.Bonds {
|
||||
|
@ -11,9 +11,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/testutil"
|
||||
)
|
||||
|
||||
var (
|
||||
seed = int64(233)
|
||||
)
|
||||
var seed = int64(233)
|
||||
|
||||
func (suite *KeeperTestSuite) TestGrpcQueryBondsList() {
|
||||
grpcClient, ctx, k := suite.queryClient, suite.ctx, suite.app.BondKeeper
|
||||
|
@ -45,6 +45,7 @@ func (k msgServer) CreateBond(c context.Context, msg *types.MsgCreateBond) (*typ
|
||||
return &types.MsgCreateBondResponse{}, nil
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*types.MsgRefillBondResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
@ -74,6 +75,7 @@ func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*typ
|
||||
return &types.MsgRefillBondResponse{}, nil
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (k msgServer) WithdrawBond(c context.Context, msg *types.MsgWithdrawBond) (*types.MsgWithdrawBondResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
|
@ -3,6 +3,7 @@ package types
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
)
|
||||
|
@ -266,7 +266,6 @@ $ %s query %s query-by-bond [bond id]
|
||||
return err
|
||||
}
|
||||
return clientCtx.PrintProto(res)
|
||||
|
||||
},
|
||||
}
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
|
@ -371,7 +371,7 @@ $ %s tx %s delete-name [crn]
|
||||
return cmd
|
||||
}
|
||||
|
||||
//GetPayloadFromFile Load payload object from YAML file.
|
||||
// GetPayloadFromFile Load payload object from YAML file.
|
||||
func GetPayloadFromFile(filePath string) (*types.PayloadType, error) {
|
||||
var payload types.PayloadType
|
||||
|
||||
|
@ -60,11 +60,12 @@ func (s *IntegrationTestSuite) TestGRPCQueryParams() {
|
||||
}
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryWhoIs() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/whois/%s"
|
||||
var authorityName = "QueryWhoIS"
|
||||
authorityName := "QueryWhoIS"
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
@ -78,7 +79,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryWhoIs() {
|
||||
true,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -132,7 +132,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/lookup?crn=%s"
|
||||
var authorityName = "QueryLookUp"
|
||||
authorityName := "QueryLookUp"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
@ -147,7 +147,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() {
|
||||
true,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -181,6 +180,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() {
|
||||
}
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
@ -199,7 +199,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() {
|
||||
true,
|
||||
"",
|
||||
func(bondId string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -253,6 +252,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() {
|
||||
}
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
@ -271,7 +271,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() {
|
||||
true,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -325,6 +324,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() {
|
||||
}
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryListRecords() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
@ -343,7 +343,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryListRecords() {
|
||||
true,
|
||||
"",
|
||||
func(bondId string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -483,7 +482,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByBondID() {
|
||||
true,
|
||||
"",
|
||||
func(bondId string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -538,7 +536,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetNameServiceModuleBalance() {
|
||||
true,
|
||||
"",
|
||||
func(bondId string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -590,7 +587,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryNamesList() {
|
||||
true,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -66,7 +66,6 @@ func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() {
|
||||
true,
|
||||
0,
|
||||
func() {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -235,7 +234,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() {
|
||||
func (s *IntegrationTestSuite) TestGetCmdWhoIs() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "test2"
|
||||
authorityName := "test2"
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
@ -249,7 +248,6 @@ func (s *IntegrationTestSuite) TestGetCmdWhoIs() {
|
||||
true,
|
||||
1,
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -306,7 +304,7 @@ func (s *IntegrationTestSuite) TestGetCmdWhoIs() {
|
||||
func (s *IntegrationTestSuite) TestGetCmdLookupCRN() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "test1"
|
||||
authorityName := "test1"
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
@ -320,7 +318,6 @@ func (s *IntegrationTestSuite) TestGetCmdLookupCRN() {
|
||||
true,
|
||||
0,
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -400,7 +397,7 @@ func (s *IntegrationTestSuite) TestGetCmdLookupCRN() {
|
||||
func (s *IntegrationTestSuite) GetRecordExpiryQueue() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "GetRecordExpiryQueue"
|
||||
authorityName := "GetRecordExpiryQueue"
|
||||
|
||||
testCasesForRecordsExpiry := []struct {
|
||||
name string
|
||||
@ -415,7 +412,6 @@ func (s *IntegrationTestSuite) GetRecordExpiryQueue() {
|
||||
true,
|
||||
0,
|
||||
func(authorityName string, s *IntegrationTestSuite) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -451,10 +447,11 @@ func (s *IntegrationTestSuite) GetRecordExpiryQueue() {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetAuthorityExpiryQueue() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "TestGetAuthorityExpiryQueue"
|
||||
authorityName := "TestGetAuthorityExpiryQueue"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
@ -467,7 +464,6 @@ func (s *IntegrationTestSuite) TestGetAuthorityExpiryQueue() {
|
||||
[]string{"invalid", fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite {
|
||||
func (s *IntegrationTestSuite) SetupSuite() {
|
||||
s.T().Log("setting up integration test suite")
|
||||
|
||||
var genesisState = s.cfg.GenesisState
|
||||
genesisState := s.cfg.GenesisState
|
||||
var nsData nstypes.GenesisState
|
||||
s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[nstypes.ModuleName], &nsData))
|
||||
|
||||
@ -222,7 +222,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetRecord() {
|
||||
func (s *IntegrationTestSuite) TestGetCmdReserveName() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "testtest"
|
||||
authorityName := "testtest"
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
@ -289,7 +289,7 @@ func (s *IntegrationTestSuite) TestGetCmdReserveName() {
|
||||
func (s *IntegrationTestSuite) TestGetCmdSetName() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "TestGetCmdSetName"
|
||||
authorityName := "TestGetCmdSetName"
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
@ -307,7 +307,6 @@ func (s *IntegrationTestSuite) TestGetCmdSetName() {
|
||||
},
|
||||
true,
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -394,7 +393,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetName() {
|
||||
func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "TestGetCmdSetAuthorityBond"
|
||||
authorityName := "TestGetCmdSetAuthorityBond"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
@ -413,7 +412,6 @@ func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() {
|
||||
},
|
||||
true,
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -480,7 +478,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() {
|
||||
func (s *IntegrationTestSuite) TestGetCmdDeleteName() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "TestGetCmdDeleteName"
|
||||
authorityName := "TestGetCmdDeleteName"
|
||||
testCasesForDeletingName := []struct {
|
||||
name string
|
||||
args []string
|
||||
@ -498,7 +496,6 @@ func (s *IntegrationTestSuite) TestGetCmdDeleteName() {
|
||||
},
|
||||
true,
|
||||
func(authorityName string, s *IntegrationTestSuite) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -564,7 +561,6 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() {
|
||||
return ""
|
||||
},
|
||||
func(recordId string, s *IntegrationTestSuite) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -807,7 +803,6 @@ func (s *IntegrationTestSuite) TestGetCmdAssociateBond() {
|
||||
return "", ""
|
||||
},
|
||||
func(recordId, bondId string, s *IntegrationTestSuite) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -17,7 +17,6 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data types.GenesisState)
|
||||
|
||||
// Add to record expiry queue if expiry time is in the future.
|
||||
expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -33,7 +32,7 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data types.GenesisState)
|
||||
}
|
||||
|
||||
for _, authority := range data.Authorities {
|
||||
//Only import authorities that are marked active.
|
||||
// Only import authorities that are marked active.
|
||||
if authority.Entry.Status == types.AuthorityActive {
|
||||
keeper.SetNameAuthority(ctx, authority.Name, authority.Entry)
|
||||
|
||||
|
@ -7,11 +7,10 @@ import (
|
||||
"encoding/gob"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"sort"
|
||||
|
||||
wnsUtils "github.com/cerc-io/laconicd/utils"
|
||||
set "github.com/deckarep/golang-set"
|
||||
|
||||
"sort"
|
||||
)
|
||||
|
||||
func StringToBytes(val string) []byte {
|
||||
@ -62,7 +61,6 @@ func MarshalMapToJSONBytes(val map[string]interface{}) (bytes []byte) {
|
||||
func UnMarshalMapFromJSONBytes(bytes []byte) map[string]interface{} {
|
||||
var val map[string]interface{}
|
||||
err := json.Unmarshal(bytes, &val)
|
||||
|
||||
if err != nil {
|
||||
panic("Marshal error.")
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ func (suite *KeeperTestSuite) TestGrpcQueryNameserviceModuleBalance() {
|
||||
func (suite *KeeperTestSuite) TestGrpcQueryWhoIS() {
|
||||
grpcClient, ctx := suite.queryClient, suite.ctx
|
||||
sr := suite.Require()
|
||||
var authorityName = "TestGrpcQueryWhoIS"
|
||||
authorityName := "TestGrpcQueryWhoIS"
|
||||
|
||||
testCases := []struct {
|
||||
msg string
|
||||
|
@ -73,7 +73,8 @@ type Keeper struct {
|
||||
|
||||
// NewKeeper creates new instances of the nameservice Keeper
|
||||
func NewKeeper(cdc codec.BinaryCodec, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, recordKeeper RecordKeeper,
|
||||
bondKeeper bondkeeper.Keeper, auctionKeeper auctionkeeper.Keeper, storeKey storetypes.StoreKey, ps paramtypes.Subspace) Keeper {
|
||||
bondKeeper bondkeeper.Keeper, auctionKeeper auctionkeeper.Keeper, storeKey storetypes.StoreKey, ps paramtypes.Subspace,
|
||||
) Keeper {
|
||||
// set KeyTable if it has not already been set
|
||||
if !ps.HasKeyTable() {
|
||||
ps = ps.WithKeyTable(types.ParamKeyTable())
|
||||
@ -295,7 +296,6 @@ func (k Keeper) GetRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Ti
|
||||
// InsertRecordExpiryQueue inserts a record CID to the appropriate timeslice in the record expiry queue.
|
||||
func (k Keeper) InsertRecordExpiryQueue(ctx sdk.Context, val types.Record) {
|
||||
expiryTime, err := time.Parse(time.RFC3339, val.ExpiryTime)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -308,7 +308,6 @@ func (k Keeper) InsertRecordExpiryQueue(ctx sdk.Context, val types.Record) {
|
||||
// DeleteRecordExpiryQueue deletes a record CID from the record expiry queue.
|
||||
func (k Keeper) DeleteRecordExpiryQueue(ctx sdk.Context, record types.Record) {
|
||||
expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -344,7 +343,6 @@ func (k Keeper) GetAllExpiredRecords(ctx sdk.Context, currTime time.Time) (expir
|
||||
|
||||
for ; itr.Valid(); itr.Next() {
|
||||
timeslice, err := helpers.BytesArrToStringArr(itr.Value())
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -426,7 +424,6 @@ func recordObjToRecord(store sdk.KVStore, codec codec.BinaryCodec, record types.
|
||||
|
||||
if store.Has(reverseNameIndexKey) {
|
||||
names, err := helpers.BytesArrToStringArr(store.Get(reverseNameIndexKey))
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -17,9 +17,7 @@ import (
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
)
|
||||
|
||||
var (
|
||||
seed = int64(233)
|
||||
)
|
||||
var seed = int64(233)
|
||||
|
||||
type KeeperTestSuite struct {
|
||||
suite.Suite
|
||||
|
@ -51,6 +51,7 @@ func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types
|
||||
return &types.MsgSetRecordResponse{Id: record.Id}, nil
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.MsgSetNameResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
@ -107,6 +108,7 @@ func (m msgServer) ReserveName(c context.Context, msg *types.MsgReserveAuthority
|
||||
return &types.MsgReserveAuthorityResponse{}, nil
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (m msgServer) SetAuthorityBond(c context.Context, msg *types.MsgSetAuthorityBond) (*types.MsgSetAuthorityBondResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
@ -180,6 +182,7 @@ func (m msgServer) RenewRecord(c context.Context, msg *types.MsgRenewRecord) (*t
|
||||
return &types.MsgRenewRecordResponse{}, nil
|
||||
}
|
||||
|
||||
//nolint: all
|
||||
func (m msgServer) AssociateBond(c context.Context, msg *types.MsgAssociateBond) (*types.MsgAssociateBondResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
|
@ -653,7 +653,6 @@ func (k Keeper) GetAllExpiredAuthorities(ctx sdk.Context, currTime time.Time) (e
|
||||
for ; itr.Valid(); itr.Next() {
|
||||
timeslice := []string{}
|
||||
timeslice, err := helpers.BytesArrToStringArr(itr.Value())
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -89,8 +89,10 @@ func (k RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionID string)
|
||||
}
|
||||
|
||||
// Record keeper implements the bond usage keeper interface.
|
||||
var _ bondtypes.BondUsageKeeper = (*RecordKeeper)(nil)
|
||||
var _ auctiontypes.AuctionUsageKeeper = (*RecordKeeper)(nil)
|
||||
var (
|
||||
_ bondtypes.BondUsageKeeper = (*RecordKeeper)(nil)
|
||||
_ auctiontypes.AuctionUsageKeeper = (*RecordKeeper)(nil)
|
||||
)
|
||||
|
||||
// ModuleName returns the module name.
|
||||
func (k RecordKeeper) ModuleName() string {
|
||||
@ -162,7 +164,6 @@ func (k Keeper) ProcessRenewRecord(ctx sdk.Context, msg types.MsgRenewRecord) er
|
||||
// Check if renewal is required (i.e. expired record marked as deleted).
|
||||
record := k.GetRecord(ctx, msg.RecordId)
|
||||
expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -182,7 +183,6 @@ func (k Keeper) ProcessRenewRecord(ctx sdk.Context, msg types.MsgRenewRecord) er
|
||||
|
||||
// ProcessAssociateBond associates a record with a bond.
|
||||
func (k Keeper) ProcessAssociateBond(ctx sdk.Context, msg types.MsgAssociateBond) error {
|
||||
|
||||
if !k.HasRecord(ctx, msg.RecordId) {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Record not found.")
|
||||
}
|
||||
|
@ -106,7 +106,6 @@ func (am AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier {
|
||||
}
|
||||
|
||||
func (am AppModule) RegisterServices(cfg module.Configurator) {
|
||||
|
||||
querier := keeper.Querier{Keeper: am.keeper}
|
||||
types.RegisterQueryServer(cfg.QueryServer(), querier)
|
||||
|
||||
|
@ -31,7 +31,6 @@ func (msg MsgSetName) Type() string { return "set-name" }
|
||||
|
||||
// ValidateBasic Implements Msg.
|
||||
func (msg MsgSetName) ValidateBasic() error {
|
||||
|
||||
if msg.Crn == "" {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "CRN is required.")
|
||||
}
|
||||
@ -76,7 +75,6 @@ func (msg MsgReserveAuthority) Type() string { return "reserve-authority" }
|
||||
|
||||
// ValidateBasic Implements Msg.
|
||||
func (msg MsgReserveAuthority) ValidateBasic() error {
|
||||
|
||||
if len(msg.Name) == 0 {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "name is required.")
|
||||
}
|
||||
|
@ -3,9 +3,10 @@ package types
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Default parameter values.
|
||||
@ -75,8 +76,8 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
|
||||
func NewParams(recordRent sdk.Coin, recordRentDuration time.Duration,
|
||||
authorityRent sdk.Coin, authorityRentDuration time.Duration, authorityGracePeriod time.Duration,
|
||||
authorityAuctionEnabled bool, commitsDuration time.Duration, revealsDuration time.Duration,
|
||||
commitFee sdk.Coin, revealFee sdk.Coin, minimumBid sdk.Coin) Params {
|
||||
|
||||
commitFee sdk.Coin, revealFee sdk.Coin, minimumBid sdk.Coin,
|
||||
) Params {
|
||||
return Params{
|
||||
RecordRent: recordRent,
|
||||
RecordRentDuration: recordRentDuration,
|
||||
|
@ -22,7 +22,7 @@ type PayloadType struct {
|
||||
// ToPayload converts PayloadType to Payload object.
|
||||
// Why? Because go-amino can't handle maps: https://github.com/tendermint/go-amino/issues/4.
|
||||
func (payloadObj *PayloadType) ToPayload() Payload {
|
||||
var payload = Payload{
|
||||
payload := Payload{
|
||||
Record: &Record{
|
||||
Deleted: false,
|
||||
Owners: nil,
|
||||
|
Loading…
Reference in New Issue
Block a user