Missing blocks but unsure why

Can you post the exact script you are using, and tell me exactly when you executed it and for each epoch?

You wrote:

I ran the cardano-cli query ledger-stateand dumpedledger-state.json to

but the usage does not need it.
You need to query stake snapshot and extract POOL_STAKE and ACTIVE_STAKE, then calculate the leaderlog.

SNAPSHOT=$(/usr/local/bin/cardano-cli query stake-snapshot --mainnet --stake-pool-id ${POOL_ID})
POOL_STAKE=$(jq .poolStakeMark <<< ${SNAPSHOT})
ACTIVE_STAKE=$(jq .activeStakeMark <<< ${SNAPSHOT})

If you use poolStakeMark and activeStakeMark, you can calculate for the next epoch, when there are less than 36 hours before the epoch ends:

cncli leaderlog --ledger-set next ....

and if you want for the current epoch, then you have to use poolStakeSet and activeStakeSet

POOL_STAKE=$(jq .poolStakeSet <<< ${SNAPSHOT})
ACTIVE_STAKE=$(jq .activeStakeSet <<< ${SNAPSHOT})

and run
cncli leaderlog --ledger-set current ....

Did you do this?

Sure, here is my script that runs the leaderlog for the current epoch. It’s based on the coincashew guide, but it’s the same as the Andrew Westberg script.

#!/usr/bin/env bash

/usr/local/bin/cncli sync --host 127.0.0.1 --port 6000 --no-service

MYPOOLID=$(cat $NODE_HOME/stakepoolid.txt)

echo "LeaderLog - POOLID $MYPOOLID"

SNAPSHOT=$(/usr/local/bin/cardano-cli query stake-snapshot --stake-pool-id $MYPOOLID --mainnet)
POOL_STAKE=$(echo "$SNAPSHOT" | grep -oP '(?<=    "poolStakeMark": )\d+(?=,?)')
ACTIVE_STAKE=$(echo "$SNAPSHOT" | grep -oP '(?<=    "activeStakeMark": )\d+(?=,?)')
MYPOOL=`/usr/local/bin/cncli leaderlog --pool-id $MYPOOLID --pool-vrf-skey ${NODE_HOME}/vrf.skey --byron-genesis ${NODE_HOME}/mainnet-byron-genesis.json --shelley-genesis ${NODE_HOME}/mainnet-shelley-genesis.json --pool-stake $POOL_STAKE --active-stake $ACTIVE_STAKE --ledger-set current`
echo $MYPOOL | jq .

EPOCH=`echo $MYPOOL | jq .epoch`
echo "\`Epoch $EPOCH\` 🧙🔮:"

SLOTS=`echo $MYPOOL | jq .epochSlots`
IDEAL=`echo $MYPOOL | jq .epochSlotsIdeal`
PERFORMANCE=`echo $MYPOOL | jq .maxPerformance`

echo "\`MYPOOL - $SLOTS \`🎰\`,  $PERFORMANCE% \`🍀max, \`$IDEAL\` 🧱ideal"

The, if you read your script and my previous message, it is clear why it is wrong.
You are using the stake values for next epoch to calculate the leaderlog for the current epoch.
You should update it to use:
POOL_STAKE=$(jq .poolStakeSet <<< ${SNAPSHOT})
ACTIVE_STAKE=$(jq .activeStakeSet <<< ${SNAPSHOT})
or
POOL_STAKE=$(echo "$SNAPSHOT" | grep -oP '(?<= "poolStakeSet": )\d+(?=,?)') ACTIVE_STAKE=$(echo "$SNAPSHOT" | grep -oP '(?<= "activeStakeSet": )\d+(?=,?)')
(if you prefer to use grep instead of jq) for the current epoch.

1 Like

Great catch George! I simply copied one of the scripts and changed out the ledger-set values (prev,current,next). I didn’t notice the stake property name differences. Thanks to you, I have fixed them. :pray:

As long as we’re on this subject. Maybe you know the answer to these questions:

  1. Where can one see the nonce value of each epoch, so that we can compare to the script output? I could not find it on cardanoscan.io.

  2. Last epoch, I ran the ReLeaderLogs script, which queries Blockfrost API using python (github repo). This script gave me back 2 assigned slots. However, I only minted one block last epoch, so I assumed I missed the 2nd block. Just now, I ran the cncli-leaderlogs-prev.sh script, and it only shows one assigned slot, which matches the one I minted. Is the cncli-leaderlogs-prev.sh script only showing the assigned slots that produced blocks? I’m guessing that it doesn’t cull out the missed slots, so maybe I was only meant to get one assigned block after all. But, that’s just a guess.

Thanks

I’m glad it’s working now!

  1. the nonce must be calculated, I did not see it on any cardano explorer.
    You can calculate it for the next epoch (when there are less than 36 hours until the current epoch ends) like this:
    /usr/local/bin/cncli nonce
    –ledger-set next
    –byron-genesis ~/cardano-node/config/mainnet-byron-genesis.json
    –shelley-genesis ~/cardano-node/config/mainnet-shelley-genesis.json
    –db ~/cardano-node/cncli-db/cncli.db
    (of course with you correct paths to the files)

  2. I don’t think the leaderlog for the previous epoch is checking the minted blocks. I’m sure it is calculating the slots just as for the current epoch and next epoch.

1 Like