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

feature request: python bindings for ExEx #8090

Open
bout3fiddy opened this issue May 4, 2024 · 2 comments
Open

feature request: python bindings for ExEx #8090

bout3fiddy opened this issue May 4, 2024 · 2 comments
Labels
A-exex Execution Extensions C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started S-needs-investigation This issue requires detective work to figure out what's going wrong

Comments

@bout3fiddy
Copy link

bout3fiddy commented May 4, 2024

Description

Following the announcement of ExEx, I can imagine this would be very useful for indexers, real-time analytics teams etc. with a background in python.

I can imagine searchers could find benefit in this, especially for rollups. For Ethereum mainnet, this may not be as useful since they typically want to know if a tx in the mempool (or bundle?) gets included.

We probably need a Notification class, and I'm thinking it could be something that simply tracks state changes in a contract:

class ExExNotifications:

    def __init__(self, contract_address: str):
        self.address = contract_address

    def state_write(self) -> bool:
        # logic here checks state of the previous contract and returns True if state was changed

    def state_read(self) -> bool:
        # logic here returns True if contract's state was read by any other contract in the block

    async def listen(self):
        # async method to listen to state changes

    # rest of the logic invoking exex to fetch old and new states

Which could then be used as follows:

from pyreth import exex

trigger = exex.Notifications(some_contract_address):

with trigger.sync():
    if trigger.state_read():
        # check, for example, if peripheral contracts have their states changed
        # example an AMM's exponential moving average price oracle was read. check if lending market
        # dependent on the oracle has it's state changed.

     if trigger.state_write():
        # do something if, say, state price of the AMM changed

Additional context

No response

@bout3fiddy bout3fiddy added C-enhancement New feature or request S-needs-triage This issue needs to be labelled labels May 4, 2024
@DaniPopes DaniPopes added A-exex Execution Extensions and removed S-needs-triage This issue needs to be labelled labels May 4, 2024
@mattsse mattsse added the D-good-first-issue Nice and easy! A great choice to get started label May 4, 2024
@mattsse
Copy link
Collaborator

mattsse commented May 4, 2024

for this we'd need a bunch of wrapper types with pyo3 that define the py <-> rust interface and then a way to call this from rust

https://pyo3.rs/v0.21.2/python-from-rust

@mattsse mattsse added the S-needs-investigation This issue requires detective work to figure out what's going wrong label May 4, 2024
@0xqd
Copy link
Contributor

0xqd commented May 7, 2024

@bout3fiddy you can have a wrapper around rust with pyo3, or simpler, just write a simple network code with ExEx in rust, and send notification to another python service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-exex Execution Extensions C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started S-needs-investigation This issue requires detective work to figure out what's going wrong
Projects
Status: Todo
Development

No branches or pull requests

4 participants