Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vrfv2plus: fix processor not printing proof #13207

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

leeyikjiun
Copy link
Contributor

No description provided.

Copy link
Contributor

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

Copy link
Contributor

@ibrajer ibrajer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted!

@leeyikjiun
Copy link
Contributor Author

Well spotted!

Not spotted. Tested in production 😆

@@ -1162,6 +1162,25 @@ func (lsn *listenerV2) simulateFulfillment(
res.proof = FromV2Proof(m["proof"].(vrf_coordinator_v2.VRFProof))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to reuse this if block by making the condition:

if trr.Task.Type() == pipeline.TaskTypeVRFV2 || trr.Task.Type() == pipeline.TaskTypeVRFV2Plus {

and having an if condition around proof

if trr.Task.Type() == pipeline.TaskTypeVRFV2 {
   res.proof = FromV2Proof(m["proof"].(vrf_coordinator_v2.VRFProof))
} else {
  res.proof = FromV2PlusProof(m["proof"].(vrf_coordinator_v2plus_interface.IVRFCoordinatorV2PlusInternalProof))
}

I don't see any other difference between the two code blocks and we could re-use much of the previous logic without code duplication.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible. But I think it's easier to read and manage if they were 2 separate blocks than if else, shared code, if else, maybe more shared code. The 2 versions while doing mostly the same thing might not necessarily have logic that is always applicable to both versions. If the bulk of the logic in the future is shared, then yes, it's better to refactor to what you suggested.

Comment on lines +1177 to +1182
// extract the abi-encoded tx data to fulfillRandomWords from the VRF task.
// that's all we need in the event of a force-fulfillment.
m := trr.Result.Value.(map[string]interface{})
res.payload = m["output"].(string)
res.proof = FromV2PlusProof(m["proof"].(vrf_coordinator_v2plus_interface.IVRFCoordinatorV2PlusInternalProof))
res.reqCommitment = NewRequestCommitment(m["requestCommitment"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this change is needed for v2plus because there is no force-fulfillment in v2plus. e.g. vrfOwnerContract is not set for v2plus jobs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants