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

feat: Add time-driven event processing for triggering scheduled transactions #16017

Merged
merged 85 commits into from
Nov 25, 2024

Conversation

JivkoKelchev
Copy link
Contributor

@JivkoKelchev JivkoKelchev commented Oct 17, 2024

Description:

Add time-driven event processing for triggering scheduled transactions

Related issue(s):

Fixes #16019

Notes for reviewer:

  1. The main goal of this PR was to process time-based events (execute schedule transactions) independent of the useerTxn’s stack. Ideally, to run the processInterval() method without even passing the userTxn and move the method invocation out of the execute() method. However, userTxn's stack should be used to purge the state in case of interval without executable schedules (only deleted or executed schedules). Also, in case the feature flag is false, the purge is done through the userTxn’s stack.

  2. In order to reduce the number of changes in this PR

  • The integration of the ScheduleService iterator will be in an upcoming PR.
  • Fixing and enabling the tests contains scheduling of contract create/call will be in following PR.
  • The precise calculation of the schedule consensus timestamp will be in an upcoming PR.
  1. All mono tests will be redone to match the Hapi tests style guide when the work on the test plan starts.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

JivkoKelchev and others added 7 commits October 16, 2024 10:13
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com>
Signed-off-by: ibankov <ivan.bankov@limechain.tech>
Signed-off-by: ibankov <ivan.bankov@limechain.tech>
…transactions

# Conflicts:
#	hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/HandleWorkflow.java
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
refactor hapi tests

Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Copy link

codecov bot commented Oct 18, 2024

Codecov Report

Attention: Patch coverage is 83.10940% with 88 lines in your changes missing coverage. Please review.

Project coverage is 63.59%. Comparing base (11f5f17) to head (c86922d).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...dera/node/app/workflows/handle/HandleWorkflow.java 78.37% 15 Missing and 9 partials ⚠️
...rvice/schedule/impl/WritableScheduleStoreImpl.java 79.68% 12 Missing and 1 partial ⚠️
...ra/node/app/blocks/impl/KVStateChangeListener.java 0.00% 12 Missing ⚠️
.../hedera/node/app/throttle/ThrottleAccumulator.java 76.00% 8 Missing and 4 partials ⚠️
...app/service/schedule/impl/ScheduleServiceImpl.java 87.01% 5 Missing and 5 partials ⚠️
...ice/token/impl/handlers/FinalizeRecordHandler.java 14.28% 6 Missing ⚠️
...-app/src/main/java/com/hedera/node/app/Hedera.java 78.57% 2 Missing and 1 partial ⚠️
...app/workflows/standalone/TransactionExecutors.java 76.92% 3 Missing ⚠️
.../node/app/workflows/prehandle/PreHandleResult.java 33.33% 1 Missing and 1 partial ⚠️
...ce/schedule/impl/handlers/ScheduleSignHandler.java 60.00% 0 Missing and 2 partials ⚠️
... and 1 more
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             develop   #16017      +/-   ##
=============================================
+ Coverage      63.45%   63.59%   +0.14%     
- Complexity     20313    20396      +83     
=============================================
  Files           2545     2547       +2     
  Lines          94604    94872     +268     
  Branches        9878     9912      +34     
=============================================
+ Hits           60027    60330     +303     
+ Misses         30958    30923      -35     
  Partials        3619     3619              
Files with missing lines Coverage Δ
.../utils/sysfiles/domain/throttling/ScaleFactor.java 100.00% <100.00%> (ø)
...ce/addressbook/impl/helpers/AddressBookHelper.java 55.17% <ø> (ø)
.../main/java/com/hedera/node/app/spi/AppContext.java 33.33% <ø> (ø)
...com/hedera/node/app/blocks/BlockStreamManager.java 100.00% <ø> (ø)
...om/hedera/node/app/blocks/impl/BlockImplUtils.java 79.46% <100.00%> (+0.37%) ⬆️
...edera/node/app/blocks/impl/BlockStreamBuilder.java 73.17% <ø> (+3.98%) ⬆️
...a/node/app/blocks/impl/BlockStreamManagerImpl.java 94.88% <100.00%> (+0.10%) ⬆️
...e/app/blocks/impl/BoundaryStateChangeListener.java 63.95% <100.00%> (+1.30%) ⬆️
...ode/app/blocks/schemas/V0560BlockStreamSchema.java 100.00% <100.00%> (ø)
...a/com/hedera/node/app/services/AppContextImpl.java 100.00% <ø> (ø)
... and 30 more

... and 30 files with indirect coverage changes

Impacted file tree graph

---- 🚨 Try these New Features:

Copy link

codacy-production bot commented Oct 18, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.13% (target: -1.00%) 87.72%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (11f5f17) 97369 63457 65.17%
Head commit (c86922d) 97637 (+268) 63760 (+303) 65.30% (+0.13%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#16017) 521 457 87.72%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

tinker-michaelj and others added 9 commits October 18, 2024 10:17
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: ibankov <ivan.bankov@limechain.tech>
@JivkoKelchev JivkoKelchev changed the title 15055 poc long term scheduled transactions feat: Add time-driven event processing for triggering scheduled transactions Oct 21, 2024
@JivkoKelchev JivkoKelchev self-assigned this Oct 21, 2024
@JivkoKelchev JivkoKelchev added this to the v0.56 milestone Oct 21, 2024
JivkoKelchev and others added 6 commits October 21, 2024 17:41
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: ibankov <ivan.bankov@limechain.tech>
Signed-off-by: ibankov <ivan.bankov@limechain.tech>
fix long term schedule throttle warning.

Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Copy link

Node: HAPI Test (Restart) Results

9 files  ±0  1 errors  8 suites   - 1   7m 23s ⏱️ - 1m 12s
7 tests  - 1  7 ✅  - 1  0 💤 ±0  0 ❌ ±0 
8 runs   - 1  8 ✅  - 1  0 💤 ±0  0 ❌ ±0 

For more details on these parsing errors, see this check.

Results for commit e0d80b6. ± Comparison against base commit 00ceb9a.

…persistence' into 15055-POC-long-term-scheduled-transactions

# Conflicts:
#	hedera-node/hedera-schedule-service-impl/src/main/java/com/hedera/node/app/service/schedule/impl/handlers/HandlerUtility.java
#	hedera-node/hedera-schedule-service-impl/src/main/java/com/hedera/node/app/service/schedule/impl/handlers/ScheduleCreateHandler.java
#	hedera-node/hedera-schedule-service-impl/src/main/java/com/hedera/node/app/service/schedule/impl/handlers/ScheduleDeleteHandler.java
#	hedera-node/hedera-schedule-service-impl/src/main/java/com/hedera/node/app/service/schedule/impl/handlers/ScheduleManager.java
#	hedera-node/hedera-schedule-service-impl/src/main/java/com/hedera/node/app/service/schedule/impl/handlers/ScheduleSignHandler.java
#	hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/HandlerUtilityTest.java
#	hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/ScheduleCreateHandlerTest.java
#	hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/ScheduleManagerTest.java
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
@JivkoKelchev JivkoKelchev marked this pull request as ready for review November 20, 2024 21:40
@JivkoKelchev JivkoKelchev requested review from a team as code owners November 20, 2024 21:40
tinker-michaelj and others added 4 commits November 21, 2024 20:57
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Co-authored-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Co-authored-by: Joseph S. <121976561+jsync-swirlds@users.noreply.github.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Copy link
Collaborator

@tinker-michaelj tinker-michaelj left a comment

Choose a reason for hiding this comment

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

LGTM, tyvm @JivkoKelchev !

@tinker-michaelj tinker-michaelj merged commit 295d53a into develop Nov 25, 2024
49 of 50 checks passed
@tinker-michaelj tinker-michaelj deleted the 15055-POC-long-term-scheduled-transactions branch November 25, 2024 15:03
tinker-michaelj added a commit that referenced this pull request Nov 25, 2024
…actions (#16017)

Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com>
Signed-off-by: ibankov <ivan.bankov@limechain.tech>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Co-authored-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com>
Co-authored-by: ibankov <ivan.bankov@limechain.tech>
Co-authored-by: Michael Tinker <michael.tinker@swirldslabs.com>
Co-authored-by: Joseph S. <121976561+jsync-swirlds@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add time-driven event processing for triggering scheduled transactions
4 participants