-
Notifications
You must be signed in to change notification settings - Fork 24
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
API endpoint for manually relaying warp message #327
Conversation
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 handful of comments and asks, and I'd like to think a bit more about the new MessageCoordinator
type. But overall, the changes make sense and I'm a big fan of the trend of decoupling all of the components and coordinating them in main
.
main/main.go
Outdated
"Created application relayers", | ||
zap.String("blockchainID", sourceBlockchain.BlockchainID), | ||
) | ||
return relayer.ProcessManualWarpMessages(manualWarpMessages[sourceBlockchain.GetBlockchainID()]) |
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.
We should add deprecation notes for manual Warp messages in the config, and perhaps emit logs when they are provided.
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.
Sorry, I already removed the manual warp messages from the config. Do you think we should keep them in there for a few releases with a deprecation note? I can't imagine many people were using them already given the difficulty in having to add them to the nodes 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 deprecate features gracefully at this point, even though I agree that likely few people are using this particular feature. Apologies for not making that clear up front
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 a couple thoughts here. We don't initialize the logger for the application until after we finish parsing the config. So it would be a little hard to emit logs from here. Returning an error and failing validation seems a little too extreme here, is there some middle ground?
Do we still want to process the manual warp messages if they're included in the config? It should be easy enough to point the users to the new API.
relayer/relay_message_api_handler.go
Outdated
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.
Let's document this endpoint in the top-level README
Co-authored-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Signed-off-by: Geoff Stuart <geoff.vball@gmail.com>
) (map[ids.ID]map[common.Address]messages.MessageHandlerFactory, error) { | ||
messageHandlerFactories := make(map[ids.ID]map[common.Address]messages.MessageHandlerFactory) | ||
for _, sourceBlockchain := range globalConfig.SourceBlockchains { | ||
messageHandlerFactoriesForSource := make(map[common.Address]messages.MessageHandlerFactory) |
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.
nit: can we rename to messageProtocolHandlerFactory
or simiilar
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.
Rename which?
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.
messageHandlerFactoriesForSource
Co-authored-by: F. Eugene Aumson <feuGeneA@users.noreply.github.com> Signed-off-by: Geoff Stuart <geoff.vball@gmail.com>
Co-authored-by: F. Eugene Aumson <feuGeneA@users.noreply.github.com> Signed-off-by: Geoff Stuart <geoff.vball@gmail.com>
Co-authored-by: F. Eugene Aumson <feuGeneA@users.noreply.github.com> Signed-off-by: Geoff Stuart <geoff.vball@gmail.com>
Co-authored-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Signed-off-by: Geoff Stuart <geoff.vball@gmail.com>
Co-authored-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Signed-off-by: Geoff Stuart <geoff.vball@gmail.com>
Co-authored-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Signed-off-by: Geoff Stuart <geoff.vball@gmail.com>
Co-authored-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Signed-off-by: Geoff Stuart <geoff.vball@gmail.com>
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.
Two more final comments, then I think we're good to go
error, | ||
) { | ||
// Check that the warp message is from a supported message protocol contract address. | ||
messageHandlerFactory, supportedMessageProtocol := mc.messageHandlerFactories[warpMessageInfo.UnsignedMessage.SourceChainID][warpMessageInfo.SourceAddress] |
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.
Nit: This line looks very long...I'm not too worried about it specifically but surprised we're not getting a linter error/warning in CI
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 looks like this can be enabled with the lll
linter: https://golangci-lint.run/usage/linters/#lll
Worth noting that the Go team has explicitly denied adding line length limits to gofmt.
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.
There are a good number of lines that don't fit in the line length, so I'll make a separate ticket for 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.
Last few nits, but LGTM otherwise
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.
One last uber mega nit that I'm just noticing now - can we capitalize the first letters of the log message strings for consistency? I think the only files that need to be modified are health_check.go
and relay_message.go
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.
LGTM! 🙏
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.
LGTM
Why this should be merged
Closes #314
How this works
Creates a global
MessageCoordinator
that contains maps to Source Clients, Application Relayers, and Message Handler Factories.TODOs:
ShouldSendMessage()
returning false.How this was tested
E2E Test
How is this documented
TODO