Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify time-based logic in tests, and fix requestEnd() #218

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions contracts/Marketplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -558,13 +558,15 @@ contract Marketplace is SlotReservations, Proofs, StateRetrieval, Endian {
}

function requestEnd(RequestId requestId) public view returns (uint64) {
uint64 end = _requestContexts[requestId].endsAt;
RequestState state = requestState(requestId);
if (state == RequestState.New || state == RequestState.Started) {
return end;
} else {
return uint64(Math.min(end, block.timestamp - 1));
return _requestContexts[requestId].endsAt;
}
if (state == RequestState.Cancelled) {
return _requestContexts[requestId].expiresAt;
}
return
uint64(Math.min(_requestContexts[requestId].endsAt, block.timestamp));
}

function requestExpiry(RequestId requestId) public view returns (uint64) {
Expand Down
1 change: 1 addition & 0 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
networks: {
hardhat: {
tags: ["local"],
allowBlocksWithSameTimestamp: true
},
codexdisttestnetwork: {
url: `${process.env.DISTTEST_NETWORK_URL}`,
Expand Down
Loading