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

Fetch warp numerator (rebased off of off-chain-warp-messages) #157

Merged
merged 31 commits into from
Feb 8, 2024

Conversation

cam-schultz
Copy link
Collaborator

Why this should be merged

Fixes #8

How this works

Fetches the Warp Quorum from the Warp Config on startup. Hardcodes the quorum value for the primary network, since that will never change.

How this was tested

Added unit tests

How is this documented

N/A

config/config.go Outdated

// Fetch the Warp quorum values for each source subnet
for _, sourceSubnet := range c.SourceSubnets {
blockchainID, err := ids.FromString(sourceSubnet.BlockchainID)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just want to make sure we're not missing a corner case here. My understanding is that each subnet can have multiple blockchains, but in the relayer code we treat every subnet as if it only contains one blockchain (though this is probably true for almost all subnets).

Let's say a subnet has two blockchains, are they supposed to have them in the config as two different "subnets"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, blockchains are the distinct unit in the relayer config, so multiple blockchains in the same subnet would need their own distinct entries in the config.

Copy link
Contributor

Choose a reason for hiding this comment

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

So probably not something for this PR, but I think that means the slices in the config should be SourceBlockchains and DestinationBlockchains. I think we're fine for now, but I can definitely see this causing confusion for anyone else who comes along in the future (and anyone consuming/forking this repo)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Definitely agree. This is an artifact of some of the language that was used in early Warp designs, when we were considering alternative approaches than Warp to achieve inter-blockchain communication in the same subnet. I'll create a ticket to clean this up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ticket here: #170

Copy link
Contributor

@geoff-vball geoff-vball left a comment

Choose a reason for hiding this comment

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

Just a couple more small questions about subnetID/blockchainID, but otherwise LGTM

config/config.go Outdated

// Fetch the Warp quorum values for each source subnet
for _, sourceSubnet := range c.SourceSubnets {
blockchainID, err := ids.FromString(sourceSubnet.BlockchainID)
Copy link
Contributor

Choose a reason for hiding this comment

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

So probably not something for this PR, but I think that means the slices in the config should be SourceBlockchains and DestinationBlockchains. I think we're fine for now, but I can definitely see this causing confusion for anyone else who comes along in the future (and anyone consuming/forking this repo)

geoff-vball
geoff-vball previously approved these changes Feb 5, 2024
michaelkaplan13
michaelkaplan13 previously approved these changes Feb 6, 2024
Base automatically changed from off-chain-warp-messages to main February 7, 2024 22:31
@cam-schultz cam-schultz dismissed stale reviews from michaelkaplan13 and geoff-vball February 7, 2024 22:31

The base branch was changed.

@@ -427,7 +429,7 @@ func (r *Relayer) RelayMessage(warpLogInfo *vmtypes.WarpLogInfo, storeProcessedH
}

// Create and run the message relayer to attempt to deliver the message to the destination chain
messageRelayer := newMessageRelayer(r, unsignedMessage, destinationBlockchainID)
messageRelayer, err := newMessageRelayer(r, unsignedMessage, destinationBlockchainID)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this err check below was unnecessary previously. Glad it's corrected now 👍

@cam-schultz cam-schultz merged commit e136006 into main Feb 8, 2024
7 checks passed
@cam-schultz cam-schultz deleted the fetch-warp-numerator-rebase branch February 8, 2024 15:28
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.

Get Quorum numerator/denominator from VM
3 participants