Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[PAN-2352] Make alloc optional and provide nicer error messages when genesis config is invalid #1029

Merged
merged 5 commits into from
Mar 4, 2019

Conversation

ajsutton
Copy link
Contributor

@ajsutton ajsutton commented Mar 4, 2019

PR description

Allow the alloc element in genesis configs to be omitted, defaulting to no allocations.
Provide better error messages when items in the genesis config are invalid.

nonce = nonce.substring(2);
}
return Long.parseUnsignedLong(nonce, 16);
return withNiceErrorMessage("mixHash", genesis.getMixHash(), Hash::fromHexStringLenient);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you meant to make the mixHash parsing more lenient here^ ? Wonder if we should accept any zero-valued hash, and otherwise be strict ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this was deliberate (as with parentHash). It's unlikely that it will make any difference but since the mix hash for the genesis file really doesn't matter (as long as it's the same for all nodes) it seems nice to not have to add all the digits for no real reason. It doesn't seem worth the extra code to specifically allow it only for 0x0.

@ajsutton ajsutton merged commit 18de723 into PegaSysEng:master Mar 4, 2019
@ajsutton ajsutton deleted the stripped-genesis-config branch March 4, 2019 22:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants