-
Notifications
You must be signed in to change notification settings - Fork 150
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
fix: finalization for /blocks/head
#631
Conversation
const { hash, queryFinalizedHead, omitFinalizedTag } = | ||
await this.parseFinalizationOpts(this.options.finalizes, paramFinalized); | ||
await this.parseFinalizationOpts( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get this, how does it fix it by converting passing it as a String
rather than a boolean
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm, you make a good point that it is confusing too outside eyes as to what is happening, so I am going to just revert it completely to what it use to be so that there is no confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused about the string usage; can the string just be true
or false
and, why a string and not a bool? I'm probably missing too much context really :)
Sounds like you'll revert anyway so maybe I don't need to know :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@niklasad1 @jsdw Okay, so I reverted it back to what it was originally before I abstracted out of the controller. Hopefully it's a little clearer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So IIUC, finalizes
checks if the network itself supports finalization, and finalized
is a user parameter, but I'm not sure what the use of FinalizedTag
/queryFinalizedHead
is. What does FinalizedTag
do that queryFinalizedHead
does not? I'm trying to understand why we use queryFinalizedHead
with the chain.getHeader()
func. Or why when we use getHeader
when queryFinalizedHead
head is false, and getFinalizedHead
when queryFinalizedHead
is true.
Otherwise I think this looks good
@insipx Great question, I just added a comment to clarify. But the idea behind The logic where this all takes place when this is queried ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense to me
This fixes the default behavior for querying the finalized head. The query param and its expected behavior still works. The only issue is the
/blocks/head
endpoint is not returning the finalized head by default, which means you have to tag the finalized param onto the query. This fixes the slight bug introduced in this PR #615.