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.
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
fix(abci): ignore comet ctx and use app ctx #2568
fix(abci): ignore comet ctx and use app ctx #2568
Changes from 68 commits
e7f0b79
a3796f5
da52ea0
dbd75e1
3dc865d
26f4c7d
8bc54e9
3b91793
d20bd0d
35296a1
4687f00
00ef155
db423b2
b58fced
62b5838
015698c
194ba50
4e49106
2639b6b
8ec64f3
f9096cb
9b1255f
b6e92ab
5303fd5
dc34dc9
d51d636
2069930
2798898
48f6f7d
8dc24a5
ab124a9
5f9fe91
5df3171
69d67fd
156ba5f
0144133
a871e7b
8a86207
dcf36f0
42fa262
aa7b9f7
0265130
a7b367b
adc58d0
f8032c4
347cf4b
b0da96e
7c22253
7c39a3f
d422a6d
73b0444
d375414
b225f6f
a1cf15a
16feb52
5899cb5
8ff93eb
17e2094
a0658c3
d7d7449
38d5b09
75b5ad6
b26a276
f8b3cbe
6416fb7
994b472
a4e630d
b387d0b
aea72aa
b25d97d
f1c22ab
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
bit unsure on this. Why was introducing this 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.
So the cosmos SDK context, which I will refer to as
cosmosCtx
, contains a reference to thebaseCtx
, which is the regular golangcontext.Context
. ThiscosmosCtx
also stores a bunch of data in it for our state and commit multi store and whatnot, but we don't want to affect any of that.When we
resetState(ctx)
, we are creating a newcosmosCtx
, wherebaseCtx = ctx
.If we do not
resetState(ctx)
, then the already existingfinalizeBlockState
is used. This state has the oldcosmosCtx
, which has the oldctx
from whichever other function is was set in, likely the previousProcessProposal
. We don't mind using the oldcosmosCtx
, but we want to make sure we are using the newctx
that is passed in for this function. So we can simply setbaseCtx = ctx
here.Indeed, this is not as big of a problem now, since all of the contexts are the same and the context isn't getting canceled inbetween each ABCI++ call like it was in a previous iteration of this PR. However, purely for correctness, we want to make sure our
s.Blockchain.FinalizeBlock(s.finalizeBlockState.Context())
is using thectx
passed in viafinalizeBlockInteral(ctx, ...)
and NOT thectx
from some other function call.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 had assumed it was always going to be using this context.
For my understanding, is it fair to say that we don't need to change the context here given we have this universal base context which currently never changes?
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.
@rezbera if you check the call hierarchy you will see that
FinalizeBlock
does uses.ctx
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.
Actually @rezbera we can solve the issue by just not passing ctx as parameter, but reusing s.ctx everywhere, which this PR basically does. So no need to look up the call hierarchy
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.
can you make a helper function on
state
to reset/update the base ctx