Compare commits
1 Commits
main
...
zach/prefi
Author | SHA1 | Date | |
---|---|---|---|
|
a93e67b206 |
@ -8,6 +8,7 @@ linters:
|
|||||||
- bodyclose
|
- bodyclose
|
||||||
# - depguard # 20231120 disable until https://github.com/golangci/golangci-lint/issues/3906 is released
|
# - depguard # 20231120 disable until https://github.com/golangci/golangci-lint/issues/3906 is released
|
||||||
- dogsled
|
- dogsled
|
||||||
|
- dupl
|
||||||
- errcheck
|
- errcheck
|
||||||
- goconst
|
- goconst
|
||||||
- gocritic
|
- gocritic
|
||||||
|
2
Makefile
2
Makefile
@ -337,7 +337,7 @@ test-import:
|
|||||||
go test -run TestImporterTestSuite -timeout=20m -v --vet=off github.com/cerc-io/laconicd/tests/importer
|
go test -run TestImporterTestSuite -timeout=20m -v --vet=off github.com/cerc-io/laconicd/tests/importer
|
||||||
|
|
||||||
test-rpc:
|
test-rpc:
|
||||||
./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 10 -m "rpc" -r "true"
|
./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 2 -m "rpc" -r "true"
|
||||||
|
|
||||||
run-integration-tests:
|
run-integration-tests:
|
||||||
@nix-shell ./tests/integration_tests/shell.nix --run ./scripts/run-integration-tests.sh
|
@nix-shell ./tests/integration_tests/shell.nix --run ./scripts/run-integration-tests.sh
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Bech32Prefix defines the Bech32 prefix used for EthAccounts
|
// Bech32Prefix defines the Bech32 prefix used for EthAccounts
|
||||||
Bech32Prefix = "ethm"
|
Bech32Prefix = "laconic"
|
||||||
|
|
||||||
// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
|
// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
|
||||||
Bech32PrefixAccAddr = Bech32Prefix
|
Bech32PrefixAccAddr = Bech32Prefix
|
||||||
|
11
init.sh
11
init.sh
@ -100,17 +100,6 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
|
|||||||
$HOME/.laconicd/config/config.toml
|
$HOME/.laconicd/config/config.toml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable telemetry (prometheus metrics: http://localhost:1317/metrics?format=prometheus)
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
||||||
sed -i '' 's/enabled = false/enabled = true/g' $HOME/.laconicd/config/app.toml
|
|
||||||
sed -i '' 's/prometheus-retention-time = 0/prometheus-retention-time = 60/g' $HOME/.laconicd/config/app.toml
|
|
||||||
sed -i '' 's/prometheus = false/prometheus = true/g' $HOME/.laconicd/config/config.toml
|
|
||||||
else
|
|
||||||
sed -i 's/enabled = false/enabled = true/g' $HOME/.laconicd/config/app.toml
|
|
||||||
sed -i 's/prometheus-retention-time = 0/prometheus-retention-time = 60/g' $HOME/.laconicd/config/app.toml
|
|
||||||
sed -i 's/prometheus = false/prometheus = true/g' $HOME/.laconicd/config/config.toml
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Allocate genesis accounts (cosmos formatted addresses)
|
# Allocate genesis accounts (cosmos formatted addresses)
|
||||||
laconicd add-genesis-account $KEY 100000000000000000000000000aphoton --keyring-backend $KEYRING
|
laconicd add-genesis-account $KEY 100000000000000000000000000aphoton --keyring-backend $KEYRING
|
||||||
|
|
||||||
|
@ -94,10 +94,11 @@ func (s *websocketsServer) Start() {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
var err error
|
var err error
|
||||||
|
/* #nosec G114 -- http functions have no support for timeouts */
|
||||||
if s.certFile == "" || s.keyFile == "" {
|
if s.certFile == "" || s.keyFile == "" {
|
||||||
err = http.ListenAndServe(s.wsAddr, ws) /* #nosec G114 -- http functions have no support for timeouts */
|
err = http.ListenAndServe(s.wsAddr, ws)
|
||||||
} else {
|
} else {
|
||||||
err = http.ListenAndServeTLS(s.wsAddr, s.certFile, s.keyFile, ws) // #nosec G114
|
err = http.ListenAndServeTLS(s.wsAddr, s.certFile, s.keyFile, ws)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
##
|
##
|
||||||
## Example:
|
## Example:
|
||||||
##
|
##
|
||||||
## $ scripts/create-and-fund-account.sh 1000000000
|
## ❯ scripts/create-and-fund-account.sh 1000000000
|
||||||
## {
|
## {
|
||||||
## "name": "68334d7175fd4f86befa4902657e5270",
|
## "name": "68334d7175fd4f86befa4902657e5270",
|
||||||
## "type": "local",
|
## "type": "local",
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package utils
|
|
||||||
|
|
||||||
import (
|
|
||||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
func CtxWithCustomKVGasConfig(ctx *sdk.Context) *sdk.Context {
|
|
||||||
updatedCtx := ctx.WithKVGasConfig(storetypes.GasConfig{
|
|
||||||
HasCost: 0,
|
|
||||||
DeleteCost: 0,
|
|
||||||
ReadCostFlat: 0,
|
|
||||||
ReadCostPerByte: 0,
|
|
||||||
WriteCostFlat: 0,
|
|
||||||
WriteCostPerByte: 0,
|
|
||||||
IterNextCostFlat: 0,
|
|
||||||
})
|
|
||||||
|
|
||||||
return &updatedCtx
|
|
||||||
}
|
|
@ -15,7 +15,6 @@ import (
|
|||||||
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||||
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
||||||
params "github.com/cosmos/cosmos-sdk/x/params/types"
|
params "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||||
"github.com/tendermint/tendermint/libs/log"
|
|
||||||
|
|
||||||
wnsUtils "github.com/cerc-io/laconicd/utils"
|
wnsUtils "github.com/cerc-io/laconicd/utils"
|
||||||
)
|
)
|
||||||
@ -79,11 +78,6 @@ func NewKeeper(accountKeeper auth.AccountKeeper,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logger returns a module-specific logger.
|
|
||||||
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
|
||||||
return ctx.Logger().With("module", types.ModuleName)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (k *Keeper) SetUsageKeepers(usageKeepers []types.AuctionUsageKeeper) {
|
func (k *Keeper) SetUsageKeepers(usageKeepers []types.AuctionUsageKeeper) {
|
||||||
k.usageKeepers = usageKeepers
|
k.usageKeepers = usageKeepers
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,9 @@ package keeper
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/utils"
|
|
||||||
"github.com/cerc-io/laconicd/x/auction/types"
|
"github.com/cerc-io/laconicd/x/auction/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -22,7 +20,6 @@ var _ types.MsgServer = msgServer{}
|
|||||||
|
|
||||||
func (s msgServer) CreateAuction(c context.Context, msg *types.MsgCreateAuction) (*types.MsgCreateAuctionResponse, error) {
|
func (s msgServer) CreateAuction(c context.Context, msg *types.MsgCreateAuction) (*types.MsgCreateAuctionResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -49,15 +46,13 @@ func (s msgServer) CreateAuction(c context.Context, msg *types.MsgCreateAuction)
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
s.logTxGasConsumed(ctx, "CreateAuction")
|
|
||||||
|
|
||||||
return &types.MsgCreateAuctionResponse{Auction: resp}, nil
|
return &types.MsgCreateAuctionResponse{Auction: resp}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommitBid is the command for committing a bid
|
// CommitBid is the command for committing a bid
|
||||||
|
//nolint: all
|
||||||
func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types.MsgCommitBidResponse, error) {
|
func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types.MsgCommitBidResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -82,15 +77,13 @@ func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
s.logTxGasConsumed(ctx, "CommitBid")
|
|
||||||
|
|
||||||
return &types.MsgCommitBidResponse{Bid: resp}, nil
|
return &types.MsgCommitBidResponse{Bid: resp}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RevealBid is the command for revealing a bid
|
//RevealBid is the command for revealing a bid
|
||||||
|
//nolint: all
|
||||||
func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types.MsgRevealBidResponse, error) {
|
func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types.MsgRevealBidResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -115,12 +108,5 @@ func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
s.logTxGasConsumed(ctx, "RevealBid")
|
|
||||||
|
|
||||||
return &types.MsgRevealBidResponse{Auction: resp}, nil
|
return &types.MsgRevealBidResponse{Auction: resp}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s msgServer) logTxGasConsumed(ctx sdk.Context, tx string) {
|
|
||||||
gasConsumed := ctx.GasMeter().GasConsumed()
|
|
||||||
s.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed))
|
|
||||||
}
|
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||||
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
||||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||||
"github.com/tendermint/tendermint/libs/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// prefixIDToBondIndex is the prefix for ID -> Bond index in the KVStore.
|
// prefixIDToBondIndex is the prefix for ID -> Bond index in the KVStore.
|
||||||
@ -63,11 +62,6 @@ func NewKeeper(cdc codec.BinaryCodec,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logger returns a module-specific logger.
|
|
||||||
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
|
||||||
return ctx.Logger().With("module", types.ModuleName)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generates Bond ID -> Bond index key.
|
// Generates Bond ID -> Bond index key.
|
||||||
func getBondIndexKey(id string) []byte {
|
func getBondIndexKey(id string) []byte {
|
||||||
return append(prefixIDToBondIndex, []byte(id)...)
|
return append(prefixIDToBondIndex, []byte(id)...)
|
||||||
|
@ -2,12 +2,9 @@ package keeper
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/utils"
|
|
||||||
"github.com/cerc-io/laconicd/x/bond/types"
|
"github.com/cerc-io/laconicd/x/bond/types"
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type msgServer struct {
|
type msgServer struct {
|
||||||
@ -23,8 +20,6 @@ var _ types.MsgServer = msgServer{}
|
|||||||
|
|
||||||
func (k msgServer) CreateBond(c context.Context, msg *types.MsgCreateBond) (*types.MsgCreateBondResponse, error) {
|
func (k msgServer) CreateBond(c context.Context, msg *types.MsgCreateBond) (*types.MsgCreateBondResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -47,15 +42,12 @@ func (k msgServer) CreateBond(c context.Context, msg *types.MsgCreateBond) (*typ
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
k.logTxGasConsumed(ctx, "CreateBond")
|
|
||||||
|
|
||||||
return &types.MsgCreateBondResponse{}, nil
|
return &types.MsgCreateBondResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint: all
|
||||||
func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*types.MsgRefillBondResponse, error) {
|
func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*types.MsgRefillBondResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -80,15 +72,12 @@ func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*typ
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
k.logTxGasConsumed(ctx, "RefillBond")
|
|
||||||
|
|
||||||
return &types.MsgRefillBondResponse{}, nil
|
return &types.MsgRefillBondResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint: all
|
||||||
func (k msgServer) WithdrawBond(c context.Context, msg *types.MsgWithdrawBond) (*types.MsgWithdrawBondResponse, error) {
|
func (k msgServer) WithdrawBond(c context.Context, msg *types.MsgWithdrawBond) (*types.MsgWithdrawBondResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -113,15 +102,11 @@ func (k msgServer) WithdrawBond(c context.Context, msg *types.MsgWithdrawBond) (
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
k.logTxGasConsumed(ctx, "WithdrawBond")
|
|
||||||
|
|
||||||
return &types.MsgWithdrawBondResponse{}, nil
|
return &types.MsgWithdrawBondResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k msgServer) CancelBond(c context.Context, msg *types.MsgCancelBond) (*types.MsgCancelBondResponse, error) {
|
func (k msgServer) CancelBond(c context.Context, msg *types.MsgCancelBond) (*types.MsgCancelBondResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -144,12 +129,5 @@ func (k msgServer) CancelBond(c context.Context, msg *types.MsgCancelBond) (*typ
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
k.logTxGasConsumed(ctx, "CancelBond")
|
|
||||||
|
|
||||||
return &types.MsgCancelBondResponse{}, nil
|
return &types.MsgCancelBondResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k msgServer) logTxGasConsumed(ctx sdk.Context, tx string) {
|
|
||||||
gasConsumed := ctx.GasMeter().GasConsumed()
|
|
||||||
k.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed))
|
|
||||||
}
|
|
||||||
|
@ -32,10 +32,11 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// #nosec 101
|
||||||
const (
|
const (
|
||||||
OpWeightMsgEthSimpleTransfer = "op_weight_msg_eth_simple_transfer" // #nosec G101
|
OpWeightMsgEthSimpleTransfer = "op_weight_msg_eth_simple_transfer"
|
||||||
OpWeightMsgEthCreateContract = "op_weight_msg_eth_create_contract" // #nosec G101
|
OpWeightMsgEthCreateContract = "op_weight_msg_eth_create_contract"
|
||||||
OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract" // #nosec G101
|
OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2,12 +2,9 @@ package keeper
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/utils"
|
|
||||||
"github.com/cerc-io/laconicd/x/registry/types"
|
"github.com/cerc-io/laconicd/x/registry/types"
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type msgServer struct {
|
type msgServer struct {
|
||||||
@ -23,8 +20,6 @@ var _ types.MsgServer = msgServer{}
|
|||||||
|
|
||||||
func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types.MsgSetRecordResponse, error) {
|
func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types.MsgSetRecordResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -49,15 +44,12 @@ func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
m.logTxGasConsumed(ctx, "SetRecord")
|
|
||||||
|
|
||||||
return &types.MsgSetRecordResponse{Id: record.ID}, nil
|
return &types.MsgSetRecordResponse{Id: record.ID}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint: all
|
||||||
func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.MsgSetNameResponse, error) {
|
func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.MsgSetNameResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -79,16 +71,11 @@ func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.Msg
|
|||||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
m.logTxGasConsumed(ctx, "SetName")
|
|
||||||
|
|
||||||
return &types.MsgSetNameResponse{}, nil
|
return &types.MsgSetNameResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m msgServer) ReserveName(c context.Context, msg *types.MsgReserveAuthority) (*types.MsgReserveAuthorityResponse, error) {
|
func (m msgServer) ReserveName(c context.Context, msg *types.MsgReserveAuthority) (*types.MsgReserveAuthorityResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -114,16 +101,12 @@ func (m msgServer) ReserveName(c context.Context, msg *types.MsgReserveAuthority
|
|||||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
m.logTxGasConsumed(ctx, "ReserveName")
|
|
||||||
|
|
||||||
return &types.MsgReserveAuthorityResponse{}, nil
|
return &types.MsgReserveAuthorityResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint: all
|
||||||
func (m msgServer) SetAuthorityBond(c context.Context, msg *types.MsgSetAuthorityBond) (*types.MsgSetAuthorityBondResponse, error) {
|
func (m msgServer) SetAuthorityBond(c context.Context, msg *types.MsgSetAuthorityBond) (*types.MsgSetAuthorityBondResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -145,16 +128,11 @@ func (m msgServer) SetAuthorityBond(c context.Context, msg *types.MsgSetAuthorit
|
|||||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
m.logTxGasConsumed(ctx, "SetAuthorityBond")
|
|
||||||
|
|
||||||
return &types.MsgSetAuthorityBondResponse{}, nil
|
return &types.MsgSetAuthorityBondResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m msgServer) DeleteName(c context.Context, msg *types.MsgDeleteNameAuthority) (*types.MsgDeleteNameAuthorityResponse, error) {
|
func (m msgServer) DeleteName(c context.Context, msg *types.MsgDeleteNameAuthority) (*types.MsgDeleteNameAuthorityResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -175,16 +153,11 @@ func (m msgServer) DeleteName(c context.Context, msg *types.MsgDeleteNameAuthori
|
|||||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
m.logTxGasConsumed(ctx, "DeleteName")
|
|
||||||
|
|
||||||
return &types.MsgDeleteNameAuthorityResponse{}, nil
|
return &types.MsgDeleteNameAuthorityResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m msgServer) RenewRecord(c context.Context, msg *types.MsgRenewRecord) (*types.MsgRenewRecordResponse, error) {
|
func (m msgServer) RenewRecord(c context.Context, msg *types.MsgRenewRecord) (*types.MsgRenewRecordResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -205,16 +178,12 @@ func (m msgServer) RenewRecord(c context.Context, msg *types.MsgRenewRecord) (*t
|
|||||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
m.logTxGasConsumed(ctx, "RenewRecord")
|
|
||||||
|
|
||||||
return &types.MsgRenewRecordResponse{}, nil
|
return &types.MsgRenewRecordResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint: all
|
||||||
func (m msgServer) AssociateBond(c context.Context, msg *types.MsgAssociateBond) (*types.MsgAssociateBondResponse, error) {
|
func (m msgServer) AssociateBond(c context.Context, msg *types.MsgAssociateBond) (*types.MsgAssociateBondResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -237,16 +206,11 @@ func (m msgServer) AssociateBond(c context.Context, msg *types.MsgAssociateBond)
|
|||||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
m.logTxGasConsumed(ctx, "AssociateBond")
|
|
||||||
|
|
||||||
return &types.MsgAssociateBondResponse{}, nil
|
return &types.MsgAssociateBondResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m msgServer) DissociateBond(c context.Context, msg *types.MsgDissociateBond) (*types.MsgDissociateBondResponse, error) {
|
func (m msgServer) DissociateBond(c context.Context, msg *types.MsgDissociateBond) (*types.MsgDissociateBondResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -267,16 +231,11 @@ func (m msgServer) DissociateBond(c context.Context, msg *types.MsgDissociateBon
|
|||||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
m.logTxGasConsumed(ctx, "DissociateBond")
|
|
||||||
|
|
||||||
return &types.MsgDissociateBondResponse{}, nil
|
return &types.MsgDissociateBondResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m msgServer) DissociateRecords(c context.Context, msg *types.MsgDissociateRecords) (*types.MsgDissociateRecordsResponse, error) {
|
func (m msgServer) DissociateRecords(c context.Context, msg *types.MsgDissociateRecords) (*types.MsgDissociateRecordsResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -297,16 +256,11 @@ func (m msgServer) DissociateRecords(c context.Context, msg *types.MsgDissociate
|
|||||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
m.logTxGasConsumed(ctx, "DissociateRecords")
|
|
||||||
|
|
||||||
return &types.MsgDissociateRecordsResponse{}, nil
|
return &types.MsgDissociateRecordsResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m msgServer) ReAssociateRecords(c context.Context, msg *types.MsgReAssociateRecords) (*types.MsgReAssociateRecordsResponse, error) { //nolint: all
|
func (m msgServer) ReAssociateRecords(c context.Context, msg *types.MsgReAssociateRecords) (*types.MsgReAssociateRecordsResponse, error) { //nolint: all
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
|
|
||||||
|
|
||||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -328,13 +282,5 @@ func (m msgServer) ReAssociateRecords(c context.Context, msg *types.MsgReAssocia
|
|||||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
m.logTxGasConsumed(ctx, "ReAssociateRecords")
|
|
||||||
|
|
||||||
return &types.MsgReAssociateRecordsResponse{}, nil
|
return &types.MsgReAssociateRecordsResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m msgServer) logTxGasConsumed(ctx sdk.Context, tx string) {
|
|
||||||
gasConsumed := ctx.GasMeter().GasConsumed()
|
|
||||||
m.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed))
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user