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

Integrate Teleporter message id changes #128

Merged
merged 3 commits into from
Jan 12, 2024

Conversation

minghinmatthewlam
Copy link

@minghinmatthewlam minghinmatthewlam commented Jan 5, 2024

Why this should be merged

updates relayer to be compatible with Teleporter message id changes, fixes #123

How this works

We use the abi-bindings pkg from teleporter repo and the destination client to create a Teleporter instance. Then when relaying a Teleporter message we use the instance to calculate message id and check message received when deciding whether we should send a message.

How this was tested

Updated unit/e2e tests
CI

How is this documented

Updated code comments

fix unit tests

update mock files
@minghinmatthewlam minghinmatthewlam changed the title integrate Teleporter message id changes Integrate Teleporter message id changes Jan 8, 2024
@minghinmatthewlam minghinmatthewlam marked this pull request as ready for review January 8, 2024 21:55
cam-schultz
cam-schultz previously approved these changes Jan 9, 2024
Copy link
Collaborator

@cam-schultz cam-schultz left a comment

Choose a reason for hiding this comment

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

The changes LGTM. Thanks for cleaning up the Teleporter contract interaction in message manager as well.

Copy link
Collaborator

@michaelkaplan13 michaelkaplan13 left a comment

Choose a reason for hiding this comment

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

The changes LGTM, but would like to follow up about making API calls for calculateMessageID. Would be great to remove that in the future by either passing in the proper message ID, or calculating it based on the input parameters directly using keccack256

@@ -125,29 +124,31 @@ func (m *messageManager) ShouldSendMessage(warpMessageInfo *vmtypes.WarpMessageI
return false, fmt.Errorf("relayer not configured to deliver to destination. destinationBlockchainID=%s", destinationBlockchainID.String())
}

teleporterMessenger := m.getTeleporterMessenger(destinationClient)
teleporterMessageID, err := m.calculateMessageID(teleporterMessenger, warpMessageInfo.WarpUnsignedMessage.SourceChainID, destinationBlockchainID, teleporterMessage.MessageNonce)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It a bit sub-optimal that getting the message ID requires an additional API call here, but given the current interfaces and utilities, it's I agree that it's the easiest option.

Alternatively, the message ID is emitted as a part of the SendCrossChainMessage event and could be used directly from there (though we don't currently subscribe or otherwise get that event), or we could provide a Golang utility for the hash operation, which would be far more efficient than an API call but have a small amount of duplicated logic.

I don't think we need to change it for this PR, but wanted to call out to hear people's thoughts.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah investigated this a bit and unfortunately there is no way to call any methods from the golang ABI without an RPC call, even if you're calling a pure function. I totally agree that needing the API here is very undesired.

I think the best solution here is probably to build our own Golang utility that reproduces the functionality. Importantly, we should add a test (or include the sanity check in the e2e network setup) that calls the Teleporter contract to make sure it aligns with our utility.

We can totally defer this to a new ticket, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, the utility should be located in the teleporter repo.

Copy link
Author

Choose a reason for hiding this comment

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

created new issue to track: #136

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed on all points. In the future when optimizing end to end relayer latency, minimizing the number of network round trips will be an obvious starting point.

messages/teleporter/message_manager.go Show resolved Hide resolved
@minghinmatthewlam minghinmatthewlam merged commit fd533e4 into main Jan 12, 2024
7 checks passed
@minghinmatthewlam minghinmatthewlam deleted the integrate-teleporter-updates branch January 12, 2024 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Integrate message ID hash
4 participants