-
Notifications
You must be signed in to change notification settings - Fork 130
[PAN-3126] add an override facility for genesis configs #1915
Conversation
final String value = configOverrides.get(key); | ||
return value == null || value.isEmpty() | ||
? OptionalLong.empty() | ||
: OptionalLong.of(Long.valueOf(configOverrides.get(key))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we explicitly specify the radix
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
final String value = configOverrides.get(key); | ||
return value == null || value.isEmpty() | ||
? OptionalInt.empty() | ||
: OptionalInt.of(Integer.valueOf(configOverrides.get(key))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we explicitly specify the radix
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
final GenesisConfigFile config = GenesisConfigFile.development(); | ||
final int bigBlock = 999_999_999; | ||
final String bigBlockString = Integer.toString(bigBlock); | ||
final Map<String, String> override = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some tests that use a case-sensitive Map
with various casing strategies for the keys to verify that values are replaced in a case-insensitive way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
PR description
Add a generalized genesis config override facility for command line use. Only useful for string or integer config values, not object values.
Sample use - enable Istanbul fork on block 99 million
--override-genesis-config=istanbulFork=99000000
Overriding a value with an empty string unsets the value
Sample use - disable Istanbul fork by un-setting
istanbulFork
:--override-genesis-config=istanbulFork=