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

Add chain id to bus messages #4409

Merged
merged 15 commits into from
Nov 26, 2021
Merged

Add chain id to bus messages #4409

merged 15 commits into from
Nov 26, 2021

Conversation

pscott31
Copy link
Contributor

closes #4408 (or will once it's done)

@pscott31 pscott31 marked this pull request as ready for review November 25, 2021 16:04
@pscott31 pscott31 requested a review from a team as a code owner November 25, 2021 16:04
@pscott31 pscott31 changed the title Add chain id to context, add callback handler for when chain id is set Add chain id to bus messages Nov 25, 2021
@@ -78,6 +78,7 @@ type App struct {
txTotals []uint64
txSizes []int
cBlock string
chainCtx context.Context // use this to have access to chain ID
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: we probably don't need chainCtx if we just did something like this in OnBeginBlock? I could be wrong

ctx = vgcontext.WithTraceID(app.chainCtx, hash)
ctx = vgcontext.WithBlockHeight(ctx, req.Header.Height)
if chainID, err := vgcontext.ChainIDFromContext(app.blockCtx); err != nil {
    ctx = vgcontext.WithChainID(ctx, chainID)
}
app.blockCtx = ctx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually wrote it like first, but couldn't quite convince myself that app.blockCtx was always going to be one that already has a chain id in it. It seemed like it probably would :) Happy to change it to this if you think it's better that way. I think perhaps I'm missing something but contexts seem a bit suspect to me, you never quite know what is going to be in it!

Copy link
Contributor

Choose a reason for hiding this comment

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

Nah, don't bother changing it if you have doubts about it. You've probably thought about it harder than I have!

@wwestgarth
Copy link
Contributor

I'm guessing the change to core needs to be merged first else it'll all fall apart?

@pscott31 pscott31 merged commit 3255c3c into develop Nov 26, 2021
@pscott31 pscott31 deleted the 4408-chain-id-event branch November 26, 2021 09:52
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.

Include chain id in broker message stream
2 participants