Skip to content

Commit dd23b79

Browse files
committed
Changed type of msgIndex in model to uint64:
1 parent 7b8ee77 commit dd23b79

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

engine/access/rest/websockets/data_providers/account_statuses_provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (p *AccountStatusesDataProvider) handleResponse() func(accountStatusesRespo
121121
BlockID: accountStatusesResponse.BlockID.String(),
122122
Height: strconv.FormatUint(accountStatusesResponse.Height, 10),
123123
AccountEvents: accountStatusesResponse.AccountEvents,
124-
MessageIndex: strconv.FormatUint(index, 10),
124+
MessageIndex: index,
125125
}
126126

127127
return nil

engine/access/rest/websockets/data_providers/account_statuses_provider_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,12 @@ func (s *AccountStatusesProviderSuite) TestMessageIndexAccountStatusesProviderRe
255255
}
256256

257257
// Verifying that indices are starting from 1
258-
s.Require().Equal("1", responses[0].MessageIndex, "Expected MessageIndex to start with 1")
258+
s.Require().Equal(uint64(1), responses[0].MessageIndex, "Expected MessageIndex to start with 1")
259259

260260
// Verifying that indices are strictly increasing
261261
for i := 1; i < len(responses); i++ {
262-
prevIndex, _ := strconv.Atoi(responses[i-1].MessageIndex)
263-
currentIndex, _ := strconv.Atoi(responses[i].MessageIndex)
262+
prevIndex := responses[i-1].MessageIndex
263+
currentIndex := responses[i].MessageIndex
264264
s.Require().Equal(prevIndex+1, currentIndex, "Expected MessageIndex to increment by 1")
265265
}
266266

engine/access/rest/websockets/data_providers/events_provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (p *EventsDataProvider) handleResponse() func(eventsResponse *backend.Event
108108
BlockHeight: strconv.FormatUint(eventsResponse.Height, 10),
109109
BlockTimestamp: eventsResponse.BlockTimestamp,
110110
Events: eventsResponse.Events,
111-
MessageIndex: strconv.FormatUint(index, 10),
111+
MessageIndex: index,
112112
}
113113

114114
return nil

engine/access/rest/websockets/data_providers/events_provider_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@ func (s *EventsProviderSuite) TestMessageIndexEventProviderResponse_HappyPath()
282282
}
283283

284284
// Verifying that indices are starting from 1
285-
s.Require().Equal("1", responses[0].MessageIndex, "Expected MessageIndex to start with 1")
285+
s.Require().Equal(uint64(1), responses[0].MessageIndex, "Expected MessageIndex to start with 1")
286286

287287
// Verifying that indices are strictly increasing
288288
for i := 1; i < len(responses); i++ {
289-
prevIndex, _ := strconv.Atoi(responses[i-1].MessageIndex)
290-
currentIndex, _ := strconv.Atoi(responses[i].MessageIndex)
289+
prevIndex := responses[i-1].MessageIndex
290+
currentIndex := responses[i].MessageIndex
291291
s.Require().Equal(prevIndex+1, currentIndex, "Expected MessageIndex to increment by 1")
292292
}
293293

engine/access/rest/websockets/models/account_models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ type AccountStatusesResponse struct {
77
BlockID string `json:"blockID"`
88
Height string `json:"height"`
99
AccountEvents map[string]flow.EventsList `json:"account_events"`
10-
MessageIndex string `json:"message_index"`
10+
MessageIndex uint64 `json:"message_index"`
1111
}

engine/access/rest/websockets/models/event_models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ type EventResponse struct {
1212
BlockHeight string `json:"block_height"`
1313
BlockTimestamp time.Time `json:"block_timestamp"`
1414
Events []flow.Event `json:"events"`
15-
MessageIndex string `json:"message_index"`
15+
MessageIndex uint64 `json:"message_index"`
1616
}

0 commit comments

Comments
 (0)