From 9c4fb3433003d140ae9ba7b33606fda1dea76cb7 Mon Sep 17 00:00:00 2001 From: MaksymMalicki Date: Mon, 16 Dec 2024 14:40:56 +0100 Subject: [PATCH] Refactor the code --- pkg/hintrunner/hintrunner.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/hintrunner/hintrunner.go b/pkg/hintrunner/hintrunner.go index bb2ddf23a..fe54c3407 100644 --- a/pkg/hintrunner/hintrunner.go +++ b/pkg/hintrunner/hintrunner.go @@ -16,15 +16,19 @@ type HintRunner struct { } func NewHintRunner(hints map[uint64][]h.Hinter, userArgs []starknet.CairoFuncArgs) HintRunner { - return HintRunner{ - // Context for certain hints that require it. Each manager is - // initialized only when required by the hint - context: *h.SetContextWithScope( + context := *h.InitializeDefaultContext() + if userArgs != nil { + context = *h.SetContextWithScope( map[string]any{ "userArgs": userArgs, }, - ), - hints: hints, + ) + } + return HintRunner{ + // Context for certain hints that require it. Each manager is + // initialized only when required by the hint + context: context, + hints: hints, } }