You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In BMTFile.sol, in the unit tests we add an additional property to ChunkInclusionProof named spanValue, that is the value return by getSpanValue, which is a little endian uint32 value.
The unit test fills this value using BN.js which has support for endianess.
// TODO: Move this logic to bmt.jsconstproofChunksBigNumber=proofChunks.map((i: {span: Uint8Array;sisterSegments: Uint8Array[]})=>{return{// eslint-disable-next-line node/no-unsupported-features/es-syntax
...i,// Note: It has to be exactly little endian with length of 8 bytesspanValue: newBN(i.span).toBuffer('le',8),}})
The struct in Solidity is:
struct ChunkInclusionProof{
// big endian valueuint64 span;
// little endian valueuint64 spanValue;
bytes32[] sisterSegments;
}
Ideally, bmt.js must implement spanValue and use BN.js to calculate the endianess, thus the unit test implementation can be removed, making for an easier fdp-contracts API to use for developers.
The text was updated successfully, but these errors were encountered:
In BMTFile.sol, in the unit tests we add an additional property to ChunkInclusionProof named spanValue, that is the value return by getSpanValue, which is a little endian uint32 value.
The unit test fills this value using BN.js which has support for endianess.
The struct in Solidity is:
Ideally, bmt.js must implement
spanValue
and use BN.js to calculate the endianess, thus the unit test implementation can be removed, making for an easier fdp-contracts API to use for developers.The text was updated successfully, but these errors were encountered: