[Bug] Fix bug introduced by changing BigEndian
to LittleEndian
#36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Human Summary
BigEndian
what changed toLittleEndian
it meant that the hashes generated by the trie would be different in the SMSTAI Summary
Summary generated by Reviewpad on 01 Jan 24 20:51 UTC
This pull request includes the following changes:
The file
proof_sizes_test.go
has updates related to modifying and proving values in a trie data structure. It includes replacing the usage ofbinary.LittleEndian.PutUint64
withbinary.BigEndian.PutUint64
.The file
smst_proofs_test.go
has changes in lines 101, 321, 347, 418, and 450, wherebinary.LittleEndian.PutUint64
is replaced withbinary.BigEndian.PutUint64
. Additionally, the loop in line 450 has been modified to insert 100 key-value-sum triples instead of 100,000.The file
smst_utils_test.go
has changes in theUpdate
andGetValueSum
functions. The byte order used for encoding and decoding thesumBz
variable has been modified from little endian to big endian. TheProveSumCompact
function has been removed.The file
smst.go
has changes in theGet
,Update
, andSum
functions, where the byte ordering of variablesweight
andsum
has been changed from little endian to big endian.The file
smst_test.go
has a change in line 462, wherebinary.LittleEndian.Uint64
is replaced withbinary.BigEndian.Uint64
for calculating the variablerootSum
.The file diff includes modifications in functions related to compaction and decompaction in the
smt_proofs_test.go
file. The error handling has been improved by replacingt.Fatalf()
withrequire.NoErrorf()
.The file diff modifies the test case
TestSMT_ProveClosest_Proof
insmt_proofs_test.go
, reducing the number of key-value-sum triples inserted from 100,000 to 100.The file
utils.go
has changes in theintToBytes
andbytesToInt
functions. The byte ordering for converting between int and byte slice has been changed from little endian to big endian.The file
proofs.go
has changes in theVerifyProof
andVerifyClosestProof
functions, where the byte ordering for encoding and decoding a uint64 value has been changed from little endian to big endian.The file
hasher.go
has changes in theencodeSumInner
function. The byte slices are now converted into unsigned integers and sum using big endian encoding instead of little endian encoding.The file
fuzz_test.go
has changes in line 75, replacingbinary.LittleEndian.PutUint64
withbinary.BigEndian.PutUint64
, and lines 96-98, where a default case has been added to handle unknown operations.The file diff in
MerkleSumTrie.md
suggests changing the encoding of the sum value from little endian to big endian.Let me know if you need any further assistance!
Issue
Fixes N/A
Type of change
Please mark the relevant option(s):
Testing
make test_all
make benchmark_{all | suite name}
Required Checklist
godoc
format comments see: tip.golang.org/doc/comment)If Applicable Checklist