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

Stop chain after a specified number of blocks mined or reach a specified height. #1306

Closed
yangby-cryptape opened this issue Aug 4, 2023 · 0 comments · Fixed by #1581
Closed
Assignees

Comments

@yangby-cryptape
Copy link
Collaborator

Contact Details

No response

Propose-a-new-feature

Proposed Feature

Stop chain after a specified number of blocks mined or reach a specified height.

A proposal:

# Exit after mine 10 blocks.
axon run --mine-limit 10
# Exit after reach block 10
axon run --mine-to 10

Reason

When run axon run, there is no way to:

  • stop process programmatically.
  • stop it at a specified height accurately.

This feature would help a lot for tests.

For example:

  • If I want to test migrations:
    • Start a chain with the old binary, mine 10 blocks.
    • Stop the chain.
    • Start a chain with the new binary.

In above example, I have to use JSON-RPC to test which height is reached, then stop it.

  • And, if I am correct, currently there is no truncate / rollback method.

    When I want to test a chain that tip is 10, I check the height with JSON-RPC, when it reaches height 10, then send stop signal, it may reaches 11.

    I could not truncate the chain, so I have to re-run the chain.

    See, to control the tip is difficult.

In Further

As I said in above section, if I am correct, currently there is no truncate / rollback method.
Because these methods are unsuitable for a account model chain.

But it is useful for testing forked blocks and a bad chain network with abnormal nodes.

For a alternative choice, I checked ethereum clients:

  • geth has a command geth attach, it could sync blocks to a specific block. (ref: a guide in reddit)

Axon could add a similar command.

Alternatives you've considered

No response

Anything else?

All features I proposed in this issue, are used for testing.

So the priority is low.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants