Skip to content

Commit cce09b7

Browse files
committed
hardfork > create_runtime_config.sh: improve jq expression readability
1 parent 6a9ebe6 commit cce09b7

File tree

1 file changed

+35
-30
lines changed

1 file changed

+35
-30
lines changed

scripts/hardfork/create_runtime_config.sh

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,38 @@ SLOT=$((DIFFERENCE_IN_SLOTS+OFFSET))
3535
# jq expression below could be written with less code,
3636
# but we aimed for maximum verbosity
3737

38-
jq "{\
39-
genesis: {\
40-
genesis_state_timestamp: \"$GENESIS_TIMESTAMP\"\
41-
},\
42-
proof: {\
43-
fork: {\
44-
state_hash: .proof.fork.state_hash,\
45-
blockchain_length: .proof.fork.blockchain_length,\
46-
global_slot_since_genesis: $SLOT,\
47-
},\
48-
},\
49-
ledger: {\
50-
add_genesis_winner: false,\
51-
hash: \$hashes[0].ledger.hash,\
52-
s3_data_hash: \$hashes[0].ledger.s3_data_hash\
53-
},\
54-
epoch_data: {\
55-
staking: {\
56-
seed: .epoch_data.staking.seed,\
57-
hash: \$hashes[0].epoch_data.staking.hash,\
58-
s3_data_hash: \$hashes[0].epoch_data.staking.s3_data_hash\
59-
},\
60-
next: {\
61-
seed: .epoch_data.next.seed,\
62-
hash: \$hashes[0].epoch_data.next.hash,\
63-
s3_data_hash: \$hashes[0].epoch_data.next.s3_data_hash\
64-
}\
65-
}\
66-
}" -M \
67-
--slurpfile hashes "$LEDGER_HASHES_JSON" "$FORK_CONFIG_JSON"
38+
jq -M \
39+
--arg genesis_timestamp "$GENESIS_TIMESTAMP" \
40+
--argjson slot "$SLOT" \
41+
--slurpfile hashes "$LEDGER_HASHES_JSON" \
42+
'
43+
{
44+
genesis: {
45+
genesis_state_timestamp: $genesis_timestamp
46+
},
47+
proof: {
48+
fork: {
49+
state_hash: .proof.fork.state_hash,
50+
blockchain_length: .proof.fork.blockchain_length,
51+
global_slot_since_genesis: $slot
52+
}
53+
},
54+
ledger: {
55+
add_genesis_winner: false,
56+
hash: $hashes[0].ledger.hash,
57+
s3_data_hash: $hashes[0].ledger.s3_data_hash
58+
},
59+
epoch_data: {
60+
staking: {
61+
seed: .epoch_data.staking.seed,
62+
hash: $hashes[0].epoch_data.staking.hash,
63+
s3_data_hash: $hashes[0].epoch_data.staking.s3_data_hash
64+
},
65+
next: {
66+
seed: .epoch_data.next.seed,
67+
hash: $hashes[0].epoch_data.next.hash,
68+
s3_data_hash: $hashes[0].epoch_data.next.s3_data_hash
69+
}
70+
}
71+
}
72+
' "$FORK_CONFIG_JSON"

0 commit comments

Comments
 (0)