-
Notifications
You must be signed in to change notification settings - Fork 277
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
[feature] #1619: Introduce event-based triggers #1874
[feature] #1619: Introduce event-based triggers #1874
Conversation
Codecov Report
@@ Coverage Diff @@
## iroha2-dev #1874 +/- ##
==============================================
- Coverage 79.02% 78.24% -0.78%
==============================================
Files 163 164 +1
Lines 22243 22528 +285
==============================================
+ Hits 17577 17627 +50
- Misses 4666 4901 +235
Continue to review full report at Codecov.
|
be488e7
to
7c706f3
Compare
60c5053
to
6c4fb22
Compare
6c4fb22
to
81e7f51
Compare
/// Find all actions which match the current events. | ||
pub fn actions_matching(&self, events: &[Event]) -> Vec<Action> { | ||
let mut result = Vec::new(); | ||
for event in events { |
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 is quadratic, because DashMap
is keyed in the trigger's name.
A solution would be to keep a few DashMaps
with specialised filters, and custom logic. I'd leave that for a much later stage if possible.
21cd85f
to
38f5885
Compare
38f5885
to
8f1f57a
Compare
8f1f57a
to
849efbb
Compare
@@ -312,11 +334,14 @@ impl ChainedBlock { | |||
.map(VersionedRejectedTransaction::hash) | |||
.collect::<MerkleTree<_>>() | |||
.root_hash(); | |||
let trigger_recommendations = self.trigger_recommendations; | |||
// TODO: Validate trigger recommendations somehow? |
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.
I'm still under considering about how to validate the recommendations
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.
I used to think that the technical accounts would be the solution. But the problem with them, is that you either don't attach a signature, store the private key on-chain or in a node, either of which defeats the point of validation.
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 is left to #1891, right?
// TODO: This should properly process triggers | ||
let trigger_recommendations = Vec::new(); |
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.
From what this PR is suggesting,
wsv.triggers.recommendations
works as a temporary store of the recommendations
which is based on events emitted by previous block application, right?
Then Sumeragi somehow can receive the recommendations from WSV
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.
Exactly.
I'm wondering if there's more kinds of validation that we could do.
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.
Could you create an issue for this TODO?
26686a7
to
8e33775
Compare
8e33775
to
bf9aa94
Compare
b684b60
to
86b0bc7
Compare
Signed-off-by: Aleksandr <[email protected]>
Signed-off-by: Aleksandr <[email protected]>
Signed-off-by: Aleksandr <[email protected]>
86b0bc7
to
d00ceeb
Compare
@@ -312,11 +334,14 @@ impl ChainedBlock { | |||
.map(VersionedRejectedTransaction::hash) | |||
.collect::<MerkleTree<_>>() | |||
.root_hash(); | |||
let trigger_recommendations = self.trigger_recommendations; | |||
// TODO: Validate trigger recommendations somehow? |
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 is left to #1891, right?
// TODO: This should properly process triggers | ||
let trigger_recommendations = Vec::new(); |
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.
Could you create an issue for this TODO?
Description of the Change
Add
TriggerSet
and carry trigger recommendations through the lifecycle of a block.TriggerSet
is stored in WSV.Issue
Closes #1619
Closes #1859
Related to #1771
Benefits
Event triggers
Possible Drawbacks
Prototype implementation, so both UX and reliability are untested.
Event processing is quadratic.
Opens #1889
Opens #1890
Opens #1891
Opens #1892