Skip to content

Commit

Permalink
split out testnet features and add db choice
Browse files Browse the repository at this point in the history
  • Loading branch information
badgersrus committed Feb 16, 2024
1 parent 084dec0 commit cb315c1
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 24 deletions.
66 changes: 43 additions & 23 deletions design/host/host_db_requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,41 +26,49 @@ var (
Some of the schema keys are dummy keys for entries where we only have one entry that is updated such as totals or tip
data. The rest of the schema keys are used as prefixes appended with the `byte[]` representation of the key.

| Data Type | Description | Schema | Key | Value (Encoded) |
|------------------|---------------------------------|-----------|------------------------------|--------------------|
| **Batch** | Batch hash to headers | ba | BatchHeader.Hash() | BatchHeader |
| **Batch** | Batch hash to ExtBatch | bp | ExtBatch.Hash() | ExtBatch |
| **Batch** | Batch hash to TX hashes | bt | ExtBatch.Hash() | ExtBatch.TxHashes |
| **Batch** | Batch number to batch hash | bh | BatchHeader.Number | BatchHeader.Hash() |
| **Batch** | Batch seq no to batch hash | bs | BatchHeader.SequencerOrderNo | BatchHeader.Hash() |
| **Batch** | TX hash to batch number | bn | ExtBatch.TxHashes[i] | BatchHeader.Number |
| **Batch** | Head Batch | hb | "hb" | ExtBatch.Hash() |
| **Block** | L1 Block hash to block header | b | Header.Hash() | Header |
| **Block** | L1 Block height to block header | bnh | Header.Number | Header |
| **Block** | Latest Block | bht | "bht" | Header.Hash() |
| **Rollup** | Rollup hash to header | rh | RollupHeader.Hash() | RollupHeader |
| **Rollup** | L1 Block hash to rollup header | rhb | L1Block.Hash() | RollupHeader |
| **Rollup** | Tip rollup header | | "tr" | RollupHeader |
| **Transactions** | Total number of transactions | | "t" | Int |
| Data Type | Description | Schema | Key | Value (Encoded) |
|------------------|---------------------------------|--------|------------------------------|--------------------|
| **Batch** | Batch hash to headers | ba | BatchHeader.Hash() | BatchHeader |
| **Batch** | Batch hash to ExtBatch | bp | ExtBatch.Hash() | ExtBatch |
| **Batch** | Batch hash to TX hashes | bt | ExtBatch.Hash() | ExtBatch.TxHashes |
| **Batch** | Batch number to batch hash | bh | BatchHeader.Number | BatchHeader.Hash() |
| **Batch** | Batch seq no to batch hash | bs | BatchHeader.SequencerOrderNo | BatchHeader.Hash() |
| **Batch** | TX hash to batch number | bn | ExtBatch.TxHashes[i] | BatchHeader.Number |
| **Batch** | Head Batch | hb | "hb" | ExtBatch.Hash() |
| **Block** | L1 Block hash to block header | b | Header.Hash() | Header |
| **Block** | L1 Block height to block header | bnh | Header.Number | Header |
| **Block** | Latest Block | bht | "bht" | Header.Hash() |
| **Rollup** | Rollup hash to header | rh | RollupHeader.Hash() | RollupHeader |
| **Rollup** | L1 Block hash to rollup header | rhb | L1Block.Hash() | RollupHeader |
| **Rollup** | Tip rollup header | tr | "tr" | RollupHeader |
| **Transactions** | Total number of transactions | t | "t" | Int |

## Tenscan Functionality Requirements

### Mainnet Features
#### Currently supported
* Return the list of batches in descending order
* Return the list of transactions within the batch (once decrypted)
* Return the list of transactions in descending order
* Decrypt the encrypted TX blob
* View details within the batch (BatchHeader and ExtBatch)
* Return the number of transactions within the batch
* Return the list of transactions in descending order

### Not currently supported
* Return a list of rollups in descending order
* Return a list of rollups in descending order
* View details of the rollup (probably needs to be ExtBatch for user )
* Navigate to the L1 block on etherscan from the rollup
* Return the list of batches within the rollup
* Return the list of batches within the rollup
* Navigate from the transaction to the batch it was included in
* Navigate from the batch to the rollup that it was included in
* TODO Cross chain messaging - Arbiscan shows L1>L2 and L2>L1

### TODO Cross chain messaging data & mainnet vs testnet
### Testnet-Only Features
#### Currently supported
* Copy the encrypted TX blob to a new page and decrypt there

Will add these after quick in person meeting next week
#### Not currently supported
* From the batch you should be able to optionally decrypt the transactions within the batch
* Navigate into the transaction details from the decrypted transaction
* We want to be able to navigate up the chain from TX to batch to rollup

## SQL Schema

Expand Down Expand Up @@ -155,3 +163,15 @@ SELECT r.hash
FROM rollup r
WHERE ? BETWEEN r.start_seq AND r.end_seq;
```

## Database Choice

The obvious choice is MariaDB as this is what is used by the gateway so we would have consistency across the stack. It
would make deployment simpler as the scripts are already there. Main benefits of MariaDB:

* Offer performance improvements through the use of aria storage engine which is not available through MySQL
* Strong security focus with RBAC and data-at-rest encryption
* Supports a large number of concurrent connections

Postgres would be the obvious other alternative but given it is favoured for advanced data types, complex queries and
geospatial capabilities, it doesn't offer us any benefit for this use case over MariaDB.
2 changes: 1 addition & 1 deletion go/common/batches.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
// todo (#718) - expand this structure to contain the required fields.
type ExtBatch struct {
Header *BatchHeader
// todo - remove
// todo - remove and replace with
TxHashes []TxHash // The hashes of the transactions included in the batch.
EncryptedTxBlob EncryptedTransactions
hash atomic.Value
Expand Down

0 comments on commit cb315c1

Please sign in to comment.