Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stake credential history tool #3086

Merged
merged 1 commit into from
Oct 12, 2021
Merged

Conversation

JaredCorduan
Copy link
Contributor

@JaredCorduan JaredCorduan commented Aug 16, 2021

I made this tool, which has come in handy for debugging several issues. The tool takes a stake credential and uses foldBlocks to replay the chain and log every event related to this credential. Currently it only works for key credentials.

I think it makes sense to check this tool in.

@erikd
Copy link
Contributor

erikd commented Oct 12, 2021

This does not work on the shelley_qa network:

$ ./stake-credential-history-exe --conf config/shelley_qa-config.json --socket \
    ../cardano-node/state-node-shelley_qa/node.socket --checkpoints-off \
    --stake-address-hex e017e3b8e8dd979fa86d3f1e49957c6132e528042e2f115a9c51c67c6f
stake-credential-history-exe: EpochErr "PastHorizon {pastHorizonCallStack = [(\"runQuery\",SrcLoc {srcLocPackage = \"ouroboros-consensus-0.1.0.0-76b8ce8a4fbefce7e17fef184981a21eea77d5008300bfc13951651ff54bb3f4\", srcLocModule = \"Ouroboros.Consensus.HardFork.History.Qry\", srcLocFile = \"src/Ouroboros/Consensus/HardFork/History/Qry.hs\", srcLocStartLine = 429, srcLocStartCol = 44, srcLocEndLine = 429, srcLocEndCol = 64}),(\"interpretQuery\",SrcLoc {srcLocPackage = \"ouroboros-consensus-0.1.0.0-76b8ce8a4fbefce7e17fef184981a21eea77d5008300bfc13951651ff54bb3f4\", srcLocModule = \"Ouroboros.Consensus.HardFork.History.EpochInfo\", srcLocFile = \"src/Ouroboros/Consensus/HardFork/History/EpochInfo.hs\", srcLocStartLine = 43, srcLocStartCol = 50, srcLocEndLine = 43, srcLocEndCol = 68}),(\"interpretQuery'\",SrcLoc {srcLocPackage = \"ouroboros-consensus-0.1.0.0-76b8ce8a4fbefce7e17fef184981a21eea77d5008300bfc13951651ff54bb3f4\", srcLocModule = \"Ouroboros.Consensus.HardFork.History.EpochInfo\", srcLocFile = \"src/Ouroboros/Consensus/HardFork/History/EpochInfo.hs\", srcLocStartLine = 36, srcLocStartCol = 31, srcLocEndLine = 36, srcLocEndCol = 71}),(\"epochInfoEpoch_\",SrcLoc {srcLocPackage = \"cardano-slotting-0.1.0.0-e926e1d5ed7afa4784535e579a97151645f58779d1692c1985a95d50c33e8e5e\", srcLocModule = \"Cardano.Slotting.EpochInfo.API\", srcLocFile = \"src/Cardano/Slotting/EpochInfo/API.hs\", srcLocStartLine = 54, srcLocStartCol = 9, srcLocEndLine = 54, srcLocEndCol = 24}),(\"epochInfoEpoch\",SrcLoc {srcLocPackage = \"cardano-slotting-0.1.0.0-e926e1d5ed7afa4784535e579a97151645f58779d1692c1985a95d50c33e8e5e\", srcLocModule = \"Cardano.Slotting.EpochInfo.API\", srcLocFile = \"src/Cardano/Slotting/EpochInfo/API.hs\", srcLocStartLine = 116, srcLocStartCol = 27, srcLocEndLine = 116, srcLocEndCol = 44}),(\"epochInfoEpoch_\",SrcLoc {srcLocPackage = \"cardano-slotting-0.1.0.0-e926e1d5ed7afa4784535e579a97151645f58779d1692c1985a95d50c33e8e5e\", srcLocModule = \"Cardano.Slotting.EpochInfo.API\", srcLocFile = \"src/Cardano/Slotting/EpochInfo/API.hs\", srcLocStartLine = 54, srcLocStartCol = 9, srcLocEndLine = 54, srcLocEndCol = 24}),(\"epochInfoEpoch\",SrcLoc {srcLocPackage = \"cardano-slotting-0.1.0.0-e926e1d5ed7afa4784535e579a97151645f58779d1692c1985a95d50c33e8e5e\", srcLocModule = \"Cardano.Slotting.EpochInfo.API\", srcLocFile = \"src/Cardano/Slotting/EpochInfo/API.hs\", srcLocStartLine = 116, srcLocStartCol = 27, srcLocEndLine = 116, srcLocEndCol = 44}),(\"epochInfoEpoch_\",SrcLoc {srcLocPackage = \"cardano-slotting-0.1.0.0-e926e1d5ed7afa4784535e579a97151645f58779d1692c1985a95d50c33e8e5e\", srcLocModule = \"Cardano.Slotting.EpochInfo.API\", srcLocFile = \"src/Cardano/Slotting/EpochInfo/API.hs\", srcLocStartLine = 54, srcLocStartCol = 9, srcLocEndLine = 54, srcLocEndCol = 24}),(\"epochInfoEpoch\",SrcLoc {srcLocPackage = \"cardano-ledger-core-0.1.0.0-89813406c9d3db99fc6f82d22586a6811292651cf9d67a3270f5237f3262d498\", srcLocModule = \"Cardano.Ledger.Slot\", srcLocFile = \"src/Cardano/Ledger/Slot.hs\", srcLocStartLine = 62, srcLocStartCol = 28, srcLocEndLine = 62, srcLocEndCol = 48}),(\"epochInfoEpoch\",SrcLoc {srcLocPackage = \"cardano-ledger-shelley-0.1.0.0-b8d81370f39b70052cdee949ac6efcb4294812b9b7b295ffc0cef01974ffdd7f\", srcLocModule = \"Cardano.Ledger.Shelley.Rules.Tick\", srcLocFile = \"src/Cardano/Ledger/Shelley/Rules/Tick.hs\", srcLocStartLine = 160, srcLocStartCol = 5, srcLocEndLine = 160, srcLocEndCol = 27})], pastHorizonExpression = Some (ELet (ERelSlotToEpoch (EAbsToRelSlot (ELit (SlotNo 21600)))) (\\x0 -> EPair (ERelToAbsEpoch (EVar x0)) (ESnd (EVar x0)))), pastHorizonSummary = [EraSummary {eraStart = Bound {boundTime = RelativeTime 0s, boundSlot = SlotNo 0, boundEpoch = EpochNo 0}, eraEnd = EraEnd (Bound {boundTime = RelativeTime 14400s, boundSlot = SlotNo 720, boundEpoch = EpochNo 2}), eraParams = EraParams {eraEpochSize = EpochSize 360, eraSlotLength = SlotLength 20s, eraSafeZone = StandardSafeZone 72}},EraSummary {eraStart = Bound {boundTime = RelativeTime 14400s, boundSlot = SlotNo 720, boundEpoch = EpochNo 2}, eraEnd = EraEnd (Bound {boundTime = RelativeTime 21600s, boundSlot = SlotNo 7920, boundEpoch = EpochNo 3}), eraParams = EraParams {eraEpochSize = EpochSize 7200, eraSlotLength = SlotLength 1s, eraSafeZone = StandardSafeZone 2160}}]}"

Also on the shelley_qa network, the --stake-address-bech32 command line option does not understand stake_test1uqt78w8gmktel2rd8u0yn9tuvyew22qy9ch3zk5u28r8cmcdkesdj which is valid on that network.

Copy link
Contributor

@erikd erikd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to also work on shelley_qa .

@JaredCorduan
Copy link
Contributor Author

@erikd it works on shelley-qa if you set the correct number of slots-per-epoch. I'm not sure why foldBlocks doesn't handle this automatically, but in the meantime I can document and explain how you figure it out (here and in the markdown doc).

Note that k is set to 36 on shelley-qa: https://github.com/input-output-hk/cardano-node/blob/ea49211672eb26ba46121cd7afabc562df5490dc/configuration/cardano/shelley_qa-byron-genesis.json#L61

Byron has 10k slots per epoch, so you need to use --slots-per-epoch 360 when running shelley-qa.

@JaredCorduan JaredCorduan force-pushed the jc/stake-credential-history-tool branch from 00be4eb to c33653a Compare October 12, 2021 13:55
@JaredCorduan JaredCorduan force-pushed the jc/stake-credential-history-tool branch from c33653a to 27f858b Compare October 12, 2021 14:13
@JaredCorduan
Copy link
Contributor Author

@erikd it turned out to be easy to get foldBlocks to compute slotsPerEpoch, so now there is no need to use the flag. I've also fixed the -stake-address-bech32 flag so that it now works on testnet.

@erikd
Copy link
Contributor

erikd commented Oct 12, 2021

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Oct 12, 2021

Build succeeded:

@iohk-bors iohk-bors bot merged commit 068aa46 into master Oct 12, 2021
@iohk-bors iohk-bors bot deleted the jc/stake-credential-history-tool branch October 12, 2021 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants