dymensionxyz / dymension

Dymension Hub
https://dymension.xyz
Other
363 stars 327 forks source link

feat(rollapp): Updating x/rollapp to accommodate generalized DA layer interface #974

Open spoo-bar opened 4 days ago

spoo-bar commented 4 days ago

[!WARNING]
This PR builds on top of https://github.com/dymensionxyz/dymension/pull/970 and should not be merged before that one is

This PR aims to generalize and standardize the DA Layers that a rollapp can decide to use. The sequencers can then multiplex between different DAs. Using this, the inclusions of blob can be proved and allows for a trustless dispute process to prove inclusion, non-inclusion or tampering.

The main change includes the change of DAPath from string to a concrete type in MsgUpdateState. Rest of the fields stay the same.

message DAPath {
    // da_type identifies the DA type being used by the sequencer to post the blob.
    string da_type = 1;
    // commitment defines a generic commitment interpreted by the DA Layer.
    google.Protobuf.Any commitment = 2;
}

Every new da layer supported will need to implement the following interface to satisfy the requirements.

// DALayer defines a generic DA layer from the point of view of the
// dymension settlement layer.
type DALayer interface {
    // This is called by x/rollapp keeper during a rollapp state update.
    // It is used to verify the correctness of the provided commitment.
    // It is up to the DA Layer to decide the verification level.
    // For example, a DA layer using IBC can immediately verify inclusion
    // of the blob.
    OnRollappStateUpdate(ctx context.Context, commitment anypb.Any) error
    // VerifyMembership is called by x/rollapp during the dispute process to verify
    // the inclusion or non inclusion of the blob, or verify that it was not tampered 
    // with.
    // It also provides arbitrary proof bytes that can be used to confirm the membership.
    VerifyMembership(ctx context.Context, commitment anypb.Any, proof []byte) error
}

Description

References:

  1. SPEC

All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow-up issues.

PR review checkboxes:

I have...

SDK Checklist

Full security checklist here

----;

For Reviewer:

---;

After reviewer approval: