sequencer, oracle integration with L1 to L2 messages#683
Conversation
3aa5593 to
5e29a31
Compare
5e29a31 to
12fd8cc
Compare
| void msgKey; // this line can be removed its to appease the linter on this stub | ||
| const message = L1ToL2Message.empty().toFieldArray(); | ||
| const message = (await this.node.getL1ToL2Message(msgKey)).toFieldArray(); | ||
| // TODO: note index will be requested from the database, stubbed as 0 for the meantime |
There was a problem hiding this comment.
The approach of removing from the archiver and then reinserting upon publish failure seems very brittle. What if a sequencer stops/crashes after retrieving the messages but before publishing them? I think a much better approach is to leave the messages in the archiver store and remove them upon receipt of a new block in the archiver.
It also breaks down in a multi-sequencer world. The archiver should be a read-only store of latest chain state for all consumers to query. Pending messages should remain pending until the chain says they aren't.
|
|
||
| // there are only 2 l1ToL2 messages in the store | ||
| expect((await archiver.getPendingL1ToL2Messages(10)).length).toEqual(2); | ||
| expect((await archiver.consumePendingL1ToL2Messages(10)).length).toEqual(2); |
There was a problem hiding this comment.
This seems like it is "consuming" the pending messages (popping), but that should happen when the L2 block that includes them is broadcast, not when you want to just fetch them?
| * @returns Array of the top L1 to L2 message keys sorted by fee | ||
| * (of maximum size `take` - smaller if not enough messages) | ||
| */ | ||
| public consumePendingL1ToL2Messages(take: number = NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP): Promise<Fr[]> { |
|
As @PhilWindle mentioned and outlined in #520 and #529, the archiver depends only on what happens on L1 and don't need to know about the existance of sequencers. Pending L1 to L2 messages should be "consumed" when they are included in an L2 block. I have created #691 since the ever-growing "non-pending" L1 to L2 message set was not explicitly outlined in #520 before. Also reopened #520 as the last point was not addressed in #642. |
Description
Fixes #529:
Builds on from #642
TODO: Add some tests around the archiver, fix the l1 publisher integration
Please sanity check that there are no other places I have missed
Also any test suggestions are welcome!
Checklist: