-
Notifications
You must be signed in to change notification settings - Fork 501
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/horizon: Add endpoint for getting any ledger entry given a ledger entry key XDR string #4695
Comments
I strongly support having this functionality - I think it's an important building block. Realistically, soroban-rpc might be a better place to implement that in as it will need to have this type of data view anyway to facilitate preflight requests. |
I'd be happy to see the bigger picture here : what is the goal of getting a ledger ? |
I don't understand this. Can you expand? RPC server will know the state of everything for the purposes of pre-flight. Are you saying the user needs ledger entries in order to use preflight? |
This is based on the following assumptions, deduced from the design doc
|
Yup, the RPC server needs ledger entries for preflight. Preflight requires the ledger entries the contract will read or write, and given it's preflight without a footprint that could include any account, any trust line, and any contract data for the executing contract, and same for any contract that is called by the invoked contract, and so on. |
I think that the confusion here is between the core's preflight ( soon to be depreciated ) and the simulateTransaction. The simulateTransaction is intended to be all-in-one endpoint, that will retrieve the ledger needed(internally), simulate the transaction execution on top of that ledger, and return the results. That won't work for the case where you want to run your transaction against custom ledger ( which I'm not sure we need ). |
Exactly. RPC server has internal access to the current state of the ledger. RPC preflight therefore doesn't need an endpoint. So I'm asking specifically about the need for a ledger entry endpoint like this for the user - not the smart contract. |
My assumption was that if soroban-rpc has internal access to the required ledger entries, then the added lift of exposing them externally through this API is relatively small. Is that a false assumption? |
It's not about the lift, it's about understanding the requirements. There are trade offs around API scope and performance. Not saying it's a bad idea, just want to understand the way such an endpoint would be used. |
Closing this as |
What
Add an endpoint for getting a ledger entry given a ledger entry key XDR string.
Supporting at least the following ledger entry key types:
Account
Trustline
ContractData
ContractCode
Example contract data ledger entry lookup:
Example account ledger entry lookup:
Example contract code entry lookup:
Why
Horizon has many types of ledger entries in some form but presents them only in its opinionated JSON form. It would be useful if Horizon exposed the raw XDR of those ledger entries in a similar way that it exposes raw XDR for transaction envelopes.
One use case is applications using the Soroban environment. The Soroban environment when running contracts has a lookup mechanism where it can lazily ask for ledger entries from a data source. It would be helpful in some applications to be able to lazily collect those ledger entries from Horizon who already has them.
It's probably unlikely that Horizon could provide all ledger entries, and for any ledger entry it doesn't support it could return a 422 or 400.
(This isn't a request connected to making Horizon the ledger entry data source for the RPC, although it could be an alternative data source in that way.)
The text was updated successfully, but these errors were encountered: