Skip to content

Commit

Permalink
support reading 2.6.1 check result
Browse files Browse the repository at this point in the history
  • Loading branch information
amirylm committed Nov 24, 2023
1 parent 565ebd3 commit 717f844
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion pkg/v3/types/basetypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,23 @@ type CheckResult struct {
RetryInterval time.Duration
}

// checkResultMsg261 is used for encoding and decoding check results.
// NOTE: this is a temporary struct for supporting v2.6.1 input
type checkResultMsg261 struct {
PipelineExecutionState uint8
Retryable bool
Eligible bool
IneligibilityReason uint8
UpkeepID UpkeepIdentifier
Trigger Trigger
WorkID string
GasAllocated uint64
PerformData []byte
FastGasWei *big.Int
LinkNative *big.Int
RetryInterval time.Duration
}

// checkResultMsg is used for encoding and decoding check results.
type checkResultMsg struct {
PipelineExecutionState uint8
Expand Down Expand Up @@ -260,9 +277,25 @@ func (r CheckResult) MarshalJSON() ([]byte, error) {

func (r *CheckResult) UnmarshalJSON(data []byte) error {
var crm checkResultMsg
var crm261 checkResultMsg261

if err := json.Unmarshal(data, &crm); err != nil {
return err
if err := json.Unmarshal(data, &crm261); err != nil {
return err
}
crm = checkResultMsg{
PipelineExecutionState: crm261.PipelineExecutionState,
Retryable: crm261.Retryable,
Eligible: crm261.Eligible,
IneligibilityReason: crm261.IneligibilityReason,
UpkeepID: crm261.UpkeepID,
Trigger: crm261.Trigger,
WorkID: crm261.WorkID,
GasAllocated: crm261.GasAllocated,
PerformData: crm261.PerformData,
FastGasWei: crm261.FastGasWei,
LinkNative: crm261.LinkNative,
}
}

r.PipelineExecutionState = crm.PipelineExecutionState
Expand Down

0 comments on commit 717f844

Please sign in to comment.