Skip to content

Commit

Permalink
build: update prophet-core-contracts package (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJabberwock authored Jul 26, 2024
1 parent eff1822 commit ee716ee
Show file tree
Hide file tree
Showing 18 changed files with 78 additions and 75 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"package.json": "sort-package-json"
},
"dependencies": {
"@defi-wonderland/prophet-core-contracts": "0.0.0-ad40b65b",
"@defi-wonderland/prophet-core-contracts": "0.0.0-c25103ea",
"@openzeppelin/contracts": "4.9.5",
"solmate": "https://github.com/transmissions11/solmate.git#bfc9c25865a274a7827fea5abf6e4fb64fc64e6c"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ contract BondEscalationModule is Module, IBondEscalationModule {
RequestParameters memory _params = decodeRequestData(_request.disputeModuleData);
BondEscalation storage _escalation = _escalations[_dispute.requestId];

if (block.number > ORACLE.createdAt(_dispute.responseId) + _params.disputeWindow) {
if (block.number > ORACLE.responseCreatedAt(_dispute.responseId) + _params.disputeWindow) {
revert BondEscalationModule_DisputeWindowOver();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ contract ContractCallRequestModule is Module, IContractCallRequestModule {
) external override(IContractCallRequestModule, Module) onlyOracle {
RequestParameters memory _params = decodeRequestData(_request.requestModuleData);

if (ORACLE.createdAt(_getId(_response)) != 0) {
if (ORACLE.responseCreatedAt(_getId(_response)) != 0) {
_params.accountingExtension.pay({
_requestId: _response.requestId,
_payer: _request.requester,
Expand Down
2 changes: 1 addition & 1 deletion solidity/contracts/modules/request/HttpRequestModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ contract HttpRequestModule is Module, IHttpRequestModule {
) external override(IHttpRequestModule, Module) onlyOracle {
RequestParameters memory _params = decodeRequestData(_request.requestModuleData);

if (ORACLE.createdAt(_getId(_response)) != 0) {
if (ORACLE.responseCreatedAt(_getId(_response)) != 0) {
_params.accountingExtension.pay({
_requestId: _response.requestId,
_payer: _request.requester,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ contract SparseMerkleTreeRequestModule is Module, ISparseMerkleTreeRequestModule
) external override(ISparseMerkleTreeRequestModule, Module) onlyOracle {
RequestParameters memory _params = decodeRequestData(_request.requestModuleData);

if (ORACLE.createdAt(_getId(_response)) != 0) {
if (ORACLE.responseCreatedAt(_getId(_response)) != 0) {
_params.accountingExtension.pay({
_requestId: _response.requestId,
_payer: _request.requester,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ contract PrivateERC20ResolutionModule is Module, IPrivateERC20ResolutionModule {
/// @inheritdoc IPrivateERC20ResolutionModule
function commitVote(IOracle.Request calldata _request, IOracle.Dispute calldata _dispute, bytes32 _commitment) public {
bytes32 _disputeId = _validateDispute(_request, _dispute);
if (ORACLE.createdAt(_disputeId) == 0) revert PrivateERC20ResolutionModule_NonExistentDispute();
if (ORACLE.disputeCreatedAt(_disputeId) == 0) revert PrivateERC20ResolutionModule_NonExistentDispute();
if (ORACLE.disputeStatus(_disputeId) != IOracle.DisputeStatus.Escalated) {
revert PrivateERC20ResolutionModule_AlreadyResolved();
}
Expand Down Expand Up @@ -113,7 +113,7 @@ contract PrivateERC20ResolutionModule is Module, IPrivateERC20ResolutionModule {
IOracle.Response calldata _response,
IOracle.Dispute calldata _dispute
) external onlyOracle {
if (ORACLE.createdAt(_disputeId) == 0) revert PrivateERC20ResolutionModule_NonExistentDispute();
if (ORACLE.disputeCreatedAt(_disputeId) == 0) revert PrivateERC20ResolutionModule_NonExistentDispute();
if (ORACLE.disputeStatus(_disputeId) != IOracle.DisputeStatus.Escalated) {
revert PrivateERC20ResolutionModule_AlreadyResolved();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ contract BondedResponseModule is Module, IBondedResponseModule {
revert BondedResponseModule_TooEarlyToFinalize();
}

uint256 _responseCreatedAt = ORACLE.createdAt(_getId(_response));
uint256 _responseCreatedAt = ORACLE.responseCreatedAt(_getId(_response));

if (_responseCreatedAt != 0) {
if (!_isModule && block.number < _responseCreatedAt + _params.disputeWindow) {
Expand Down
4 changes: 2 additions & 2 deletions solidity/test/integration/RequestCreation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract Integration_RequestCreation is IntegrationBase {
assertEq(oracle.nonceToRequestId(mockRequest.nonce), _requestId);

// Check: saved the correct creation block?
assertEq(oracle.createdAt(_requestId), block.number);
assertEq(oracle.requestCreatedAt(_requestId), block.number);

// Check: saved the allowed modules?
assertTrue(oracle.allowedModule(_requestId, mockRequest.requestModule));
Expand All @@ -61,7 +61,7 @@ contract Integration_RequestCreation is IntegrationBase {
assertEq(oracle.nonceToRequestId(mockRequest.nonce), _requestId);

// Check: saved the correct creation block?
assertEq(oracle.createdAt(_requestId), block.number);
assertEq(oracle.requestCreatedAt(_requestId), block.number);

// Check: saved the allowed modules?
assertTrue(oracle.allowedModule(_requestId, mockRequest.requestModule));
Expand Down
2 changes: 1 addition & 1 deletion solidity/test/integration/ResponseDispute.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ contract Integration_ResponseDispute is IntegrationBase {
assertEq(oracle.disputeOf(_getId(mockResponse)), _disputeId);

// Check: creation time is correct?
assertEq(oracle.createdAt(_disputeId), block.number);
assertEq(oracle.disputeCreatedAt(_disputeId), block.number);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion solidity/test/integration/ResponseProposal.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract Integration_ResponseProposal is IntegrationBase {
assertEq(_getResponseIds[0], _getId(mockResponse));

// Check: the creation block is correct?
assertEq(oracle.createdAt(_getId(mockResponse)), block.number);
assertEq(oracle.responseCreatedAt(_getId(mockResponse)), block.number);
}

/**
Expand Down
30 changes: 15 additions & 15 deletions solidity/test/unit/modules/dispute/BondEscalationModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ contract BondEscalationModule_Unit_EscalateDispute is BaseTest {
vm.expectEmit(true, true, true, true, address(bondEscalationModule));
emit BondEscalationStatusUpdated(_requestId, _disputeId, IBondEscalationModule.BondEscalationStatus.Escalated);

// Mock and expect IOracle.createdAt to be called
// Mock and expect IOracle.disputeStatus to be called
_mockAndExpect(
address(oracle), abi.encodeCall(IOracle.disputeStatus, (_disputeId)), abi.encode(IOracle.DisputeStatus.Escalated)
);
Expand Down Expand Up @@ -431,8 +431,8 @@ contract BondEscalationModule_Unit_DisputeResponse is BaseTest {
// Warp to a time after the disputeWindow is over.
vm.roll(block.number + _disputeWindow + 1);

// Mock and expect IOracle.createdAt to be called
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.createdAt, (_responseId)), abi.encode(1));
// Mock and expect IOracle.responseCreatedAt to be called
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.responseCreatedAt, (_responseId)), abi.encode(1));

// Check: does it revert if the dispute window is over?
vm.expectRevert(IBondEscalationModule.BondEscalationModule_DisputeWindowOver.selector);
Expand Down Expand Up @@ -460,8 +460,8 @@ contract BondEscalationModule_Unit_DisputeResponse is BaseTest {
mockDispute.responseId = _responseId;
mockDispute.requestId = _requestId;

// Mock and expect IOracle.createdAt to be called
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.createdAt, (_responseId)), abi.encode(1));
// Mock and expect IOracle.responseCreatedAt to be called
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.responseCreatedAt, (_responseId)), abi.encode(1));

// Mock and expect the accounting extension to be called
_mockAndExpect(
Expand Down Expand Up @@ -513,8 +513,8 @@ contract BondEscalationModule_Unit_DisputeResponse is BaseTest {
abi.encode(true)
);

// Mock and expect IOracle.createdAt to be called
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.createdAt, (_responseId)), abi.encode(1));
// Mock and expect IOracle.responseCreatedAt to be called
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.responseCreatedAt, (_responseId)), abi.encode(1));

vm.expectEmit(true, true, true, true, address(bondEscalationModule));
emit ResponseDisputed({
Expand Down Expand Up @@ -563,8 +563,8 @@ contract BondEscalationModule_Unit_DisputeResponse is BaseTest {
mockDispute.responseId = _responseId;
bytes32 _disputeId = _getId(mockDispute);

// Mock and expect IOracle.createdAt to be called
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.createdAt, (_responseId)), abi.encode(1));
// Mock and expect IOracle.responseCreatedAt to be called
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.responseCreatedAt, (_responseId)), abi.encode(1));

// Mock and expect the accounting extension to be called
_mockAndExpect(
Expand Down Expand Up @@ -627,7 +627,7 @@ contract BondEscalationModule_Unit_OnDisputeStatusChange is BaseTest {
abi.encode(true)
);

// Mock and expect IOracle.createdAt to be called
// Mock and expect IOracle.disputeStatus to be called
_mockAndExpect(
address(oracle), abi.encodeCall(IOracle.disputeStatus, (_disputeId)), abi.encode(IOracle.DisputeStatus.Lost)
);
Expand Down Expand Up @@ -669,7 +669,7 @@ contract BondEscalationModule_Unit_OnDisputeStatusChange is BaseTest {
abi.encode(true)
);

// Mock and expect IOracle.createdAt to be called
// Mock and expect IOracle.disputeStatus to be called
_mockAndExpect(
address(oracle), abi.encodeCall(IOracle.disputeStatus, (_disputeId)), abi.encode(IOracle.DisputeStatus.Won)
);
Expand All @@ -690,7 +690,7 @@ contract BondEscalationModule_Unit_OnDisputeStatusChange is BaseTest {
mockDispute.requestId = _requestId;
bytes32 _disputeId = _getId(mockDispute);

// Mock and expect IOracle.createdAt to be called
// Mock and expect IOracle.disputeStatus to be called
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.disputeStatus, (_disputeId)), abi.encode(_status));

// Mock and expect IAccountingExtension.pay to be called
Expand Down Expand Up @@ -746,7 +746,7 @@ contract BondEscalationModule_Unit_OnDisputeStatusChange is BaseTest {
// Set the bond escalation status to Active, which is the only possible one for this function
bondEscalationModule.forTest_setBondEscalationStatus(_requestId, IBondEscalationModule.BondEscalationStatus.Active);

// Mock and expect IOracle.createdAt to be called
// Mock and expect IOracle.disputeStatus to be called
_mockAndExpect(
address(oracle), abi.encodeCall(IOracle.disputeStatus, (_disputeId)), abi.encode(IOracle.DisputeStatus.Won)
);
Expand Down Expand Up @@ -812,7 +812,7 @@ contract BondEscalationModule_Unit_OnDisputeStatusChange is BaseTest {
_requestId, IBondEscalationModule.BondEscalationStatus.Escalated
);

// Mock and expect IOracle.createdAt to be called
// Mock and expect IOracle.disputeStatus to be called
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.disputeStatus, (_disputeId)), abi.encode(_status));

// Mock and expect IAccountingExtension.pay to be called
Expand Down Expand Up @@ -891,7 +891,7 @@ contract BondEscalationModule_Unit_OnDisputeStatusChange is BaseTest {
_requestId, IBondEscalationModule.BondEscalationStatus.Escalated
);

// Mock and expect IOracle.createdAt to be called
// Mock and expect IOracle.disputeStatus to be called
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.disputeStatus, (_disputeId)), abi.encode(_status));

// Mock and expect IAccountingExtension.pay to be called
Expand Down
1 change: 0 additions & 1 deletion solidity/test/unit/modules/finality/CallbackModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ contract CallbackModule_Unit_FinalizeRequest is BaseTest {
* @notice Test that finalizeRequest emits events
*/
function test_emitsEvents(address _proposer, address _target, bytes calldata _data) public assumeFuzzable(_target) {
vm.etch(_target, '0xabcdef');
mockRequest.finalityModuleData = abi.encode(ICallbackModule.RequestParameters({target: _target, data: _data}));
mockResponse.requestId = _getId(mockRequest);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ contract ContractCallRequestModule_Unit_FinalizeRequest is BaseTest {

// Mock and expect oracle to return the response's creation time
_mockAndExpect(
address(oracle), abi.encodeCall(IOracle.createdAt, (_getId(mockResponse))), abi.encode(block.timestamp)
address(oracle), abi.encodeCall(IOracle.responseCreatedAt, (_getId(mockResponse))), abi.encode(block.timestamp)
);

// Mock and expect IAccountingExtension.pay to be called
Expand Down Expand Up @@ -186,7 +186,7 @@ contract ContractCallRequestModule_Unit_FinalizeRequest is BaseTest {
mockResponse.requestId = _requestId;

// Mock and expect oracle to return no timestamp
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.createdAt, (_getId(mockResponse))), abi.encode(0));
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.responseCreatedAt, (_getId(mockResponse))), abi.encode(0));

// Mock and expect IAccountingExtension.release to be called
_mockAndExpect(
Expand Down Expand Up @@ -216,7 +216,7 @@ contract ContractCallRequestModule_Unit_FinalizeRequest is BaseTest {
mockResponse.requestId = _requestId;

// Mock and expect oracle to return no timestamp
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.createdAt, (_getId(mockResponse))), abi.encode(0));
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.responseCreatedAt, (_getId(mockResponse))), abi.encode(0));

// Mock and expect IAccountingExtension.release to be called
_mockAndExpect(
Expand Down
6 changes: 3 additions & 3 deletions solidity/test/unit/modules/request/HttpRequestModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ contract HttpRequestModule_Unit_FinalizeRequest is BaseTest {

// Mock and expect oracle to return the response's creation time
_mockAndExpect(
address(oracle), abi.encodeCall(IOracle.createdAt, (_getId(mockResponse))), abi.encode(block.timestamp)
address(oracle), abi.encodeCall(IOracle.responseCreatedAt, (_getId(mockResponse))), abi.encode(block.timestamp)
);

// Mock and expect IAccountingExtension.pay to be called
Expand Down Expand Up @@ -183,7 +183,7 @@ contract HttpRequestModule_Unit_FinalizeRequest is BaseTest {
mockResponse.requestId = _requestId;

// Mock and expect oracle to return no timestamp
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.createdAt, (_getId(mockResponse))), abi.encode(0));
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.responseCreatedAt, (_getId(mockResponse))), abi.encode(0));

// Mock and expect IAccountingExtension.release to be called
_mockAndExpect(
Expand Down Expand Up @@ -213,7 +213,7 @@ contract HttpRequestModule_Unit_FinalizeRequest is BaseTest {
mockResponse.requestId = _requestId;

// Update mock call to return the response's createdAt
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.createdAt, (_getId(mockResponse))), abi.encode(0));
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.responseCreatedAt, (_getId(mockResponse))), abi.encode(0));

// Mock and expect IAccountingExtension.release to be called
_mockAndExpect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ contract SparseMerkleTreeRequestModule_Unit_FinalizeRequest is BaseTest {

// Oracle confirms that the response has been created
_mockAndExpect(
address(oracle), abi.encodeCall(IOracle.createdAt, (_getId(mockResponse))), abi.encode(block.timestamp)
address(oracle), abi.encodeCall(IOracle.responseCreatedAt, (_getId(mockResponse))), abi.encode(block.timestamp)
);

// Mock and expect IAccountingExtension.pay to be called
Expand Down Expand Up @@ -214,7 +214,7 @@ contract SparseMerkleTreeRequestModule_Unit_FinalizeRequest is BaseTest {
mockResponse.requestId = _requestId;

// Oracle returns no createdAt value - finalizing without a response
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.createdAt, (_getId(mockResponse))), abi.encode(0));
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.responseCreatedAt, (_getId(mockResponse))), abi.encode(0));

// Mock and expect IAccountingExtension.release to be called
_mockAndExpect(
Expand Down
Loading

0 comments on commit ee716ee

Please sign in to comment.