-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat: add header and comet info service #15850
Conversation
im thinking of defining the comet abci types for validatorUpdates and misbehaviour in golang so we can move it to core. how does this sound to others? |
core/blockinfo/service.go
Outdated
GetDecidedLastCommit() CommitInfo // GetDecidedLastCommit returns the last commit info | ||
} | ||
|
||
// MisbehaviorType is the type of misbehavior for a validator |
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.
would love feedback on defining our own types like 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.
Seems reasonable to me.
@tac0turtle your pull request is missing a changelog! |
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 confused as to where the evidence module actually uses the BlockInfo
service. The keeper has a field but it's never used from what I can see.
core/blockinfo/service.go
Outdated
GetDecidedLastCommit() CommitInfo // GetDecidedLastCommit returns the last commit info | ||
} | ||
|
||
// MisbehaviorType is the type of misbehavior for a validator |
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.
Seems reasonable to me.
core/comet/service.go
Outdated
// CommitInfo is the commit information of ABCI | ||
type CommitInfo interface { | ||
Round() int32 | ||
Votes() []VoteInfo |
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.
It would probably be better to avoid returning an array (which is actually mutable) and use a wrapper interface like the official protobuf does: https://pkg.go.dev/google.golang.org/protobuf/reflect/protoreflect#MessageDescriptors. Ex:
type VoteInfos interface {
Len() int
Get(int) VoteInfo
}
This has the added performance benefit that we avoid allocating and copying an array when wrapping all the request types
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.
added good call
@@ -194,12 +194,14 @@ func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeg | |||
WithBlockGasMeter(gasMeter). | |||
WithHeaderHash(req.Hash). | |||
WithConsensusParams(app.GetConsensusParams(app.deliverState.ctx)). | |||
WithVoteInfos(req.LastCommitInfo.GetVotes()) | |||
WithVoteInfos(req.LastCommitInfo.GetVotes()). | |||
WithCometInfo(cometInfo{Misbehavior: req.ByzantineValidators, ValidatorsHash: req.Header.ValidatorsHash, ProposerAddress: req.Header.ProposerAddress, LastCommit: req.LastCommitInfo}) |
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.
why cometInfo vs a begin block request wrapper?
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.
because in the next pr integrating comet we drop the beginblock type, i was thinking might as well do this here
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 left a few style comments. I mostly followed what's going on here, and I think it seems fine, but I am missing context on the bigger picture here. Soft +1 from me, deferring to others more familiar with this than I am.
core/comet/service.go
Outdated
GetCometInfo(context.Context) BlockInfo | ||
} |
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.
How about we do a Misbehaviors
wrapper like we did for VoteInfos
instead of an array
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.
modified thanks
WithTxBytes(txBytes). | ||
WithVoteInfos(app.voteInfos) | ||
WithTxBytes(txBytes) | ||
// WithVoteInfos(app.voteInfos) // TODO: identify if this is needed |
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.
Was this left commented intentionally?
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.
yes, its still unclear why this is needed, we can add it back via cometinfo to not cause such a large breaking change.
Co-authored-by: Aaron Craelius <[email protected]>
Description
ref #14683
this pr adds block info service as an interface and passes it to evidence.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change