mock-node: simplify and remove client setup code #12838
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 custommock-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