Skip to content

Commit

Permalink
workbench: shelley genesis fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
deepfire committed May 4, 2022
1 parent 8f82d53 commit b5129e4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
15 changes: 11 additions & 4 deletions nix/workbench/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,35 +152,42 @@ case "$op" in
mkdir -p "$dir"

jq ' $prof[0] as $p
| . * ($p.genesis.shelley // {})
| . * ($p.genesis.alonzo // {})
' --slurpfile prof "$profile_json" \
"$global_basedir"/profiles/presets/mainnet/genesis/genesis-alonzo.json \
> "$dir"/genesis.alonzo.spec.json

msg "genesis: creating initial genesis"
cardano-cli genesis create --genesis-dir "$dir"/ \
$(jq '.cli_args.createSpec | join(" ")' "$profile_json" --raw-output)

## Overlay the verbatim genesis part into the profile spec:
local params=(
--slurpfile profile "$profile_json"
--slurpfile prof "$profile_json"
--raw-output
)
jq "${params[@]}" '
. * ($profile[0].genesis.shelley // {})
' "$dir"/genesis.spec.json |
jq ' $prof[0] as $p
| . * ($p.genesis.shelley // {})
' "$dir"/genesis.spec.json "${params[@]}" |
sponge "$dir"/genesis.spec.json

msg "genesis: mutating into staked genesis"
params=(--genesis-dir "$dir"
$(jq '.cli_args.createFinalBulk | join(" ")' "$profile_json" --raw-output)
)
cardano-cli genesis create-staked "${params[@]}"
mv "$dir"/genesis.json "$dir"/genesis-shelley.json
mv "$dir"/genesis.spec.json "$dir"/genesis-shelley.spec.json

msg "genesis: removing delegator keys.."
rm "$dir"/stake-delegator-keys -rf

cat <<<$cache_key_input > "$dir"/cache.key.input
cat <<<$cache_key > "$dir"/cache.key
cat <<<$global_genesis_format_version > "$dir"/layout.version

msg "genesis: moving keys"
## TODO: try to get rid of this step:
Massage_the_key_file_layout_to_match_AWS "$profile_json" "$topo_dir" "$dir";;

Expand Down
1 change: 1 addition & 0 deletions nix/workbench/profiles/defaults.jq
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def era_defaults($era):
, minFeeA: 0
, minFeeB: 0
, decentralisationParam: 0
, nOpt: 50
}
}
}
Expand Down
21 changes: 10 additions & 11 deletions nix/workbench/profiles/derived.jq
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,16 @@ def add_derived_params:
, pool_coin: (if $n_pools == 0 then 0
else $gsis.per_pool_balance end)
, shelley:
({ protocolParams:
{ activeSlotsCoeff: $gsis.active_slots_coeff
, epochLength: $gsis.epoch_length
, securityParam: $gsis.parameter_k
, slotLength: $gsis.slot_duration
, maxTxSize: $gsis.max_tx_size
, protocolParams:
{ "decentralisationParam": $gsis.decentralisation_param
, "maxBlockBodySize": $gsis.max_block_size
, "nOpt": $compo.n_pools
}
({
activeSlotsCoeff: $gsis.active_slots_coeff
, epochLength: $gsis.epoch_length
, securityParam: $gsis.parameter_k
, slotLength: $gsis.slot_duration
, protocolParams:
{ maxTxSize: $gsis.max_tx_size
, decentralisationParam: $gsis.decentralisation_param
, maxBlockBodySize: $gsis.max_block_size
, nOpt: $compo.n_pools
}
} * ($gsis.shelley // {}))
# , alonzo: supposed to already be filled
Expand Down

0 comments on commit b5129e4

Please sign in to comment.