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: adds ContractLog.topics property for calculating the topics from a log #2505

Merged
merged 10 commits into from
Feb 14, 2025

Conversation

antazoey
Copy link
Member

What I did

I need this for implementing get_contract_logs() in ape-titanoboa

How I did it

How to verify it

Checklist

  • All changes are completed
  • Change is covered in tests
  • Documentation is complete

@antazoey antazoey requested a review from fubuloubu February 13, 2025 17:34
@@ -256,6 +219,16 @@ def abi(self) -> EventABI:
self._abi = abi
return abi

@cached_property
def topics(self) -> list[HexStr]:
Copy link
Member Author

Choose a reason for hiding this comment

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

If we are worried about name clashing here, we could make this a method, e.g.:

def get_topics()`

or

@property
def encoded_topics

or whatever else

fubuloubu
fubuloubu previously approved these changes Feb 13, 2025
Copy link
Member

@fubuloubu fubuloubu left a comment

Choose a reason for hiding this comment

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

Wonder if this could actually move a bit upstream into ethpm_types.EventABI, would be useful here: https://github.com/ApeWorX/silverback/blob/main/silverback/runner.py#L355 (used for creating streaming subscriptions)

@antazoey
Copy link
Member Author

Wonder if this could actually move a bit upstream into ethpm_types.EventABI, would be useful here: https://github.com/ApeWorX/silverback/blob/main/silverback/runner.py#L355 (used for creating streaming subscriptions)

Done! ApeWorX/ethpm-types#148

@antazoey antazoey force-pushed the feat/topics-available-contract-log branch 2 times, most recently from f7578e7 to 685c13f Compare February 14, 2025 06:00
@antazoey antazoey force-pushed the feat/topics-available-contract-log branch from 685c13f to f4204a6 Compare February 14, 2025 06:01
@antazoey
Copy link
Member Author

Wonder if this could actually move a bit upstream into ethpm_types.EventABI, would be useful here: https://github.com/ApeWorX/silverback/blob/main/silverback/runner.py#L355 (used for creating streaming subscriptions)

OK so now we have 1 basic implementation ethpm-types, as you saw, and one in Ape which is richer because it handles conversions as well.

@antazoey
Copy link
Member Author

This will allow us to actually get ape-titanoboa to implement .get_contract_logs() and honor the given topics.

@antazoey antazoey merged commit f26546f into ApeWorX:main Feb 14, 2025
18 checks passed
@antazoey antazoey deleted the feat/topics-available-contract-log branch February 14, 2025 18:21
@antazoey
Copy link
Member Author

Now ApeWorX/ape-titanoboa#17 is unblocked

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.

3 participants