-
Notifications
You must be signed in to change notification settings - Fork 6
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: added spanValue for BMT smart contracts #11
Conversation
50969d6
to
9f239be
Compare
package.json
Outdated
"@types/jest": "^27.4.1", | ||
"@types/terser-webpack-plugin": "^5.2.0", | ||
"@types/webpack-bundle-analyzer": "^4.4.1", | ||
"@typescript-eslint/eslint-plugin": "^5.12.1", | ||
"@typescript-eslint/parser": "^5.12.1", | ||
"babel-jest": "^27.5.1", | ||
"babel-loader": "^8.2.3", | ||
"bn.js": "^5.2.1", |
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.
why is it in the devDependencies
when you use it in the application logic?
src/file.ts
Outdated
chunkInclusionProofs.push({ | ||
sisterSegments, | ||
span: chunk.span(), | ||
spanValue: new BN(chunk.span()).toBuffer('le', 8), |
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.
please don't use external library for these kind of problems. can you solve it with DataView
usage or with other basic API functions?
Moreover, it has to work in browser envrionment as well, and the toBuffer
's JSDoc suggests different method to use...
src/file.ts
Outdated
|
||
export interface ChunkInclusionProof<SpanLength extends number = typeof DEFAULT_SPAN_SIZE> { | ||
span: Bytes<SpanLength> | ||
spanValue: Uint8Array |
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.
it is very confusing, we have an Uint8Array value with span
and another Uint8Array with name spanValue
....
you have to keep littleEndian for span serialization of swarm hashes, and create a helper method to serialize the span value into bigEndian if you need. Even better would be maybe a breaking change, where we keep |
resolved by fairDataSociety/fdp-contracts@e44adf0 |
Reference:
#10