EYBlockchain / nightfall_3

a mono-repo containing an optimistic version of nightfall
Creative Commons Zero v1.0 Universal
260 stars 57 forks source link

feat: nightfall3 bec optimizations #1448

Open VishnuNarayanan3 opened 2 months ago

VishnuNarayanan3 commented 2 months ago

What does this implement/fix? Explain your changes.

Change Filepath(s)  
Added a system to write keys to a backup file, and restore them on client bootup nightfall-client/src/services/keys.mjs , nightfall-client/src/index.mjs
CHECK_REGISTER_PROPOSER_SECOND inherited from environment variables instead of hard-coding apps/proposer/src/proposer.mjs  
checkAndChangeProposer can now be skipped by controlling an environment variable apps/proposer/src/proposer.mjs  
checkAndRegisterProposer no longer crashes the container if the call to optimist fails apps/proposer/src/proposer.mjs Added try-catch to method
Proposer container now supports hot reloading in local apps/proposer/package.jsondocker/docker-compose.apps.yml Added nodemon
Improved logging on /offchain-transaction route apps/proposer/src/proposer.mjs  
Added configuration for amoy and baseSepolia bin/config/default.js  
Infosec compliance - Forces the transitive dependency request-cookie to a version without vulnerabilities cli/package.jsoncommon-files/package.json "request": { "tough-cookie": "4.1.3" }
Infosec compliance - Removed the super user used in images docker/client.Dockerfiledocker/deployer.Dockerfile  
Client, worker and optimist now support start up on arbitrary ports that can be controlled via environment variables. This is because the loss of super-user prevents startup on protected port 80. worker/src/index.mjsnightfall-client/src/index.mjsnightfall-optimist/src/index.mjs  
Optimist container no longer crashes when mempool transactions build up over time. This is done by throttling the number of txs fetched from db at any given time, the amount can be controlled using the variable MEMPOOL_TXS_FETCH_LIMIT config/default.jsnightfall-optimist/src/services/block-assembler.mjsnightfall-optimist/src/services/database.mjs  
Logging change - The repeated “heartbeat” message in the block assembler can now be toggled via a new endpoint - /debug/toggle-heartbeat-loggingbug/toggle-heartbeat-logging nightfall-optimist/src/services/block-assembler.mjsnightfall-optimist/src/routes/debug.mjs This was primarily to simplify log anaylsis by minimizing log cluttering
Client container no longer syncs from the firstSeenBlock, but uses the lastProcessedBlock. This avoids an unnecessary delay in the bootup time of the client. nightfall-client/src/services/state-sync.mjs  
Client container no longer returns a “Bad Request” while syncing. It returns a “503 - Nf3 client is syncing” message instead. The healthcheck route has also been excluded from this to prevent k8s from considering the container unhealthy. nightfall-client/src/app.mjs  

Does this close any currently open issues?

No

What commands can I run to test the change?

curl for new debugging endpoint:

curl --location --request POST 'http://{optimistUrl}/debug/toggle-heartbeat-logging' \
--header 'Content-Type: application/json' \
--data-raw '{
    "heartBeatLogging": "false"
}'

Any other comments?

PR includes multiple changes centred around "unhappy paths" such as mempool buildup, container crashes etc. Also includes configuration changes to attempt deployment on polygon amoy and base sepolia.