diff --git a/core/state_transition.go b/core/state_transition.go index b74a2766d19e..8dc521b9c141 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -202,7 +202,7 @@ func (st *StateTransition) buyGas() error { return fmt.Errorf("%w: fee delegation type not supported", ErrTxTypeNotSupported) } FDmgval := new(big.Int).SetUint64(st.msg.Gas()) - FDmgval = FDmgval.Mul(FDmgval, st.gasFeeCap) + FDmgval = FDmgval.Mul(FDmgval, st.gasPrice) feePayer := *st.msg.FeePayer() if feePayer == st.msg.From() { FDbalanceCheck := new(big.Int).SetUint64(st.msg.Gas()) diff --git a/core/tx_pool.go b/core/tx_pool.go index e4b1ed565e6f..ee1db92cb154 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -707,8 +707,11 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { // fee delegation if tx.Type() == types.FeeDelegateDynamicFeeTxType { // Make sure the transaction is signed properly. + if tx.FeePayer() == nil { + return ErrInvalidFeePayer + } feePayer, err := types.FeePayer(types.NewFeeDelegateSigner(pool.chainconfig.ChainID), tx) - if *tx.FeePayer() != feePayer || err != nil { + if err != nil || *tx.FeePayer() != feePayer { return ErrInvalidFeePayer } if pool.currentState.GetBalance(feePayer).Cmp(tx.FeePayerCost()) < 0 { diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 915f373c2c8b..2174d61ce7e1 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1746,6 +1746,10 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c // Ensure only eip155 signed transactions are submitted if EIP155Required is set. return common.Hash{}, errors.New("only replay-protected (EIP-155) transactions allowed over RPC") } + // fee delegation + if tx.Type() == types.FeeDelegateDynamicFeeTxType && tx.FeePayer() == nil { + return common.Hash{}, errors.New("FeePayer address is null") + } if err := b.SendTx(ctx, tx); err != nil { return common.Hash{}, err }