Skip to content

Commit

Permalink
cleanup pipeline execution errors
Browse files Browse the repository at this point in the history
  • Loading branch information
infiloop2 committed Feb 20, 2024
1 parent b660a70 commit 0336020
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ const (
UpkeepFailureReasonTxHashReorged UpkeepFailureReason = 36

// pipeline execution error
NoPipelineError PipelineExecutionState = 0
CheckBlockTooOld PipelineExecutionState = 1
CheckBlockInvalid PipelineExecutionState = 2
RpcFlakyFailure PipelineExecutionState = 3
MercuryFlakyFailure PipelineExecutionState = 4
PackUnpackDecodeFailed PipelineExecutionState = 5
MercuryUnmarshalError PipelineExecutionState = 6
UpkeepNotAuthorized PipelineExecutionState = 7
NoPipelineError PipelineExecutionState = 0
CheckBlockTooOld PipelineExecutionState = 1
CheckBlockInvalid PipelineExecutionState = 2
RpcFlakyFailure PipelineExecutionState = 3
MercuryFlakyFailure PipelineExecutionState = 4
PackUnpackDecodeFailed PipelineExecutionState = 5
PrivilegeConfigUnmarshalError PipelineExecutionState = 6
)

// ErrCode is used for invoking an error handler with a specific error code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func (s *streams) AllowedToUseMercury(opts *bind.CallOpts, upkeepId *big.Int) (s

var privilegeConfig UpkeepPrivilegeConfig
if err = json.Unmarshal(upkeepPrivilegeConfigBytes, &privilegeConfig); err != nil {
return encoding.MercuryUnmarshalError, encoding.UpkeepFailureReasonNone, false, false, fmt.Errorf("failed to unmarshal privilege config: %v", err)
return encoding.PrivilegeConfigUnmarshalError, encoding.UpkeepFailureReasonNone, false, false, fmt.Errorf("failed to unmarshal privilege config: %v", err)
}

s.mercuryConfig.SetUpkeepAllowed(upkeepId.String(), privilegeConfig.MercuryEnabled, cache.DefaultExpiration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func TestStreams_AllowedToUseMercury(t *testing.T) {
{
name: "failure - cannot unmarshal privilege config",
err: fmt.Errorf("failed to unmarshal privilege config: invalid character '\\x00' looking for beginning of value"),
state: encoding.MercuryUnmarshalError,
state: encoding.PrivilegeConfigUnmarshalError,
config: []byte{0, 1},
registry: &mockRegistry{
GetUpkeepPrivilegeConfigFn: func(opts *bind.CallOpts, upkeepId *big.Int) ([]byte, error) {
Expand Down

0 comments on commit 0336020

Please sign in to comment.