-
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
Fix multiple deposits #126
Conversation
35aaf89
to
01f02c0
Compare
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.
Awesome work on fixing the encodePacked issue!
This is the first pass of the review. Might take a second round again.
err = DBI.InitAccountTree(int(accountTreeDepth.Uint64())) | ||
err = DBI.InitAccountTree(int(accountTreeDepth.Uint64()) + 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.
Nice catch here! The DEPTH in the accountTree contract is misleading, created an issue to fix it later https://github.com/thehubbleproject/hubble-contracts/issues/457😓 .
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.
This one lead to finding another big issue, so no harm no foul.
) | ||
|
||
// Aggregator is the service which is supposed to create batches | ||
// It has the following tasks: | ||
// 1. Pick txs from the mempool | ||
// 1. Pick txs from the mempoolinaccurate number of transactione |
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 this accidentally committed?
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.
yeah, will change
func encodePacked(input ...[]byte) []byte { | ||
return bytes.Join(input, nil) | ||
} |
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.
Great work solving this!
@@ -17,7 +17,7 @@ func init() { | |||
panic(err) | |||
} | |||
|
|||
DefaultHashes, err = GenDefaultHashes(100) | |||
DefaultHashes, err = GenDefaultHashes(100, ZeroLeaf) |
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.
No change is required here. Just want to point out that we call the zero/empty leaf differently between the contract and the client.
thehubbleproject/hubble-contracts#376 (comment)
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.
LGTM. The comment on merkle tree might deserve its own issue and PR to resolve.
if len(leaves)%2 != 0 { | ||
leaves = append(leaves, ZeroLeaf) | ||
} |
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.
Here we handled the odd number of leaves only in the bottom level. But the odd number of nodes should be handled at every level.
For example, say we have 9 leaves to merklise. This makes a 4 level tree (not counting the root).
- We add defaultHash[0] in level 0 leaves. After the ascend, level 1 has 5 nodes
- We add defaultHash[1] in level 1 nodes to make them 6 nodes. After the ascend, level 2 has 3 nodes.
- We add defaultHash[2] in level 2 nodes to make them 4 nodes. After the ascend, level 3 has 2 nodes.
I suggest this logic is better handled in the ascend
method.
if len(txs) < int(a.cfg.TxsPerCommitment) { | ||
return commitments, ErrNotEnoughTransactions | ||
} |
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.
Does a transaction take a long time to be submitted on chain if the commitment is unfilled?
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.
not really, it just might be non economical to submit unfilled commitments on-chain for a coordinator, so we allow him to configure that tightly.
No description provided.