-
Notifications
You must be signed in to change notification settings - Fork 225
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
// 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 |
There was a problem hiding this comment.
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?
Why this should be merged
How this works
How this was tested
How is this documented