-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add Merkle Tree #1
Conversation
data/example/sign.ts
Outdated
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.
What's the purpose of this file?
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 signs all claims and store as signatures.json
. Of course it is for testing/demonstration purpose
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.
Could this file be refactored in a way that we could use it as a library for generating signatures? And then create another example file to use this library?
I think it would be beneficial to have something like this.
Or do we have a plan to create another issue which will deal with it?
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 question, we can work closely with UI team to see how the sign module should be implemented
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.
Since in this repo, there will be multiple functionality
- Library
- CLI
- Server?
it would be nice to prepare it as monorepo?
README.md
Outdated
mandatoryKeys: string[]; | ||
optionalKeys: string[]; | ||
payload: string; |
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.
Is payload
used somewhere?
In merkle-tree-result.json
file I can't find it.
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.
payload is a field to manually compare with existing data, however OZ's lib does not have a function to generate abi-encoded message so now I have removed it
So sorry the README was not updated accordingly, now it has been updated |
src/interface.ts
Outdated
numberOfSignatures: number; | ||
mandatoryKeys: Array<string>; | ||
optionalKeys: Array<string>; | ||
payload: string; |
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.
Probably here could payload
also be removed?
README.md
Outdated
|
||
Due to the constraint of vm.parseJson in Foundry, fields in `merkle-tree-result` such as decimal field will trigger error. | ||
|
||
`merkle-tree-simple.json` is a lightweight version of `merkle-tree-result.json`, which also has sufficient params for claiming. |
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.
merkle-tree-simple.json
-> merkle-tree-result-simple.json
?
@@ -0,0 +1,59 @@ | |||
import * as fs from 'fs'; |
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.
let's keep the file name in snake case (both for src and test)
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.
Also, applications
maybe doesn't fit with the contents
packages/tree-builder/src/commands/generate-merkle-tree/index.ts
Outdated
Show resolved
Hide resolved
packages/tree-builder/src/applications/example/sign-accounts.ts
Outdated
Show resolved
Hide resolved
98f9349
to
8f257da
Compare
90805d3
to
ade43be
Compare
5cc70b1
to
28d64d5
Compare
packages/tree-builder/src/applications/example/sign_accounts.ts
Outdated
Show resolved
Hide resolved
1cafbea
to
2a0a7fa
Compare
8b9ce34
to
646fc49
Compare
UPDATE: This PR focuses on Merkle Tree building, the method of account reading will be changed in the another PR. |
What was the problem?
This PR resolves #2
How was it solved?
Merkle Tree function implemented, and a script to read balances json
How was it tested?
Test cases passed at lisk-contract side using the merkle tree and root built by this script