Skip to content

[application] Remove Event MMR #9

@patrick-ogrady

Description

@patrick-ogrady

We should just compute a root over the events at some height (using bmt) rather than storing an events root.

This change will cut ~50% off the commit flow at the end of a block (

// Apply events if this is the next block
if height == events_height + 1 {
events_start_op = events.op_count();
for output in outputs.into_iter() {
events.append(output).await.unwrap();
}
events
.commit(Some(Output::Commit {
height,
start: events_start_op,
}))
.await
.unwrap();
}
// Apply state once we've committed events (can't regenerate after state updated)
state.apply(layer.commit()).await;
state
.commit(Some(Value::Commit {
height,
start: state_start_op,
}))
.await
.unwrap();
), won't limit our ability to service event proofs (can still prove any subset of block events using this bmt), and will simplify recovery logic (don't need to worry about committing event before state).

If we want to retain a global event index for all items, we can store the last index value in the commit metadata (with height) and start event block indexing at that value. This would still allow us to offer an API that walks the event history without any meaningful overhead for the node.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions