Skip to content

Commit

Permalink
perf: request struct packing
Browse files Browse the repository at this point in the history
  • Loading branch information
moebius committed Oct 26, 2023
1 parent bbc4698 commit c6699c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions solidity/contracts/Oracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ contract Oracle is IOracle {
}

_finalizedResponses[_requestId] = _finalizedResponseId;
_request.finalizedAt = block.timestamp;
_request.finalizedAt = uint128(block.timestamp);
_finalize(_requestId, _request);
}

Expand Down Expand Up @@ -406,7 +406,7 @@ contract Oracle is IOracle {
}
}
}
_request.finalizedAt = block.timestamp;
_request.finalizedAt = uint128(block.timestamp);
_finalize(_requestId, _request);
}

Expand Down Expand Up @@ -448,7 +448,7 @@ contract Oracle is IOracle {
finalityModule: _request.finalityModule,
requester: msg.sender,
nonce: _requestNonce,
createdAt: block.timestamp,
createdAt: uint128(block.timestamp),
finalizedAt: 0
});

Expand Down
8 changes: 4 additions & 4 deletions solidity/interfaces/IOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ interface IOracle {
*/
struct Request {
bytes32 ipfsHash;
uint128 createdAt;
uint128 finalizedAt;
uint256 nonce;
address requester;
IRequestModule requestModule;
IResponseModule responseModule;
IDisputeModule disputeModule;
IResolutionModule resolutionModule;
IFinalityModule finalityModule;
address requester;
uint256 nonce;
uint256 createdAt;
uint256 finalizedAt;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion solidity/test/unit/Oracle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ contract Unit_ProposeResponse is BaseTest {
assertEq(_responseIds[1], _secondResponseId);
}

function test_proposeResponseRevertsIfAlreadyFinalized(bytes calldata _responseData, uint256 _finalizedAt) public {
function test_proposeResponseRevertsIfAlreadyFinalized(bytes calldata _responseData, uint128 _finalizedAt) public {
vm.assume(_finalizedAt > 0);

// Create mock request
Expand Down

0 comments on commit c6699c2

Please sign in to comment.