Skip to content

Commit d9b75f0

Browse files
committed
cleanup
1 parent a4b172d commit d9b75f0

File tree

3 files changed

+14
-54
lines changed

3 files changed

+14
-54
lines changed

target_chains/ethereum/contracts/contracts/pulse/IPulse.sol

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -139,23 +139,4 @@ interface IPulse is PulseEvents {
139139
function setExclusivityPeriod(uint256 periodSeconds) external;
140140

141141
function getExclusivityPeriod() external view returns (uint256);
142-
143-
/**
144-
* @notice Gets the first N active requests
145-
* @param count Maximum number of active requests to return
146-
* @return requests Array of active requests, ordered from oldest to newest
147-
* @return actualCount Number of active requests found (may be less than count)
148-
* @dev Gas Usage: This function's gas cost scales linearly with the number of requests
149-
* between firstUnfulfilledSeq and currentSequenceNumber. Each iteration costs approximately:
150-
* - 2100 gas for cold storage reads, 100 gas for warm storage reads (SLOAD)
151-
* - Additional gas for array operations
152-
* The function starts from firstUnfulfilledSeq (all requests before this are fulfilled)
153-
* and scans forward until it finds enough active requests or reaches currentSequenceNumber.
154-
*/
155-
function getFirstActiveRequests(
156-
uint256 count
157-
)
158-
external
159-
view
160-
returns (PulseState.Request[] memory requests, uint256 actualCount);
161142
}

target_chains/ethereum/contracts/contracts/pulse/Pulse.sol

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -429,39 +429,4 @@ abstract contract Pulse is IPulse, PulseState {
429429
function getExclusivityPeriod() external view override returns (uint256) {
430430
return _state.exclusivityPeriodSeconds;
431431
}
432-
433-
function getFirstActiveRequests(
434-
uint256 count
435-
)
436-
external
437-
view
438-
override
439-
returns (Request[] memory requests, uint256 actualCount)
440-
{
441-
requests = new Request[](count);
442-
actualCount = 0;
443-
444-
// Start from the first unfulfilled sequence and work forwards
445-
// uint64 currentSeq = _state.firstUnfulfilledSeq;
446-
uint64 currentSeq = 0;
447-
448-
// Continue until we find enough active requests or reach current sequence
449-
while (
450-
actualCount < count && currentSeq < _state.currentSequenceNumber
451-
) {
452-
Request memory req = findRequest(currentSeq);
453-
if (isActive(req)) {
454-
requests[actualCount] = req;
455-
actualCount++;
456-
}
457-
currentSeq++;
458-
}
459-
460-
// If we found fewer requests than asked for, resize the array
461-
if (actualCount < count) {
462-
assembly {
463-
mstore(requests, actualCount)
464-
}
465-
}
466-
}
467432
}

target_chains/ethereum/contracts/contracts/pulse/PulseState.sol

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@ contract PulseState {
77
bytes1 public constant NUM_REQUESTS_MASK = 0x1f;
88

99
struct Request {
10+
// Storage word 1
1011
address requester;
1112
uint64 sequenceNumber;
13+
// 4 bytes unused
14+
// Storage word 2
1215
address provider;
1316
uint64 publishTime;
17+
// 4 bytes unused
18+
// Storage word 3
1419
bytes32 priceIdsHash;
20+
// Storage word 4
1521
uint128 callbackGasLimit;
1622
uint128 fee;
1723
}
@@ -26,13 +32,21 @@ contract PulseState {
2632
}
2733

2834
struct State {
35+
// Storage word 1
2936
uint128 pythFeeInWei;
3037
uint128 accruedFeesInWei;
38+
// Storage word 2
3139
address pyth;
3240
uint64 currentSequenceNumber;
41+
// 4 bytes unused
42+
// Storage word 3
3343
address defaultProvider;
44+
// 12 bytes unused
45+
// Storage word 4
3446
uint256 exclusivityPeriodSeconds;
47+
// Storage word 5
3548
address admin;
49+
// 12 bytes unused
3650
Request[NUM_REQUESTS] requests;
3751
mapping(bytes32 => Request) requestsOverflow;
3852
mapping(address => ProviderInfo) providers;

0 commit comments

Comments
 (0)