Skip to content

feat: new leader receipt compatibility - #23

Merged
danieljrc888 merged 7 commits into
mainfrom
feat/new-leader-receipt-compatibility
Jun 4, 2025
Merged

danieljrc888 merged 7 commits into
mainfrom
feat/new-leader-receipt-compatibility

Conversation

@danieljrc888

@danieljrc888 danieljrc888 commented Jun 3, 2025 •

Copy link
Copy Markdown
Contributor

Fixes DXP-363

What

Notes

Summary by CodeRabbit

  • Bug Fixes

    • Improved transaction execution status checks to handle new data formats and edge cases.
  • Tests

    • Added comprehensive tests for transaction execution success and failure assertions.
  • Chores

    • Updated project version to 0.1.2.
    • Upgraded the "genlayer-py" dependency to version 0.3.0.

@coderabbitai

coderabbitai Bot commented Jun 3, 2025 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@danielrc888 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 46 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 a848deb and 9522d99.

📒 Files selected for processing (1)
  • tests/assertions/test_assertions.py (1 hunks)

Walkthrough

The changes update a function in gltest/assertions.py to correctly access data within a nested list structure. Additionally, the project version and a dependency version are incremented in pyproject.toml. New unit tests were added in tests/assertions/test_assertions.py to verify the behavior of the assertion functions. No public API or exported entity declarations are altered.

Changes

File(s) Change Summary
gltest/assertions.py Fixed logic to properly access execution_result within the first element of leader_receipt list.
pyproject.toml Bumped project version to 0.1.2 and updated "genlayer-py" dependency to 0.3.0.
tests/assertions/test_assertions.py Added unit tests for tx_execution_succeeded and tx_execution_failed assertion functions.

Poem

Up hopped the code, with a version anew,
Dependency freshened, as all good things do.
A list’s little secret, now properly found,
The logic corrected, the tests will resound.
With each tiny hop, our project will grow—
Onward and upward, as all bunnies know! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@danieljrc888
danieljrc888 force-pushed the feat/new-leader-receipt-compatibility branch from d2636a4 to 22ed312 Compare June 3, 2025 19:49
@danieljrc888 danieljrc888 self-assigned this Jun 3, 2025
@danieljrc888
danieljrc888 marked this pull request as ready for review June 3, 2025 20:00

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
gltest/assertions.py (1)

4-12: Consider adding unit tests for the new data structure.

Since this is a breaking change in data structure access, it would be valuable to add tests that verify the function works correctly with both the new list structure and handles edge cases like empty lists.

Would you like me to help generate unit tests for this function to ensure it handles the new data structure correctly?

🧰 Tools
🪛 Pylint (3.3.7)

[convention] 4-4: Missing function or method docstring

(C0116)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac7e871 and 22ed312.

📒 Files selected for processing (2)
  • gltest/assertions.py (1 hunks)
  • pyproject.toml (2 hunks)
🔇 Additional comments (3)
pyproject.toml (2)

7-7: Version bump aligns with feature addition.

The project version increment from 0.1.1 to 0.1.2 appropriately reflects the addition of new leader receipt compatibility as a feature.


17-17:

Details

❓ Verification inconclusive

Verify the dependency version exists and contains expected changes.

The major version jump from 0.1.0 to 0.3.0 for genlayer-py suggests breaking changes, which aligns with the data structure modifications in assertions.py. Please ensure this version exists and contains the new leader receipt structure.


🏁 Script executed:

#!/bin/bash
# Description: Verify that genlayer-py version 0.3.0 exists on PyPI
# Expected: Should return version 0.3.0 if it exists

curl -s https://pypi.org/pypi/genlayer-py/json | jq -r '.releases | keys[]' | grep "0.3.0"

Length of output: 90


Confirm genlayer-py@0.3.0 is published and includes the new leader receipt structure

It looks like version 0.3.0 of genlayer-py isn’t appearing on PyPI. Please verify that:

  • The correct package name and version (0.3.0) are published on PyPI.
  • The release includes the new leader receipt data structure required by assertions.py.

Location:

  • pyproject.toml, line 17

You can list all published versions with:

curl -s https://pypi.org/pypi/genlayer-py/json | jq -r '.releases | keys[]'
gltest/assertions.py (1)

11-11: Data structure access correctly updated.

The change properly accesses the first element of the leader_receipt list to retrieve the execution_result, which aligns with the new data structure introduced in genlayer-py 0.3.0.

Comment thread gltest/assertions.py Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🔭 Outside diff range comments (1)
tests/assertions/test_assertions.py (1)

36-42: 🛠️ Refactor suggestion

Consolidate duplicate test cases for tx_execution_failed.

Similar to the previous comment, these test cases are duplicates and should be consolidated with more comprehensive coverage.

-def test_tx_execution_failed_with_invalid_transaction():
-    assert tx_execution_failed({}) is True
-
-
-def test_tx_execution_failed_with_empty_transaction():
-    assert tx_execution_failed({}) is True
+def test_tx_execution_failed_with_empty_transaction():
+    assert tx_execution_failed({}) is True
+
+
+def test_tx_execution_failed_with_missing_consensus_data():
+    assert tx_execution_failed({"other_data": "value"}) is True
+
+
+def test_tx_execution_failed_with_missing_leader_receipt():
+    assert tx_execution_failed({"consensus_data": {}}) is True
+
+
+def test_tx_execution_failed_with_empty_leader_receipt():
+    assert tx_execution_failed({"consensus_data": {"leader_receipt": []}}) is True
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 36-36: Missing function or method docstring

(C0116)


[convention] 40-40: Missing function or method docstring

(C0116)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 22ed312 and f229066.

📒 Files selected for processing (1)
  • tests/assertions/test_assertions.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/assertions/test_assertions.py (1)
gltest/assertions.py (2)
  • tx_execution_succeeded (4-12)
  • tx_execution_failed (15-16)
🪛 Pylint (3.3.7)
tests/assertions/test_assertions.py

[convention] 1-1: Missing module docstring

(C0114)


[error] 1-1: Unable to import 'gltest.assertions'

(E0401)


[convention] 12-12: Missing function or method docstring

(C0116)


[convention] 16-16: Missing function or method docstring

(C0116)


[convention] 20-20: Missing function or method docstring

(C0116)


[convention] 24-24: Missing function or method docstring

(C0116)


[convention] 28-28: Missing function or method docstring

(C0116)


[convention] 32-32: Missing function or method docstring

(C0116)


[convention] 36-36: Missing function or method docstring

(C0116)


[convention] 40-40: Missing function or method docstring

(C0116)

🔇 Additional comments (1)
tests/assertions/test_assertions.py (1)

3-9: LGTM! Test data structure aligns with new leader receipt format.

The mock transaction data correctly reflects the new leader receipt structure where execution_result is accessed via leader_receipt[0], which aligns with the updated assertion logic and the PR objectives for leader receipt compatibility.

Comment thread tests/assertions/test_assertions.py Resolved
Comment thread tests/assertions/test_assertions.py Resolved
Comment thread tests/assertions/test_assertions.py Resolved
Comment thread tests/assertions/test_assertions.py Resolved
@linear

linear Bot commented Jun 3, 2025

Copy link
Copy Markdown

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