mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 18:30:45 +00:00
Merge pull request #874 from gzliudan/fix_debug_api
core: fix special tx cause debug API fail after EIP-1559
This commit is contained in:
commit
1a1c613464
5 changed files with 10 additions and 12 deletions
|
|
@ -289,7 +289,7 @@ func (st *StateTransition) preCheck() error {
|
||||||
}
|
}
|
||||||
// This will panic if baseFee is nil, but basefee presence is verified
|
// This will panic if baseFee is nil, but basefee presence is verified
|
||||||
// as part of header validation.
|
// as part of header validation.
|
||||||
if (msg.To() == nil || *msg.To() != common.RandomizeSMCBinary) && st.gasFeeCap.Cmp(st.evm.Context.BaseFee) < 0 {
|
if !types.IsSpecialTx(msg.To()) && st.gasFeeCap.Cmp(st.evm.Context.BaseFee) < 0 {
|
||||||
return fmt.Errorf("%w: address %v, maxFeePerGas: %s baseFee: %s", ErrFeeCapTooLow,
|
return fmt.Errorf("%w: address %v, maxFeePerGas: %s baseFee: %s", ErrFeeCapTooLow,
|
||||||
msg.From().Hex(), st.gasFeeCap, st.evm.Context.BaseFee)
|
msg.From().Hex(), st.gasFeeCap, st.evm.Context.BaseFee)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,7 @@ func (l *list) Overlaps(tx *types.Transaction) bool {
|
||||||
func (l *list) Add(tx *types.Transaction, priceBump uint64) (bool, *types.Transaction) {
|
func (l *list) Add(tx *types.Transaction, priceBump uint64) (bool, *types.Transaction) {
|
||||||
// If there's an older better transaction, abort
|
// If there's an older better transaction, abort
|
||||||
old := l.txs.Get(tx.Nonce())
|
old := l.txs.Get(tx.Nonce())
|
||||||
if old != nil && old.IsSpecialTransaction() {
|
if old.IsSpecialTransaction() {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
if old != nil {
|
if old != nil {
|
||||||
|
|
|
||||||
|
|
@ -700,7 +700,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
|
||||||
return core.ErrInsufficientFunds
|
return core.ErrInsufficientFunds
|
||||||
}
|
}
|
||||||
|
|
||||||
if tx.To() == nil || (tx.To() != nil && !tx.IsSpecialTransaction()) {
|
if !tx.IsSpecialTransaction() {
|
||||||
// Ensure the transaction has more gas than the basic tx fee.
|
// Ensure the transaction has more gas than the basic tx fee.
|
||||||
intrGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.To() == nil, true, pool.eip1559)
|
intrGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.To() == nil, true, pool.eip1559)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -950,7 +950,7 @@ func (pool *TxPool) promoteSpecialTx(addr common.Address, tx *types.Transaction,
|
||||||
list := pool.pending[addr]
|
list := pool.pending[addr]
|
||||||
|
|
||||||
old := list.txs.Get(tx.Nonce())
|
old := list.txs.Get(tx.Nonce())
|
||||||
if old != nil && old.IsSpecialTransaction() {
|
if old.IsSpecialTransaction() {
|
||||||
return false, ErrDuplicateSpecialTransaction
|
return false, ErrDuplicateSpecialTransaction
|
||||||
}
|
}
|
||||||
// Otherwise discard any previous transaction and mark this
|
// Otherwise discard any previous transaction and mark this
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,6 @@ var (
|
||||||
ErrTxTypeNotSupported = errors.New("transaction type not supported")
|
ErrTxTypeNotSupported = errors.New("transaction type not supported")
|
||||||
ErrGasFeeCapTooLow = errors.New("fee cap less than base fee")
|
ErrGasFeeCapTooLow = errors.New("fee cap less than base fee")
|
||||||
errShortTypedTx = errors.New("typed transaction too short")
|
errShortTypedTx = errors.New("typed transaction too short")
|
||||||
errInvalidYParity = errors.New("'yParity' field must be 0 or 1")
|
|
||||||
errVYParityMismatch = errors.New("'v' and 'yParity' fields do not match")
|
|
||||||
errVYParityMissing = errors.New("missing 'yParity' or 'v' field in transaction")
|
|
||||||
errNoSigner = errors.New("missing signing methods")
|
|
||||||
ErrFeeCapTooLow = errors.New("fee cap less than base fee")
|
|
||||||
|
|
||||||
skipNonceDestinationAddress = map[common.Address]bool{
|
skipNonceDestinationAddress = map[common.Address]bool{
|
||||||
common.XDCXAddrBinary: true,
|
common.XDCXAddrBinary: true,
|
||||||
|
|
@ -487,11 +482,14 @@ func (tx *Transaction) TxCost(number *big.Int) *big.Int {
|
||||||
return total
|
return total
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tx *Transaction) IsSpecialTransaction() bool {
|
func IsSpecialTx(to *common.Address) bool {
|
||||||
to := tx.To()
|
|
||||||
return to != nil && (*to == common.BlockSignersBinary || *to == common.RandomizeSMCBinary)
|
return to != nil && (*to == common.BlockSignersBinary || *to == common.RandomizeSMCBinary)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (tx *Transaction) IsSpecialTransaction() bool {
|
||||||
|
return tx != nil && IsSpecialTx(tx.To())
|
||||||
|
}
|
||||||
|
|
||||||
func (tx *Transaction) IsTradingTransaction() bool {
|
func (tx *Transaction) IsTradingTransaction() bool {
|
||||||
to := tx.To()
|
to := tx.To()
|
||||||
return to != nil && *to == common.XDCXAddrBinary
|
return to != nil && *to == common.XDCXAddrBinary
|
||||||
|
|
|
||||||
|
|
@ -2294,7 +2294,7 @@ func (s *PublicTransactionPoolAPI) sign(addr common.Address, tx *types.Transacti
|
||||||
|
|
||||||
// SubmitTransaction is a helper function that submits tx to txPool and logs a message.
|
// SubmitTransaction is a helper function that submits tx to txPool and logs a message.
|
||||||
func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (common.Hash, error) {
|
func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (common.Hash, error) {
|
||||||
if tx.To() != nil && tx.IsSpecialTransaction() {
|
if tx.IsSpecialTransaction() {
|
||||||
return common.Hash{}, errors.New("don't allow transaction sent to BlockSigners & RandomizeSMC smart contract via API")
|
return common.Hash{}, errors.New("don't allow transaction sent to BlockSigners & RandomizeSMC smart contract via API")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue