dtr-org / unit-e

A digital currency for a new era of decentralized trust
https://unit-e.io
MIT License
45 stars 15 forks source link

Add check for the genesis block's supply #1034

Closed castarco closed 5 years ago

castarco commented 5 years ago

Given that some consensus parameters (like reward) are in part derived from the chain parameter stating which is the expected initial supply, to ensure consistency, we should assert that the constant is actually correct.

This commit adds such assertion, checking the constant against the initial supply created in the genesis block.

Signed-off-by: Andres Correa Casablanca andres@thirdhash.com

cmihai commented 5 years ago

It's good to check this, but wouldn't it be better to make it a unit test instead?

castarco commented 5 years ago

It's good to check this, but wouldn't it be better to make it a unit test instead?

Yes, I could extract the check function from the unit-e binary and just execute it in the unit tests.

scravy commented 5 years ago

It's good to check this, but wouldn't it be better to make it a unit test instead?

Interesting, I just commented exactly the other way.

I think it should be an assert as this is about the consistency of parameters which are consensus critical, the node should not operate with an invalid setting here.

castarco commented 5 years ago

I just reverted the last three commits.

castarco commented 5 years ago

I just applied one of @scravy 's suggestions, although not his preferred one.

scravy commented 5 years ago

utACK 81db412d081754dbb956e99d148cb2df5c3ba123