Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
Validate that the proposer payment has no calldata and its gas usage (#6
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Ruteri authored Oct 26, 2022
1 parent 2674513 commit 9b80db4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2490,5 +2490,21 @@ func (bc *BlockChain) ValidatePayload(block *types.Block, feeRecipient common.Ad
return fmt.Errorf("inaccurate payment %s, expected %s", paymentTx.Value().String(), expectedProfit.String())
}

if len(paymentTx.Data()) != 0 {
return fmt.Errorf("malformed proposer payment, contains calldata")
}

if paymentTx.GasPrice().Cmp(block.BaseFee()) != 0 {
return fmt.Errorf("malformed proposer payment, gas price not equal to base fee")
}

if paymentTx.GasTipCap().Cmp(block.BaseFee()) != 0 && paymentTx.GasTipCap().Sign() != 0 {
return fmt.Errorf("malformed proposer payment, unexpected gas tip cap")
}

if paymentTx.GasFeeCap().Cmp(block.BaseFee()) != 0 {
return fmt.Errorf("malformed proposer payment, unexpected gas fee cap")
}

return nil
}

0 comments on commit 9b80db4

Please sign in to comment.