Skip to content

Commit

Permalink
Merge branch 'main' into icq-destination
Browse files Browse the repository at this point in the history
  • Loading branch information
themandalore authored Nov 12, 2024
2 parents a3962c0 + 032163d commit 6a97277
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
10 changes: 7 additions & 3 deletions daemons/reporter/client/reporter_monitors.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ func (c *Client) MonitorCyclelistQuery(ctx context.Context, wg *sync.WaitGroup)
if err != nil {
// log error
c.logger.Error("getting current query", "error", err)
time.Sleep(150 * time.Millisecond)
time.Sleep(100 * time.Millisecond)
continue
}
if bytes.Equal(querydata, prevQueryData) || commitedIds[querymeta.Id] {
time.Sleep(150 * time.Millisecond)
time.Sleep(100 * time.Millisecond)
continue
}

Expand All @@ -34,7 +35,10 @@ func (c *Client) MonitorCyclelistQuery(ctx context.Context, wg *sync.WaitGroup)
c.logger.Error("Generating CycleList message", "error", err)
}
}(ctx, querydata, querymeta)
time.Sleep(250 * time.Millisecond)
err = c.WaitForBlockHeight(ctx, int64(querymeta.Expiration))
if err != nil {
c.logger.Error("Error waiting for block height", "error", err)
}
}
}

Expand Down
29 changes: 18 additions & 11 deletions evm/contracts/testing/SimpleLayerUser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ contract SimpleLayerUser {
bytes32 public queryId;

struct PriceData {
uint256 price;
uint256 timestamp;
uint256 aggregatePower;
uint256 previousTimestamp;
uint256 nextTimestamp;
uint256 relayTimestamp;
uint256 price; // reported price
uint256 timestamp; // aggregate report timestamp
uint256 aggregatePower; // aggregate reporter power
uint256 previousTimestamp; // previous report timestamp
uint256 nextTimestamp; // next report timestamp
uint256 relayTimestamp; // time relayed data included in block
uint256 attestationTimestamp; // time of attestation
uint256 userTriggerTimestamp; // time user decided to tip
uint256 beginRelayTimestamp; // time relay tx initiated
}

constructor(address _blobstreamO, bytes32 _queryId) {
Expand All @@ -25,20 +28,24 @@ contract SimpleLayerUser {
function updateOracleData(
OracleAttestationData calldata _attestData,
Validator[] calldata _currentValidatorSet,
Signature[] calldata _sigs
Signature[] calldata _sigs,
uint256 _userTriggerTimestamp,
uint256 _beginRelayTimestamp
) external {
require(_attestData.queryId == queryId, "Invalid queryId");
blobstreamO.verifyOracleData(_attestData, _currentValidatorSet, _sigs);
uint256 _price = abi.decode(_attestData.report.value, (uint256));
priceData.push(PriceData(
_price,
_attestData.attestationTimestamp,
_attestData.report.timestamp,
_attestData.report.aggregatePower,
_attestData.report.previousTimestamp,
_attestData.report.nextTimestamp,
block.timestamp
)
);
block.timestamp,
_attestData.attestationTimestamp,
_userTriggerTimestamp,
_beginRelayTimestamp
));
}

function getCurrentPriceData() external view returns (PriceData memory) {
Expand Down

0 comments on commit 6a97277

Please sign in to comment.