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

Refactor: No unwraps No. 2 #135

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

Conversation

aoikurokawa
Copy link
Contributor

Related to #116, I found some unwrapping in jito-jsm-core module.

Copy link
Contributor

@coachchucksol coachchucksol left a comment

Choose a reason for hiding this comment

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

Still need to make sure the program fails if a previous unwraped would have failed

@@ -66,7 +68,7 @@ impl SlotToggle {
/// * `bool` - Whether the feature was successfully activated
pub fn activate(&mut self, slot: u64, epoch_length: u64) -> bool {
match self.state(slot, epoch_length) {
SlotToggleState::Inactive => {
Ok(SlotToggleState::Inactive) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

In these cases, we'll want to also check for the error and fail the program. So this function would also return a Result<bool, JsmCoreError>

@aoikurokawa
Copy link
Contributor Author

@coachchucksol
Thanks! I've modified some functions in slot_toggle to return the Result type.

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