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

Do the locking around Validator state instead of on each member #3163

Open
wants to merge 1 commit into
base: albatross
Choose a base branch
from

Conversation

hrxi
Copy link
Contributor

@hrxi hrxi commented Nov 27, 2024

This makes it easier to add new members, also, the individual locking did not really make sense because these shouldn't go out of sync.

info!("Initializing validator {}", validator.validator_address());
info!(
"Initializing validator {}",
validator.state().read().validator_address
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
validator.state().read().validator_address
validator.state().validator_address()

This read() is maybe not so nice, should I encapsulate that?

Copy link
Member

Choose a reason for hiding this comment

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

I do not mind the .read() here all that much, so from my end a change would not be necessary.

@sisou
Copy link
Member

sisou commented Nov 27, 2024

Can you add an explanation of why to the PR?

This makes it easier to add new members, also, the individual locking
did not really make sense because these shouldn't go out of sync.
@hrxi hrxi force-pushed the hrxi/validator_state branch from 9e0e58e to fbc8d13 Compare November 27, 2024 21:18
Copy link
Member

@nibhar nibhar left a comment

Choose a reason for hiding this comment

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

LGTM, just added a wish list item.

info!("Initializing validator {}", validator.validator_address());
info!(
"Initializing validator {}",
validator.state().read().validator_address
Copy link
Member

Choose a reason for hiding this comment

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

I do not mind the .read() here all that much, so from my end a change would not be necessary.

consensus_state: Arc<RwLock<ConsensusState>>,
validator_state: Option<InactivityState>,
automatic_reactivate: Arc<AtomicBool>,

macro_producer: Option<ProduceMacroBlock<TValidatorNetwork>>,
macro_state: Arc<RwLock<Option<MacroState>>>,
Copy link
Member

Choose a reason for hiding this comment

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

This could be added to the ValidatorState. Additionally that would open up a Rpc call to see the macro state which could be a very useful debugging tool.

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.

3 participants