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

multi: refactor mailbox item handling, more logs #40

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

torkelrogstad
Copy link
Contributor

@torkelrogstad torkelrogstad commented Feb 19, 2025

The idea with the mailbox item handling refactor is to make it possible to add tracing IDs to better figure out what's happening.

There's currently a linter failure here, which I'm not sure how to handle. @Ash-L2L are you able to help?

@@ -139,7 +139,7 @@ impl std::fmt::Display for PeerStateId {
}
}

#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, strum::Display)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if a Display impl is a good idea here, debug should be enough.
If you just want to show the discriminant, use https://docs.rs/strum/latest/strum/derive.EnumDiscriminants.html and https://docs.rs/strum/latest/strum/trait.IntoDiscriminant.html

@@ -157,7 +157,9 @@ pub enum Response {
TransactionRejected(Txid),
}

#[derive(BorshSerialize, Clone, Debug, Deserialize, Serialize)]
#[derive(
BorshSerialize, Clone, Debug, Deserialize, Serialize, strum::Display,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if a Display impl is a good idea here, debug should be enough.
If you just want to show the discriminant, use https://docs.rs/strum/latest/strum/derive.EnumDiscriminants.html and https://docs.rs/strum/latest/strum/trait.IntoDiscriminant.html

HashMap<mainchain_task::Request, HashSet<(SocketAddr, PeerStateId)>>,

/// PhantomData to use the MainchainTransport type parameter
_phantom: std::marker::PhantomData<MainchainTransport>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this type parameter needed at all here? Looks like the parameter should be on MailboxState::handle_mailbox_item

}

#[derive(Debug, strum::Display)]
enum MailboxItem {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please move this above MailboxState, since it is used in the impl for MailboxState

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