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

block transaction replay right after block update gives errors #7702

Closed
chris-bce opened this issue Jun 10, 2023 · 5 comments
Closed

block transaction replay right after block update gives errors #7702

chris-bce opened this issue Jun 10, 2023 · 5 comments
Labels

Comments

@chris-bce
Copy link

System information

Erigon version: ./erigon --version

erigon version 2.45.1-stable-83398871

OS & Version: Linux

Chain/Network: erigon mainnet

Expected behaviour

replaying block transactions immediately after block update should succeed

Actual behaviour

replaying block transactions immediately after block update shows errors. adding a time.sleep(1) after getting the update and before replaying block transactions seems to make them go away

Steps to reproduce the behaviour

use the following script:

from typing import Optional

import json
import pprint
import subprocess

current = None
next_id = 1


def pop_id() -> int:
    global next_id
    result = next_id
    next_id += 1
    return result


def poll_for_new_block(prev: Optional[str]) -> str:
    while True:
        s = subprocess.check_output("""curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest", false],"id":%d}' localhost:8545""" % pop_id(), shell=True, stderr=subprocess.DEVNULL)
        #print(s)
        data = json.loads(s)
        block_hash = data['result']['hash']
        if prev is None or block_hash != prev:
            return block_hash

current = poll_for_new_block(None)

while True:
    current = poll_for_new_block(current)
    data = json.loads(subprocess.check_output("""curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"trace_replayBlockTransactions","params":["%s", ["stateDiff"]],"id":%d}' localhost:8545""" % (current, pop_id()), shell=True, stderr=subprocess.DEVNULL))
    pprint.pprint(data)

Backtrace

there will be a stream of errors in the output like:

{'error': {'code': -32000,
           'message': 'first run for txIndex 0 error: nonce too low: address '
                      '0x1aCa6E70c0aA9A23a340B0F4308eb0dE520dBd9D, tx: 18 '
                      'state: 19'},
 'id': 772,
 'jsonrpc': '2.0'}
{'error': {'code': -32000,
           'message': 'first run for txIndex 0 error: nonce too low: address '
                      '0xD6f859ba5076e7690b2056f697e5097f9FE836Ed, tx: 9483 '
                      'state: 9484'},
 'id': 881,
 'jsonrpc': '2.0'}
 {'error': {'code': -32000,
           'message': 'first run for txIndex 0 error: nonce too low: address '
                      '0xd78ceBa1f9291dadE3539bD558eB5D9B969ec66F, tx: 13213 '
                      'state: 13214'},
 'id': 1034,
 'jsonrpc': '2.0'}
@bgelb
Copy link
Contributor

bgelb commented Jun 12, 2023

This seems to be due to a regression introduced somewhere after release 2.42.

I see the failure with 2.45.1, and I don't see it on 2.42 (which is the prior version deployed on my systems).

@AskAlexSharov
Copy link
Collaborator

hmm... it's already 2nd similar issue (first #7686)
i will try to check - maybe we don't call "commit" after staged sync cycle.
in-theory we send notification after commit - so all data must be visible for readers.

@AskAlexSharov
Copy link
Collaborator

oookey... seems I understand: Released v2.45.2

@github-actions
Copy link

This issue is stale because it has been open for 40 days with no activity. Remove stale label or comment, or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jul 23, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants