Skip to content

Conversation

@danieljrc888
Copy link
Contributor

@danieljrc888 danieljrc888 commented Jan 13, 2026

Fix DXP-730

What

  • Add wait triggered transactions depth param in deploy and transact method
  • Add raw transact method
  • Add wait for transaction in utils

Summary by CodeRabbit

Release Notes

  • New Features

    • Added non-blocking transaction submission capability for immediate hash retrieval.
    • Introduced hierarchical transaction tracking to organize related transactions.
    • Added utility function for flexible transaction confirmation with configurable depth-based triggered transaction monitoring.
  • Enhancements

    • Improved triggered transaction handling with depth-limited traversal across multiple levels.
    • Extended deployment and transaction methods with enhanced triggered transaction configuration options.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 94f641a and 7c31a2b.

📒 Files selected for processing (3)
  • gltest/contracts/contract_functions.py
  • gltest/types.py
  • gltest/utils.py
📝 Walkthrough

Walkthrough

The PR adds depth-limited traversal of triggered transactions throughout the contract interaction layer. It introduces a TransactionTree data structure to represent hierarchical transaction relationships, provides a wait_for_transaction utility for multi-level transaction waiting, adds a raw_transact_method for immediate transaction hash returns, and extends existing transaction methods with a wait_triggered_transactions_depth parameter to control traversal depth.

Changes

Cohort / File(s) Summary
Transaction Core Methods
gltest/contracts/contract.py, gltest/contracts/contract_functions.py
Added wait_triggered_transactions_depth: int = 3 parameter to transact_method and transact(), implementing depth-limited multi-level traversal of triggered transactions with early break on empty results. Introduced new raw_transact_method() and raw_transact() for sending transactions without waiting for confirmations.
Contract Deployment
gltest/contracts/contract_factory.py
Extended deploy() and deploy_contract_tx() with wait_triggered_transactions_depth: int = 3 parameter. Replaced simple one-shot polling with breadth-first depth-bounded traversal that iteratively collects and awaits triggered transaction receipts.
Data Structures & Utilities
gltest/types.py, gltest/utils.py
Introduced TransactionTree dataclass with flatten() and get_children_receipts() methods for representing nested transaction structures. Added wait_for_transaction() helper that builds and returns a TransactionTree root containing receipts and nested children for triggered transactions up to specified depth. Removed re-exports of several types from gltest/types.py.

Sequence Diagrams

sequenceDiagram
    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
Loading
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)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • kstroobants
  • cristiam86

Poem

🐰 Hoppy transact trees now bloom so deep,
With triggered receipts in a structured heap,
One path waits patiently, depth by depth,
The other springs forth with swift-footed step,
Nested transactions now dance in harmony!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 76.92% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding support for triggered transactions management with depth control, raw transact method, and utility functions.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@danieljrc888 danieljrc888 changed the title Fix wait for triggered txs feat: support for triggered transactions management Jan 13, 2026
@danieljrc888 danieljrc888 self-assigned this Jan 13, 2026
@danieljrc888 danieljrc888 marked this pull request as ready for review January 13, 2026 01:41
Copy link

@coderabbitai coderabbitai bot left a 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_config and leader_only setup is duplicated between transact_method and raw_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

📥 Commits

Reviewing files that changed from the base of the PR and between f6a0c39 and 94f641a.

📒 Files selected for processing (5)
  • gltest/contracts/contract.py
  • gltest/contracts/contract_factory.py
  • gltest/contracts/contract_functions.py
  • gltest/types.py
  • gltest/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 TransactionTree dataclass is well-designed for representing hierarchical transaction relationships. The flatten() method correctly performs depth-first traversal, and the use of field(default_factory=list) avoids the mutable default argument pitfall.


64-82: LGTM!

The get_children_receipts method provides a clean API for filtering direct children by triggered_on status, with safe .get() access to handle missing keys.

gltest/contracts/contract_functions.py (1)

36-51: LGTM!

The wait_triggered_transactions_depth parameter is correctly wired through to the underlying transact_method call.

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_depth parameter is correctly passed through from deploy to deploy_contract_tx.


203-222: LGTM!

The depth-bounded breadth-first traversal for triggered transactions is correctly implemented. The early break on empty next_receipts prevents unnecessary iterations. This logic is consistent with the implementation in contract.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_method is correctly exposed on the ContractFunction, enabling the non-waiting transaction path alongside existing methods.

@danieljrc888 danieljrc888 force-pushed the fix-wait-for-triggered-txs branch from 94f641a to ec482d8 Compare January 13, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants