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

First sketch of InvokeHostFunctionOp preflight endpoint. #3500

Merged
merged 1 commit into from
Aug 23, 2022

Conversation

graydon
Copy link
Contributor

@graydon graydon commented Aug 5, 2022

This implements a new preflight?blob=<InvokeHostFunctionOp> HTTP endpoint which then runs the requested op synchronously against the current ledger in preflight / footprint-recording mode, and reports back

  • the host-function call result
  • the storage footprint that was recorded
  • the cpu instruction and memory byte counts (since we don't currently have a way to translate these into "gas costs")

It also adds a new getledgerentry?key=<LedgerKey> HTTP endpoint, which returns a status, encoded ledger entry, and ledger number (for consistency validation on the caller), because there's some ongoing discussion about doing preflight in the CLI client / in an RPC host / closer to the operator and it's harmless to include at this point (it's short and not part of release builds or anything, easy to remove later).

I also very slightly cleaned up the tx?blob= endpoint because it kinda looks like nobody has touched it in 7 years and it's a little messy. And I slightly cleaned up the existing call path for invoke_host_function.

Addresses #3484 and stellar/stellar-cli#63

"Must specify an InvokeHostFunctionOp blob: preflight?blob=<op in "
"base64 XDR format>");
}
retStr = root.toStyledString();
Copy link
Contributor

Choose a reason for hiding this comment

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

toStyledString is not the right writer: this one produces a human readable string (with tabs etc), the way to do it is Json::FastWriter().write(root)

Copy link
Contributor

Choose a reason for hiding this comment

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

applies to all changes you made in this file, but not all endpoints (for example, the quorum, info endpoints are commonly used by operators and are not performance sensitive)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@MonsieurNicolas
Copy link
Contributor

r+ 97cd4aa

@latobarita latobarita merged commit 19ea1e4 into stellar:master Aug 23, 2022
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.

None yet

3 participants