-
Notifications
You must be signed in to change notification settings - Fork 115
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
go/consensus/api: Add GetTransactionsWithResults
method
#3073
Conversation
2363932
to
654169b
Compare
Codecov Report
@@ Coverage Diff @@
## master #3073 +/- ##
==========================================
+ Coverage 68.17% 68.21% +0.03%
==========================================
Files 371 372 +1
Lines 36546 36578 +32
==========================================
+ Hits 24917 24950 +33
+ Misses 8416 8400 -16
- Partials 3213 3228 +15
Continue to review full report at Codecov.
|
654169b
to
4bb3b28
Compare
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.
Nice, this recent change looks good! Feel free to do the same for other services (registry, roothash). We could probably also get rid of ConvertBlockEvents
and the associated types then?
4ef3cb9
to
0e28065
Compare
@@ -69,6 +72,87 @@ type queries struct { | |||
runtimeGenesisRound uint64 | |||
} | |||
|
|||
func (q *queries) sanityCheckTransactionEvents(ctx context.Context, height int64, txEvents []*results.Event) error { | |||
// Ensure transaction events match querying backend GetEvents methods. | |||
// TODO: Registry events don't include any transaction info, so we cannot |
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.
Should we add this (e.g. adding some tx info - maybe the transaction hash as we do for staking, to registry events as well)?
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 we should.
@kostko this is ready for more reviews, i posted 2 questions as comments (will also split into multiple commits & fragments after this round of reviews) |
@@ -69,6 +72,87 @@ type queries struct { | |||
runtimeGenesisRound uint64 | |||
} | |||
|
|||
func (q *queries) sanityCheckTransactionEvents(ctx context.Context, height int64, txEvents []*results.Event) error { | |||
// Ensure transaction events match querying backend GetEvents methods. | |||
// TODO: Registry events don't include any transaction info, so we cannot |
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 we should.
fbd7613
to
5772c59
Compare
events = append(events, ev) | ||
case bytes.Equal(key, app.KeyRuntimeID): | ||
// Runtime ID attribute. | ||
// TODO: Every event should contain this attribute, but not used atm |
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.
See this comments please @kostko (should we remove the RuntimeID
field in each of the events, now that we have this attribute? or should we keep it unused for now, maybe just add a check for it to exist for every event?)
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 the RuntimeID
attribute would mostly be used for filtering events in queries (in this case the runtime ID that it contains as value should be text-serialized) not for populating it from anywhere else. So it is fine if it is unused during processing (could add a sanity check to make sure it is there though).
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.
Nice overall, added some minor comments.
go/registry/api/api.go
Outdated
} | ||
|
||
// InternalEvent is a registry app internal event that is not exposed. | ||
type InternalEvent struct { |
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 even expose this in the general API? If it is internal then it is backend-specific so it should just be defined inside the backend implementation and not exposed.
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 agreed & fixed
2be39b1
to
e4c3629
Compare
e4c3629
to
37576a9
Compare
Fixes: #3047