-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify Relayer service to order Events from L1 by block index (#1779)
closes #1772 *** Had to modify `MockDB` to also maintain order. This code only works if the Relayer DB maintains order. In production it is stored as a `Mappable` with value being `[Event]`: ``` impl Mappable for EventsHistory { /// The key is the height of the DA. type Key = Self::OwnedKey; type OwnedKey = DaBlockHeight; /// The value is an events happened at the height. type Value = [Event]; type OwnedValue = Vec<Event>; } ``` So it should be good. This approach is flakier than having the relayer reader in the executor ensure the order, but it could add a lot of extra execution cost to the executor code if we put the sorting on that side. We are already making assumptions about what the writing code is doing though. For example, if an event is missing from L1, correct order doesn't matter. So why not add more assumptions :P *** We require that all `Logs`include the `log_index` so we can sort them. So I added a test `relayer__if_a_log_does_not_include_index_then_event_not_included` to check the sad path. **I'm not positive this is the behavior we want.** It is erroring in the `sort_events_by_log_index` method but I'm not exactly sure where that bubbles up to: `start_and_await` still returns an `Ok(Starting)` not an `Ok(StoppedWithError)`. That might be a bug in our `Service` code, or might be meant to be used differently. Not sure. So I just check that the `Log` isn't included in the test... ~I had to modify `MockMiddleware` to only let you take the batch once. Before it would error and then just try again and call the same value over and over and never exited. Making some assumptions there too.~ --------- Co-authored-by: Green Baneling <[email protected]>
- Loading branch information
1 parent
33848a3
commit 951308e
Showing
10 changed files
with
319 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.