MinaProtocol / mina

Mina is a cryptocurrency protocol with a constant size blockchain, improving scaling while maintaining decentralization and security.
https://minaprotocol.com
Apache License 2.0
1.99k stars 529 forks source link

Script to pre-generated genesis ledger from a list of accounts and reference that in the config file #14713

Closed deepthiskumar closed 9 months ago

deepthiskumar commented 11 months ago

Config file passed as daemon argument consists of genesis ledger as a list of accounts. These accounts can grow (mainnet now has over 200k accounts). This can take up significant boot-up time during which the daemon is unresponsive. The config file has options to take the merkle root or a name of the ledger instead. With these options, the daemon will look for files with a specific name locally as well as in an s3 bucket that's currently hardcoded.

The task for this issue is to test the two functionalities (using Hash and Name) in runtime config. The ledger can be generated by the daemon using a list of accounts first. Or preferably, one could create an app to do ledger generation using account list (just extracting the same piece of code the daemon uses) instead of running the daemon. I believe, https://github.com/MinaProtocol/mina/blob/berkeley/src/app/runtime_genesis_ledger/runtime_genesis_ledger.ml does this but needs to be confirmed.

Update: Script: takes config file with ledgers (incluuding both the staking ledgers) with account list as input and generate as output the corresponding tars and a config file that refers to these files (instead of list of accounts)

michal0mina commented 10 months ago

@deepthiskumar when you are back -- can you add a bit more details here?

joaosreis commented 10 months ago

I've looked into this. My findings are the following:

Let me know if you need me to look into something else or give more details. @deepthiskumar @michal0mina

joaosreis commented 10 months ago

I now have a script to automate the process of using a config file with the genesis ledger accounts as well as both staking ledger accounts and producing the tar files for each of these ledgers and a new config file referencing the Merkle root hash of these ledgers instead of the accounts.

However, I noticed that the runtime config doesn't allow specifying the hash of the ledger for the staking ledgers, it only allows specifying accounts, so this needs to be changed. The logic used to load the staking ledger is the same as the genesis one, so this should be simply a matter of adding the possibility of specifying the hash on both staking ledgers in the config file.

Today I will create a PR with both of these changes.