Skip to content

Commit

Permalink
Fix CIP-64/66 related sanity checks
Browse files Browse the repository at this point in the history
The fee-currency conversion pre-London (legacy-tx) was unneccessary,
since we don't allow celo transactions here.

Additionally some sanity-checks regarding Celo related fields were
missing
  • Loading branch information
ezdac committed Jun 11, 2024
1 parent 815cb7c commit 7a87ae6
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions internal/ethapi/transaction_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b CeloBackend)
// other tx values. See https://github.com/ethereum/go-ethereum/pull/23274
// for more information.
eip1559ParamsSet := args.MaxFeePerGas != nil && args.MaxPriorityFeePerGas != nil

if args.MaxFeeInFeeCurrency != nil && args.FeeCurrency == nil {
return errors.New("feeCurrency must be set when maxFeeInFeeCurrency is given")
}
// Sanity check the EIP-1559 fee parameters if present.
if args.GasPrice == nil && eip1559ParamsSet {
if args.MaxFeePerGas.ToInt().Sign() == 0 {
Expand Down Expand Up @@ -245,17 +249,6 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b CeloBackend)
if err != nil {
return err
}
if args.IsFeeCurrencyDenominated() {
price, err = b.ConvertToCurrency(
ctx,
rpc.BlockNumberOrHashWithHash(head.Hash(), false),
price,
args.FeeCurrency,
)
if err != nil {
return fmt.Errorf("can't convert suggested gasTipCap to fee-currency: %w", err)
}
}
args.GasPrice = (*hexutil.Big)(price)
}
return nil
Expand Down

0 comments on commit 7a87ae6

Please sign in to comment.