Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Get events panics #906

Closed
Closed
@marioiordanov

Description

@marioiordanov

method get_sorted_events executed on on CallInfo struct with the following events array:
[OrderedEvent { order: 0, keys: [271746229759260285552388728919865295615886751538523744128730118297934206697], data: [3115174808656846022129950072744275264472597267198601635297513001234245526786, 4096, 0, 0] }]

Panics with the following message panicked at 'attempt to subtract with overflow

I assume the problem is, because event order is 0 and is of type u64 and then trying to subtract which results in overflow.

starknet_events.remove(ordered_event.order as usize - 1);

starknet_events.insert(ordered_event.order as usize - 1, Some(event));

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions