QuilibriumNetwork / ceremonyclient

Mirror of Quilibrium git repo: ceremonyclient
GNU Affero General Public License v3.0
95 stars 41 forks source link

Embed json files in binary #182

Closed agostbiro closed 6 months ago

agostbiro commented 6 months ago

Problem

The node/ceremony.json file contains the results of the powers of tau ceremony for KZG polynomial commitments. The node/retroactive_peers.json file contains the retroactive rewards for nodes.

When starting a node, these files are currently loaded from disk using a relative path to the repository. This has two drawbacks:

  1. Nodes cannot be started outside of the node directory.
  2. The json files are not signed for releases.

Solution

This PR fixes both by embedding the json files in the Go binary.

Testing

Running the full node test suite fails for me both with and without this change, so I tested by running the KZG-related related tests (node/crypto/kzg_inclusion_prover_test.go and node/crypto/kzg/kzg_test.go). Both of these pass. I couldn't find tests that would load retroactive_peers.json.

I also tested by building a node binary in the node directory with GOEXPERIMENT=arenas go build -o node main.go and moving it outside the repository and running it there. For testing, I forced the recreation of the genesis file so that the retroactive_peers.json file is utilized.

Update

This PR originally embedded only the ceremony.json file. Thanks to feedback from TG, I also added the retroactive_peers.json file and updated this message to reflect that.