Proposer add logging and registration check #546
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.
This PR fixes a bug in the dev environment (or indeed any environment) whereby restarting the
proposer
application will fail if it has already been registered withoptimist
. It does that by requesting a list of registered proposers fromoptimist
and only attempting to register if its address is not on the list.This PR also adds some logging to the nf3 class. Specifically, opening, closing, messaging and errors are all now logged for the proposer websocket, although actual log details are limited because of the way websockets work.
Note that to add the logger, some the rather brittle common-files psuedo-packaging has been removed from
proposer
anduser-local
as this did not work well when importing bothcommon-files
andcli
. It is unnecessary in any case now theDockerfiles
have been moved to the repository root.The e2e test script runners in
package.json
have been modified to disable logging when these are run, otherwise the test output is spammed with log data.To test, run the
ping-pong
tests (see the readme intests/ping-pong
). You will see the new log output as the test proceeds. If you wish to test duplicate registration, the easiest way is to addawait nf3.registerProposer();
at line 24 ofindex.mjs
. This will force the proposer to attempt to register twice. A warning will be logged and the second attempt will not proceed.