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

On-demand headers relay: error in the relay_mandatory_header_from_range #3001

Closed
svyatonik opened this issue May 20, 2024 · 4 comments
Closed
Assignees
Labels
A-bug Something isn't working P-Relay

Comments

@svyatonik
Copy link
Contributor

Right now on-demand relays are only used in practice to sync mandatory headers in Polkadot <> Kusama bridge - they are not actually on-demand relays anymore (because we use batch transactions there). However, there's a dumb condition in the code which is wrong when it is used like that. So here we check that the required_header_number >= mandatory_source_header_number and then we set it like that: *required_header_number = mandatory_source_header_number;.
So if relay finds a mandatory header 100, it first sets the required_header_number to 100 and in next iteration it checks if 100 >= 100 and does not relay next mandatory header. We should fix it, even though this relayer will hopefully be abandoned soon.

@svyatonik svyatonik added A-bug Something isn't working P-Relay labels May 20, 2024
@svyatonik svyatonik self-assigned this May 20, 2024
@svyatonik
Copy link
Contributor Author

svyatonik commented May 20, 2024

OTOH we are starting headers relay that may relay mandatory headers IIRC, so why it was not syncing? Needs additional investigation

@svyatonik
Copy link
Contributor Author

OTOH we are starting headers relay that may relay mandatory headers IIRC, so why it was not syncing? Needs additional investigation

Ok, it also reads the best known source chain header from the same required_header_number => it can not proceed

@svyatonik
Copy link
Contributor Author

svyatonik commented May 21, 2024

Ok, let's not touch that code right now - in the future, I hope, we will drop support for complex relayers and right now we don't need the fix anymore. Ill leave the issue open, though - maybe we'll see the same issue again. The most obvious and the least intrusive fix is to simply change the type of required_header_number from simple Option<BlockNumber> to Option<enum { ActuallyRequired(BlockNumber), SelectedMandatory(BlockNumber) }>. The underlying relayer should see the value from ActuallyRequired and we internally (in the on-demand relay) may also use the ActuallyRequired variant when we want to sync mandatory headers.

UPD: why I think it'd be better not to touch it now is because affected relayer is only used in production bridge - Rococo<>Westend is already migrated to use separate relayers set. So it'd be hard to battle test it before it'll reach prod

@svyatonik
Copy link
Contributor Author

Not actual with the #3002

@svyatonik svyatonik closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bug Something isn't working P-Relay
Projects
None yet
Development

No branches or pull requests

1 participant