Skip to content

Commit

Permalink
add logging for vrf output (#11719)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhoonbang authored Jan 10, 2024
1 parent 5b9abcf commit f8bc7c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions core/services/pipeline/task.vrfv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (t *VRFTaskV2) Type() TaskType {
return TaskTypeVRFV2
}

func (t *VRFTaskV2) Run(_ context.Context, _ logger.Logger, vars Vars, inputs []Result) (result Result, runInfo RunInfo) {
func (t *VRFTaskV2) Run(_ context.Context, lggr logger.Logger, vars Vars, inputs []Result) (result Result, runInfo RunInfo) {
if len(inputs) != 1 {
return Result{Error: ErrWrongInputCardinality}, runInfo
}
Expand Down Expand Up @@ -134,13 +134,16 @@ func (t *VRFTaskV2) Run(_ context.Context, _ logger.Logger, vars Vars, inputs []
return Result{Error: err}, runInfo
}
results := make(map[string]interface{})
results["output"] = hexutil.Encode(b)
output := hexutil.Encode(b)
results["output"] = output
// RequestID needs to be a [32]byte for EvmTxMeta.
results["requestID"] = hexutil.Encode(requestId.Bytes())

// store vrf proof and request commitment separately so they can be used in a batch fashion
results["proof"] = onChainProof
results["requestCommitment"] = rc

lggr.Debugw("Completed VRF V2 task run", "reqID", requestId.String(), "output", output)

return Result{Value: results}, runInfo
}
7 changes: 5 additions & 2 deletions core/services/pipeline/task.vrfv2plus.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (t *VRFTaskV2Plus) Type() TaskType {
return TaskTypeVRFV2Plus
}

func (t *VRFTaskV2Plus) Run(_ context.Context, _ logger.Logger, vars Vars, inputs []Result) (result Result, runInfo RunInfo) {
func (t *VRFTaskV2Plus) Run(_ context.Context, lggr logger.Logger, vars Vars, inputs []Result) (result Result, runInfo RunInfo) {
if len(inputs) != 1 {
return Result{Error: ErrWrongInputCardinality}, runInfo
}
Expand Down Expand Up @@ -142,13 +142,16 @@ func (t *VRFTaskV2Plus) Run(_ context.Context, _ logger.Logger, vars Vars, input
return Result{Error: err}, runInfo
}
results := make(map[string]interface{})
results["output"] = hexutil.Encode(b)
output := hexutil.Encode(b)
results["output"] = output
// RequestID needs to be a [32]byte for EvmTxMeta.
results["requestID"] = hexutil.Encode(requestId.Bytes())

// store vrf proof and request commitment separately so they can be used in a batch fashion
results["proof"] = onChainProof
results["requestCommitment"] = rc

lggr.Debugw("Completed VRF V2 task run", "reqID", requestId.String(), "output", output)

return Result{Value: results}, runInfo
}

0 comments on commit f8bc7c6

Please sign in to comment.