-
Notifications
You must be signed in to change notification settings - Fork 42
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: add function to validate autoshard content topic #1711
Conversation
size-limit report 📦
|
@@ -0,0 +1,88 @@ | |||
import { expect } from "chai"; |
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 can keep this test in packages/tests
similarly how other utils are done there.
https://github.com/waku-org/js-waku/blob/master/packages/tests/tests/utils.spec.ts
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.
@weboko I tired this but now it takes a lot longer to run the unit tests for this function. IMO it shouldn't share a test file that needs docker running in order to not fail.
Plus the tests in that package feel more like integration tests, whereas here we have straightforward unit tests.
* Given a string, will throw an error if it is not formatted as a valid content topic for autosharding based on https://rfc.vac.dev/spec/51/ | ||
* @param contentTopic String to validate | ||
*/ | ||
export function validateContentTopic(contentTopic: string): void { |
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.
nitpick: when the method throws an error on failed check, then I believe the ensure
prefix is more commonly used.
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.
renamed to ensureValidContentTopic
497c0ef
to
0ff58e0
Compare
0ff58e0
to
1bc1eb5
Compare
Problem
There is currently no function for validating content topics used for autosharding
Solution
This PR adds a function to sharding utils which validates that a string is a valid content topic in the context of autosharding
Notes