diff --git a/.gitignore b/.gitignore index e3970df..73be683 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,8 @@ data-head data-worker data-worker-2 main.py +avs/ +vendor/ +debug/ +configs/ .DS_Store diff --git a/cmd/node/main.go b/cmd/node/main.go index cd27365..700ee4f 100644 --- a/cmd/node/main.go +++ b/cmd/node/main.go @@ -189,7 +189,10 @@ func (e *AlloraExecutor) ExecuteFunction(requestID string, req execute.Request) inferenceForecastsBundle := &types.InferenceForecastBundle{} // Build inference if existent if responseValue.InfererValue != "" { - infererValue := alloraMath.MustNewDecFromString(responseValue.InfererValue) + infererValue, err := alloraMath.NewDecFromString(responseValue.InfererValue) + if err != nil { + return result, err + } inference := &types.Inference{ TopicId: topicId, Inferer: e.appChain.Address, @@ -202,7 +205,10 @@ func (e *AlloraExecutor) ExecuteFunction(requestID string, req execute.Request) if len(responseValue.ForecasterValues) > 0 { var forecasterElements []*types.ForecastElement for _, val := range responseValue.ForecasterValues { - decVal := alloraMath.MustNewDecFromString(val.Value) + decVal, err := alloraMath.NewDecFromString(val.Value) + if err != nil { + return result, err + } if !topicAllowsNegative { decVal, err = alloraMath.Log10(decVal) if err != nil { @@ -333,7 +339,10 @@ func (e *AlloraExecutor) ExecuteFunction(requestID string, req execute.Request) ) for _, inf := range nestedValueBundle.InfererValues { - value := alloraMath.MustNewDecFromString(inf.Value) + value, err := alloraMath.NewDecFromString(inf.Value) + if err != nil { + return result, err + } if !topicAllowsNegative { value, err = alloraMath.Log10(value) if err != nil { @@ -347,7 +356,10 @@ func (e *AlloraExecutor) ExecuteFunction(requestID string, req execute.Request) }) } for _, inf := range nestedValueBundle.ForecasterValues { - value := alloraMath.MustNewDecFromString(inf.Value) + value, err := alloraMath.NewDecFromString(inf.Value) + if err != nil { + return result, err + } if !topicAllowsNegative { value, err = alloraMath.Log10(value) if err != nil { @@ -361,7 +373,10 @@ func (e *AlloraExecutor) ExecuteFunction(requestID string, req execute.Request) }) } for _, inf := range nestedValueBundle.OneOutInfererValues { - value := alloraMath.MustNewDecFromString(inf.Value) + value, err := alloraMath.NewDecFromString(inf.Value) + if err != nil { + return result, err + } if !topicAllowsNegative { value, err = alloraMath.Log10(value) if err != nil { @@ -375,7 +390,10 @@ func (e *AlloraExecutor) ExecuteFunction(requestID string, req execute.Request) }) } for _, inf := range nestedValueBundle.OneOutForecasterValues { - value := alloraMath.MustNewDecFromString(inf.Value) + value, err := alloraMath.NewDecFromString(inf.Value) + if err != nil { + return result, err + } if !topicAllowsNegative { value, err = alloraMath.Log10(value) if err != nil { @@ -389,7 +407,10 @@ func (e *AlloraExecutor) ExecuteFunction(requestID string, req execute.Request) }) } for _, inf := range nestedValueBundle.OneInForecasterValues { - value := alloraMath.MustNewDecFromString(inf.Value) + value, err := alloraMath.NewDecFromString(inf.Value) + if err != nil { + return result, err + } if !topicAllowsNegative { value, err = alloraMath.Log10(value) if err != nil { diff --git a/launch-node.sh b/launch-node.sh index fc773ce..d4ede73 100755 --- a/launch-node.sh +++ b/launch-node.sh @@ -6,4 +6,4 @@ allora-node \ --role head \ --workspace /tmp/debug/head \ --private-key ./testkeys/head/priv.bin \ ---rest-api :8081 \ No newline at end of file +--rest-api :8081