-
Notifications
You must be signed in to change notification settings - Fork 302
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
staking: 🎁 add additional tracing telemetry #4017
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
to disambiguate epochs ending due to chain upgrades, or other natural causes, include these in the info event.
the changes in `crates/core/component/stake/src/lib.rs` are the important bit here. `StateReadExt` and `StateWriteExt` are complimentary traits, and thus often used together. if we are going to reexport `StateReadExt` in the top-level namespace, we should include both. changes in other files adjust imports so that we import both from the same path, instead of `crate::{StateReadExt, component::StateWriteExt}`, to clarify their semantic relation.
this is where we are reexporting symbols into our public api. since there is only one `Lazy` here, let's avoid conflating local imports and public api surface, and refer to `Lazy` by its whole path.
a nit: let's be extra clear that we are reexporting symbols from this crate.
these are the core interactions with the cnidarium storage that the app uses to query various staking parameters.
NB: this is different from logging the error that is propagated back upwards. at this precise point, it where we will still be in the context of the various spans that brought us to this point: this allows to see information like: ``` 2024-03-13T16:47:37.801600Z INFO penumbra_app::app: ending epoch, is_end_epoch: true, is_chain_upgrade: false, current_height: 718 at crates/core/app/src/app/mod.rs:485 in penumbra_app::app::end_block with height: 1 in penumbra_mock_consensus::abci::end_block in penumbra_mock_consensus::block::execute with height: 718, time: 1710348457 in penumbra_mock_consensus::fast_forward with blocks: 1000, height: 0, fast_forward.blocks: 1000 in mock_consensus_staking::fast forwarding test node to next epoch 2024-03-13T16:47:37.802068Z ERROR penumbra_stake::component::stake: could not find delegation changes for block at crates/core/component/stake/src/component/stake.rs:262 in penumbra_stake::component::stake::get_delegation_changes with height: block::Height(2) in penumbra_stake::component::epoch_handler::end_epoch with index: 0 in penumbra_stake::component::stake::staking in penumbra_app::app::end_block with height: 1 in penumbra_mock_consensus::abci::end_block in penumbra_mock_consensus::block::execute with height: 718, time: 1710348457 in penumbra_mock_consensus::fast_forward with blocks: 1000, height: 0, fast_forward.blocks: 1000 in mock_consensus_staking::fast forwarding test node to next epoch ```
the inner expression is a `Result<T, E>`, we don't need to write `Ok(expr?)`.
cratelyn
added
A-staking
Area: Design and implementation of staking and delegation
C-enhancement
Category: an enhancement to the codebase
A-telemetry
Area: Metrics, logging, and other observability-related features
A-mock-consensus
Area: Relates to the mock consensus engine
C-refactor
Category: refactors and other related improvements
labels
Mar 13, 2024
erwanor
approved these changes
Mar 13, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -474,7 +477,7 @@ impl App { | |||
.expect("able to detect upgrade heights"); | |||
|
|||
if is_end_epoch || is_chain_upgrade { | |||
tracing::info!(?current_height, "ending epoch"); | |||
tracing::info!(%is_end_epoch, %is_chain_upgrade, ?current_height, "ending epoch"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This was referenced Mar 13, 2024
cratelyn
added a commit
that referenced
this pull request
Mar 18, 2024
fixes #3966. fixes #3908. fixes _part of_ #3995. this branch introduces the first steps towards mock consensus (#3588) testing of the staking component (#3845). this defines a validator after genesis, and then shows that it does _not_ enter the consensus set. #3966 is addressed in this branch so that the existing genesis validator correctly enters the consensus set, and so that we can successfully progress to the second epoch. subsequent changes will exercise delegating to this validator in the `mock_consensus_can_define_and_delegate_to_a_validator`. #### ✨ changes * alters `with_penumbra_auto_app_state` so that it adds an allocation of delegation tokens to the shielded pool component's genesis content. * extends `generate_penumbra_validator` so that it generates a real spend key, and returns an `Allocation` for the generated validator. _(see #3966)_ * adds a new `mock_consensus_can_define_and_delegate_to_a_validator` test that defines a post-genesis validator. _(see #3908)_ * defines a new `ConsensusIndexRead::get_consensus_set()` method, which collects all of the identity keys returned by `consensus_set_stream`. * lowers the events in `penumbra_mock_consensus::block::Builder::execute()` to trace-level events. * `penumbra_mock_consensus::builder::Builder` will now log a warning if values may be errantly rewritten by the builder methods. * `TestNode::fast_forward` sets its `i` span field to `1..n`, rather than `0..n-1`. --- #### :link: related * #4009 * #4010 * #4011 * #4017 * #4027 * #4028 * #4029 * #3966 * #3908 * #3588 --------- Co-authored-by: Henry de Valence <hdevalence@penumbralabs.xyz>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-mock-consensus
Area: Relates to the mock consensus engine
A-staking
Area: Design and implementation of staking and delegation
A-telemetry
Area: Metrics, logging, and other observability-related features
C-enhancement
Category: an enhancement to the codebase
C-refactor
Category: refactors and other related improvements
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this is a group of improvements to the telemetry in the staking component, cherry-picked out of #4001. this improves the logs seen in tests, and additionally takes the time to make some other small gardening tweaks: consolidating imports, adding documentation comments, etc. this is another branch in the spirit of #4009.
the changes here are itemized into distinct, small code transformations to facilitate review, and demonstrate that these are noop changes. you can start here.
Ok(_)
StateReadExt
methodsself::
prefix in reexportsstate.end_epoch
callApp::end_block
end_epoch