avalanchego
avalanchego copied to clipboard
block delay test on avalanche
I attempted to subscribe to the latest blocks received by my local node using the eth_blockSubscribe method provided by the Avalanche node. I then calculated the delay by subtracting the timestamp in the block from the time when the block was received. In theory, if my node can consistently catch up to the latest block, this time should be less than Avalanche's block time. However, the results are not satisfactory, approximately in the range of 2000ms to 3000ms. I checked the node logs, and the results are as follows:
1、After receiving request information from other nodes, the node issues requests to obtain missing blocks based on the information and local state.
2、After obtaining the block, perform block verification.
3、Add the block to the consensus engine and select it as the preference block.
4、Sample and select the validator set.
5、applying and process vote
6、Continuously process votes until the block is in the "accepting" state (including the commit process).
Taking the verification of the block as the time of receiving the block, the delay for receiving the block is 515ms. The total time for processing the block, waiting for votes, and committing the block is 1419ms. In total, it is 1419 + 515 = 1934ms. And I have questions below
1、My node is not a validator node, why is there a process of selecting a validator set and receiving votes? Is this part of the Avalanche consensus process? 2、I looked at the relevant code section and found that the transactions in a block are executed only after collecting all the votes. Is my conclusion correct? 3、Is there a way to execute transactions upon receiving a block on Avalanche, similar to Ethereum, without waiting for the voting process?
Is this part of the Avalanche consensus process?
Yes, Avalanche consensus performs sampling of the validator set.
I looked at the relevant code section and found that the transactions in a block are executed only after collecting all the votes. Is my conclusion correct?
Blocks are only Accepted
after receiving a sufficient amount of votes. Blocks are Verified
before being placed into consensus.
Is there a way to execute transactions upon receiving a block on Avalanche, similar to Ethereum, without waiting for the voting process?
Transactions are executed during block verification, which happens prior to accumulating votes for the block.
Is this part of the Avalanche consensus process?
Yes, Avalanche consensus performs sampling of the validator set.
I looked at the relevant code section and found that the transactions in a block are executed only after collecting all the votes. Is my conclusion correct?
Blocks are only
Accepted
after receiving a sufficient amount of votes. Blocks areVerified
before being placed into consensus.Is there a way to execute transactions upon receiving a block on Avalanche, similar to Ethereum, without waiting for the voting process?
Transactions are executed during block verification, which happens prior to accumulating votes for the block.
Thank you for your response. I have another point I'd like to confirm. When I use the eth_blocksubscribe method on the AvalancheGo node, does this method return the block content in the Verified stage or the Accepted stage? From my testing perspective, it seems like the block content is returned in the Accepted stage. If my assumption is correct, is there any way to obtain the block content in the Verified stage?
This issue has become stale because it has been open 60 days with no activity. Adding the lifecycle/frozen
label will cause this issue to ignore lifecycle events.