-
Notifications
You must be signed in to change notification settings - Fork 1
feat: support for triggered transactions management #60
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
|
Warning Rate limit exceeded@danieljrc888 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minutes and 37 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR adds depth-limited traversal of triggered transactions throughout the contract interaction layer. It introduces a Changes
Sequence DiagramssequenceDiagram
participant Caller
participant Contract
participant TransactionWaiter
participant TransactionSystem
Caller->>Contract: transact_method(wait_triggered_transactions=true, depth=3)
Contract->>TransactionSystem: send transaction
TransactionSystem-->>Contract: tx_hash
Contract->>TransactionWaiter: wait_for_transaction(tx_hash, depth=3)
loop Depth iterations (0 to depth-1)
TransactionWaiter->>TransactionSystem: fetch receipt
TransactionSystem-->>TransactionWaiter: receipt
alt triggered_transactions exist
TransactionWaiter->>TransactionWaiter: collect triggered tx hashes
loop For each triggered tx
TransactionWaiter->>TransactionSystem: fetch triggered receipt
TransactionSystem-->>TransactionWaiter: triggered receipt
end
TransactionWaiter->>TransactionWaiter: add as children to tree
else no triggered_transactions
TransactionWaiter->>TransactionWaiter: break loop
end
end
TransactionWaiter-->>Contract: TransactionTree (nested receipts)
Contract-->>Caller: TransactionTree
sequenceDiagram
participant Caller
participant Contract
participant TransactionSystem
Caller->>Contract: raw_transact_method(value, consensus_max_rotations)
Contract->>TransactionSystem: send transaction (no waiting)
TransactionSystem-->>Contract: tx_hash
Contract-->>Caller: tx_hash (immediate return)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In @gltest/contracts/contract_functions.py:
- Around line 53-63: The raw_transact method currently calls raw_transact_method
without guarding against read-only methods; add the same protection as in
transact by checking if self.raw_transact_method is None and raise a clear error
(e.g., ValueError or RuntimeError stating the method is read-only) before
attempting to call it, and also ensure you validate transaction_context/value
inputs as transact does (i.e., None checks) so raw_transact fails fast with a
descriptive message when invoked on a read-only method or with invalid None
parameters.
In @gltest/types.py:
- Around line 2-5: Restore the missing re-exports in gltest.types by importing
CalldataEncodable, TransactionStatus, TransactionHashVariant, and
CalldataAddress from their original source (e.g., genlayer_py.types) and
exposing them from the module namespace (either by adding them to the
module-level imports and including them in __all__ or by directly assigning them
in the module). Specifically, add a line like "from genlayer_py.types import
CalldataEncodable, TransactionStatus, TransactionHashVariant, CalldataAddress"
alongside the existing GenLayerTransaction import and ensure these symbols are
exported so other modules importing from gltest.types no longer raise
ImportError.
In @gltest/utils.py:
- Around line 41-45: Update the TransactionTree docstring to correct the
erroneous method reference: replace the non-existent `.get_all_children()` with
the actual `.get_children_receipts()` method so the docstring lists the correct
available methods (`.flatten()`, `.children`, and `.get_children_receipts()`)
for accessing descendants and receipts.
🧹 Nitpick comments (1)
gltest/contracts/contract.py (1)
142-175: Consider extracting shared config logic.The
sim_configandleader_onlysetup is duplicated betweentransact_methodandraw_transact_method. This is acceptable for now but could be extracted into a helper if more methods need this pattern.The implementation is otherwise correct and provides a clean API for non-waiting transaction submissions.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
gltest/contracts/contract.pygltest/contracts/contract_factory.pygltest/contracts/contract_functions.pygltest/types.pygltest/utils.py
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-06-10T20:24:58.774Z
Learnt from: danielrc888
Repo: genlayerlabs/genlayer-testing-suite PR: 27
File: tests/artifact/contracts/duplicate_ic_contract_2.py:7-22
Timestamp: 2025-06-10T20:24:58.774Z
Learning: In this codebase, contract/test files commonly use `from genlayer import *`, which brings a `gl` symbol into the local namespace; therefore references like `gl.public.view` are valid and linter warnings about `gl` being undefined can be ignored.
Applied to files:
gltest/types.py
📚 Learning: 2025-09-15T11:15:12.026Z
Learnt from: danielrc888
Repo: genlayerlabs/genlayer-testing-suite PR: 53
File: gltest/validators/validator_factory.py:33-47
Timestamp: 2025-09-15T11:15:12.026Z
Learning: In the genlayer-testing-suite project, the "response" key in MockedLLMResponse is being deprecated in favor of "nondet_exec_prompt". This is an intentional breaking change as part of a planned API migration.
Applied to files:
gltest/types.py
🪛 GitHub Actions: Tests
gltest/types.py
[error] 1-1: ImportError: cannot import name 'CalldataEncodable' from 'gltest.types'
gltest/contracts/contract.py
[error] 5-5: ImportError: cannot import name 'CalldataEncodable' from 'gltest.types' during pytest plugin load while running 'gltest tests/gltest_cli/'.
🪛 Ruff (0.14.10)
gltest/contracts/contract.py
162-164: Avoid specifying long messages outside the exception class
(TRY003)
🔇 Additional comments (8)
gltest/types.py (2)
50-62: LGTM!The
TransactionTreedataclass is well-designed for representing hierarchical transaction relationships. Theflatten()method correctly performs depth-first traversal, and the use offield(default_factory=list)avoids the mutable default argument pitfall.
64-82: LGTM!The
get_children_receiptsmethod provides a clean API for filtering direct children bytriggered_onstatus, with safe.get()access to handle missing keys.gltest/contracts/contract_functions.py (1)
36-51: LGTM!The
wait_triggered_transactions_depthparameter is correctly wired through to the underlyingtransact_methodcall.gltest/utils.py (1)
66-90: LGTM!The breadth-first traversal for triggered transactions is well-implemented. The depth-limiting loop with early exit when no further triggered transactions exist is efficient and prevents unnecessary iterations.
gltest/contracts/contract_factory.py (2)
118-138: LGTM!The
wait_triggered_transactions_depthparameter is correctly passed through fromdeploytodeploy_contract_tx.
203-222: LGTM!The depth-bounded breadth-first traversal for triggered transactions is correctly implemented. The early break on empty
next_receiptsprevents unnecessary iterations. This logic is consistent with the implementation incontract.py.gltest/contracts/contract.py (2)
121-140: LGTM!The depth-bounded breadth-first traversal for triggered transactions is correctly implemented, matching the pattern in
contract_factory.py.
206-212: LGTM!The
raw_transact_methodis correctly exposed on theContractFunction, enabling the non-waiting transaction path alongside existing methods.
94f641a to
ec482d8
Compare
Fix DXP-730
What
Summary by CodeRabbit
Release Notes
New Features
Enhancements
✏️ Tip: You can customize this high-level summary in your review settings.