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

WIP Move Host DB to SQL Impl #1804

Merged
merged 126 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
9c00f41
initial schema proposal
badgersrus Feb 9, 2024
ea6e519
remove empty file
badgersrus Feb 9, 2024
7a60a0b
Update host_db_requirements.md
badgersrus Feb 12, 2024
c99f19e
use sqlite definitions
badgersrus Feb 12, 2024
0f045ef
Merge branch 'main' of https://github.com/ten-protocol/go-ten into wi…
badgersrus Feb 12, 2024
44f2775
use sqlite definitions
badgersrus Feb 12, 2024
35d6488
Merge branch 'main' of https://github.com/ten-protocol/go-ten into wi…
badgersrus Feb 15, 2024
9cd7b10
remove accidental changes
badgersrus Feb 15, 2024
084dec0
Update design doc
badgersrus Feb 15, 2024
cb315c1
split out testnet features and add db choice
badgersrus Feb 16, 2024
1cc3481
stashing
badgersrus Feb 16, 2024
f5c7763
stashing initial
badgersrus Feb 20, 2024
4baf5e0
Add total tx count
badgersrus Feb 20, 2024
07d5613
stashing
badgersrus Feb 21, 2024
7bf2a56
Merge branch 'main' of https://github.com/ten-protocol/go-ten into wi…
badgersrus Feb 21, 2024
6171b5b
fix some batch tests
badgersrus Feb 21, 2024
57f433f
fix tx truncation
badgersrus Feb 25, 2024
af79470
All existing tests passing
badgersrus Feb 26, 2024
353b965
stashing for a new branch
badgersrus Feb 26, 2024
b0b8fc2
Merge branch 'willh/enclave-api-get-batch-start-seq' of https://githu…
badgersrus Feb 28, 2024
1fb3ac1
Merge branch 'main' of https://github.com/ten-protocol/go-ten into wi…
badgersrus Feb 29, 2024
77da5b0
GetRollupListing pagination working
badgersrus Mar 1, 2024
d711cee
Merge branch 'main' of https://github.com/ten-protocol/go-ten into wi…
badgersrus Mar 4, 2024
2dd403a
stashing for sanity
badgersrus Mar 4, 2024
523c22d
fix unit tests
badgersrus Mar 6, 2024
a371c34
fix rollups unit test
badgersrus Mar 6, 2024
2ff1e27
stashing before fetch
badgersrus Mar 7, 2024
64f11bc
Merge branch 'main' of https://github.com/ten-protocol/go-ten into wi…
badgersrus Mar 7, 2024
7009263
stashing
badgersrus Mar 7, 2024
14035d2
add transaction handling and AddBlock - might not be needed
badgersrus Mar 7, 2024
fd171c6
stashing
badgersrus Mar 8, 2024
082d8ba
desparation logging
badgersrus Mar 8, 2024
bb48e04
tweak hash truncation to avoid collisions
badgersrus Mar 11, 2024
3dcdb04
stashing for matt
badgersrus Mar 11, 2024
27e7bb4
add host prefix to DB path
badgersrus Mar 11, 2024
b592090
stashing
badgersrus Mar 12, 2024
8385747
fix database prefix
badgersrus Mar 12, 2024
27d497b
fix lower bound for get batch listing
badgersrus Mar 13, 2024
2abf402
stashing
badgersrus Mar 13, 2024
0c0ae3c
stashing
badgersrus Mar 13, 2024
7a8e8a3
change schema to store extBatch blob
badgersrus Mar 13, 2024
bb7b7f7
sim tests passing - THANK YE JESUS
badgersrus Mar 13, 2024
1963052
fix some tenscan endpoints
badgersrus Mar 14, 2024
a6928ac
fix all tenscan tests
badgersrus Mar 14, 2024
8466b55
fix broken sim
badgersrus Mar 14, 2024
27e4177
Add backwards compatible get batch listing endpoint
badgersrus Mar 14, 2024
bdb7bf5
stashing mariadb impl
badgersrus Mar 15, 2024
8932543
Merge branch 'main' of https://github.com/ten-protocol/go-ten into wi…
badgersrus Mar 18, 2024
b11871e
update sql script path
badgersrus Mar 18, 2024
eb579b5
support both sqlite and mariadb insert queries
badgersrus Mar 18, 2024
2d46210
set db name
badgersrus Mar 18, 2024
80b9e0e
update in mem obscuro client with rpc calls
badgersrus Mar 18, 2024
d4f7c9a
fix unit tests
badgersrus Mar 19, 2024
9127465
fix full network test with maria db
badgersrus Mar 19, 2024
aa44091
remove test code
badgersrus Mar 19, 2024
4d40e15
gofumpt
badgersrus Mar 19, 2024
cc72d3a
Merge branch 'main' into will/sql-host-impl
badgersrus Mar 19, 2024
23155af
lint
badgersrus Mar 19, 2024
44d89ce
Merge branch 'will/sql-host-impl' of https://github.com/ten-protocol/…
badgersrus Mar 19, 2024
167ef9f
lint
badgersrus Mar 19, 2024
f60fe0c
fix getbatchnumber
badgersrus Mar 19, 2024
d9a3680
lint
badgersrus Mar 19, 2024
6099642
lint
badgersrus Mar 19, 2024
dfbc53a
lint
badgersrus Mar 19, 2024
4ddd199
lint
badgersrus Mar 19, 2024
0caf4ed
switch sim test to in mem for host
badgersrus Mar 20, 2024
554fc12
unused field
badgersrus Mar 20, 2024
adcd4c9
lint
badgersrus Mar 21, 2024
d1b3c52
tidy up
badgersrus Mar 21, 2024
3036757
Merge branch 'main' into will/sql-host-impl
badgersrus Mar 21, 2024
75697e6
fix adding of blocks
badgersrus Mar 21, 2024
38e5961
Merge branch 'will/sql-host-impl' of https://github.com/ten-protocol/…
badgersrus Mar 21, 2024
cb9825a
fix merge conflict
badgersrus Mar 21, 2024
ff69bb2
fml
badgersrus Mar 21, 2024
2dfcd8e
remove hash truncation'
badgersrus Mar 21, 2024
02da2b5
update design doc with latest schema
badgersrus Mar 21, 2024
80dca88
temporarily remove block data from host db
badgersrus Mar 27, 2024
bc2b6b8
add block for backwards compatibility with tenscan
badgersrus Mar 28, 2024
6422dbe
storage wrapper around host db calls
badgersrus Mar 28, 2024
567bee0
add sql statements to interface
badgersrus Apr 2, 2024
4fb91a4
stashing before I lose my mind
badgersrus Apr 2, 2024
3b6a71a
working postgres finally
badgersrus Apr 3, 2024
6f2b557
fix tests with new dbTx
badgersrus Apr 3, 2024
83aa1ff
full network test passing postrges
badgersrus Apr 3, 2024
1a885ab
Merge latest from main
badgersrus Apr 3, 2024
df4ec7e
fix merge bodge
badgersrus Apr 3, 2024
a9245a9
turn sqlite back on
badgersrus Apr 4, 2024
199111a
Merge branch 'main' into will/sql-host-impl
badgersrus Apr 4, 2024
f30e5e3
rename all mariaDBHost > postgresDBHost & lint
badgersrus Apr 4, 2024
9738f9e
Merge branch 'will/sql-host-impl' of https://github.com/ten-protocol/…
badgersrus Apr 4, 2024
3cdda1b
rename all mariaDBHost > postgresDBHost & lint
badgersrus Apr 4, 2024
558a57a
lint
badgersrus Apr 4, 2024
708040a
lint
badgersrus Apr 4, 2024
2f7bbe3
testing postgres
badgersrus Apr 5, 2024
b857949
Remove crud
badgersrus Apr 5, 2024
5c911f3
update db URL & rollup test
badgersrus Apr 5, 2024
393b0a3
Switch mariaDB flag in docker container
badgersrus Apr 8, 2024
0de88d3
full network test running against deployed dev DB
badgersrus Apr 9, 2024
c90be15
remove test script
badgersrus Apr 9, 2024
8a34f6a
use storage interface for scan API
badgersrus Apr 9, 2024
9e51d96
remove println
badgersrus Apr 9, 2024
ae5d262
get rid of redundant DB method
badgersrus Apr 10, 2024
8bb960a
Merge branch 'main' of https://github.com/ten-protocol/go-ten into wi…
badgersrus Apr 10, 2024
931a13f
switch filepath to sqlFile
badgersrus Apr 10, 2024
1295209
try to fix docker filepath fuckery
badgersrus Apr 10, 2024
2ba4b62
tudor suggested changes
badgersrus Apr 10, 2024
270e3cd
gah
badgersrus Apr 10, 2024
644afa7
shorten file name
badgersrus Apr 10, 2024
d7305c7
format
badgersrus Apr 10, 2024
1f6c631
wrap dbTx with sql.Tx
badgersrus Apr 10, 2024
9d5c40a
try gateway migration code
badgersrus Apr 10, 2024
730cc5a
move gateway mig code to common module
badgersrus Apr 10, 2024
12ea132
manually copy postgres path into docker container path
badgersrus Apr 10, 2024
98b8a85
Merge branch 'will/sql-tx-test' into will/sql-host-impl
badgersrus Apr 10, 2024
7f78c79
refactor tests
badgersrus Apr 10, 2024
6e3bd3b
remove unnessecary BeginTx function
badgersrus Apr 10, 2024
ad5bbec
fix dbtx
badgersrus Apr 10, 2024
0578d00
reshuffle & add rollbacks
badgersrus Apr 10, 2024
0c30efe
remove unnessecary rollback calls
badgersrus Apr 10, 2024
92d7c49
add write to tests
badgersrus Apr 10, 2024
00a6844
cosmetic changes
badgersrus Apr 11, 2024
3898ba2
feckin lint
badgersrus Apr 11, 2024
c793514
Merge branch 'main' of https://github.com/ten-protocol/go-ten into wi…
badgersrus Apr 11, 2024
835d410
tenscan api names
badgersrus Apr 11, 2024
f9871d0
fix in mem test
badgersrus Apr 11, 2024
330e59d
temp renaming of new api path
badgersrus Apr 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/manual-deploy-testnet-l2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ jobs:
-max_batch_interval=${{ vars.L2_MAX_BATCH_INTERVAL }} \
-rollup_interval=${{ vars.L2_ROLLUP_INTERVAL }} \
-l1_chain_id=${{ vars.L1_CHAIN_ID }} \
-postgres_db_host=postgres://tenuser:${{ secrets.TEN_POSTGRES_USER_PWD }}@postgres-ten-${{ github.event.inputs.testnet_type }}.postgres.database.azure.com:5432/ \
start'

check-obscuro-is-healthy:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ root
│ │ ├── <a href="./go/ethadapter/erc20contractlib">erc20contractlib</a>: Understand ERC20 transactions.
│ │ └── <a href="./go/ethadapter/mgmtcontractlib">mgmtcontractlib</a>: Understand Ten Management contrract transactions.
│ ├── <a href="./go/host">host</a>: The standalone host process.
│ │ ├── <a href="./go/host/db">db</a>: The host's database.
│ │ ├── <a href="go/host/storage/db">db</a>: The host's database.
│ │ ├── <a href="./go/host/hostrunner">hostrunner</a>: The entry point.
│ │ ├── <a href="./go/host/main">main</a>: Main
│ │ ├── <a href="./go/host/node">node</a>: The host implementation.
Expand Down
154 changes: 154 additions & 0 deletions design/host/host_db_requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Moving Host DB to SQL

The current implementation uses the `ethdb.KeyValueStore` which provides fast access but is not sufficient for the
querying capabilities required by Tenscan. We want to move to an SQL implementation similar to what the Enclave uses.

## Current Storage
### Schema Keys
```go
var (
blockHeaderPrefix = []byte("b")
blockNumberHeaderPrefix = []byte("bnh")
batchHeaderPrefix = []byte("ba")
batchHashPrefix = []byte("bh")
batchNumberPrefix = []byte("bn")
batchPrefix = []byte("bp")
batchHashForSeqNoPrefix = []byte("bs")
batchTxHashesPrefix = []byte("bt")
headBatch = []byte("hb")
totalTransactionsKey = []byte("t")
rollupHeaderPrefix = []byte("rh")
rollupHeaderBlockPrefix = []byte("rhb")
tipRollupHash = []byte("tr")
blockHeadedAtTip = []byte("bht")
)
```
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 | "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
* 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
* 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
* 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

### Testnet-Only Features
#### Currently supported
* Copy the encrypted TX blob to a new page and decrypt there

#### 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

There are some considerations here around the behaviour of tenscan for testnet vs mainnet. Because we are able to decrypt
the encrypted blob on testnet we are able to retrieve the number of transactions but on mainnet this wont be possible so
we need to store the TxCount in

### Rollup
```sql
create table if not exists rollup_host
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
hash binary(16) NOT NULL UNIQUE,
start_seq int NOT NULL,
end_seq int NOT NULL,
time_stamp int NOT NULL,
ext_rollup blob NOT NULL,
compression_block binary(32) NOT NULL
);

create index IDX_ROLLUP_HASH_HOST on rollup_host (hash);
create index IDX_ROLLUP_PROOF_HOST on rollup_host (compression_block);
create index IDX_ROLLUP_SEQ_HOST on rollup_host (start_seq, end_seq);
```

Calculating the `L1BlockHeight` as done in `calculateL1HeightsFromDeltas` will be quite computationally expensive so we
can just order them by `end_seq`.

### Batch
Storing the encoded ext batch so that we can provide rich data to the UI including gas, receipt, cross-chain hash etc.
```sql
create table if not exists batch_host
(
sequence int primary key,
full_hash binary(32) NOT NULL,
hash binary(16) NOT NULL unique,
height int NOT NULL,
ext_batch mediumblob NOT NULL
);

create index IDX_BATCH_HEIGHT_HOST on batch_host (height);

```

### Transactions

We need to store these separately for efficient lookup of the batch by tx hash and vice versa.

Because we are able to decrypt the encrypted blob on testnet we are able to retrieve the number of transactions that way
but on mainnet this won't be possible, so we need to store the `tx_count` in this table. There is a plan to remove
`ExtBatch.TxHashes` and expose a new Enclave API to retrieve this.

```sql
create table if not exists transactions_host
(
hash binary(32) primary key,
b_sequence int REFERENCES batch_host
);

create table if not exists transaction_count
(
id int NOT NULL primary key,
total int NOT NULL
);

```

## 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.

## Cross Chain Messages

We want to display L2 > L1 and L1 > L2 transaction data. We will expose an API to retrieve these and the implementation
for retrieving the data will either be via subscriptions to the events API or we will store them in the database. TBC
6 changes: 5 additions & 1 deletion dockerfiles/host.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ FROM alpine:3.18
# Copy over just the binary from the previous build stage into this one.
COPY --from=build-host \
/home/obscuro/go-obscuro/go/host/main /home/obscuro/go-obscuro/go/host/main


# Workaround to fix postges filepath issue
COPY --from=build-host \
/home/obscuro/go-obscuro/go/host/storage/init/postgres /home/obscuro/go-obscuro/go/host/storage/init/postgres

WORKDIR /home/obscuro/go-obscuro/go/host/main

# expose the http and the ws ports to the host
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ require (
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
Expand Down
4 changes: 2 additions & 2 deletions 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 enclave API
TxHashes []TxHash // The hashes of the transactions included in the batch.
EncryptedTxBlob EncryptedTransactions
hash atomic.Value
Expand All @@ -32,7 +32,7 @@ func (b *ExtBatch) Hash() L2BatchHash {
func (b *ExtBatch) Encoded() ([]byte, error) {
return rlp.EncodeToBytes(b)
}

func (b *ExtBatch) SeqNo() *big.Int { return new(big.Int).Set(b.Header.SequencerOrderNo) }
func DecodeExtBatch(encoded []byte) (*ExtBatch, error) {
var batch ExtBatch
if err := rlp.DecodeBytes(encoded, &batch); err != nil {
Expand Down
5 changes: 2 additions & 3 deletions go/common/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ten-protocol/go-ten/go/common"
"github.com/ten-protocol/go-ten/go/config"
"github.com/ten-protocol/go-ten/go/host/db"
"github.com/ten-protocol/go-ten/go/host/storage"
"github.com/ten-protocol/go-ten/go/responses"
"github.com/ten-protocol/go-ten/lib/gethfork/rpc"
)

// Host is the half of the Obscuro node that lives outside the enclave.
type Host interface {
Config() *config.HostConfig
DB() *db.DB
EnclaveClient() common.Enclave

Storage() storage.Storage
// Start initializes the main loop of the host.
Start() error
// SubmitAndBroadcastTx submits an encrypted transaction to the enclave, and broadcasts it to the other hosts on the network.
Expand Down
31 changes: 31 additions & 0 deletions go/common/query_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,21 @@ type BatchListingResponse struct {
Total uint64
}

type BatchListingResponseDeprecated struct {
BatchesData []PublicBatchDeprecated
Total uint64
}

type BlockListingResponse struct {
BlocksData []PublicBlock
Total uint64
}

type RollupListingResponse struct {
RollupsData []PublicRollup
Total uint64
}

type PublicTransaction struct {
TransactionHash TxHash
BatchHeight *big.Int
Expand All @@ -38,10 +48,31 @@ type PublicTransaction struct {
}

type PublicBatch struct {
SequencerOrderNo *big.Int `json:"sequence"`
Hash []byte `json:"hash"`
FullHash common.Hash `json:"fullHash"`
Height *big.Int `json:"height"`
TxCount *big.Int `json:"txCount"`
Header *BatchHeader `json:"header"`
EncryptedTxBlob EncryptedTransactions `json:"encryptedTxBlob"`
}

// TODO (@will) remove when tenscan UI has been updated
type PublicBatchDeprecated struct {
BatchHeader
TxHashes []TxHash `json:"txHashes"`
}

type PublicRollup struct {
ID *big.Int
Hash []byte
FirstSeq *big.Int
LastSeq *big.Int
Timestamp uint64
Header *RollupHeader
L1Hash []byte
}

type PublicBlock struct {
BlockHeader types.Header `json:"blockHeader"`
RollupHash common.Hash `json:"rollupHash"`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package database
package storage

import (
"database/sql"
Expand Down
13 changes: 8 additions & 5 deletions go/config/host_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ type HostInputConfig struct {
// UseInMemoryDB sets whether the host should use in-memory or persistent storage
UseInMemoryDB bool

// LevelDBPath path for the levelDB persistence dir (can be empty if a throwaway file in /tmp/ is acceptable, or if using InMemory DB)
LevelDBPath string
// PostgresDBHost db url for connecting to Postgres host database
PostgresDBHost string

// DebugNamespaceEnabled enables the debug namespace handler in the host rpc server
DebugNamespaceEnabled bool
Expand Down Expand Up @@ -132,7 +132,7 @@ func (p HostInputConfig) ToHostConfig() *HostConfig {
MetricsEnabled: p.MetricsEnabled,
MetricsHTTPPort: p.MetricsHTTPPort,
UseInMemoryDB: p.UseInMemoryDB,
LevelDBPath: p.LevelDBPath,
PostgresDBHost: p.PostgresDBHost,
DebugNamespaceEnabled: p.DebugNamespaceEnabled,
BatchInterval: p.BatchInterval,
MaxBatchInterval: p.MaxBatchInterval,
Expand Down Expand Up @@ -191,8 +191,11 @@ type HostConfig struct {
LogPath string
// Whether the host should use in-memory or persistent storage
UseInMemoryDB bool
// filepath for the levelDB persistence dir (can be empty if a throwaway file in /tmp/ is acceptable, or if using InMemory DB)
LevelDBPath string
// Host address for Postgres DB instance (can be empty if using InMemory DB or if attestation is disabled)
PostgresDBHost string
// filepath for the sqlite DB persistence file (can be empty if a throwaway file in /tmp/ is acceptable or
// if using InMemory DB)
SqliteDBPath string

//////
// NODE NETWORKING
Expand Down
Loading
Loading