mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core: fix some test error strings
This commit is contained in:
parent
2cd4ccfdd0
commit
7aff3652d2
3 changed files with 7 additions and 10 deletions
|
|
@ -86,11 +86,11 @@ var (
|
||||||
// transaction with a tip higher than the total fee cap.
|
// transaction with a tip higher than the total fee cap.
|
||||||
ErrTipAboveFeeCap = errors.New("max priority fee per gas higher than max fee per gas")
|
ErrTipAboveFeeCap = errors.New("max priority fee per gas higher than max fee per gas")
|
||||||
|
|
||||||
// ErrTipVeryHigh is a sanity error to avoid extremely big numbers specified
|
// ErrTipVeryHigh is a sanity error to avoid extremly big numbers specified
|
||||||
// in the tip field.
|
// in the tip field.
|
||||||
ErrTipVeryHigh = errors.New("max priority fee per gas higher than 2^256-1")
|
ErrTipVeryHigh = errors.New("max priority fee per gas higher than 2^256-1")
|
||||||
|
|
||||||
// ErrFeeCapVeryHigh is a sanity error to avoid extremely big numbers specified
|
// ErrFeeCapVeryHigh is a sanity error to avoid extremly big numbers specified
|
||||||
// in the fee cap field.
|
// in the fee cap field.
|
||||||
ErrFeeCapVeryHigh = errors.New("max fee per gas higher than 2^256-1")
|
ErrFeeCapVeryHigh = errors.New("max fee per gas higher than 2^256-1")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ func TestStateProcessorErrors(t *testing.T) {
|
||||||
}), signer, key1)
|
}), signer, key1)
|
||||||
return tx
|
return tx
|
||||||
}
|
}
|
||||||
var mkBlobTx = func(nonce uint64, to common.Address, gasLimit uint64, gasTipCap, gasFeeCap *big.Int, hashes []common.Hash) *types.Transaction {
|
var mkBlobTx = func(nonce uint64, to common.Address, gasLimit uint64, gasTipCap, gasFeeCap, blobGasFeeCap *big.Int, hashes []common.Hash) *types.Transaction {
|
||||||
tx, err := types.SignTx(types.NewTx(&types.BlobTx{
|
tx, err := types.SignTx(types.NewTx(&types.BlobTx{
|
||||||
Nonce: nonce,
|
Nonce: nonce,
|
||||||
GasTipCap: uint256.MustFromBig(gasTipCap),
|
GasTipCap: uint256.MustFromBig(gasTipCap),
|
||||||
|
|
@ -103,6 +103,7 @@ func TestStateProcessorErrors(t *testing.T) {
|
||||||
Gas: gasLimit,
|
Gas: gasLimit,
|
||||||
To: to,
|
To: to,
|
||||||
BlobHashes: hashes,
|
BlobHashes: hashes,
|
||||||
|
BlobFeeCap: uint256.MustFromBig(blobGasFeeCap),
|
||||||
Value: new(uint256.Int),
|
Value: new(uint256.Int),
|
||||||
}), signer, key1)
|
}), signer, key1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -196,7 +197,7 @@ func TestStateProcessorErrors(t *testing.T) {
|
||||||
txs: []*types.Transaction{
|
txs: []*types.Transaction{
|
||||||
mkDynamicTx(0, common.Address{}, params.TxGas, big.NewInt(0), big.NewInt(0)),
|
mkDynamicTx(0, common.Address{}, params.TxGas, big.NewInt(0), big.NewInt(0)),
|
||||||
},
|
},
|
||||||
want: "could not apply tx 0 [0xc4ab868fef0c82ae0387b742aee87907f2d0fc528fc6ea0a021459fb0fc4a4a8]: max fee per gas less than block base fee: address 0x71562b71999873DB5b286dF957af199Ec94617F7, maxFeePerGas: 0 baseFee: 875000000",
|
want: "could not apply tx 0 [0xc4ab868fef0c82ae0387b742aee87907f2d0fc528fc6ea0a021459fb0fc4a4a8]: max fee per gas less than block base fee: address 0x71562b71999873DB5b286dF957af199Ec94617F7, maxFeePerGas: 0, baseFee: 875000000",
|
||||||
},
|
},
|
||||||
{ // ErrTipVeryHigh
|
{ // ErrTipVeryHigh
|
||||||
txs: []*types.Transaction{
|
txs: []*types.Transaction{
|
||||||
|
|
@ -247,9 +248,9 @@ func TestStateProcessorErrors(t *testing.T) {
|
||||||
},
|
},
|
||||||
{ // ErrBlobFeeCapTooLow
|
{ // ErrBlobFeeCapTooLow
|
||||||
txs: []*types.Transaction{
|
txs: []*types.Transaction{
|
||||||
mkBlobTx(0, common.Address{}, params.TxGas, big.NewInt(1), big.NewInt(1), []common.Hash{(common.Hash{1})}),
|
mkBlobTx(0, common.Address{}, params.TxGas, big.NewInt(1), big.NewInt(1), big.NewInt(0), []common.Hash{(common.Hash{1})}),
|
||||||
},
|
},
|
||||||
want: "could not apply tx 0 [0x6c11015985ce82db691d7b2d017acda296db88b811c3c60dc71449c76256c716]: max fee per gas less than block base fee: address 0x71562b71999873DB5b286dF957af199Ec94617F7, maxFeePerGas: 1 baseFee: 875000000",
|
want: "could not apply tx 0 [0x6c11015985ce82db691d7b2d017acda296db88b811c3c60dc71449c76256c716]: max fee per gas less than block base fee: address 0x71562b71999873DB5b286dF957af199Ec94617F7, maxFeePerGas: 1, baseFee: 875000000",
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
block := GenerateBadBlock(gspec.ToBlock(), beacon.New(ethash.NewFaker()), tt.txs, gspec.Config)
|
block := GenerateBadBlock(gspec.ToBlock(), beacon.New(ethash.NewFaker()), tt.txs, gspec.Config)
|
||||||
|
|
|
||||||
|
|
@ -330,10 +330,6 @@ func (st *StateTransition) preCheck() error {
|
||||||
// Skip the checks if gas fields are zero and blobBaseFee was explicitly disabled (eth_call)
|
// Skip the checks if gas fields are zero and blobBaseFee was explicitly disabled (eth_call)
|
||||||
skipCheck := st.evm.Config.NoBaseFee && msg.BlobGasFeeCap.BitLen() == 0
|
skipCheck := st.evm.Config.NoBaseFee && msg.BlobGasFeeCap.BitLen() == 0
|
||||||
if !skipCheck {
|
if !skipCheck {
|
||||||
if l := msg.BlobGasFeeCap.BitLen(); l > 256 {
|
|
||||||
return fmt.Errorf("%w: address %v, blobGasFeeCap bit length: %d", ErrFeeCapVeryHigh,
|
|
||||||
msg.From.Hex(), l)
|
|
||||||
}
|
|
||||||
// This will panic if blobBaseFee is nil, but blobBaseFee presence
|
// This will panic if blobBaseFee is nil, but blobBaseFee presence
|
||||||
// is verified as part of header validation.
|
// is verified as part of header validation.
|
||||||
if msg.BlobGasFeeCap.Cmp(st.evm.Context.BlobBaseFee) < 0 {
|
if msg.BlobGasFeeCap.Cmp(st.evm.Context.BlobBaseFee) < 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue