Skip to content

The bridge returns a response only one time #79

@irimiacosmin

Description

@irimiacosmin

Hello,
I want to deploy locally a oracle contract that gives me the current timestamp but it works only one time, after this it does not call the query anymore.
The steps:

  1. ganache-cli -l 800000000 --allowUnlimitedContractSize
  2. ethereum-bridge -H localhost:8545 --broadcast -a 1 --dev --loglevel verbose
  3. I copy the line OAR = OracleAddrResolverI(0xX...X); in the ctor of the TimeMachine contract
  4. truffle migrate --reset

After this, the ganache console prints a infinite number of eth_getFilterChanges and that's a good thing, the call to the exposed public method returns one valid timestamp and the bridge prints this

[2020-01-27T08:41:14.230Z] INFO contract 0xcf903000689f8fd441a2f90ae797a4d4acc14cd0 __callback tx sent, transaction hash: 0x8f5b03fdb3b5c3968ad9f17c7a8aef06d9f18ce6c8ea5fef80fb45507178d668
{
    "myid": "0x5c2db0aca7e507a155675a93f2db0b9d69a1413cc793f80f0c94e6f209bb9cf2",
    "result": "1580114467",
    "proof": null,
    "proof_type": "0x00",
    "contract_address": "0xcf903000689f8fd441a2f90ae797a4d4acc14cd0",
    "gas_limit": 200000,
    "gas_price": null
}

After this, ganache continue to print filter changes but the bridge does not give me another timestamp, it sticks with the current one for the rost of it's life.

For the full context, see the contract bellow:

pragma solidity ^0.5.10;
import "./usingOraclize.sol";

contract TimeMachine is usingProvable {

    uint256 public timestamp;
    event LogConstructorInitiated(string nextStep);
    event LogPriceUpdated(string price);
    event LogNewProvableQuery(string description);

    constructor () public payable {
	OAR = OracleAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);
        emit LogConstructorInitiated("Constructor was initiated. Call 'updateTime()' to send the Provable Query.");
	updateTime();
    }

    function pay() public payable {}

    function balance() public view returns(uint256)  {
        return address(this).balance;
    }

    function __callback(bytes32, string memory result) public {
        if (msg.sender != provable_cbAddress()) revert();
        timestamp = parseInt(result);
        emit LogPriceUpdated(result);
        updateTime();
    }

    function updateTime() public payable {
        if (provable_getPrice("URL") > address(this).balance) {
            emit LogNewProvableQuery("Provable query was NOT sent, please add some ETH to cover for the query fee");
        } else {
            emit LogNewProvableQuery("Provable query was sent, standing by for the answer..");
            provable_query("URL", "json(http://worldtimeapi.org/api/timezone/Europe/Bucharest).unixtime");
        }
    }
}

I'm doing something wrong or this is a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions