@@ -44,11 +44,9 @@ abstract contract Pulse is IPulse, PulseState {
4444 req.publishTime = 1 ;
4545 req.callbackGasLimit = 1 ;
4646 req.requester = address (1 );
47- req.numPriceIds = 0 ;
48- // Pre-warm the priceIds array storage
49- for (uint8 j = 0 ; j < MAX_PRICE_IDS; j++ ) {
50- req.priceIds[j] = bytes32 (0 );
51- }
47+ req.priceIdsHash = bytes32 (uint256 (1 ));
48+ req.fee = 1 ;
49+ req.provider = address (1 );
5250 }
5351 }
5452 }
@@ -83,16 +81,12 @@ abstract contract Pulse is IPulse, PulseState {
8381 Request storage req = allocRequest (requestSequenceNumber);
8482 req.sequenceNumber = requestSequenceNumber;
8583 req.publishTime = publishTime;
86- req.callbackGasLimit = callbackGasLimit;
84+ req.callbackGasLimit = SafeCast. toUint128 ( callbackGasLimit) ;
8785 req.requester = msg .sender ;
88- req.numPriceIds = uint8 (priceIds.length );
8986 req.provider = provider;
9087 req.fee = SafeCast.toUint128 (msg .value - _state.pythFeeInWei);
88+ req.priceIdsHash = keccak256 (abi.encodePacked (priceIds));
9189
92- // Copy price IDs to storage
93- for (uint8 i = 0 ; i < priceIds.length ; i++ ) {
94- req.priceIds[i] = priceIds[i];
95- }
9690 _state.accruedFeesInWei += _state.pythFeeInWei;
9791
9892 emit PriceUpdateRequested (req, priceIds);
@@ -119,14 +113,9 @@ abstract contract Pulse is IPulse, PulseState {
119113
120114 // Verify priceIds match
121115 require (
122- priceIds. length == req.numPriceIds ,
123- "Price IDs length mismatch "
116+ req.priceIdsHash == keccak256 ( abi.encodePacked (priceIds)) ,
117+ "Price IDs mismatch "
124118 );
125- for (uint8 i = 0 ; i < req.numPriceIds; i++ ) {
126- if (priceIds[i] != req.priceIds[i]) {
127- revert InvalidPriceIds (priceIds[i], req.priceIds[i]);
128- }
129- }
130119
131120 // TODO: should this use parsePriceFeedUpdatesUnique? also, do we need to add 1 to maxPublishTime?
132121 IPyth pyth = IPyth (_state.pyth);
@@ -154,12 +143,14 @@ abstract contract Pulse is IPulse, PulseState {
154143 // TODO: I'm pretty sure this is going to use a lot of gas because it's doing a storage lookup for each sequence number.
155144 // a better solution would be a doubly-linked list of active requests.
156145 // After successful callback, update firstUnfulfilledSeq if needed
146+ /*
157147 while (
158148 _state.firstUnfulfilledSeq < _state.currentSequenceNumber &&
159149 !isActive(findRequest(_state.firstUnfulfilledSeq))
160150 ) {
161151 _state.firstUnfulfilledSeq++;
162152 }
153+ */
163154
164155 try
165156 IPulseConsumer (req.requester)._pulseCallback {
@@ -463,7 +454,8 @@ abstract contract Pulse is IPulse, PulseState {
463454 actualCount = 0 ;
464455
465456 // Start from the first unfulfilled sequence and work forwards
466- uint64 currentSeq = _state.firstUnfulfilledSeq;
457+ // uint64 currentSeq = _state.firstUnfulfilledSeq;
458+ uint64 currentSeq = 0 ;
467459
468460 // Continue until we find enough active requests or reach current sequence
469461 while (
0 commit comments