provable-things / ethereum-api

Provable API for Ethereum smart contracts
https://docs.provable.xyz/#ethereum
MIT License
800 stars 428 forks source link

Decrypted query error #78

Closed rrubo closed 5 years ago

rrubo commented 5 years ago

I have a random.org nested query, which was working a couple of weeks ago. Today, when I tried to query a random number, I got:

ERROR HTTP query error
        [
    "datasources.decrypt.access_denied",
    "parsing_helper.wrong_path"

This is really frustrating, as I haven't changed anything in the code.

When I removed the encrypted API key and inserted the decrypted one, the query worked just fine.

What could be the error?

gskapka commented 5 years ago

That parsing error is when there's an error traversing the response from the URL endpoint. A few reasons it could occur:

1) If the format of the response is altered at the API level itself.

2) If a malformed query results in trying to parse a 404 response or similar.

3) If an API key to a service has expired/been revoked resulting in a 403 (or similar).

Since you've ruled out #3 & #1 via your experiments so far, and we haven't changed anything on our side re the encryption, could you share your query code so we can investigate further? And also what network was this on?

rrubo commented 5 years ago

The query:

"[URL] ['json(https://api.random.org/json-rpc/1/invoke).result.random[\"serialNumber\",\"data\"]', '\\n{\"jsonrpc\":\"2.0\",\"method\":\"generateSignedIntegers\",\"params\":{\"apiKey\":\"${[decrypt] BEna2ojyJ8x3euQmExkugHrukwYeMH2Z7o3e9XEqATmN1ApOokRElT5IJEp1JNFhbn3dvdEo3wLaDaZJu5PqRUaoI4ZnbDTwAmMtkfLP1jBD7OldcYReDzG4cc5tdjCdP2KbzhIOEuXskoW3PzkqHzGq641e}\",\"n\":1,\"min\":1,\"max\":10,\"replacement\":false,\"base\":10${[identity] \"}\"},\"id\":778${[identity] \"}\"}']"

This has been tested both on Ethereum-bridge and Remix IDE VM. Decryption error in both of the cases.

D-Nice commented 5 years ago

To protect mainnet contracts from having their encrypted queries hijacked, there is a notion of ownership. The above error indicates that some mainnet contract is already using that encrypted query. If you updated to a new contract, you will have to regenerate the encrypted portion for each contract.

If this in fact happened to an existing mainnet contract, let us know the address, and we'll take a look.

ytrezq commented 3 years ago

I have a random.org nested query, which was working a couple of weeks ago. Today, when I tried to query a random number, I got:

ERROR HTTP query error
        [
    "datasources.decrypt.access_denied",
    "parsing_helper.wrong_path"

This is really frustrating, as I haven't changed anything in the code.

When I removed the encrypted API key and inserted the decrypted one, the query worked just fine.

What could be the error?

@rrubo how did you get error details?

gskapka commented 3 years ago

@ytrezq - by using the check query tool along with the query's chain id here: https://app.provable.xyz/home/check_query