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: make Role type a uint64 and use constants #1240

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ARR4N
Copy link
Contributor

@ARR4N ARR4N commented Jul 17, 2024

Why this should be merged

How this works

How this was tested

How is this documented

Copy link
Collaborator

@darioush darioush left a comment

Choose a reason for hiding this comment

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

this seems like an improvement so far, could we add the context/motivation to the description?

default:
return false
}
// IsValid returns whether or not `r` is a valid value.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: while ` is more broadly used avalanche code bases use [] for this type of notation.

IsUint64() bool
}

// RoleFromBig converts `u.Uint64()` into a [Role] if `u.IsUint64()` is true.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit

Suggested change
// RoleFromBig converts `u.Uint64()` into a [Role] if `u.IsUint64()` is true.
// RoleFromBig converts `b.Uint64()` into a [Role] if `b.IsUint64()` is true.

return Role(state.GetState(precompileAddr, addressKey))
r, err := RoleFromHash(state.GetState(precompileAddr, addressKey))
if err != nil {
panic(err) // DO NOT MERGE
Copy link
Collaborator

Choose a reason for hiding this comment

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

what should the actual behavior be in this case?

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