-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: l2 metrics service #63
Conversation
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.
Good to go!
describe("getL1BatchBlockRange", () => { | ||
it("should return the block range for the specified L1 batch number", async () => { | ||
zkProvider = new ZKChainProvider(defaultRpcUrls, mockLogger, defaultMockChain); | ||
const l1BatchNumber = 1000; | ||
const blockRange: [number, number] = [5000, 6000]; | ||
|
||
vi.spyOn(zkProvider["zkClient"], "getL1BatchBlockRange").mockResolvedValue(blockRange); | ||
|
||
const result = await zkProvider.getL1BatchBlockRange(l1BatchNumber); | ||
|
||
expect(result).toEqual(blockRange); | ||
expect(zkProvider["zkClient"].getL1BatchBlockRange).toHaveBeenCalledWith({ | ||
l1BatchNumber, | ||
}); | ||
}); | ||
}); |
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.
Any non-happy paths worth testing?
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.
just a brief comment
} else if (isNativeError(error)) { | ||
this.logger.error(error); | ||
} | ||
return undefined; |
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.
Following the way we are handling errors, for the rest of the methods. Should we throw here instead of returning undefined ? The lastVerifiedBlock is not an optional method on the front end
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.
this got me thinking tbh, should we actually return return value | undefined for all methods? like an error on L2 shouldn't break anything as it's like not having rpc urls wdyt?
as discussed offline @0xkenj1, we let the service consumer handle errors instead of returning undefined for consistency |
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.
🚀
🤖 Linear
Closes ZKS-228
Description
L2MetricsService
implementation onmetrics
package