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

API to fetch all notifications from a block (with filters) #3779

Open
roman-khimov opened this issue Dec 27, 2024 · 0 comments
Open

API to fetch all notifications from a block (with filters) #3779

roman-khimov opened this issue Dec 27, 2024 · 0 comments
Labels
feature Completely new functionality I2 Regular impact rpc RPC server and client S3 Minimally significant U2 Seriously planned

Comments

@roman-khimov
Copy link
Member

Is your feature request related to a problem? Please describe.

I'm always frustrated when we can not nspcc-dev/neofs-node#3070 work easily with blocks. We can listen for events, but we don't know which event comes from which block. If we're to add a subscription to block header we're still getting this event when block starts, but we're not getting any when block processing ends. If we're to add the block number to emitted event the problem is still the same, you can only say that the old block was processed when you get an event from new block.

But blocks are important. We're doing off-chain calculations here, but we want them to be perfectly synchronized with the chain to implement something resembling of a storeBlock for our events, get clear boundaries and calculate proper per-block state. We can subscribe to headers, request a block, walk through transactions and get all application logs, but that'd be devastating performance-wise, too many of requests to do.

Describe the solution you'd like

An API like getblocknotifications (and gettransactionnotifications?) that accepts a block number/hash and extracts all notifications from all successful transactions executed in this block. With a filtering possibility, just like we have for regular subscriptions. It sounds terrifying initially, but in its essence it's very similar to what getblock does DB-wise, we're picking transactions one by one until block is done. Here we'd be picking application logs from the same DB entries effectively and filtering is not hard. So we can get it using the same DB we have now.

Other applications of it include node synchronization when it misses a block or two upon disconnect (contrary to full sync).

Describe alternatives you've considered

I'm open to any alternative suggestions.

Additional context

In some ways related to neo-project/neo#3583, but that one requires an additional index.

CC @carpawell.

@roman-khimov roman-khimov added feature Completely new functionality I2 Regular impact rpc RPC server and client U2 Seriously planned S3 Minimally significant labels Dec 27, 2024
@roman-khimov roman-khimov changed the title API to fetch all notifications in a block (with filters) API to fetch all notifications from a block (with filters) Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Completely new functionality I2 Regular impact rpc RPC server and client S3 Minimally significant U2 Seriously planned
Projects
None yet
Development

No branches or pull requests

1 participant