Skip to content

Commit

Permalink
interop: Add initial indexing api spec
Browse files Browse the repository at this point in the history
  • Loading branch information
ajsutton committed Jul 23, 2024
1 parent d847dc0 commit fa59525
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
1 change: 1 addition & 0 deletions specs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
- [Sequencer](./interop/sequencer.md)
- [Verifier](./interop/verifier.md)
- [Rollup Node P2P](./interop/rollup_node_p2p.md)
- [Indexing API](./interop/indexing_api)
- [Fault Proof](./interop/fault_proof.md)
- [Upgrade](./interop/upgrade.md)
- [Token Bridging](./interop/token-bridging.md)
Expand Down
56 changes: 56 additions & 0 deletions specs/interop/indexing_api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Indexing API

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [Optional Indexing Backend](#optional-indexing-backend)
- [Methods](#methods)
- [`interop_checkMessage`](#interop_checkmessage)
- [Parameters](#parameters)
- [Returns](#returns)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Optional Indexing Backend

Sequencers or verifies MAY utilise an external service to index the logs from chains in the dependency set and optimise
cross-chain validity checks. To aid compatibility between different implementations of sequencers, verifiers and
backends, a standard API for indexers to expose is defined here.

The API uses [JSON-RPC] and follows the same conventions as the [Ethereum JSON-RPC API].

## Methods

### `interop_checkMessage`

Determines the safety level of an individual message. This can be used to verify initiating messages exist, for example
by the tx-pool and block-building, to verify user-input before inclusion into the chain.

#### Parameters

1. Object - The Identifier object
- origin: DATA, 20 Bytes - Account that emits the log
- blocknumber: QUANTITY - Block number in which the log was emitted
- logIndex: QUANTITY - The index of the log in the array o fall logs emitted in the block
- timestamp: QUANTITY - The timestamp that the log was emitted
- chainid: QUANTITY - The chain id of the chain that emitted the log
2. payloadHash: DATA, 32 bytes - the keccak256 hash of the [message payload](./messaging.md#message-payload)

#### Returns

`String` - The strictest applicable `SafetyLevel` of the message

- `conflicts` - data is available for the block referenced by the identifier but does not contain a matching log
- `unknown` - data for the block referenced by the identifier is not yet available
- `finalized` - the specified log exists
- `unsafe` - the specified log exists and meets the requirements of [`unsafe` inputs`](./verifier.md#unsafe-inputs)
- `cross-unsafe` - the specified log exists and meets the requirements
of [`cross-unsafe` inputs`](./verifier.md#cross-unsafe-inputs)
- `safe` - the specified log exists and meets the requirements of [`safe` inputs`](./verifier.md#safe-inputs)
- `finalized` - the specified log exists and meets the requirements
of [`finalized` inputs`](./verifier.md#finalized-inputs)

[JSON-RPC]: https://www.jsonrpc.org/specification

[Ethereum JSON-RPC API]: https://ethereum.org/en/developers/docs/apis/json-rpc/
2 changes: 1 addition & 1 deletion specs/interop/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ network upgrade will be included in this document in the future.
| Source Chain | A blockchain that includes an initiating message |
| Destination Chain | A blockchain that includes an executing message |
| Initiating Message | An event emitted from a source chain |
| Executing Message | An event emitted from a destination chain's `CrossL2Inbox` that includes an initiating message |
| Executing Message | An event emitted from a destination chain's `CrossL2Inbox` that includes an initiating message |
| Cross Chain Message | The cumulative execution and side effects of the initiating message and executing message |
| Dependency Set | The set of chains that originate initiating transactions where the executing transactions are valid |

Expand Down

0 comments on commit fa59525

Please sign in to comment.