-
Notifications
You must be signed in to change notification settings - Fork 26
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
Move time-related enabling conditions to p2p #254
Conversation
Because |
Yes, you're right, I've been looking at the I would also remove that |
There are some issues still, probably I screwed up enabling conditions when merged them. |
2db7edc
to
feacbc6
Compare
35336b7
to
a009fe2
Compare
@binier Zura, how about that? Having additional time-aware method proved to be error-prone, so I've just added the |
Is this required because the substates don't have access to the top-level state time? What about adding a new pub trait EnablingCondition<State> {
/// Enabling condition for the Action.
///
/// Checks if the given action is enabled for a given state.
fn is_enabled(&self, state: &State) -> bool {
true
}
/// Enabling condition for the Action (version with time).
///
/// Checks if the given action is enabled for a given state and timestamp.
fn is_enabled_with_time(&self, state: &State, _time: crate::Timestamp) -> bool {
self.is_enabled(state)
}
} This allows for the current enabling conditions that do not require this workaround to keep their current definitions. |
Well, partially. On the other hand, keeping time in state is kind of a workaround.
That was my first idea, but with current impl we need to be super-careful implementing |
@binier @tizoc If you're fine with this, I'd like to merge it. @binier also this one: openmina/redux-rs#1 |
@akoptelov right now I cannot come up with a better alternative that solves the issue you mentioned above, so +1 from me |
a009fe2
to
804ed3c
Compare
closes #253
@binier
Note that now time passed to enabling condition is slightly differ from what is in theSee discussion below.state.time()
, but I think this is more consistent, asstate.time()
might jump back, and time that comes from redux is monotonous.