Skip to content
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

Merged
merged 4 commits into from
Jul 7, 2020

Conversation

ptrus
Copy link
Member

@ptrus ptrus commented Jul 1, 2020

Fixes: #3047

@ptrus ptrus force-pushed the ptrus/feature/transaction-results-rpc branch 2 times, most recently from 2363932 to 654169b Compare July 1, 2020 07:31
@codecov
Copy link

codecov bot commented Jul 1, 2020

Codecov Report

Merging #3073 into master will increase coverage by 0.03%.
The diff coverage is 66.06%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
go/consensus/api/api.go 50.00% <ø> (ø)
go/consensus/api/transaction/results/results.go 0.00% <0.00%> (ø)
go/consensus/tendermint/api/api.go 74.54% <ø> (-4.87%) ⬇️
go/registry/api/api.go 41.65% <ø> (ø)
go/roothash/api/api.go 75.00% <ø> (ø)
go/consensus/tendermint/roothash/roothash.go 61.69% <51.35%> (-6.81%) ⬇️
go/consensus/tendermint/registry/registry.go 75.57% <61.79%> (+6.31%) ⬆️
go/consensus/tendermint/tendermint.go 65.57% <67.34%> (-0.14%) ⬇️
go/consensus/tendermint/staking/staking.go 68.63% <67.69%> (+4.09%) ⬆️
go/consensus/api/grpc.go 68.72% <76.47%> (+0.51%) ⬆️
... and 42 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91b6ddb...37576a9. Read the comment docs.

go/consensus/api/api.go Outdated Show resolved Hide resolved
@ptrus ptrus force-pushed the ptrus/feature/transaction-results-rpc branch from 654169b to 4bb3b28 Compare July 1, 2020 14:09
Copy link
Member

@kostko kostko left a 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?

go/consensus/api/transaction/results/results.go Outdated Show resolved Hide resolved
go/consensus/tendermint/staking/staking.go Outdated Show resolved Hide resolved
go/consensus/tendermint/staking/staking.go Outdated Show resolved Hide resolved
go/consensus/tendermint/staking/staking.go Show resolved Hide resolved
@ptrus ptrus force-pushed the ptrus/feature/transaction-results-rpc branch 23 times, most recently from 4ef3cb9 to 0e28065 Compare July 6, 2020 10:59
@@ -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
Copy link
Member Author

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)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we should.

@ptrus
Copy link
Member Author

ptrus commented Jul 6, 2020

@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)

go/registry/api/api.go Outdated Show resolved Hide resolved
go/staking/api/api.go Outdated Show resolved Hide resolved
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we should.

go/roothash/api/api.go Show resolved Hide resolved
go/roothash/api/api.go Outdated Show resolved Hide resolved
go/consensus/tendermint/roothash/roothash.go Outdated Show resolved Hide resolved
@ptrus ptrus force-pushed the ptrus/feature/transaction-results-rpc branch 5 times, most recently from fbd7613 to 5772c59 Compare July 7, 2020 12:16
@ptrus ptrus marked this pull request as ready for review July 7, 2020 12:18
events = append(events, ev)
case bytes.Equal(key, app.KeyRuntimeID):
// Runtime ID attribute.
// TODO: Every event should contain this attribute, but not used atm
Copy link
Member Author

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?)

Copy link
Member

@kostko kostko Jul 7, 2020

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).

Copy link
Member

@kostko kostko left a 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 Show resolved Hide resolved
}

// InternalEvent is a registry app internal event that is not exposed.
type InternalEvent struct {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah agreed & fixed

go/roothash/api/api.go Show resolved Hide resolved
go/consensus/tendermint/roothash/roothash.go Outdated Show resolved Hide resolved
@ptrus ptrus force-pushed the ptrus/feature/transaction-results-rpc branch 2 times, most recently from 2be39b1 to e4c3629 Compare July 7, 2020 14:22
@ptrus ptrus force-pushed the ptrus/feature/transaction-results-rpc branch from e4c3629 to 37576a9 Compare July 7, 2020 17:48
@ptrus ptrus merged commit 451b663 into master Jul 7, 2020
@ptrus ptrus deleted the ptrus/feature/transaction-results-rpc branch July 7, 2020 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transaction status via RPC
2 participants