-
Notifications
You must be signed in to change notification settings - Fork 327
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
archiver stores L1ToL2 pending messages #642
Conversation
cf159bd
to
bd10daa
Compare
public getPendingL1ToL2Messages(take: number): Promise<L1ToL2Message[]> { | ||
// todo: @rahul https://github.com/AztecProtocol/aztec-packages/issues/529 - change this so that sequencer actually actually consumes messages sorted by fee or another value | ||
// upon consumption, the messages are removed from the store | ||
return Promise.resolve(this.pendingL1ToL2Messages.slice(0, take)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this decrease the size of the existing pendingMessages
array? Or does it leave the sampled data there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sampled for now - will remove in #529
blockUntilSynced: boolean, | ||
currentBlockNumber: bigint, | ||
searchStartBlock: bigint, | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a type for the return value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I tried but it gets quite ugly (which is why none of the methods here have a return type.
Basically you add a return type like : Promise<{ nextEthBlockNumber: bigint; retrievedData: L1ToL2Message[]}>
and then the linter says Missing JDoc statement
- except the linter wants the jdoc statement in the return statement itself (L143) as opposed to on L135.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make a generic type for each:
/**
* Data retreived from logs
*/
type RollupLog<T> = {
/**
* The next block number.
*/
nextEthBlockNumber: bigint;
/**
* The data returned.
*/
retrievedData: T[];
}
Then have the return type be:
func something(): Promise<RollupLog<L1ToL2Message>> {}
should do the trick and appease the linter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing to add from my end on top of @Maddiaa0 and @LHerskind comments. Feel free to loop in @spypsy if you want a review from an Otter more familiar with the archiver than myself!
bd10daa
to
9560afa
Compare
blockUntilSynced: boolean, | ||
currentBlockNumber: bigint, | ||
searchStartBlock: bigint, | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make a generic type for each:
/**
* Data retreived from logs
*/
type RollupLog<T> = {
/**
* The next block number.
*/
nextEthBlockNumber: bigint;
/**
* The data returned.
*/
retrievedData: T[];
}
Then have the return type be:
func something(): Promise<RollupLog<L1ToL2Message>> {}
should do the trick and appease the linter
Description
Next step is the sequencer actually consuming the said messages - this will be a separate PR since this is big enough already.
Fixes #520
Checklist: