Files
nym/tools/internal/localnet-orchestrator/migrations/01_initial_tables.sql
T
Jędrzej Stuczyński e2dd8ac743 feat: localnet v2 (#6277)
* squashing localnet-v2 commits (again)

cargo fmt

fixes to localnet purge

provide path in the error message

output args

log failed exec

print based on tty

check-prerequisites cmd

checked iptables update

basic kernel features check

enable ipv6 rules

add forwarding rules

squashing localnet-v2 commits

additional changes

propagate custom-dns flag to all run containers

remove is_mock from EcashManager

another localnet squash

unused import

chore: remove redundant testnet manager

missing impl

additional linux fixes

command to rebuild container image

wait for at least 2 blocks

additional node startup fixes

added --custom-dns flag to nym node setup

add gateway probe + wait for DKG magic file

fixed localnet down on linux

container ls

re-enable state resync

additional feature locking

macos adjustments

working nyxd startup on linux

wip linux box

wip

separating network inspect betweewn macos and linux

initial linux feature locking

moved all container commands into a single location

finally working initial node performance

squashing orchestrator commits

cleanup

fixed condition for naive rearrangement

added cache of cosmwasm contracts for speed up on subsequent runs

'down' command

refreshing described cache after nodes are bonded

nym nodes setup + wip on nym api refresh

nodes setup WIP

first pass cleanup

placeholder for nym-node setup

bypassing the dkg

further progress on nym-api setup

wip: api setup

up/down/purge placeholders

persisting contract setup data

fix contract upload by forcing amd64 container platform

wip: contracts setup4

wip: contracts setup3

wip: contracts setup2

wip: contracts setup

include network setup

init and spawn nyxd

build nyxd image in dedicated orchestrator

build nyxd image

squashed cherry-picked lp changes

Bits and bobs to make everything work

Title

MacOS setup instructions

Docker/Container localnet

* clippy

* fixes on non-unix targets

---------

Co-authored-by: durch <durch@users.noreply.github.com>
2026-03-12 14:46:00 +00:00

99 lines
3.3 KiB
SQL

/*
* Copyright 2025 - Nym Technologies SA <contact@nymtech.net>
* SPDX-License-Identifier: Apache-2.0
*/
CREATE TABLE account
(
address TEXT NOT NULL PRIMARY KEY UNIQUE,
mnemonic TEXT NOT NULL
);
CREATE TABLE nyxd
(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
rpc_endpoint TEXT NOT NULL,
master_address TEXT NOT NULL REFERENCES account (address)
);
CREATE table nym_api
(
network_id INTEGER NOT NULL PRIMARY KEY REFERENCES localnet_metadata (id),
endpoint TEXT NOT NULL
);
CREATE TABLE contract
(
-- note: I'm purposely not using contract address as primary key,
-- as you can have the same addresses for different contracts (on different instances of localnets)
-- as addressing is semi-kinda deterministic-ish
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
address TEXT NOT NULL,
admin_address TEXT NOT NULL REFERENCES account (address)
);
CREATE TABLE localnet_metadata
(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
-- human-readable name associated with the localnet (to have some unique prefix for containers)
name TEXT NOT NULL UNIQUE,
created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE localnet_contracts
(
metadata_id INTEGER NOT NULL PRIMARY KEY REFERENCES localnet_metadata (id),
mixnet_contract_id INTEGER NOT NULL REFERENCES contract (id),
vesting_contract_id INTEGER NOT NULL REFERENCES contract (id),
ecash_contract_id INTEGER NOT NULL REFERENCES contract (id),
cw3_multisig_contract_id INTEGER NOT NULL REFERENCES contract (id),
cw4_group_contract_id INTEGER NOT NULL REFERENCES contract (id),
dkg_contract_id INTEGER NOT NULL REFERENCES contract (id),
performance_contract_id INTEGER NOT NULL REFERENCES contract (id)
);
CREATE TABLE localnet_auxiliary_accounts
(
network_id INTEGER NOT NULL PRIMARY KEY REFERENCES localnet_metadata (id),
rewarder_address TEXT NOT NULL REFERENCES account (address),
ecash_holding_account_address TEXT NOT NULL REFERENCES account (address)
);
CREATE TABLE localnet
(
metadata_id INTEGER NOT NULL PRIMARY KEY REFERENCES localnet_metadata (id),
nyxd_id INTEGER NOT NULL REFERENCES nyxd (id)
);
-- keep it separate to more easily support testing having multiple network monitors
CREATE TABLE authorised_network_monitor
(
address TEXT NOT NULL PRIMARY KEY REFERENCES account (address),
network_id INTEGER NOT NULL REFERENCES localnet_metadata (id)
);
CREATE TABLE metadata
(
id INTEGER PRIMARY KEY CHECK (id = 0),
latest_network_id INTEGER REFERENCES localnet_metadata (id),
latest_nyxd_id INTEGER REFERENCES nyxd (id)
);
CREATE TABLE nym_node
(
node_id INTEGER NOT NULL,
identity_key TEXT NOT NULL PRIMARY KEY,
private_identity_key TEXT NOT NULL,
network_id INTEGER NOT NULL REFERENCES localnet_metadata (id),
owner_address TEXT NOT NULL REFERENCES account (address),
gateway BOOL NOT NULL
);
INSERT OR IGNORE INTO metadata(id)
VALUES (0);