forked from cerc-io/laconicd-deprecated
chore: Gofumpt (#1298)
* fumpt * golangci * Update keeper_test.go * Update keeper_test.go * Update handler_test.go * Update rpc_pending_test.go * lll * line length limits * Update CHANGELOG.md
This commit is contained in:
+31
-5
@@ -57,7 +57,12 @@ var apiCreators map[string]APICreator
|
||||
|
||||
func init() {
|
||||
apiCreators = map[string]APICreator{
|
||||
EthNamespace: func(ctx *server.Context, clientCtx client.Context, tmWSClient *rpcclient.WSClient, allowUnprotectedTxs bool, indexer ethermint.EVMTxIndexer) []rpc.API {
|
||||
EthNamespace: func(ctx *server.Context,
|
||||
clientCtx client.Context,
|
||||
tmWSClient *rpcclient.WSClient,
|
||||
allowUnprotectedTxs bool,
|
||||
indexer ethermint.EVMTxIndexer,
|
||||
) []rpc.API {
|
||||
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
|
||||
return []rpc.API{
|
||||
{
|
||||
@@ -94,7 +99,12 @@ func init() {
|
||||
},
|
||||
}
|
||||
},
|
||||
PersonalNamespace: func(ctx *server.Context, clientCtx client.Context, _ *rpcclient.WSClient, allowUnprotectedTxs bool, indexer ethermint.EVMTxIndexer) []rpc.API {
|
||||
PersonalNamespace: func(ctx *server.Context,
|
||||
clientCtx client.Context,
|
||||
_ *rpcclient.WSClient,
|
||||
allowUnprotectedTxs bool,
|
||||
indexer ethermint.EVMTxIndexer,
|
||||
) []rpc.API {
|
||||
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
|
||||
return []rpc.API{
|
||||
{
|
||||
@@ -115,7 +125,12 @@ func init() {
|
||||
},
|
||||
}
|
||||
},
|
||||
DebugNamespace: func(ctx *server.Context, clientCtx client.Context, _ *rpcclient.WSClient, allowUnprotectedTxs bool, indexer ethermint.EVMTxIndexer) []rpc.API {
|
||||
DebugNamespace: func(ctx *server.Context,
|
||||
clientCtx client.Context,
|
||||
_ *rpcclient.WSClient,
|
||||
allowUnprotectedTxs bool,
|
||||
indexer ethermint.EVMTxIndexer,
|
||||
) []rpc.API {
|
||||
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
|
||||
return []rpc.API{
|
||||
{
|
||||
@@ -126,7 +141,12 @@ func init() {
|
||||
},
|
||||
}
|
||||
},
|
||||
MinerNamespace: func(ctx *server.Context, clientCtx client.Context, _ *rpcclient.WSClient, allowUnprotectedTxs bool, indexer ethermint.EVMTxIndexer) []rpc.API {
|
||||
MinerNamespace: func(ctx *server.Context,
|
||||
clientCtx client.Context,
|
||||
_ *rpcclient.WSClient,
|
||||
allowUnprotectedTxs bool,
|
||||
indexer ethermint.EVMTxIndexer,
|
||||
) []rpc.API {
|
||||
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
|
||||
return []rpc.API{
|
||||
{
|
||||
@@ -141,7 +161,13 @@ func init() {
|
||||
}
|
||||
|
||||
// GetRPCAPIs returns the list of all APIs
|
||||
func GetRPCAPIs(ctx *server.Context, clientCtx client.Context, tmWSClient *rpcclient.WSClient, allowUnprotectedTxs bool, indexer ethermint.EVMTxIndexer, selectedAPIs []string) []rpc.API {
|
||||
func GetRPCAPIs(ctx *server.Context,
|
||||
clientCtx client.Context,
|
||||
tmWSClient *rpcclient.WSClient,
|
||||
allowUnprotectedTxs bool,
|
||||
indexer ethermint.EVMTxIndexer,
|
||||
selectedAPIs []string,
|
||||
) []rpc.API {
|
||||
var apis []rpc.API
|
||||
|
||||
for _, ns := range selectedAPIs {
|
||||
|
||||
@@ -35,7 +35,10 @@ func (b *Backend) GetCode(address common.Address, blockNrOrHash rpctypes.BlockNu
|
||||
}
|
||||
|
||||
// GetProof returns an account object with proof and any storage proofs
|
||||
func (b *Backend) GetProof(address common.Address, storageKeys []string, blockNrOrHash rpctypes.BlockNumberOrHash) (*rpctypes.AccountResult, error) {
|
||||
func (b *Backend) GetProof(address common.Address,
|
||||
storageKeys []string,
|
||||
blockNrOrHash rpctypes.BlockNumberOrHash,
|
||||
) (*rpctypes.AccountResult, error) {
|
||||
blockNum, err := b.GetBlockNumber(blockNrOrHash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -196,7 +196,6 @@ func (b *Backend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Transac
|
||||
if args.MaxFeePerGas.ToInt().Cmp(args.MaxPriorityFeePerGas.ToInt()) < 0 {
|
||||
return args, fmt.Errorf("maxFeePerGas (%v) < maxPriorityFeePerGas (%v)", args.MaxFeePerGas, args.MaxPriorityFeePerGas)
|
||||
}
|
||||
|
||||
} else {
|
||||
if args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil {
|
||||
return args, errors.New("maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet")
|
||||
|
||||
@@ -233,7 +233,12 @@ func (b *Backend) ListAccounts() ([]common.Address, error) {
|
||||
}
|
||||
|
||||
// NewAccount will create a new account and returns the address for the new account.
|
||||
func (b *Backend) NewMnemonic(uid string, language keyring.Language, hdPath, bip39Passphrase string, algo keyring.SignatureAlgo) (*keyring.Record, error) {
|
||||
func (b *Backend) NewMnemonic(uid string,
|
||||
language keyring.Language,
|
||||
hdPath,
|
||||
bip39Passphrase string,
|
||||
algo keyring.SignatureAlgo,
|
||||
) (*keyring.Record, error) {
|
||||
info, _, err := b.clientCtx.Keyring.NewMnemonic(uid, keyring.English, bip39Passphrase, bip39Passphrase, algo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -113,7 +113,10 @@ func (b *Backend) TraceTransaction(hash common.Hash, config *evmtypes.TraceConfi
|
||||
// traceBlock configures a new tracer according to the provided configuration, and
|
||||
// executes all the transactions contained within. The return value will be one item
|
||||
// per transaction, dependent on the requested tracer.
|
||||
func (b *Backend) TraceBlock(height rpctypes.BlockNumber, config *evmtypes.TraceConfig, block *tmrpctypes.ResultBlock) ([]*evmtypes.TxTraceResult, error) {
|
||||
func (b *Backend) TraceBlock(height rpctypes.BlockNumber,
|
||||
config *evmtypes.TraceConfig,
|
||||
block *tmrpctypes.ResultBlock,
|
||||
) ([]*evmtypes.TxTraceResult, error) {
|
||||
txs := block.Block.Txs
|
||||
txsLength := len(txs)
|
||||
|
||||
|
||||
@@ -269,7 +269,10 @@ func (e *PublicAPI) GetCode(address common.Address, blockNrOrHash rpctypes.Block
|
||||
}
|
||||
|
||||
// GetProof returns an account object with proof and any storage proofs
|
||||
func (e *PublicAPI) GetProof(address common.Address, storageKeys []string, blockNrOrHash rpctypes.BlockNumberOrHash) (*rpctypes.AccountResult, error) {
|
||||
func (e *PublicAPI) GetProof(address common.Address,
|
||||
storageKeys []string,
|
||||
blockNrOrHash rpctypes.BlockNumberOrHash,
|
||||
) (*rpctypes.AccountResult, error) {
|
||||
e.logger.Debug("eth_getProof", "address", address.Hex(), "keys", storageKeys, "block number or hash", blockNrOrHash)
|
||||
return e.backend.GetProof(address, storageKeys, blockNrOrHash)
|
||||
}
|
||||
@@ -279,7 +282,10 @@ func (e *PublicAPI) GetProof(address common.Address, storageKeys []string, block
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Call performs a raw contract call.
|
||||
func (e *PublicAPI) Call(args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, _ *rpctypes.StateOverride) (hexutil.Bytes, error) {
|
||||
func (e *PublicAPI) Call(args evmtypes.TransactionArgs,
|
||||
blockNrOrHash rpctypes.BlockNumberOrHash,
|
||||
_ *rpctypes.StateOverride,
|
||||
) (hexutil.Bytes, error) {
|
||||
e.logger.Debug("eth_call", "args", args.String(), "block number or hash", blockNrOrHash)
|
||||
|
||||
blockNum, err := e.backend.GetBlockNumber(blockNrOrHash)
|
||||
@@ -345,7 +351,10 @@ func (e *PublicAPI) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *
|
||||
return e.backend.EstimateGas(args, blockNrOptional)
|
||||
}
|
||||
|
||||
func (e *PublicAPI) FeeHistory(blockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*rpctypes.FeeHistoryResult, error) {
|
||||
func (e *PublicAPI) FeeHistory(blockCount rpc.DecimalOrHex,
|
||||
lastBlock rpc.BlockNumber,
|
||||
rewardPercentiles []float64,
|
||||
) (*rpctypes.FeeHistoryResult, error) {
|
||||
e.logger.Debug("eth_feeHistory")
|
||||
return e.backend.FeeHistory(blockCount, lastBlock, rewardPercentiles)
|
||||
}
|
||||
@@ -499,7 +508,11 @@ func (e *PublicAPI) FillTransaction(args evmtypes.TransactionArgs) (*rpctypes.Si
|
||||
|
||||
// Resend accepts an existing transaction and a new gas price and limit. It will remove
|
||||
// the given transaction from the pool and reinsert it with the new gas price and limit.
|
||||
func (e *PublicAPI) Resend(_ context.Context, args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error) {
|
||||
func (e *PublicAPI) Resend(_ context.Context,
|
||||
args evmtypes.TransactionArgs,
|
||||
gasPrice *hexutil.Big,
|
||||
gasLimit *hexutil.Uint64,
|
||||
) (common.Hash, error) {
|
||||
e.logger.Debug("eth_resend", "args", args.String())
|
||||
return e.backend.Resend(args, gasPrice, gasLimit)
|
||||
}
|
||||
|
||||
@@ -136,7 +136,12 @@ func (api *PublicFilterAPI) NewPendingTransactionFilter() rpc.ID {
|
||||
return rpc.ID(fmt.Sprintf("error creating pending tx filter: %s", err.Error()))
|
||||
}
|
||||
|
||||
api.filters[pendingTxSub.ID()] = &filter{typ: filters.PendingTransactionsSubscription, deadline: time.NewTimer(deadline), hashes: make([]common.Hash, 0), s: pendingTxSub}
|
||||
api.filters[pendingTxSub.ID()] = &filter{
|
||||
typ: filters.PendingTransactionsSubscription,
|
||||
deadline: time.NewTimer(deadline),
|
||||
hashes: make([]common.Hash, 0),
|
||||
s: pendingTxSub,
|
||||
}
|
||||
|
||||
go func(txsCh <-chan coretypes.ResultEvent, errCh <-chan error) {
|
||||
defer cancelSubs()
|
||||
@@ -455,7 +460,13 @@ func (api *PublicFilterAPI) NewFilter(criteria filters.FilterCriteria) (rpc.ID,
|
||||
|
||||
filterID = logsSub.ID()
|
||||
|
||||
api.filters[filterID] = &filter{typ: filters.LogsSubscription, crit: criteria, deadline: time.NewTimer(deadline), hashes: []common.Hash{}, s: logsSub}
|
||||
api.filters[filterID] = &filter{
|
||||
typ: filters.LogsSubscription,
|
||||
crit: criteria,
|
||||
deadline: time.NewTimer(deadline),
|
||||
hashes: []common.Hash{},
|
||||
s: logsSub,
|
||||
}
|
||||
|
||||
go func(eventCh <-chan coretypes.ResultEvent) {
|
||||
defer cancelSubs()
|
||||
|
||||
@@ -27,8 +27,12 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
txEvents = tmtypes.QueryForEvent(tmtypes.EventTx).String()
|
||||
evmEvents = tmquery.MustParse(fmt.Sprintf("%s='%s' AND %s.%s='%s'", tmtypes.EventTypeKey, tmtypes.EventTx, sdk.EventTypeMessage, sdk.AttributeKeyModule, evmtypes.ModuleName)).String()
|
||||
txEvents = tmtypes.QueryForEvent(tmtypes.EventTx).String()
|
||||
evmEvents = tmquery.MustParse(fmt.Sprintf("%s='%s' AND %s.%s='%s'",
|
||||
tmtypes.EventTypeKey,
|
||||
tmtypes.EventTx,
|
||||
sdk.EventTypeMessage,
|
||||
sdk.AttributeKeyModule, evmtypes.ModuleName)).String()
|
||||
headerEvents = tmtypes.QueryForEvent(tmtypes.EventNewBlockHeader).String()
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user