-
Notifications
You must be signed in to change notification settings - Fork 283
feat: generic structure through execution cycle #5355
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Shunkichi Sato <[email protected]>
Signed-off-by: Shunkichi Sato <[email protected]>
Signed-off-by: Shunkichi Sato <[email protected]>
Signed-off-by: Shunkichi Sato <[email protected]>
…implemented for Wasm) Signed-off-by: Shunkichi Sato <[email protected]>
Signed-off-by: Shunkichi Sato <[email protected]>
…ot yet implemented for Wasm) Signed-off-by: Shunkichi Sato <[email protected]>
Signed-off-by: Shunkichi Sato <[email protected]>
Signed-off-by: Shunkichi Sato <[email protected]>
| match inst.level { | ||
| dm::Level::TRACE => iroha_logger::trace!(target: TARGET, "{}", inst.msg), | ||
| dm::Level::DEBUG => iroha_logger::debug!(target: TARGET, "{}", inst.msg), | ||
| dm::Level::INFO => iroha_logger::info!(target: TARGET, "{}", inst.msg), | ||
| dm::Level::WARN => iroha_logger::warn!(target: TARGET, "{}", inst.msg), | ||
| dm::Level::ERROR => iroha_logger::error!(target: TARGET, "{}", inst.msg), | ||
| } |
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.
Side effect should probably not occur during the TryFrom conversion, which in all other ways is a pure data transformation.
Isn't critical though, but maybe it's possible to have some sort of "side-effect" node?
| /// 0. Transaction: [register Carol] | ||
| /// 0. Trigger execution: account created (Carol) -> mint roses for Carol | ||
| /// 0. Transaction: [burn one of Carol's roses] ... Depends on the previous trigger execution | ||
| /// 0. Block commit |
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.
| /// 0. Transaction: [register Carol] | |
| /// 0. Trigger execution: account created (Carol) -> mint roses for Carol | |
| /// 0. Transaction: [burn one of Carol's roses] ... Depends on the previous trigger execution | |
| /// 0. Block commit | |
| /// 1. Transaction: [register Carol] | |
| /// 2. Trigger execution: account created (Carol) -> mint roses for Carol | |
| /// 3. Transaction: [burn one of Carol's roses] ... Depends on the previous trigger execution | |
| /// 4. Block commit |
|
Converted to draft because the second feature commit is no longer planned (now classified as Future Consideration). |
| (Trigger, TriggerK, TriggerKF: dm::TriggerId), | ||
| (Condition, ConditionK, ConditionKF: tr::ConditionId), | ||
| (Executable, ExecutableK, ExecutableKF: tr::ExecutableId), | ||
| (TriggerCondition, TriggerConditionK, TriggerConditionKF: dm::TriggerId, tr::ConditionId), | ||
| (TriggerExecutable, TriggerExecutableK, TriggerExecutableKF: dm::TriggerId, tr::ExecutableId), |
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 design breaks down the current all-in-one Action object into separate parts—the condition, the execution, and the mapping between them—to maximize reusability. For example, the "deposit to self" condition only needs a single global definition rather than one per trigger, and you don’t have to register the same execution component twice just because it’s invoked manually versus event-driven.
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 analysis of the pros and cons of the main commit matches about 60% of my own understanding. I intend to refine this analysis and, based on it, rewrite this commit as a separate PR.
Context
Tracking issue:
This PR introduces an abstract structure applicable to executables, events, event filters, and permissions to streamline the execution cycle.
iroha_tree::*::transitionalsubmodules demonstrate the potential to replace the current structure.predictionfeature, enabling loop detection at trigger registration time (for non-Wasm executables).Since I was unsure whether this change would be a viable atomic change until opening this PR, no RFC was written beforehand. Let's discuss it here.
Related Work
Migration Guide
transitionalsubmodules serve as interfaces between new and existing structures.transitionalsubmodules.Review Notes
For the loop detection feature:
iroha_tree::state::tests::detects_event_loopiroha::mod::triggers::not_registered_when_potential_event_loop_detectedThe crate documentation provides an abstract:
iroha_tree
iroha_authorizer
Checklist
CONTRIBUTING.md.