-
Notifications
You must be signed in to change notification settings - Fork 179
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
[Access] Add spork and node root block heights to GetNodeVersionInfo #4690
Conversation
engine/access/rpc/backend/backend.go
Outdated
@@ -145,6 +148,16 @@ func New(params Params) (*Backend, error) { | |||
} | |||
} | |||
|
|||
sporkRootBlockHeight, err := params.State.Params().SporkRootBlockHeight() |
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 wonder where do we get this data from? Did we already implemented the snapshot generation which includes the spork root block?
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.
Params.SporkRootBlockHeight
is included in the mainnet23 root-protocol-state-snapshot.json. It's extracted from the root snapshot loaded on boot, then written into the db here:
https://github.com/onflow/flow-go/blob/master/state/protocol/badger/state.go#L556-L563
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.
looks good to me
engine/access/rpc/backend/backend.go
Outdated
@@ -76,6 +76,9 @@ type Backend struct { | |||
collections storage.Collections | |||
executionReceipts storage.ExecutionReceipts | |||
connFactory connection.ConnectionFactory | |||
|
|||
sporkRootBlockHeight uint64 |
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 have one question here. Could we get these parameters directly from state
in GetNodeVersionInfo
, the same as for stateParams := b.state.Params()
and sporkID, err := stateParams.SporkID()
, or do you have another idea behind this?
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.
Yea, we could. I was trying to avoid the db lookups since this data is static. We could cache the whole result since it should never change. I'll look into adding that
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.
updated in 24898eb
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.
Looks good, just have one question in the comments.
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## master #4690 +/- ##
==========================================
- Coverage 55.46% 50.41% -5.06%
==========================================
Files 922 310 -612
Lines 85754 33086 -52668
==========================================
- Hits 47563 16680 -30883
+ Misses 34573 15132 -19441
+ Partials 3618 1274 -2344
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Closes: #4620
After spork transitions, it's useful for clients to have a way to programmatically identify the lowest height that an access node has in it's protocol db. This allows clients to know which blocks they can get from that node, and which they need to use another node, like a historic access node.
This PR updates the
GetNodeVersionInfo
endpoint to include theSporkRootBlockHeight
-> the root height for the spork networkNodeRootBlockHeight
-> the lowest sealed block the node has in its protocol databaseUpdates were made to both the gRPC and REST apis.