diff --git a/pkg/hints/bigint_hint.go b/pkg/hints/bigint_hint.go index b8271847..2ab76460 100644 --- a/pkg/hints/bigint_hint.go +++ b/pkg/hints/bigint_hint.go @@ -2,7 +2,6 @@ package hints import ( "errors" - "fmt" "math/big" . "github.com/lambdaclass/cairo-vm.go/pkg/hints/hint_utils" @@ -64,7 +63,7 @@ func NondetBigInt3(vm VirtualMachine, execScopes ExecutionScopes, idsData IdsMan /// ids.flag = 1 if k > 0 else 0 /// ``` -func SafeDivBigint(vm VirtualMachine, execScopes ExecutionScopes, idsData IdsManager) error { +func SafeDivBigint(vm *VirtualMachine, execScopes *ExecutionScopes, idsData IdsManager) error { resUncast, err := execScopes.Get("res") if err != nil { return err @@ -104,9 +103,7 @@ func SafeDivBigint(vm VirtualMachine, execScopes ExecutionScopes, idsData IdsMan param_x := new(big.Int).Mul(&res, &y) param_x.Sub(param_x, &x) - fmt.Println("param x: ",param_x) k, err := SafeDivBig(param_x, &p) - fmt.Println("k", k) if err != nil { return err } @@ -123,11 +120,11 @@ func SafeDivBigint(vm VirtualMachine, execScopes ExecutionScopes, idsData IdsMan flag = lambdaworks.FeltFromUint(0) } - execScopes.AssignOrUpdateVariable("k", k) + execScopes.AssignOrUpdateVariable("k", *k) execScopes.AssignOrUpdateVariable("value", value) val := memory.NewMaybeRelocatableFelt(flag) - idsData.Insert("flag", val, &vm) + idsData.Insert("flag", val, vm) return nil } diff --git a/pkg/hints/bigint_hint_test.go b/pkg/hints/bigint_hint_test.go index 68e66598..a3bf7441 100644 --- a/pkg/hints/bigint_hint_test.go +++ b/pkg/hints/bigint_hint_test.go @@ -125,7 +125,6 @@ func TestSafeDivBigInt(t *testing.T) { if err != nil { t.Errorf("%s", err) } - value, _ := valUncast.(big.Int) if expectedK.Cmp(&k) != 0 { diff --git a/pkg/hints/hint_processor.go b/pkg/hints/hint_processor.go index 828e03e6..d547bb2d 100644 --- a/pkg/hints/hint_processor.go +++ b/pkg/hints/hint_processor.go @@ -187,7 +187,7 @@ func (p *CairoVmHintProcessor) ExecuteHint(vm *vm.VirtualMachine, hintData *any, case FAST_EC_ADD_ASSIGN_NEW_Y: return fastEcAddAssignNewY(execScopes) case BIGINT_SAFE_DIV: - return SafeDivBigint(*vm, *execScopes, data.Ids) + return SafeDivBigint(vm, execScopes, data.Ids) default: return errors.Errorf("Unknown Hint: %s", data.Code) }