Skip to content

Instantly share code, notes, and snippets.

@redshiftzero
Last active December 10, 2025 22:11
Show Gist options
  • Select an option

  • Save redshiftzero/2bb007f98e7867eb7dce93a9246b25f4 to your computer and use it in GitHub Desktop.

Select an option

Save redshiftzero/2bb007f98e7867eb7dce93a9246b25f4 to your computer and use it in GitHub Desktop.
% ./update-webcat-r2.sh
Current height: 153, publishing for height: 154
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.13s
Running `target/debug/felidae-publish print --height 154`
=== list.json contents ===
{
"block_height": 153,
"leaves": [
[
"canonical/.re.nym.testapp",
"0a20281a8551b8db0de52cfdb2f42aec762a8ada89f86a8b4fced33163478cc6bee3"
]
],
"proof": {
"app_hash": "d6b5c38c393af866853815c7f77d88495266d51669c4ffc8b73a5cd12dda1868",
"canonical_root_hash": "a793ac0f83419f86928e5d569e6747da366562cc551748d83e9ae90698651a31",
"merkle_proof": {
"proof_bytes": [
"0a4c0a0f2e72652e6e796d2e7465737461707012220a20281a8551b8db0de52cfdb2f42aec762a8ada89f86a8b4fced33163478cc6bee31a150801100118012a0d4a4d543a3a4c6561664e6f6465",
"0aec010a0963616e6f6e6963616c1220a793ac0f83419f86928e5d569e6747da366562cc551748d83e9ae90698651a311a150801100118012a0d4a4d543a3a4c6561664e6f64652236080112104a4d543a3a496e74726e616c4e6f64651a20424c9766a054b842f8f34dfc22a323b02a11cc784f9a87c1e343388c7b0052db2236080112104a4d543a3a496e74726e616c4e6f64651a205350415253455f4d45524b4c455f504c414345484f4c4445525f484153485f5f2236080112104a4d543a3a496e74726e616c4e6f64651a205350415253455f4d45524b4c455f504c414345484f4c4445525f484153485f5f"
],
"representative_key": "canonical/.re.nym.testapp"
}
}
}
=== block.json contents ===
{
"signed_header": {
"header": {
"version": {
"block": "11",
"app": "0"
},
"chain_id": "test-chain-hGjZNv",
"height": "154",
"time": "2025-12-10T22:10:32.870076Z",
"last_block_id": {
"hash": "814AF96D7ED1D84B827D38D94C0BBE1D7FCFBA0D2A16BD77C7CA5E9C73A9B110",
"parts": {
"total": 1,
"hash": "1F05C7F77E154F83C82B9B2CA0960F094A98B5831914A7C12F06F711169D7407"
}
},
"last_commit_hash": "096F32233EF1C34D5F8BDD6F597EC530F6CEF890F7C3E49854B0F96AFD38BBEC",
"data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
"validators_hash": "04C72627103FD466C7B4C30C0E654D2B58EA140493C009B8BAB66749FFEBE60C",
"next_validators_hash": "04C72627103FD466C7B4C30C0E654D2B58EA140493C009B8BAB66749FFEBE60C",
"consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F",
"app_hash": "D6B5C38C393AF866853815C7F77D88495266D51669C4FFC8B73A5CD12DDA1868",
"last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
"evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
"proposer_address": "F588CF8C0CA8D88CDD2F909C8262018B361CF5D5"
},
"commit": {
"height": "154",
"round": 0,
"block_id": {
"hash": "CAB8A5D2AF8900FF008B08442F847D7309F57F63CD81CCEFE6EE180121D7105B",
"parts": {
"total": 1,
"hash": "527613AEC1C1AAE0631AF78F24283F070EE89F0074571F47283C64125FFB5D8B"
}
},
"signatures": [
{
"block_id_flag": 2,
"validator_address": "F588CF8C0CA8D88CDD2F909C8262018B361CF5D5",
"timestamp": "2025-12-10T22:10:37.903522Z",
"signature": "0HHWyx0njoU/fQcZIr1kNIgKmv8qxK/s32g/cj5PfRYGARdG/mLpVR35yiuy61BwIWvT3+PKPiJB5bMI3PQlDw=="
}
]
}
},
"validator_set": {
"validators": [
{
"address": "F588CF8C0CA8D88CDD2F909C8262018B361CF5D5",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "Pn7hPwDPYkoBBTKxdxL0QZLdPCupGXyds/qSyOIBSZg="
},
"power": "10",
"name": null
}
],
"proposer": {
"address": "F588CF8C0CA8D88CDD2F909C8262018B361CF5D5",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "Pn7hPwDPYkoBBTKxdxL0QZLdPCupGXyds/qSyOIBSZg="
},
"power": "10",
"name": null
},
"total_voting_power": "10"
}
}
Saved list.json and block.json
#!/usr/bin/env bash
set -euo pipefail
FELIDAE_QUERY_URL="http://127.0.0.1/canonical/leaves"
# 1. Query Felidae for current canonical leaves
LIST_JSON=$(curl -fsS "${FELIDAE_QUERY_URL}")
# 2. Extract block_height
CURRENT_HEIGHT=$(echo "${LIST_JSON}" | jq -r '.block_height')
if [[ -z "${CURRENT_HEIGHT}" || "${CURRENT_HEIGHT}" == "null" ]]; then
echo "ERROR: Could not extract block_height from ${FELIDAE_QUERY_URL}" >&2
exit 1
fi
NEXT_HEIGHT=$(( CURRENT_HEIGHT + 1 ))
echo "Current height: ${CURRENT_HEIGHT}, publishing for height: ${NEXT_HEIGHT}"
# 3. Generate LightBlock with felidae-publish
TMPFILE=$(mktemp)
trap 'rm -f "$TMPFILE"' EXIT
cargo run --bin felidae-publish -- print --height "${NEXT_HEIGHT}" > "${TMPFILE}"
# 4. Save list.json and block.json
# - LIST_JSON variable contains canonical leaves data which becomes: list.json
# - TMPFILE contains LightBlock from felidae-publish which becomes: block.json
echo "${LIST_JSON}" | jq . > list.json
cp "${TMPFILE}" block.json
echo "=== list.json contents ==="
cat list.json | jq .
echo ""
echo "=== block.json contents ==="
cat block.json | jq .
echo ""
echo "Saved list.json and block.json"
# TODO: upload JSON files to R2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment