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

services/soroban-rpc: getEvents method #4554

Closed
Tracked by #4458
paulbellamy opened this issue Aug 29, 2022 · 19 comments · Fixed by stellar/stellar-cli#270
Closed
Tracked by #4458

services/soroban-rpc: getEvents method #4554

paulbellamy opened this issue Aug 29, 2022 · 19 comments · Fixed by stellar/stellar-cli#270
Assignees

Comments

@paulbellamy
Copy link
Contributor

paulbellamy commented Aug 29, 2022

epic - stellar/stellar-rpc#43

depends on api design and data acquisition

See design output from #4676

For Nov v1, get ledgers from Horizon (until long term backend pattern is established)

  • need to get websocket setup
  • wiring JSON rpc
  • push notifications
@paulbellamy paulbellamy changed the title Add new effect types for contract deployment, etc based on InvokeHostFunctionOp services/horizon: Smart Contracts: Add new effect types for contract deployment, etc based on InvokeHostFunctionOp Aug 29, 2022
@paulbellamy paulbellamy changed the title services/horizon: Smart Contracts: Add new effect types for contract deployment, etc based on InvokeHostFunctionOp services/soroban-rpc: eventsSubscribe/eventsUnsubscribe methods Aug 29, 2022
@paulbellamy
Copy link
Contributor Author

Depends on #4558

@sreuland
Copy link
Contributor

sreuland commented Sep 1, 2022

@paulbellamy , scope-wise, what is the expectation on interface of the subscription, any request params, like filter on specific event types, etc, or just gets all. is the ws subscription endpoint defined in soroban api docs for ref? or is this effort expected to update the api docs? What event models are expected to be published, any links to source code or docs on those?

@paulbellamy
Copy link
Contributor Author

Default is gets all. Should allow filtering via contract for v1. That's probably enough for now.

endpoint is defined in the soroban-rpc api docs, yes. But there are some undefined parts there (like event structure). So design those and update the docs on confluence.

@paulbellamy
Copy link
Contributor Author

Note, the events here are coming from the txmetas emitted by the soroban-rpc captive core. No persistence, just "ingest" the txmetas as they arrive, and see if any of the events match the active subscriptions.

@sreuland
Copy link
Contributor

@paulbellamy @tamirms , just in short term for the rpc server, could it potentially proxy from horizon api, i.e. http client to streaming(sse) endpoint for transactions to obtain same txmeta? Just wondering if that option is worth considering as stop-gap in short term if it's less effort/complexity?

@tamirms
Copy link
Contributor

tamirms commented Sep 15, 2022

@sreuland I think that's a good idea. I think we still need captive core for the following endpoints as this info is not available in Horizon's API:

getContract
getContractData
simulateTransaction (Meridian)

But perhaps we could proxy those requests to horizon's captive core instead of spawning our own instance.

@sreuland
Copy link
Contributor

@tamirms , ok, for those endpoints that need core, the goal is to package up dev stack onto quickstart docker image which will provide a singular core instance that should be configurable to be in standalone/futurenet and which both horizon and sorobon-rpc services hosted in same docker container should be able to simultaneously connect to that single core instance txmeta pipe/rpc ports, will that work?

quickstart spike/discussion on this packaging - #4590 (comment)

@tamirms
Copy link
Contributor

tamirms commented Sep 15, 2022

both horizon and sorobon-rpc services hosted in same docker container should be able to simultaneously connect to that single core instance txmeta pipe/rpc ports

@sreuland both horizon and soroban can access a shared core instance via the http ports. However, the txmeta pipe cannot be broadcast to more than one listener unless we write some code to allow that. But, if we obtain txmeta in soroban-rpc via horizon then we will not need to read from the captive core txmeta pipe in the soroban-rpc service

@sreuland
Copy link
Contributor

@tamirms , thanks for catching that, if obtain txmeta in soroban-rpc via horizon means doing sql to horizon's ingested rdbms, then I think this proposed image layout for quickstart container should support both those scenarios with single core, please confirm:

Untitled-2022-09-15-0601

@tamirms
Copy link
Contributor

tamirms commented Sep 15, 2022

@sreuland by obtain txmeta in soroban-rpc via horizon I meant what you suggested earlier:

potentially proxy from horizon api, i.e. http client to streaming(sse) endpoint for transactions to obtain same txmeta

I think that would be easier than querying the horizon postgres db.

@sreuland
Copy link
Contributor

@tamirms , ok, sounds like the design reduces to:

Untitled-2022-09-15-0601

thanks, this also helps in scoping down the requirements for spike on that quickstart container #4590

@2opremio
Copy link
Contributor

2opremio commented Sep 20, 2022

Making soroban-rpc depend on Horizon seems reasonable but worries me.

This requires (almost) full Soroban support in Horizon which is a big short-term task to take up.

@tsachiherman
Copy link
Contributor

I think that from scheduling perspective, we should avoid design + implement in the same sprint by the same person as it might not have the proper "separation". That being said, if we can get enough buy-ins, I don't really care.

One way to achieve that is to define the dependent issue very clearly, including the required degree of buy-ins.

@sreuland
Copy link
Contributor

sreuland commented Nov 2, 2022

@paulbellamy , is there a corresponding dev ticket for soroban-js-sdk to have client wrapper around this api in tandem during same dev cycle, or is that fine in next iteration, etc?

[edit] found the sorobanj-js-sdk ticket, was out there - stellar/js-soroban-client#2 , guess we just need to decide which/when sprint to pull this into.

@jcx120 jcx120 moved this from Next Sprint Proposal to Current Sprint in Platform Scrum Nov 4, 2022
@Shaptic
Copy link
Contributor

Shaptic commented Nov 8, 2022

@sreuland there's also stellar/stellar-cli#61 which is the Rust client side of things. I think JS is lower priority?

@sreuland
Copy link
Contributor

sreuland commented Nov 8, 2022

there's also stellar/stellar-cli#61 which is the Rust client side of things. I think JS is lower priority?

it appears that way, stellar/js-soroban-client#2 is in Backlog, maybe during pre-pre-grooming, can discuss if this should be queued up for Next Sprint Proposal. @jcx120 , any insights on expected priority?

@jcx120
Copy link

jcx120 commented Nov 8, 2022

JS will enable us to test the event sub against our reference fundraising DApp in its ultimate deployment environment. My preference is for this to be done first.
@paulbellamy - thoughts on whether its more beneficial (and manageable) to do the CLI first? (perhaps not given we are reconsidering supporting a CLI env?)

@paulbellamy
Copy link
Contributor Author

I'd say they're about equal priority. Maybe JS should be a bit higher. We can use the CLI to test stuff all works, but like @jcx120 says the example dapp would be the more immediate use case.

There are two use cases here:

  • a web client subscribing for updates to do "instant" ui updates when stuff happens (e.g. balance update when transfer completes)
    • This is a nice ux and scalability improvement, but not critical.
  • a backend component subscribing to events to ingest them into their own database for indexing.
    • This is the way we want to push devs to building their infra, so long-term is more important. But this also doesn't super depend on the CLI, as I'd expect the dev's custom backend component to either subscribe to soroban-rpc directly, or push the events into a message-queue for processing.

@paulbellamy paulbellamy changed the title services/soroban-rpc: eventsSubscribe/eventsUnsubscribe methods services/soroban-rpc: getEvents method Nov 14, 2022
@paulbellamy
Copy link
Contributor Author

Per #4676, no websockets or push notifications for this. Just the request/response getEvents method, as per: https://docs.google.com/document/d/1TZUDgo_3zPz7TiPMMHVW_mtogjLyPL0plvzGMsxSz6A/edit#heading=h.t03hji406t76

@paulbellamy paulbellamy moved this from Current Sprint to In Progress in Platform Scrum Nov 16, 2022
@paulbellamy paulbellamy assigned paulbellamy and unassigned 2opremio Nov 16, 2022
@paulbellamy paulbellamy moved this from In Progress to Needs Review in Platform Scrum Dec 1, 2022
Repository owner moved this from Needs Review to Done in Platform Scrum Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

7 participants