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

fix(txpool): Error in GossipsubMessageAcceptance variant docstrings #2316

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

netrome
Copy link
Contributor

@netrome netrome commented Oct 8, 2024

Description

The documentation for the Ignore and Reject variants has been mixed up. This PR corrects it.

@netrome netrome requested a review from a team October 8, 2024 12:53
Copy link
Member

@MitchTurner MitchTurner left a comment

Choose a reason for hiding this comment

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

And we are certain this isn't swapped in usage elsewhere?

@netrome netrome added the no changelog Skip the CI check of the changelog modification label Oct 8, 2024
@netrome
Copy link
Contributor Author

netrome commented Oct 8, 2024

And we are certain this isn't swapped in usage elsewhere?

I'm not certain, but the place that caused my eyebrows to shift is correct. I'll go over all references to these variants and see if I find any other error. But the documentation is incorrect, and this PR fixes that at least.

@netrome netrome requested a review from MitchTurner October 8, 2024 12:57
Copy link
Member

@MitchTurner MitchTurner left a comment

Choose a reason for hiding this comment

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

Some nits on the existing comments while we are here.

crates/types/src/services/p2p.rs Outdated Show resolved Hide resolved
@@ -52,10 +52,10 @@ pub enum GossipsubMessageAcceptance {
/// Report whether the gossiped message is valid and safe to rebroadcast
Copy link
Member

Choose a reason for hiding this comment

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

"Report whether" is weird wording here. Doesn't it just "Accept" the message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. I wonder if we should even use verbs in these comments like "Report". This is a data structure, and not a behavior we're documenting.

I've reworked the comments a bit now. What do you think of the following?

/// Status of a message received via Gossip
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
pub enum GossipsubMessageAcceptance {
    /// The gossiped message is valid and safe to rebroadcast.
    Accept,
    /// The gossiped message is invalid and should be ignored.
    Ignore,
    /// The gossiped message is invalid and anyone relaying it should be penalized.
    Reject,
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@netrome
Copy link
Contributor Author

netrome commented Oct 8, 2024

And we are certain this isn't swapped in usage elsewhere?

Sweeped all references now. There seems to only be two places where the individual variants are referenced outside of test code (and this is extensively referenced from test code). The first place is the construction in process_insertion_result, which is correct, and the other place is just a simple mapping between this and the equivalent MessageAcceptance struct which is just a 1:1 mapping.

So yes, I am confident that this is correct now.

rafal-ch
rafal-ch previously approved these changes Oct 8, 2024
Copy link
Contributor

@rafal-ch rafal-ch left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@netrome netrome force-pushed the fix/gossipsub_message_info_docs branch from 6c589b8 to 7cf9472 Compare October 8, 2024 13:11
@@ -44,18 +44,15 @@ pub struct GossipsubMessageInfo {
pub peer_id: PeerId,
}

// TODO: Maybe we can remove most of types from here directly into P2P
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this comment because it's not clear exactly what it refers to, and we don't have an issue to track it.

@netrome netrome enabled auto-merge (squash) October 8, 2024 13:15
@netrome netrome merged commit f22a149 into master Oct 8, 2024
33 checks passed
@netrome netrome deleted the fix/gossipsub_message_info_docs branch October 8, 2024 13:40
@rafal-ch rafal-ch mentioned this pull request Oct 11, 2024
rafal-ch added a commit that referenced this pull request Oct 11, 2024
## Version v0.39.0

### Added
- [2324](#2324): Added metrics
for sync, async processor and for all GraphQL queries.
- [2320](#2320): Added new CLI
flag `graphql-max-resolver-recursive-depth` to limit recursion within
resolver. The default value it "1".


## Fixed
- [2320](#2320): Prevent
`/health` and `/v1/health` from being throttled by the concurrency
limiter.
- [2322](#2322): Set the
salt of genesis contracts to zero on execution.
- [2324](#2324): Ignore peer
if we already are syncing transactions from it.

#### Breaking

- [2320](#2330): Reject
queries that are recursive during the resolution of the query.

### Changed

#### Breaking
- [2311](#2311): Changed the
text of the error returned by the executor if gas overflows.

## What's Changed
* chore(executor): instrument errors to be more meaningful by @rymnc in
#2311
* fix(dummy_da_block_costs): remove dependency on polling_interval and
use channel instead by @rymnc in
#2314
* fix(txpool): Error in GossipsubMessageAcceptance variant docstrings by
@netrome in #2316
* refactor: Eager returns in txpool_v2::service::Task::run by @netrome
in #2325
* fix(api_service): exclude health checks from throttling with
ConcurrencyLimitLayer by @rymnc in
#2320
* Remove the `normalize_rewards_and_costs()` function by @rafal-ch in
#2293
* fix(genesis): set salt of contract on execution of genesis state
configuration by @rymnc in
#2322
* Fixing the issue with duplicate transaction synchronization processes
by @xgreenx in #2324
* Reject queries that are recursive during the resolution by @xgreenx in
#2330


**Full Changelog**:
v0.38.0...v0.39.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog Skip the CI check of the changelog modification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants