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

Oracles #1584

Closed
wants to merge 72 commits into from
Closed

Oracles #1584

wants to merge 72 commits into from

Conversation

shargon
Copy link
Member

@shargon shargon commented Apr 18, 2020

doubiliu and others added 28 commits March 11, 2020 09:05
* first commit

* format

* Simplify code

* add UT and add some feature

* Fix bug

* Add summary and fix bug

* format

* format

* little change

* little change

* little change

* change Fee & Fix bug

* Optimize

* add config class

* FiX UT

* Format

* Fix UT

* Fix format and Optimize

* Add some UT

* Fix bug and add UT

* Update src/neo/SmartContract/Native/Oracle/OraclePolicyContract.cs

Co-Authored-By: Luchuan <luchuan@ngd.neo.org>

* little change

* format

* Update src/neo/SmartContract/Native/Oracle/OraclePolicyContract.cs

Co-Authored-By: Shargon <shargon@gmail.com>

* add check

* change validator

* Add double initialization check

* add UT

* Add UT

* change UT

* fill UT

* up ut and fix NeoToken.GetValidators

* remove console

* reset NEO.getValidators

* fix GetOracleValidators

* Rename variable

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Fix bug

* change logic

* Fix name

* change to const

* Add double initialization check and fix ut

* optimize

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: Luchuan <luchuan@neo.org>
Co-authored-by: Erik Zhang <erik@neo.org>
* Plugins from List to array

* Move false to init

* Fix UT

* Refactor

* UT

* Change HTTP to HTTPS

* UT Syscall

* Remove Version

* Remove HTTP from the syscall name

* Check schema

* Rename

* Update src/neo/Oracle/OracleRequest.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Fix abstract

* Rename

* Remove Body

* Change order of members

* Rename Neo.Oracle.Get

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: erikzhang <erik@neo.org>
Co-authored-by: Belane <srbelane@gmail.com>
* first commit

* format

* Simplify code

* add UT and add some feature

* Fix bug

* Add summary and fix bug

* format

* format

* little change

* little change

* little change

* change Fee & Fix bug

* Optimize

* add config class

* FiX UT

* Format

* Fix UT

* Fix format and Optimize

* Add some UT

* Fix bug and add UT

* Update src/neo/SmartContract/Native/Oracle/OraclePolicyContract.cs

Co-Authored-By: Luchuan <luchuan@ngd.neo.org>

* little change

* format

* Update src/neo/SmartContract/Native/Oracle/OraclePolicyContract.cs

Co-Authored-By: Shargon <shargon@gmail.com>

* add check

* change validator

* Add double initialization check

* add UT

* Add UT

* change UT

* fill UT

* up ut and fix NeoToken.GetValidators

* remove console

* reset NEO.getValidators

* fix GetOracleValidators

* Rename variable

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Fix bug

* change logic

* Fix name

* change to const

* Add double initialization check and fix ut

* optimize

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: Luchuan <luchuan@neo.org>
Co-authored-by: Erik Zhang <erik@neo.org>
* Plugins from List to array

* Move false to init

* Fix UT

* Refactor

* UT

* Change HTTP to HTTPS

* UT Syscall

* Remove Version

* Remove HTTP from the syscall name

* Check schema

* Rename

* Update src/neo/Oracle/OracleRequest.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Fix abstract

* Rename

* Remove Body

* Change order of members

* Rename Neo.Oracle.Get

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: erikzhang <erik@neo.org>
Co-authored-by: Belane <srbelane@gmail.com>
Removed hash from the response
* first commit

* format

* Simplify code

* add UT and add some feature

* Fix bug

* Add summary and fix bug

* format

* format

* little change

* little change

* little change

* change Fee & Fix bug

* Optimize

* add config class

* FiX UT

* Format

* Fix UT

* Fix format and Optimize

* Add some UT

* Fix bug and add UT

* Update src/neo/SmartContract/Native/Oracle/OraclePolicyContract.cs

Co-Authored-By: Luchuan <luchuan@ngd.neo.org>

* little change

* format

* Update src/neo/SmartContract/Native/Oracle/OraclePolicyContract.cs

Co-Authored-By: Shargon <shargon@gmail.com>

* add check

* change validator

* Add double initialization check

* add UT

* Add UT

* change UT

* fill UT

* up ut and fix NeoToken.GetValidators

* remove console

* reset NEO.getValidators

* fix GetOracleValidators

* Rename variable

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Fix bug

* change logic

* Fix name

* change to const

* Add double initialization check and fix ut

* optimize

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: Luchuan <luchuan@neo.org>
Co-authored-by: Erik Zhang <erik@neo.org>
* Plugins from List to array

* Move false to init

* Fix UT

* Refactor

* UT

* Change HTTP to HTTPS

* UT Syscall

* Remove Version

* Remove HTTP from the syscall name

* Check schema

* Rename

* Update src/neo/Oracle/OracleRequest.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Fix abstract

* Rename

* Remove Body

* Change order of members

* Rename Neo.Oracle.Get

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: erikzhang <erik@neo.org>
Co-authored-by: Belane <srbelane@gmail.com>
Removed hash from the response
* Oracle Service

* Fix fee

* Optimize load configuration

* Fix akka message

* Optimize

* dotnet format

* Fix sort

* Oracle Service

* Fix fee

* Optimize load configuration

* Fix akka message

* Optimize

* dotnet format

* Fix sort

* Apply rename

* Small changes

* Add UT

* Fix Start Stop

* dotnet-format

* Migrate to HTTPS test

* Change AKKA message

* Tommo recomendations

* Add comunication between OracleTx and UserTx

* Advance of signature

* Fix UT

* dotnet-format

* Advance of signature

Fix UT

dotnet-format

* Fix UT

* Remove duplica method

* Reduce timeout time

* Add log for fix UT

* Add filters

* Change port to 443

* Oracle Service

* Fix fee

* Optimize load configuration

* Fix akka message

* Optimize

* dotnet format

* Fix sort

* Oracle Service

* Fix fee

* Optimize load configuration

* Fix akka message

* Optimize

* dotnet format

* Fix sort

* Apply rename

* Small changes

* Add UT

* Fix Start Stop

* dotnet-format

* Migrate to HTTPS test

* Change AKKA message

* Tommo recomendations

* Add comunication between OracleTx and UserTx

* Advance of signature

* Fix UT

* dotnet-format

* Fix UT

* Remove duplica method

* Reduce timeout time

* Add log for fix UT

* Add filters

* Change port to 443

* Merge changes

* Change SSL Protocol

* Merge remote-tracking branch 'neo-project/oracle-service' into oracle-service

* Add UT certificate

* Clean code

* Add UT
* fix GetOracleMultiSigAddress

* First lowercase

Co-authored-by: Shargon <shargon@gmail.com>
* Tx comunication

* Some fixes
* Add assert for each oracle request

* Change to goto

* Improve wallet asserts

* Optimize

* Fix URL type

* dotnet format

* Oracle: Tx comunication (#1540)

* Tx comunication

* Some fixes

* Optimize OracleExecutionCache

* Add assert for each oracle request

* Change to goto

* Improve wallet asserts

* Optimize

* Fix URL type

* dotnet format

* Optimize OracleExecutionCache

* MakeTransaction UT
* Set the right Tx version

* Remove Error types from TX and VM

* Neo.Oracle.Get now only return the result or null
* Oracle Response Signature P2P

* caches

* rename private fields

* remove comments

* remove more comments and fix size

* Clean code

Co-authored-by: Shargon <shargon@gmail.com>
* Start pool

* Prepare for neo-node

* Fix double call

* Prepare pool

* Fix

* Join oracle pool with oracle service

* dotnet-format

* Try to fix UT

* UT pass

* Fix UT

* Fix p2p message

* Unify collections

* Relay p2p message

* Clean code and fixes

* Send tx to OracleService

* RequestTx will wait for ResponseTx

* Rename

* Remove supervisor

* Allow to put request, and response in the same block

* Check the sender of OracleResponses

* Remove OracleResponse message in OracleService

* Organize code

* Fix typo

* Remove task count TODO

* Remove Thread-safe TODO

* Remove TODO

* ResponseItem changes

* Read the oracle contract on my response

Receive oraclePayload

* Clean code

* Add Stop message

* Save only one response for PublicKey/RequestTx

Improve sorting response pool

* Improve sort

* Group sort methods in the same region

* Ask for the request TX if I don't have it

* Reorder code

* Rename

* First oracle TX
* Remove some todos

* Remove one method

* Reuse ManualWitness

* dotnet format

* Allow both tx in the same block without change order or fee

* Fix p2p message serialization

* Fix p2p

* Fixes and IInventory

* Fix akka message

* Fix ut
* first commit

* format

* Simplify code

* add UT and add some feature

* Fix bug

* Add summary and fix bug

* format

* format

* little change

* little change

* little change

* change Fee & Fix bug

* Optimize

* add config class

* FiX UT

* Format

* Fix UT

* Fix format and Optimize

* Add some UT

* Fix bug and add UT

* Update src/neo/SmartContract/Native/Oracle/OraclePolicyContract.cs

Co-Authored-By: Luchuan <luchuan@ngd.neo.org>

* little change

* format

* Update src/neo/SmartContract/Native/Oracle/OraclePolicyContract.cs

Co-Authored-By: Shargon <shargon@gmail.com>

* add check

* change validator

* Add double initialization check

* add UT

* Add UT

* change UT

* fill UT

* up ut and fix NeoToken.GetValidators

* remove console

* reset NEO.getValidators

* fix GetOracleValidators

* Rename variable

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Fix bug

* change logic

* Fix name

* change to const

* Add double initialization check and fix ut

* optimize

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: Luchuan <luchuan@neo.org>
Co-authored-by: Erik Zhang <erik@neo.org>
Oracle Syscall (#1399)

* Plugins from List to array

* Move false to init

* Fix UT

* Refactor

* UT

* Change HTTP to HTTPS

* UT Syscall

* Remove Version

* Remove HTTP from the syscall name

* Check schema

* Rename

* Update src/neo/Oracle/OracleRequest.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Fix abstract

* Rename

* Remove Body

* Change order of members

* Rename Neo.Oracle.Get

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: erikzhang <erik@neo.org>
Co-authored-by: Belane <srbelane@gmail.com>
Oracle Syscall (#1399)

* Plugins from List to array

* Move false to init

* Fix UT

* Refactor

* UT

* Change HTTP to HTTPS

* UT Syscall

* Remove Version

* Remove HTTP from the syscall name

* Check schema

* Rename

* Update src/neo/Oracle/OracleRequest.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Fix abstract

* Rename

* Remove Body

* Change order of members

* Rename Neo.Oracle.Get

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: erikzhang <erik@neo.org>
Co-authored-by: Belane <srbelane@gmail.com>
Rename OracleResult->OracleResponse (#1516)

Removed hash from the response
Oracle Syscall (#1399)

* Plugins from List to array

* Move false to init

* Fix UT

* Refactor

* UT

* Change HTTP to HTTPS

* UT Syscall

* Remove Version

* Remove HTTP from the syscall name

* Check schema

* Rename

* Update src/neo/Oracle/OracleRequest.cs

Co-Authored-By: Erik Zhang <erik@neo.org>

* Fix abstract

* Rename

* Remove Body

* Change order of members

* Rename Neo.Oracle.Get

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: erikzhang <erik@neo.org>
Co-authored-by: Belane <srbelane@gmail.com>
Rename OracleResult->OracleResponse (#1516)

Removed hash from the response
Oracle Service (#1517)

* Oracle Service

* Fix fee

* Optimize load configuration

* Fix akka message

* Optimize

* dotnet format

* Fix sort

* Oracle Service

* Fix fee

* Optimize load configuration

* Fix akka message

* Optimize

* dotnet format

* Fix sort

* Apply rename

* Small changes

* Add UT

* Fix Start Stop

* dotnet-format

* Migrate to HTTPS test

* Change AKKA message

* Tommo recomendations

* Add comunication between OracleTx and UserTx

* Advance of signature

* Fix UT

* dotnet-format

* Advance of signature

Fix UT

dotnet-format

* Fix UT

* Remove duplica method

* Reduce timeout time

* Add log for fix UT

* Add filters

* Change port to 443

* Oracle Service

* Fix fee

* Optimize load configuration

* Fix akka message

* Optimize

* dotnet format

* Fix sort

* Oracle Service

* Fix fee

* Optimize load configuration

* Fix akka message

* Optimize

* dotnet format

* Fix sort

* Apply rename

* Small changes

* Add UT

* Fix Start Stop

* dotnet-format

* Migrate to HTTPS test

* Change AKKA message

* Tommo recomendations

* Add comunication between OracleTx and UserTx

* Advance of signature

* Fix UT

* dotnet-format

* Fix UT

* Remove duplica method

* Reduce timeout time

* Add log for fix UT

* Add filters

* Change port to 443

* Merge changes

* Change SSL Protocol

* Merge remote-tracking branch 'neo-project/oracle-service' into oracle-service

* Add UT certificate

* Clean code

* Add UT
fix GetOracleMultiSigAddress (#1538)

* fix GetOracleMultiSigAddress

* First lowercase

Co-authored-by: Shargon <shargon@gmail.com>
Oracle: Tx comunication (#1540)

* Tx comunication

* Some fixes
Transaction Version (#1539)


Oracle: Allow wallets to add assert for the oracle response (#1541)

* Add assert for each oracle request

* Change to goto

* Improve wallet asserts

* Optimize

* Fix URL type

* dotnet format

* Oracle: Tx comunication (#1540)

* Tx comunication

* Some fixes

* Optimize OracleExecutionCache

* Add assert for each oracle request

* Change to goto

* Improve wallet asserts

* Optimize

* Fix URL type

* dotnet format

* Optimize OracleExecutionCache

* MakeTransaction UT
Oracle: Set the right Tx version (#1542)

* Set the right Tx version

* Remove Error types from TX and VM

* Neo.Oracle.Get now only return the result or null
Oracle: P2P Response Signature Message (#1553)

* Oracle Response Signature P2P

* caches

* rename private fields

* remove comments

* remove more comments and fix size

* Clean code

Co-authored-by: Shargon <shargon@gmail.com>
Oracle: OracleService (#1555)

* Start pool

* Prepare for neo-node

* Fix double call

* Prepare pool

* Fix

* Join oracle pool with oracle service

* dotnet-format

* Try to fix UT

* UT pass

* Fix UT

* Fix p2p message

* Unify collections

* Relay p2p message

* Clean code and fixes

* Send tx to OracleService

* RequestTx will wait for ResponseTx

* Rename

* Remove supervisor

* Allow to put request, and response in the same block

* Check the sender of OracleResponses

* Remove OracleResponse message in OracleService

* Organize code

* Fix typo

* Remove task count TODO

* Remove Thread-safe TODO

* Remove TODO

* ResponseItem changes

* Read the oracle contract on my response

Receive oraclePayload

* Clean code

* Add Stop message

* Save only one response for PublicKey/RequestTx

Improve sorting response pool

* Improve sort

* Group sort methods in the same region

* Ask for the request TX if I don't have it

* Reorder code

* Rename

* First oracle TX
Oracle: Remove some TODOs (#1574)

* Remove some todos

* Remove one method

* Reuse ManualWitness

* dotnet format

* Allow both tx in the same block without change order or fee

* Fix p2p message serialization

* Fix p2p

* Fixes and IInventory

* Fix akka message

* Fix ut
Fix conflicts


Remove double call
* Remove ProtocolHandler and split caches

* Optimize signature send

* Improve OracleService with TaskManager

* Send error response when there are no agreement

* Clear code

* Clean code

* Add filter arguments

* dotnet-format
* Fix filter hash

* Remove enter

* Fix filter hash


Remove enter

* Clean filter method

* Remove Hash because is not used

* dotnet-format

* Change P2P message

* Optimizations
* Move Oracle syscall to oracle native contract

* Fix typo
@vncoelho
Copy link
Member

Very good, the same could be done for neo-node branch.

* Rename

* Log oracle errors error

* Clean csproj

* Remove comment

* Unify comments

* Add filter cost to the current execution

* Add the filter cost to the current execution, only once
@erikzhang
Copy link
Member

erikzhang commented May 26, 2020

With a sync oracle you always can build an async one, but it will require three tx, and watch the blockchain in order to send the callback, otherwise, the user won't pay for callback.

Currently, we need two transactions, one for the request, and the other for the response. If we use asynchronous mode, we also need two transaction, not three. One for the request, and the other for the callback. We don't even need attributes. We can deduct the callback fee directly from the account that sent the request. If the balance is insufficient, the callback transaction will fail.

@shargon
Copy link
Member Author

shargon commented May 26, 2020

I think going to the asynchronous oracle when we have a synchronized one is taking a step back, other blockchains only have asynchronous because they can't change the core, they need to build everything in smart contracts and offchain, and it's something that complicates the wheel and the developer experience, now we have the opportunity with neo3 of creating an sync oracle, for me have no reason to do it as async.

If you create more than one download and it produce a FAULT oracle request, it's a developer problem, ussually it will be because they use dynamic URL with block numbers, so they should expect a FAULT, if they are lucky and OracleNodes make consensus in a block, they will have his result, but it's something under control.

@erikzhang
Copy link
Member

now we have the opportunity with neo3 of creating an sync oracle, for me have no reason to do it as async.

In my opinion, the current synchronization mode is not a real synchronization. After the transaction is sent, the waiting time is the same as asynchronous.

If you create more than one download and it produce a FAULT oracle request, it's a developer problem, ussually it will be because they use dynamic URL with block numbers, so they should expect a FAULT, if they are lucky and OracleNodes make consensus in a block, they will have his result, but it's something under control.

But in asynchronous mode, using dynamic URL with block index or current time is allowed. Because the requests are created after block persisted.

@Tommo-L
Copy link
Contributor

Tommo-L commented May 27, 2020

For contract, it's realy synchronize. If we use asynchronous mode, the callback can only perform tasks that don't need to be signed by users. Therefore, we can't build arbitrarily complex applications.

@erikzhang
Copy link
Member

If we use asynchronous mode, the callback can only perform tasks that don't need to be signed by users.

You can check the witnesses in the request transaction first.

@Tommo-L
Copy link
Contributor

Tommo-L commented May 27, 2020

Some dapps can do it by that way, some may not. For example, in a gambling game, it needs to request the prize number before calling the nep5 transfer method.

@Tommo-L
Copy link
Contributor

Tommo-L commented May 27, 2020

Another thing I'm thinking about is that what's really needed behind oracle is valuable data.

Oracle's main role:

  1. Transfer data
  2. Credit endorsement for data, when the data source does not provide a credible proof

If the data source can provide trusted data directly, follow certain criteria, such as signing the data. Then, any node can become a lightweight Oracle to fulfill the first responsibility - transfer data.

In this case, we only need to provide:

  1. a signature specification (maybe a NEP) that is as good as it can be
  2. lightweight Oracle
  3. a data source registry on the chain.

One popular phenomenon these days is the willingness of exchanges to offer links to their data, such as coinbase and binance, which have started offering signature data sources.

@doubiliu
Copy link
Contributor

Well we discussed the difference between synchronous and asynchronous modes in the discussion above.This was discussed in a similar issue in our assembly last year.

Let's make a summary

Synchronous Asynchronous
Block status High correlation Low correlation
Execution time Strong restrictions Unlimited
Permissions/Charge Mechanism Simple Complex
Originality High Low

These two modes are very useful for implementing a reliable built-in Oracle.

In my opinion:These two are not contradictory, just as there are synchronous / asynchronous calling functions in the front-end technology ajax.Developers will use the correct function according to actual needs.This is the same in our built-in Oracle, we do not necessarily have only one mode.

We can extend the current implementation. We only need to let the existing Request method declare the mode and callback function we want to use (optional).If the developer chooses synchronous mode, then everything will be the same.If the developer chooses asynchronous mode, the Oracle node will trigger a callback function or some other feasible operation

But we should explain the limitations of these two modes in the API documentation and give a certain demo.
E.g:
Using synchronous mode, the overall timeout time will be limited to 2/3 of the block time, after the timeout all execution will be filled with fault by default.
Using asynchronous mode, you need to declare the callback function or the user to extract the data.

@shargon 's current implementation has done a lot of work for us.Save us a lot of time.
I think we can complete the design and implementation of the extension first, and then complete the overall implementation of the asynchronous mode

@erikzhang
Copy link
Member

In my opinion:These two are not contradictory

I don't think we should build both synchronous mode and asynchronous mode. I don't want to over complicate neo's architecture.

Maybe we should rethink each aspect of the two solutions and find out which suits us best.

@shargon
Copy link
Member Author

shargon commented May 29, 2020

A callback it's not possible because you create the callback in the request and must be triggered in response, when the context it's different, it's the same as filters, they call other contract with other parameters, but it could not be done with callback syscall, I think, the pointer will be lost.

I think that async can be done by wallets or dapps if they need it, but sync it's only possible to build if it was build in the core.

@erikzhang
Copy link
Member

You don't need a "callback syscall". When I was talking about "callback" in oracle, I mean a string methodName.

@doubiliu
Copy link
Contributor

doubiliu commented May 29, 2020

What you mean is that the user declares a callback function name when calling the Oracle service, and then when the Oracle node commit the data, it will record a message in the Oracle native contract, such as xxx: FunctionA result is xxxxxxx, and then when user use data, query it from Oracle's native contract?

@erikzhang
Copy link
Member

The oracle node send a transaction and call that method.

{
case HttpMethod.GET:
{
result = client.GetAsync(request.URL);
Copy link
Member

@erikzhang erikzhang Jul 22, 2020

Choose a reason for hiding this comment

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

I have a good idea. We can add a timestamp or block height to the URL when the actual request is made, so that non-determinacy can be eliminated, and the URL has cross-block availability. After solving this problem, we seem to be able to use the synchronization solution.

The user or contract can choose to add a time stamp URL parameter, or block height. Everything is specified in OracleRequest.

@shargon If you think this approach is feasible, please resolve the conflicts.

Copy link
Member Author

Choose a reason for hiding this comment

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

The conflicts was resolved, but OracleContract require a new review.

Copy link
Member

Choose a reason for hiding this comment

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

@shargon Do you think that the oracle nodes can reach a consensus on the request timestamp of a transaction? Maybe a node is needed to write the unified timestamp into the contract storage first?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you think that the oracle nodes can reach a consensus on the request timestamp of a transaction?

I think that is possible, sometimes, but if don't, we have two possibilities: the first one, it doesn't care because the response was the same, and the worst one, it was different, currently they return a FAULT but we can change this to have more retries.

@erikzhang
Copy link
Member

@shargon What is the consensus protocol of oracle?

@shargon
Copy link
Member Author

shargon commented Jul 23, 2020

A multisignature of all Oracle nodes

https://github.com/neo-project/neo/pull/1584/files#diff-b312bfff946ee7c97448f2b22414f873R180-R184

if they don't receive enough signatures in a certain time, they will sign as a fault download.

https://github.com/neo-project/neo/pull/1584/files#diff-671e72f8dccae549eb16aa4d94679168R335-R342

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Issues that are blocking other issues. Check issues details to see what it is blocking.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Oracles] Design, Discussion and Implementation
6 participants