dostrelith678 / cardano-leader-logs

NodeJS+Python implementation for calculating a pool's block schedule.
MIT License
6 stars 3 forks source link

[Feature] Support next epoch leader schedule calculation #15

Closed asnakep closed 1 year ago

asnakep commented 1 year ago

Hello,

thanks for your update on Praos math for leader logs calculation, please find this python script to get new epoch nonce if you want to integrate it in your tool:

https://github.com/asnakep/getNewEpochNonce.git

Manuel

dostrelith678 commented 1 year ago

Thanks for sharing, I noticed you use Blockfrost API to get the slot in epoch and cardano-cli for the rest.

So instead of relying on an external API, you can get the current slot in epoch from the local node instead and remove the dependency:

curl -s http://127.0.0.1:17798/metrics | grep slotInEpoch
cardano_node_metrics_slotInEpoch_int 1052

I will leave the issue as a feature request to support the following epoch schedule calculation (once past the 7/10 slot mark in epoch).

asnakep commented 1 year ago

Hello,

thanks for your feedback, for sure it can be done also with that prom metric, but the idea behind my tool is not to use a cardano-node at all to have a lightweight/portable tool for LL calculation.

https://github.com/asnakep/YaLL.git this use blockfrost for all except for the new epochNonce which is calculated using cardano-cli at stability windows start.

https://github.com/asnakep/YaLL_ArmadaNonce.git this use blockfrost for all and epochNonce is provided by my friends of Armada Alliance

Armada Alliance made a version using Koios APIs https://github.com/QuixoteSystems/cardano-leader-slot.git

They also told me you're a lead developer of Koios, would be great if possible to have the new epochNonce as API point in Koios.

Since protocol state query doens't go in db-sync tables, an extra table with just two columns (newEpoch, newNonce) could be set up using the method I previuosly posted.

May be as single point with just these two fields, or merged with protocol-parameters point.

Note: I built my tool some 10 months ago, refactoring the leader logs python script inside https://github.com/papacarp/pooltool.io.git

Armada Alliance pointed me here to check and update the new math for Praos, amazing work.

Kind regards, Manuel

dostrelith678 commented 1 year ago

but the idea behind my tool is not to use a cardano-node at all to have a lightweight/portable tool for LL calculation.

I see.

would be great if possible to have the new epochNonce as API point in Koios.

Yep, there will be. Some work was already done in preparation. The /pool_stake_snapshot endpoint provides all the data required for calculating block schedules - besides VRF pool keys (including data for the next epoch, but only the next epoch nonce will always be null for now).

Armada Alliance pointed me here to check and update the new math for Praos, amazing work.

It's nice to hear, thank you. Also, thanks should be primarily given to Andrew Westberg for his video on tPraos -> Praos impact on block schedule calculations, as it is great learning material for this topic.

asnakep commented 1 year ago

Great, thank you so much and yes Andrew is amazing, I bookmarked the video, In fact to get new nonce I saw the recipe from his video Epoch Nonce and some lecture from shelley specs

cheers, Manuel