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

mock-node: simplify and remove client setup code #12838

Merged
merged 3 commits into from
Jan 30, 2025

Conversation

marcelo-gonzalez
Copy link
Contributor

Before this change, the mock-node tool starts one mock node, and one normal neard node with nearcore::start_with_config(), and then waits for the node to sync. It also modifies and sets up a home dir for this client if --client-height is given on the command line.

However, nobody was really using this --client-height feature much. Since we can get good test/benchmark results from just using a regular neard home directory taken from mainnet or localnet testing, we don't really need any code that manually sets up the database state.

Then if we get rid of that, the question arises: why does this code even start a node with nearcore::start_with_config()? There's not a great reason to do it in the same binary, and doing so restricts the use of this tool, since we can't use it to test a standard neard binary, but must build a custom mock-node binary that's not very intuitive unless you've looked at the code.

So here we delete all the client set up code and just have the node start a mock node listening on whatever addr is specified in the near config. Then to use it to benchmark the sync performance of a node, you just need to set the right boot nodes argument (and possibly also manually wipe the peer store), and you can use a normal neard binary for tests

@marcelo-gonzalez marcelo-gonzalez requested a review from a team as a code owner January 30, 2025 05:47
@marcelo-gonzalez
Copy link
Contributor Author

Not really sure who to mark as a reviewer, since not many have been touching or looking at this lately, but @wacban looks like you are the lucky random assignee :D

Copy link
Contributor

@wacban wacban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me just stamp it for now assuming it's a prototype. Once we've agreed that this is something we want to include into our benchmarking / debugging tool suite let's do a proper review of the whole thing.

@marcelo-gonzalez marcelo-gonzalez added this pull request to the merge queue Jan 30, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 30, 2025
@marcelo-gonzalez marcelo-gonzalez added this pull request to the merge queue Jan 30, 2025
Merged via the queue into near:master with commit 6cd375e Jan 30, 2025
23 of 24 checks passed
@marcelo-gonzalez marcelo-gonzalez deleted the mock-node-update branch January 30, 2025 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants