Skip to content

RPC client should be informed that the transaction he sent by calling eth_sendRawTransaction fails stateful validation. #31527

Closed
@zouxyan

Description

@zouxyan

Rationale

  • Why should this feature exist?

The transaction owner sends his transaction by rpc eth_sendRawTransaction and rpc response shows that it's ok to receive. Actually the error from txpool is not nil and txpool accepted nothing, but error in rpc response is empty.

This situation misleading the transaction sender so much. The sender of the transaction will think that the transaction has been successfully sent. But no transaction of the txhash from response can be found all over the network, from etherscan e.g. 🤔

Especially for the node service runners, their customers going to be confused and unhappy, like me 😂

  • What are the use-cases?

Some days ago, I sent a transaction by my node service provider zan.top. And rpc response showed no error. So I waited the tx packaged on Ethereum. I waited for a while and I tried to search this transaction but nothing found.

After I talked to the zan.top, they told me that it's failed with error that balance of my address not enough for gas fee. 😫 So I checked the geth node version and found the code changes about txpool locals stuff. So zan.top update their geth node with flag txpool.nolocals, and finally I sent tx with rpc error back.

Code below here requires that the locals has to be nil if returns the error inside rpc response.

func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error {
	locals := b.eth.localTxTracker
	if locals != nil {
		if err := locals.Track(signedTx); err != nil {
			return err
		}
	}
	// No error will be returned to user if the transaction fails stateful
	// validation (e.g., no available slot), as the locally submitted transactions
	// may be resubmitted later via the local tracker.
	err := b.eth.txPool.Add([]*types.Transaction{signedTx}, false)[0]
	if err != nil && locals == nil {
		return err
	}
	return nil
}

Implementation

  • Do you have ideas regarding the implementation of this feature?

☝️ Let the error returned with rpc response which is important for a normal geth user.

✌️TxTracker can handle repeated transaction, ignore txs resubmitted maybe ? 🤔 Or txtracker tracks the tx after it added to pool ?

  • Are you willing to implement this feature?

Please check pr #31528

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions