-
Notifications
You must be signed in to change notification settings - Fork 4
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.
Did a very quick read. Looks good!
Left a couple of comments. only potential bug was the withdrawal credentials range
func isActive(epoch: EpochNumber) -> Bool { | ||
return self.activationEpoch <= epoch && epoch < self.exitEpoch | ||
func isActive(epoch: Epoch) -> Bool { | ||
return activationEpoch <= epoch && epoch < exitEpoch |
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.
Fancy. Don't need self.
?
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.
Nope, art.
@@ -254,17 +254,17 @@ extension StateTransition { | |||
} | |||
|
|||
static func exits(state: inout BeaconState, block: BeaconBlock) { |
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.
Might consider renaming voluntary_exits
|
||
assert(state.slot == transfer.slot) | ||
assert(BeaconChain.getCurrentEpoch(state: state) >= state.validatorRegistry[Int(transfer.from)].withdrawableEpoch) | ||
// @todo does this work (-1)? |
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.
Does it?
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.
If it does work, wouldn't it be 1 ..<= -1
so you include the last element?
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.
@djrtwo found something even nicer: https://developer.apple.com/documentation/foundation/data/1779685-suffix
@@ -297,7 +340,7 @@ extension StateTransition { | |||
extension StateTransition { | |||
|
|||
static func processEpoch(state: inout BeaconState) { | |||
assert(state.slot + 1 % EPOCH_LENGTH == 0) // @todo not sure if this should be here | |||
assert(state.slot + 1 % SLOTS_PER_EPOCH == 0) // @todo not sure if this should be here |
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.
You should only call this function if that condition holds. Seems a little redundant to assert it here but not necessarily incorrect
No description provided.