Skip to content

Commit

Permalink
Merge branch 'dev' into feat/access-control
Browse files Browse the repository at this point in the history
  • Loading branch information
xorsal committed Nov 4, 2024
2 parents cf061e2 + ed60e2e commit a0d185e
Show file tree
Hide file tree
Showing 8 changed files with 523 additions and 82 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@
"solhint-plugin-defi-wonderland": "1.1.2",
"sort-package-json": "2.4.1",
"standard-version": "9.5.0"
}
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
5 changes: 1 addition & 4 deletions solidity/contracts/modules/dispute/BondEscalationModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ contract BondEscalationModule is AccessControllerModule, IBondEscalationModule {
// Only the first dispute of a request should go through the bond escalation
// Consecutive disputes should be handled by the resolution module
if (_escalation.status == BondEscalationStatus.None) {
if (block.timestamp > ORACLE.disputeCreatedAt(_disputeId) + _params.bondEscalationDeadline) {
revert BondEscalationModule_BondEscalationOver();
}
_escalation.status = BondEscalationStatus.Active;
_escalation.disputeId = _disputeId;
emit BondEscalationStatusUpdated(_dispute.requestId, _disputeId, BondEscalationStatus.Active);
Expand Down Expand Up @@ -174,8 +171,8 @@ contract BondEscalationModule is AccessControllerModule, IBondEscalationModule {
// Refund the disputer, the bond escalation status stays Escalated
_newStatus = BondEscalationStatus.Escalated;
_params.accountingExtension.release({
_requestId: _dispute.requestId,
_bonder: _dispute.disputer,
_requestId: _dispute.requestId,
_token: _params.bondToken,
_amount: _params.bondSize
});
Expand Down
9 changes: 5 additions & 4 deletions solidity/contracts/modules/response/BondedResponseModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ contract BondedResponseModule is AccessControllerModule, IBondedResponseModule {
RequestParameters memory _params = decodeRequestData(_request.responseModuleData);

// review: _finalizer is Oracle:finalize's accessControl.user
bool _isModule = ORACLE.allowedModule(_response.requestId, _finalizer);
bytes32 _requestId = _getId(_request);
bool _isModule = ORACLE.allowedModule(_requestId, _finalizer);

if (!_isModule && block.timestamp < ORACLE.requestCreatedAt(_response.requestId) + _params.deadline) {
if (!_isModule && block.timestamp < ORACLE.requestCreatedAt(_requestId) + _params.deadline) {
revert BondedResponseModule_TooEarlyToFinalize();
}

Expand All @@ -90,13 +91,13 @@ contract BondedResponseModule is AccessControllerModule, IBondedResponseModule {

_params.accountingExtension.release({
_bonder: _response.proposer,
_requestId: _response.requestId,
_requestId: _requestId,
_token: _params.bondToken,
_amount: _params.bondSize
});
}

emit RequestFinalized(_response.requestId, _response, _finalizer);
emit RequestFinalized(_requestId, _response, _finalizer);
}

/// @inheritdoc IBondedResponseModule
Expand Down
7 changes: 4 additions & 3 deletions solidity/test/integration/ContractCallRequest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,17 @@ contract Integration_ContractCallRequest is IntegrationBase {
uint256 _requestCreatedAt = oracle.requestCreatedAt(_requestId);

// mock an empty response
mockResponse =
IOracle.Response({proposer: makeAddr('not-the-proposer'), requestId: bytes32(0), response: bytes('')});
mockResponse = IOracle.Response({proposer: address(0), requestId: bytes32(0), response: bytes('')});

assertEq(oracle.responseCreatedAt(_getId(mockResponse)), 0);

// expect call to accounting to release requester's funds
vm.expectCall(
address(_accountingExtension),
abi.encodeCall(IAccountingExtension.release, (mockRequest.requester, _requestId, usdc, _expectedReward))
);

// assert response does not exist
// assert the empty response does not exist
assertEq(oracle.responseCreatedAt(_getId(mockResponse)), 0);

vm.warp(_requestCreatedAt + _expectedDeadline);
Expand Down
Loading

0 comments on commit a0d185e

Please sign in to comment.