Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Nov 11, 2024
1 parent fc50fb9 commit 12ce894
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions rpc/types/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ func BaseFeeFromEvents(events []abci.Event) *big.Int {

// CheckTxFee is an internal function used to check whether the fee of
// the given transaction is _reasonable_(under the cap).
func CheckTxFee(gasPrice *big.Int, gas uint64, cap float64) error {
func CheckTxFee(gasPrice *big.Int, gas uint64, feeCap float64) error {

Check warning on line 291 in rpc/types/utils.go

View check run for this annotation

Codecov / codecov/patch

rpc/types/utils.go#L291

Added line #L291 was not covered by tests
// Short circuit if there is no cap for transaction fee at all.
if cap == 0 {
if feeCap == 0 {

Check warning on line 293 in rpc/types/utils.go

View check run for this annotation

Codecov / codecov/patch

rpc/types/utils.go#L293

Added line #L293 was not covered by tests
return nil
}
totalfee := new(big.Float).SetInt(new(big.Int).Mul(gasPrice, new(big.Int).SetUint64(gas)))
Expand All @@ -300,8 +300,8 @@ func CheckTxFee(gasPrice *big.Int, gas uint64, cap float64) error {
feeEth := new(big.Float).Quo(totalfee, oneToken)
// no need to check error from parsing
feeFloat, _ := feeEth.Float64()
if feeFloat > cap {
return fmt.Errorf("tx fee (%.2f ether) exceeds the configured cap (%.2f ether)", feeFloat, cap)
if feeFloat > feeCap {
return fmt.Errorf("tx fee (%.2f ether) exceeds the configured cap (%.2f ether)", feeFloat, feeCap)

Check warning on line 304 in rpc/types/utils.go

View check run for this annotation

Codecov / codecov/patch

rpc/types/utils.go#L303-L304

Added lines #L303 - L304 were not covered by tests
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions types/dynamic_fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

// HasDynamicFeeExtensionOption returns true if the tx implements the `ExtensionOptionDynamicFeeTx` extension option.
func HasDynamicFeeExtensionOption(any *codectypes.Any) bool {
_, ok := any.GetCachedValue().(*ExtensionOptionDynamicFeeTx)
func HasDynamicFeeExtensionOption(codecAny *codectypes.Any) bool {
_, ok := codecAny.GetCachedValue().(*ExtensionOptionDynamicFeeTx)

Check warning on line 24 in types/dynamic_fee.go

View check run for this annotation

Codecov / codecov/patch

types/dynamic_fee.go#L23-L24

Added lines #L23 - L24 were not covered by tests
return ok
}
8 changes: 4 additions & 4 deletions x/evm/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ func PackTxData(txData TxData) (*codectypes.Any, error) {

// UnpackTxData unpacks an Any into a TxData. It returns an error if the
// client state can't be unpacked into a TxData.
func UnpackTxData(any *codectypes.Any) (TxData, error) {
if any == nil {
func UnpackTxData(codecAny *codectypes.Any) (TxData, error) {
if codecAny == nil {
return nil, errorsmod.Wrap(errortypes.ErrUnpackAny, "protobuf Any message cannot be nil")
}

txData, ok := any.GetCachedValue().(TxData)
txData, ok := codecAny.GetCachedValue().(TxData)
if !ok {
return nil, errorsmod.Wrapf(errortypes.ErrUnpackAny, "cannot unpack Any into TxData %T", any)
return nil, errorsmod.Wrapf(errortypes.ErrUnpackAny, "cannot unpack Any into TxData %T", codecAny)

Check warning on line 102 in x/evm/types/codec.go

View check run for this annotation

Codecov / codecov/patch

x/evm/types/codec.go#L102

Added line #L102 was not covered by tests
}

return txData, nil
Expand Down

0 comments on commit 12ce894

Please sign in to comment.