2021-03-31 07:22:30 +00:00
|
|
|
def walk(f):
|
|
|
|
. as $in
|
|
|
|
| if type == "object" then
|
|
|
|
reduce keys_unsorted[] as $key
|
|
|
|
( {}; . + { ($key): ($in[$key] | walk(f)) } ) | f
|
|
|
|
elif type == "array" then map( walk(f) ) | f
|
|
|
|
else f
|
|
|
|
end;
|
|
|
|
|
2021-03-23 11:52:25 +00:00
|
|
|
# Removes all empty keys and values in input.
|
|
|
|
def remove_empty:
|
|
|
|
. | walk(
|
|
|
|
if type == "object" then
|
|
|
|
with_entries(
|
|
|
|
select(
|
|
|
|
.value != null and
|
|
|
|
.value != "" and
|
|
|
|
.value != [] and
|
|
|
|
.key != null and
|
|
|
|
.key != ""
|
|
|
|
)
|
|
|
|
)
|
|
|
|
else .
|
|
|
|
end
|
|
|
|
)
|
|
|
|
;
|
|
|
|
|
|
|
|
# Converts decimal string to number.
|
|
|
|
def to_int:
|
|
|
|
if . == null then . else .|tonumber end
|
|
|
|
;
|
|
|
|
|
|
|
|
# Converts "1" / "0" to boolean.
|
|
|
|
def to_bool:
|
|
|
|
if . == null then . else
|
|
|
|
if . == "1" then true else false end
|
|
|
|
end
|
|
|
|
;
|
|
|
|
|
|
|
|
# Replace config in input.
|
2021-05-13 11:03:57 +00:00
|
|
|
{
|
|
|
|
"genesis": {
|
|
|
|
"coinbase" : .coinbase,
|
|
|
|
"difficulty" : .difficulty,
|
|
|
|
"extraData" : .extraData,
|
|
|
|
"gasLimit" : .gasLimit,
|
|
|
|
"mixHash" : .mixHash,
|
|
|
|
"nonce" : .nonce,
|
|
|
|
"parentHash" : .parentHash,
|
|
|
|
"timestamp" : .timestamp,
|
2021-07-02 09:36:19 +00:00
|
|
|
"alloc" : .alloc,
|
|
|
|
"baseFeePerGas": .baseFeePerGas
|
2021-05-13 11:03:57 +00:00
|
|
|
}|remove_empty,
|
2021-03-23 11:52:25 +00:00
|
|
|
"config": {
|
2021-08-09 01:35:54 +00:00
|
|
|
"clique": (if env.HIVE_CLIQUE_PERIOD == null then null else {
|
|
|
|
"period": env.HIVE_CLIQUE_PERIOD|to_int,
|
|
|
|
} end),
|
2021-03-23 11:52:25 +00:00
|
|
|
"chainId": env.HIVE_CHAIN_ID|to_int,
|
|
|
|
"homesteadBlock": env.HIVE_FORK_HOMESTEAD|to_int,
|
|
|
|
"daoForkBlock": env.HIVE_FORK_DAO_BLOCK|to_int,
|
2021-05-18 02:23:12 +00:00
|
|
|
"daoForkSupport": (if env.HIVE_FORK_DAO_BLOCK then env.HIVE_FORK_DAO_VOTE|to_bool else null end),
|
2021-03-23 11:52:25 +00:00
|
|
|
"eip150Block": env.HIVE_FORK_TANGERINE|to_int,
|
2021-05-12 00:53:53 +00:00
|
|
|
"eip155Block": env.HIVE_FORK_SPURIOUS|to_int,
|
2021-03-23 11:52:25 +00:00
|
|
|
"eip158Block": env.HIVE_FORK_SPURIOUS|to_int,
|
|
|
|
"byzantiumBlock": env.HIVE_FORK_BYZANTIUM|to_int,
|
|
|
|
"constantinopleBlock": env.HIVE_FORK_CONSTANTINOPLE|to_int,
|
|
|
|
"petersburgBlock": env.HIVE_FORK_PETERSBURG|to_int,
|
|
|
|
"istanbulBlock": env.HIVE_FORK_ISTANBUL|to_int,
|
|
|
|
"muirGlacierBlock": env.HIVE_FORK_MUIR_GLACIER|to_int,
|
2021-07-01 01:14:11 +00:00
|
|
|
"berlinBlock": env.HIVE_FORK_BERLIN|to_int,
|
2021-06-28 02:01:18 +00:00
|
|
|
"londonBlock": env.HIVE_FORK_LONDON|to_int
|
2021-03-23 11:52:25 +00:00
|
|
|
}|remove_empty
|
|
|
|
}
|