Skip to content

Commit

Permalink
Handle Memory.Insert errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pefontana committed Sep 28, 2023
1 parent 6849011 commit fc6134f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/hints/usort_hints.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ func usortBody(ids IdsManager, executionScopes *types.ExecutionScopes, vm *Virtu
output_base := vm.Segments.AddSegment()

for i := range output {
vm.Segments.Memory.Insert(output_base.AddUint(uint(i)), memory.NewMaybeRelocatableFelt(output[i]))
err = vm.Segments.Memory.Insert(output_base.AddUint(uint(i)), memory.NewMaybeRelocatableFelt(output[i]))

if err != nil {
return err
}
}

multiplicities_base := vm.Segments.AddSegment()
Expand All @@ -123,7 +127,11 @@ func usortBody(ids IdsManager, executionScopes *types.ExecutionScopes, vm *Virtu
}

for i := range multiplicities {
vm.Segments.Memory.Insert(multiplicities_base.AddUint(uint(i)), memory.NewMaybeRelocatableFelt(lambdaworks.FeltFromUint64(multiplicities[i])))
err = vm.Segments.Memory.Insert(multiplicities_base.AddUint(uint(i)), memory.NewMaybeRelocatableFelt(lambdaworks.FeltFromUint64(multiplicities[i])))

if err != nil {
return err
}
}

err = ids.Insert("output", memory.NewMaybeRelocatableRelocatable(output_base), vm)
Expand Down

0 comments on commit fc6134f

Please sign in to comment.