Skip to content
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(batcher): Update Lambdaworks Merkle Trees + Update merkle leaves length check in batcher #1067

Open
wants to merge 2 commits into
base: staging
Choose a base branch
from

Conversation

PatStiles
Copy link
Contributor

@PatStiles PatStiles commented Sep 24, 2024

closes: #970

  • Updates the lambdaworks merkle tree dependencies in aligned layer from v0.7.0 -> v0.10.0.
  • Updates the length check in the batcher to allow

Testing:

Test local testnet as expected and confirm no errors are emitted.

make deps
make install_aligned_compiling
make anvil_start_with_block_time
make aggregator_start
make operator_register_and_start
make batcher_start_local
make batcher_send_burst_groth16

Note:

I removed the padding of the merkle root leaves as specified in #979 . However, this caused the Tx to revert in the BatcherPaymentService contract with InvalidMerkleRoot error (after removing the leaves power of two check). Since the merkle tree verification was sourced from eigen https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/libraries/Merkle.sol#L129 my intuition is its failing due an invariant the leaves are a power of 2 therefore we need to preserve padding the leaves to a power of two. Removing the padding will be done in a separate pr.

@@ -804,7 +804,7 @@ impl Batcher {

// FIXME(marian): This condition should be changed to current_batch_size == 0
// once the bug in Lambdaworks merkle tree is fixed.
if current_batch_len < 2 {
if current_batch_len == 0 {
info!("Current batch is empty or length 1. Waiting for more proofs...");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
info!("Current batch is empty or length 1. Waiting for more proofs...");
info!("Current batch is empty. Waiting for more proofs...");

@@ -1083,7 +1090,6 @@ impl Batcher {
signatures: Vec<SignatureData>,
fee_params: CreateNewTaskFeeParams,
) -> Result<TransactionReceipt, BatcherError> {
// pad leaves to next power of 2
let padded_leaves = Self::pad_leaves(leaves);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed comment but still padding the leaves.

The idea is to remove the padding? If the padding is removed, the contract should have a change as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants