-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Oracles] Syscall and ApplicationEngine #1275
Comments
Good design.But as my comment in economic model,I think we should do a little change. |
@doubiliu free request it's a second request with the same values? (because it's cached) |
No.Free request means paid less than the actual number of executions |
I think that if the execution requires 4 but the user has only paid for 3, the transaction should enter into the block as failed and thus charge the fee to the user anyway. |
It is also possible to return the execution failure, but we should understand that the Oracle node cannot know the actual number of calls in advance. So the purpose of |
If there are fee, he should try to get the result, because he need to know the response in order to know how much fee he need it. It should be on the price. |
Normally, this is correct. But if I try to attack, then I can only pay once but call the service multiple times in the code, I don't care about the result of the request, I just want the oracle to do useless work |
The oracle needs a mechanism to verify the number of calls |
If you pay, and it's not enought for 1 byte, you will be FAULT. It's the same with regular TX |
Calling a service will incur a fee and pay once? @shargon |
@shargon I think we can start with the first implementation of Syscall (or draft) as it has been decided which are the first filters, protocols and responses to be implemented.
|
@belane what about when the contract is expecting variations, in future is it feasible to support non-deterministic requests? |
I think that filters are very important, but also, it should be deterministic, so this is my proposal.
Where
Another idea is the filter as a The filter template should be like this public class MyFilter :SmartContract
{
public byte[] Main(byte[] result, bool isError)
{
return result;
}
} |
This proposal does not require Virtual Machine modifications. It only requires to add one new download syscall. This Syscall accepts two parameters: URL and xpath filter.
Thus, we reduce stored content in
DownloadExecutionCache
to the mínimum needed for Smart Contract.As an example, only the filtered content is agreed and stored, optimizing storage space, meaning 1 MB JSON will not be stored into the chain but just the values the smart contracts needs.
XPATH filter also helps to achieve determinism in webs/APIs that have variations in each request and these variations are outside the data that Smart Contract needs.
As an example, the following API’s response
{“name”:”NEO”,”time”:213123123213}
where time varies in each request, but the Smart Contract only needs “name”, this non determinism problem won’t exist during Oracle negotiation.(Note: Maximum content size and total TBD).
ApplicationEngine Execution
During a Smart Contract execution it will check if the result exits in the
DownloadExecutionCache
every time Oracle’s syscall is used.If the node represents an authorized Oracle or a client building his/her transactions, it will download the content, apply the filter and generate
DownloadExecutionCache
.In case the client is building the transaction, it will include results hash in
OracleExpectedResult
before signing and broadcasting the transaction.During execution, the virtual machine (syscall) will return “Failure” if there is no total or partial
DownloadExecutionCache
, or if the final OracleAgreement is false.Open Sub-discussions:
The text was updated successfully, but these errors were encountered: