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

interop: Interop Fault Proof specs draft #31

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

protolambda
Copy link
Contributor

Work in progress.

```python
MAX_SUPERCHAIN_SIZE = 2**20 # the binary merkle-tree is 20 levels deep (excluding the SSZ length-mixin)

class SuperSnapshot(Container:
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like its missing closing )

@tynes tynes mentioned this pull request Feb 8, 2024

We adapt the output-root that commits to the state of an individual L2 like in "version 0",
but now extended with a `messages_root`.
The `messages_root` commits to accumulators of the initiating messages and executing messages.
Copy link
Contributor

@tynes tynes Feb 8, 2024

Choose a reason for hiding this comment

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

I like this idea of messages_root - curious if you have thought about the structure at all yet. I think a sparse merkle tree is most simple where the key is the blockhash and the leaf is a vector commitment to the executing (ssz'ified subset of tx data) + initiating messages (all logs emitted). If block hash isn't present then we can also do keccak256(blocknumber)

This the remaining bitstring after the leading `1` bit of the generalized index.

TODO: diagram of the binary tree

Copy link
Contributor

Choose a reason for hiding this comment

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

Would be useful to define a constants table that has split depth + max l1 history

`SPLIT_DEPTH = 64`

- `path[0]`: [L1 Execution](#l1-execution-extra) [Experimental]
- `path[0] == 0`: L1 block-number bisection
Copy link
Contributor

@tynes tynes Feb 8, 2024

Choose a reason for hiding this comment

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

Is this what you mean by the padding function?

def compute_offset(value):
    # Ensure the input is within the range of a byte
    if value < 0 or value > 255:
        raise ValueError("Input must be a byte (0-255).")
    # Convert the byte value to its binary representation, remove the '0b' prefix
    binary_str = bin(value)[2:]
    # Pad the binary string on the left to make it 8 bits long
    binary_str = binary_str.rjust(8, '0')
    # Pad the binary string on the right with 1s to make it 31 bits long
    padded_binary_str = binary_str.ljust(31, '1')
    return padded_binary_str


- `path[0]`: [L1 Execution](#l1-execution-extra) [Experimental]
- `path[0] == 0`: L1 block-number bisection
- For bits in `path` in range `[1...32)`: right-pad the bits to 31 bits with `1`s as padding.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is basically saying, the more steps of bisection, go back less in time?


## Security Considerations

TODO
TODO expand fault-proof security.
Copy link
Contributor

Choose a reason for hiding this comment

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

Assumption that all chains have the same blocktime at 2 seconds

`SPLIT_DEPTH = 64`

- `path[0]`: [L1 Execution](#l1-execution-extra) [Experimental]
- `path[0] == 0`: L1 block-number bisection
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be helpful with typing if we used path[0] == 0b0, ie the 0b prefix where it makes sense, it helps me keep in context what things are

Each L1 block, relative by `max_l1_history - offset` blocks to the `l1_head` that the game started at,
is transformed into a commitment of accumulated useful and safe L1 information.
Where `max_l1_history = 24 * 60 * 60 / 12` (last 24 hours of L1 data).
TODO: depends on sequencing window and other backward L1 traversal.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you elaborate on this todo?

@protolambda protolambda changed the title interop-specs: Interop Fault Proof specs draft interop: Interop Fault Proof specs draft Feb 9, 2024
@tynes tynes force-pushed the feat/interop branch 2 times, most recently from 3db0418 to ee85a0c Compare February 11, 2024 20:37
@protolambda protolambda changed the base branch from feat/interop to main February 16, 2024 23:23
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.

Interop Specs: Fault Proof
2 participants