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

[feature] #2037: Introduce Pre-commit Triggers #2041

Merged
merged 4 commits into from
Mar 31, 2022

Conversation

Arjentix
Copy link
Contributor

Description of the Change

Initially I was planning to implement 3'rd test-case from #1890, but I forgot, that me and @appetrosyan decided to implement it with roles, not with triggers. But in the moment of realizing I've already finished this task, so here I am

  • Some functions refactored to be const
  • Added possibility to create pre-commit triggers as another kind of time-triggers
  • Added integration test for pre-commit trigger

Issue

Closes #2037

Benefits

Pre-commit triggers!

Possible Drawbacks

None

Usage Examples or Tests

See client/tests/integration/triggers/time_trigger.rs

Signed-off-by: Daniil Polyakov <arjentix@gmail.com>
Signed-off-by: Daniil Polyakov <arjentix@gmail.com>
Signed-off-by: Daniil Polyakov <arjentix@gmail.com>
@github-actions github-actions bot added the iroha2-dev The re-implementation of a BFT hyperledger in RUST label Mar 30, 2022
@codecov
Copy link

codecov bot commented Mar 30, 2022

Codecov Report

Merging #2041 (baa6b3b) into iroha2-dev (892c2d2) will increase coverage by 0.04%.
The diff coverage is 89.74%.

❗ Current head baa6b3b differs from pull request most recent head 7eba29e. Consider uploading reports for the commit 7eba29e to get more accurate results

@@              Coverage Diff               @@
##           iroha2-dev    #2041      +/-   ##
==============================================
+ Coverage       77.94%   77.98%   +0.04%     
==============================================
  Files             176      176              
  Lines           23982    24039      +57     
==============================================
+ Hits            18692    18747      +55     
- Misses           5290     5292       +2     
Impacted Files Coverage Δ
core/src/smartcontracts/isi/triggers.rs 29.03% <ø> (ø)
data_model/src/events/time.rs 86.25% <73.07%> (-1.84%) ⬇️
client/tests/integration/triggers/time_trigger.rs 97.39% <97.82%> (+0.16%) ⬆️
data_model/src/events/data/filters.rs 24.28% <100.00%> (ø)
data_model/src/events/execute_trigger.rs 77.77% <100.00%> (ø)
data_model/src/isi.rs 82.28% <100.00%> (ø)
data_model/src/merkle.rs 93.75% <100.00%> (ø)
tools/kura_inspector/src/print.rs 96.92% <100.00%> (ø)
core/src/block_sync.rs 88.55% <0.00%> (-1.81%) ⬇️
p2p/tests/p2p.rs 94.36% <0.00%> (-1.13%) ⬇️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 892c2d2...7eba29e. Read the comment docs.

@appetrosyan
Copy link
Contributor

I'd like to comment that we could need pre-commit triggers for other purposes. For example for the atomic swap and offline transactions.

IntoSchema,
Hash,
)]
pub enum ExecutionTime {
Copy link
Contributor

@appetrosyan appetrosyan Mar 31, 2022

Choose a reason for hiding this comment

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

This is an option-like enum. It should use the niche available in the other data type to encode the discriminant, but I would double check.

Otherwise flatten.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep. The sizes are identical even in Debug builds.

IntoSchema,
Hash,
)]
pub enum ExecutionTime {
Copy link
Contributor

Choose a reason for hiding this comment

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

Yep. The sizes are identical even in Debug builds.

Copy link
Contributor

@s8sato s8sato left a comment

Choose a reason for hiding this comment

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

One question remains about its naming.
What is the reason we can say it is not post-commit but pre-commit?
It looks to me every-commit or per-commit

@appetrosyan appetrosyan merged commit 8d83a3e into hyperledger:iroha2-dev Mar 31, 2022
@Arjentix Arjentix deleted the pre_commit_triggers branch March 31, 2022 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iroha2-dev The re-implementation of a BFT hyperledger in RUST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants