Skip to content

[FEATURE] Support unique message identifier in computeL2ToL1MembershipWitness #20874

@jasonxh

Description

@jasonxh

Problem Statement

There has been this lingering TODO in the code for a while now:

// TODO: Allow to specify the message to consume by its index or by an offset, in case there are multiple messages with
// the same value.
export function computeL2ToL1MembershipWitnessFromMessagesInEpoch(

With the v4 update, L2 -> L1 messages rollup has been changed from block level to epoch level, which further exacerbated this problem - it's much more likely to have duplicate L2 -> L1 messages in an epoch than in a block. As is, there doesn't seem to be a way to compute a message witness for any duplicate messages except the first one.

Proposed Solution

Implement a more intuitive and uniquely identifying computeL2ToL1MembershipWitness signature, such as

export type L2ToL1MembershipWitness = {
  epoch: EpochNumber;  // Include this in output as opposed to input
  root: Fr;
  leafIndex: bigint;
  siblingPath: SiblingPath<number>;
};

export async function computeL2ToL1MembershipWitness(
  node: AztecNode,
  txHash: TxHash,
  messageIndexInTx: number,
): Promise<L2ToL1MembershipWitness | undefined>;

which internally figures out the message's full coordinates, i.e. (epoch, checkpointIndex, blockIndex, txIndex, messageIndexInTx).

Example Use Case

No response

Alternative Solutions

No response

Additional Context

No response

Metadata

Metadata

Assignees

Labels

T-feature-requestType: Adding a brand new feature (not to be confused with improving an existing feature).from-communityThis originated from the community :)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions