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

Calculation of the amount of GAS to attach to oracle request #1982

Open
roman-khimov opened this issue Sep 30, 2020 · 2 comments
Open

Calculation of the amount of GAS to attach to oracle request #1982

roman-khimov opened this issue Sep 30, 2020 · 2 comments
Labels
Discussion Initial issue state - proposed but not yet accepted

Comments

@roman-khimov
Copy link
Contributor

Summary or problem description
Oracle contract merged with #1738 mandates the caller to specify the amount of GAS to be used for response transaction transmission and execution. It can also be seen in the demo contract from neo-project/neo-devpack-dotnet#370.

The problem is --- how should a contract developer determine the amount of GAS to be passed into Oracle.Request()? It completely depends on the oracle response, so theoretically developer should specify big enough value to cover all possible cases (and waste some GAS doing so if the majority of the cases need less than the maximum value). But it's not easy to precalculate that even for regular contract execution flow, and what if we're to make one more oracle request from the callback or just call another contract that can do whatever it wants to depending on its input parameters? And it is to be set by the developer, so some kind of RPC-driven test invocation (like invokefunction) is not applicable either.

Do you have any solution you want to propose?
I don't. But I expect this question to be raised by smart contract developers and I think we need some answer for it.

Neo Version

  • Neo 3

Where in the software does this update applies to?

  • Oracles
@roman-khimov roman-khimov added the Discussion Initial issue state - proposed but not yet accepted label Sep 30, 2020
@shargon
Copy link
Member

shargon commented Oct 1, 2020

Fee could be like in eth, if you send more than it's used, you should have a refund.

@roman-khimov
Copy link
Contributor Author

That's a good mitigation, at least eliminating some waste, but still contract developer needs to decide how much GAS to pay initially. And this decision would affect contract call cost, if the worst-case (in terms of GAS cost) callback processing scenario costs 10 GAS, then even if this scenario happens once per 1000 calls all the other ones need to spend this 10 GAS first and only receive their refund after response processing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Initial issue state - proposed but not yet accepted
Projects
None yet
Development

No branches or pull requests

2 participants