refactor!: Use hash to validate genesis block
Description
- Added
genesis.hashconfig parameter and removedgenesis.public_key - Added command
kagami genesis hashwhich calculates hash of genesis block kagami genesis signstill needs genesis key pair because it needs to be matched with genesis account id potentially present ingenesis.jsoninstructions- Maybe we could try to use
genesis@genesisalias ingenesis.json? That waykagami genesis signwill generate genesis key pair, replacegenesis@genesisalias with actual genesis account id, and users will not have to deal with genesis key pair generation
- Maybe we could try to use
- Genesis domain and account is now added to the
Worldafter receiving genesis block (since we now don't know genesis account id at startup but need to use authority of genesis block)
Deployment changes
Will be needed to change from:
kagami genesis sign ... --out-file genesis.signed.scale
irohad
To:
kagami genesis sign ... --out-file genesis.signed.scale- as before, no changeskagami genesis hash genesis.signed.scale- get hash of genesis block- Provide hash using
GENESIS_HASHenvironment variable toirohad
Linked issue
Closes #4555
Benefits
Checklist
- [x] I've read
CONTRIBUTING.md - [x] I've used the standard signed-off commit format (or will squash just before merging)
- [ ] All applicable CI checks pass (or I promised to make them pass later)
- [ ] (optional) I've written unit tests for the code changes
- [ ] I replied to all comments after code review, marking all implemented changes with thumbs up
@BAStos525
So if we still have to use genesis account afaik what benefits do we gain by now also checking hash of genesis block?
So if we still have to use genesis account afaik what benefits do we gain by now also checking hash of genesis block?
As I see kagami genesis sign might be simplified a bit (no genesis key pair needed) if we figure out how to do it. But I don't know how genesis account id can be removed altogether since it is used in genesis.json instructions like Transfer
Discussed with @mversic and decided that currently it is not worth to implement #4555. Originally it was expected that it will simplify things, but looks like there is no good and clean implementation, so will keep current approach with genesis public and private key (note that genesis private key is used only in kagami)