Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

执行的错误处理 #5

Open
SipengXie opened this issue Oct 18, 2024 · 3 comments
Open

执行的错误处理 #5

SipengXie opened this issue Oct 18, 2024 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@SipengXie
Copy link

在step函数中

	if abortErr, ok := res.err.(ErrExecAbortError); ok && abortErr.OriginError != nil && pe.scheduler.skipCheck[tx] {
		// If the transaction failed when we know it should not fail, this means the transaction itself is
		// bad (e.g. wrong nonce), and we should exit the execution immediately
		err = fmt.Errorf("could not apply tx %d [%v]: %w", tx, pe.scheduler.tasks[tx].Hash(), abortErr.OriginError)
		pe.Close(true)

		return
	}

当originError不为nil的时候会中断执行;但在以太坊交易中,如果 tx_1依赖于tx_0的nonce(tx_1与tx_0有相同的sender, 但tx_1的nonce更高)则在tx_0提交前,tx_1的执行会产生originError;我们需要区分这个情况。

@dev-ape-ai dev-ape-ai bot added bug Something isn't working help wanted Extra attention is needed labels Oct 18, 2024
Copy link

dev-ape-ai bot commented Oct 18, 2024

👋 Hey @SipengXie! 😊

Thanks for bringing up the error handling issue related to transaction nonces in blockstm-go. Let's dive into what could be causing this and potential areas of improvement.

The issue at hand focuses on handling Ethereum transactions with nonce dependencies, where a transaction depends on the nonce of a previous transaction from the same sender. This can lead to originError in cases where a dependent transaction is executed before its predecessor, causing an unexpected error.

Code Searching within the blockstm-go repository did not yield specific insights directly related to abortErr, ErrExecAbortError, OriginError, or nonce handling. This indicates either that the search keywords need refining or the error handling logic is not well-covered and thus not clearly identifiable in the codebase. Further investigation and potentially adding logging at critical areas might help clarify when and how these errors are triggered.

From the web, we gathered some valuable insights on how Ethereum handles nonces and nonce errors:

  1. Understanding Ethereum Nonces and Transaction Dependencies: Knowing that each transaction sent from a specific address must have a unique, incrementally-set nonce can be fundamental in designing error handling mechanisms. Resolving the "Nonce too low" Error in Ethereum Transactions
  2. Managing Nonces Programmatically: Platforms like Nethereum automate nonce management to avoid such errors. This could provide a hint toward automatic nonce handling or validation techniques that can be adapted or built upon in the blockstm-go code. Managing nonces with Nethereum - GitHub
  3. Sequential Identification and Ordering of Transactions: Understanding that the nonce is a sequential identifier crucial for the correct order of transactions could help in implementing validation or reordering logic if the execution order is disturbed. What is a Nonce? Management Techniques for Your Ethereum Transactions
Related Search Results

Further improvement could involve critically examining the transaction handling logic in block_executor.go and possibly implementing a middleware or auxiliary module to verify or manage nonces explicitly. This step could potentially mitigate the type of issues that are currently surfacing.

@SipengXie
Copy link
Author

实际上,根据我对代码的阅读,我发现其实那些出现错误的交易都在skipCheck里,这意味着他们本不该出错;然而,会出现nonce错误等;我看到在实现过程settle是单独一个线程在进行,这是否会导致某些skipCheck的交易并没有等到它的前序交易Settle就执行?

@SipengXie
Copy link
Author

image
根据我的实验,这是会的;所以后续交易的等待需要在Settle后才能执行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
Status: Backlog
Development

No branches or pull requests

1 participant