-
Notifications
You must be signed in to change notification settings - Fork 661
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
Adding comments to all the database columns #6068
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This ... feels fishy. My understanding that
*View
types are for RPC, not for storing directly in DB...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 found this code:
https://github.com/near/nearcore/blob/master/chain/chain/src/store.rs#L2603
And this type is BorshSerializable:
https://github.com/near/nearcore/blob/master/core/primitives/src/views.rs#L1433
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.
Yeah, it's not a statement about this particular change, it's a statement about pre-existing state of code.
My understanding is that
*View
-types are intended to beAPI
types we use in JSON RPC. So, eg, we useAction
as internal representation of what we store in the database, and we useActionView
for the RPC (which is reachable from thechunk
method).Some of the
*View
types are not only JSON-encodable, but also borsh-encodable. My understanding that this bottoms out inRoutedMessageBody::FinalExecutionOutcomeView
. I am not sure if that should've use*View
struct or not: it feels weird that here we have both*View
and not*View
struct. So, my current understanding is "some view types are borsh because we use then in p2p messages, which I am not sure why we do".What I am noticing here is that there's also at least one
*View
type which we store in the database. And that's surprising, because that means that we store both , eg,ValidatorStakeView
(throughColEpochLightClientBlocks
) andValidatorStake
(throughColEpochValidatorInfo
) in the database.Overall, it seems that the codebase as a whole is confused about what
*View
really means, and that some things are miss-classified as*View
.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.
cc #5516