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

chore: improve contract to contract write #552

Merged

Conversation

AgustinRamiroDiaz
Copy link
Contributor

Extension of #454

What

Adds self relationship to Transactions to be able to track the triggered transactions
I'll try adding more tests through the day if I have time

Why

  • to improve tracability

Testing done

  • improved e2e tests
  • manually tested

Decisions made

In the UI it's just plain text

image

We could improve this maybe by polling the triggered_transactions. But those transactions could trigger even more transactions, so this needs a bit more of definition prior to working on it

Checks

  • I have tested this code
  • I have reviewed my own PR
  • I have created an issue for this PR
  • I have set a descriptive PR title compliant with conventional commits

Reviewing tips

User facing release notes

You can now see the transactions triggered by your Intelligen Contract when writing to other contracts

Comment on lines +114 to +124
triggered_by=(
self.session.query(Transactions).filter_by(hash=triggered_by_hash).one()
if triggered_by_hash
else None
),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This query is necessary since SQLAlchemy works with objects, therefore we need to have the object related here

Copy link

codecov bot commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 16.32%. Comparing base (6a6b70a) to head (c5eed9f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #552   +/-   ##
=======================================
  Coverage   16.32%   16.32%           
=======================================
  Files         111      111           
  Lines        7843     7843           
  Branches      184      184           
=======================================
  Hits         1280     1280           
  Misses       6488     6488           
  Partials       75       75           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
@AgustinRamiroDiaz AgustinRamiroDiaz force-pushed the agustin/chore/improve-contract-to-contract-write branch from c5eed9f to c18ff62 Compare October 3, 2024 14:24
Copy link

sonarcloud bot commented Oct 3, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@AgustinRamiroDiaz AgustinRamiroDiaz merged commit 835c85c into main Oct 4, 2024
13 of 16 checks passed
@@ -155,4 +167,8 @@ def set_transaction_result(self, transaction_hash: str, consensus_data: dict):
transaction.status = TransactionStatus.FINALIZED
transaction.consensus_data = consensus_data

self.session.commit()
print(
Copy link
Collaborator

Choose a reason for hiding this comment

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

@AgustinRamiroDiaz wasn't this moved to the consensus? and why is there a bare print here?

@@ -35,6 +35,11 @@ def _parse_transaction_data(transaction_data: Transactions) -> dict:
"created_at": transaction_data.created_at.isoformat(),
"leader_only": transaction_data.leader_only,
"client_session_id": transaction_data.client_session_id,
"triggered_by": transaction_data.triggered_by_hash,
"triggered_transactions": [
Copy link
Collaborator

Choose a reason for hiding this comment

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

@AgustinRamiroDiaz when is this field populated?

@AgustinRamiroDiaz AgustinRamiroDiaz deleted the agustin/chore/improve-contract-to-contract-write branch October 4, 2024 16:45
Copy link
Contributor

github-actions bot commented Oct 7, 2024

🎉 This PR is included in version 0.13.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

3 participants