Skip to content

Commit

Permalink
feat: Prepare configuration for secondary bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinTrinque committed Feb 21, 2024
1 parent 948a61c commit 365fe16
Show file tree
Hide file tree
Showing 31 changed files with 944 additions and 999 deletions.
342 changes: 14 additions & 328 deletions config.md

Large diffs are not rendered by default.

24 changes: 13 additions & 11 deletions config/ethereum_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ note: |
example:
type: hcl
name: Setup for local Ganache
value: |
ethereum {
chain_id = "1440"
network_id = "1441"
endpoint = "http://127.0.0.1:8545/"
}
type: hcl
name: Setup for local Ganache
value: |
ethereum {
chain_id = "1440"
network_id = "1441"
endpoint = "http://127.0.0.1:8545/"
secondary_endpoint = "http://127.0.0.1:8545/"
}
*/
type EthereumConfig struct {
ChainID string `hcl:"chain_id"`
NetworkID string `hcl:"network_id"`
Endpoint string `hcl:"endpoint"`
ChainID string `hcl:"chain_id"`
NetworkID string `hcl:"network_id"`
Endpoint string `hcl:"endpoint"`
SecondaryEndpoint string `hcl:"secondary_endpoint"`
}
3 changes: 3 additions & 0 deletions generator/vega/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"code.vegaprotocol.io/shared/paths"
vgconfig "code.vegaprotocol.io/vega/core/config"

"code.vegaprotocol.io/vegacapsule/types"

"github.com/BurntSushi/toml"
Expand All @@ -21,6 +22,7 @@ type ConfigTemplateContext struct {
VegaNodePrefix string
DataNodePrefix string
ETHEndpoint string
SecondaryETHEndpoint string
NodeMode string
FaucetPublicKey string
NodeNumber int
Expand All @@ -43,6 +45,7 @@ func (vg ConfigGenerator) TemplateConfig(ns types.NodeSet, fc *types.Faucet, con
VegaNodePrefix: vg.conf.VegaNodePrefix,
DataNodePrefix: vg.conf.DataNodePrefix,
ETHEndpoint: vg.conf.Network.Ethereum.Endpoint,
SecondaryETHEndpoint: vg.conf.Network.Ethereum.SecondaryEndpoint,
NodeMode: ns.Mode,
NodeNumber: ns.Index,
NodeSet: ns,
Expand Down
87 changes: 53 additions & 34 deletions net_confs/config.hcl
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
vega_binary_path = "vega"

network "testnet" {
ethereum {
chain_id = "1440"
network_id = "1441"
endpoint = "ws://127.0.0.1:8545/"
ethereum {
chain_id = "1440"
network_id = "1441"
endpoint = "ws://127.0.0.1:8545/"
secondary_endpoint = "ws://127.0.0.1:8546/"
}

faucet "faucet-1" {
wallet_pass = "f4uc3tw4ll3t-v3g4-p4ssphr4e3"
wallet_pass = "f4uc3tw4ll3t-v3g4-p4ssphr4e3"

template = <<-EOT
template = <<-EOT
[Node]
Port = 3002
IP = "127.0.0.1"
Expand All @@ -35,8 +36,8 @@ EOT
pre_start {
docker_service "ganache-1" {
image = "vegaprotocol/ganache:latest"
cmd = "ganache-cli"
args = [
cmd = "ganache-cli"
args = [
"--blockTime", "1",
"--chainId", "1440",
"--networkId", "1441",
Expand All @@ -47,68 +48,86 @@ EOT
]
static_port {
value = 8545
to = 8545
to = 8545
}
auth_soft_fail = true
}
docker_service "ganache-2" {
image = "vegaprotocol/ganache:latest"
cmd = "ganache-cli"
args = [
"--blockTime", "1",
"--chainId", "1440",
"--networkId", "1441",
"-h", "0.0.0.0",
"-p", "8546",
"-m", "fish tube jaguar bus lazy alley toast mule typical capable exhibit vote",
"--db", "/app/ganache-db",
]
static_port {
value = 8546
to = 8546
}
auth_soft_fail = true
}
docker_service "postgres-1" {
image = "vegaprotocol/timescaledb:2.8.0-pg14"
cmd = "postgres"
args = []
env = {
POSTGRES_USER="vega"
POSTGRES_PASSWORD="vega"
POSTGRES_DBS="vega0,vega1,vega2,vega3,vega4,vega5,vega6,vega7,vega8,vega9,vega10,vega11,vega12,vega13,vega14,vega15,vega16,vega17,vega18,vega19,vega20,vega21,vega22,vega23,vega24,vega25"
cmd = "postgres"
args = []
env = {
POSTGRES_USER = "vega"
POSTGRES_PASSWORD = "vega"
POSTGRES_DBS = "vega0,vega1,vega2,vega3,vega4,vega5,vega6,vega7,vega8,vega9,vega10,vega11,vega12,vega13,vega14,vega15,vega16,vega17,vega18,vega19,vega20,vega21,vega22,vega23,vega24,vega25"
}

static_port {
value = 5232
to = 5432
to = 5432
}
resources {
cpu = 600
cpu = 600
memory = 900
}

volume_mounts = ["${network_home_path}:${network_home_path}"]

auth_soft_fail = true
}
}
genesis_template_file = "./genesis.tmpl"

genesis_template_file = "./genesis.tmpl"
smart_contracts_addresses_file = "./public_smart_contracts_addresses.json"

node_set "validators" {
count = 2
mode = "validator"
node_wallet_pass = "n0d3w4ll3t-p4ssphr4e3"
vega_wallet_pass = "w4ll3t-p4ssphr4e3"
mode = "validator"

node_wallet_pass = "n0d3w4ll3t-p4ssphr4e3"
vega_wallet_pass = "w4ll3t-p4ssphr4e3"
ethereum_wallet_pass = "ch41nw4ll3t-3th3r3um-p4ssphr4e3"

config_templates {
vega_file = "./node_set_templates/default/vega_validators.tmpl"
vega_file = "./node_set_templates/default/vega_validators.tmpl"
tendermint_file = "./node_set_templates/default/tendermint_validators.tmpl"
}
}

node_set "full" {
count = 1
mode = "full"
count = 1
mode = "full"
use_data_node = true

pre_start_probe {
postgres {
connection = "user=vega dbname=vega{{ .NodeNumber }} password=vega port=5232 sslmode=disable"
query = "select 10 + 10"
query = "select 10 + 10"
}
}

config_templates {
vega_file = "./node_set_templates/default/vega_full.tmpl"
vega_file = "./node_set_templates/default/vega_full.tmpl"
tendermint_file = "./node_set_templates/default/tendermint_full.tmpl"
data_node_file = "./node_set_templates/default/data_node_full_external_postgres.tmpl"
data_node_file = "./node_set_templates/default/data_node_full_external_postgres.tmpl"
}
}
}
91 changes: 56 additions & 35 deletions net_confs/config_checkpoint.hcl
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
vega_binary_path = "vega"

network "testnet" {
ethereum {
chain_id = "1440"
network_id = "1441"
endpoint = "ws://127.0.0.1:8545/"
ethereum {
chain_id = "1440"
network_id = "1441"
endpoint = "ws://127.0.0.1:8545/"
secondary_endpoint = "ws://127.0.0.1:8546/"
}

faucet "faucet-1" {
wallet_pass = "f4uc3tw4ll3t-v3g4-p4ssphr4e3"
wallet_pass = "f4uc3tw4ll3t-v3g4-p4ssphr4e3"

template = <<-EOT
template = <<-EOT
[Node]
Port = 3002
IP = "127.0.0.1"
Expand All @@ -35,8 +36,8 @@ EOT
pre_start {
docker_service "ganache-1" {
image = "vegaprotocol/ganache:latest"
cmd = "ganache-cli"
args = [
cmd = "ganache-cli"
args = [
"--blockTime", "1",
"--chainId", "1440",
"--networkId", "1441",
Expand All @@ -45,16 +46,34 @@ EOT
"-m", "ozone access unlock valid olympic save include omit supply green clown session",
"--db", "/app/ganache-db",
]
static_port {
static_port {
value = 8545
to = 8545
to = 8545
}
auth_soft_fail = true
}
docker_service "ganache-2" {
image = "vegaprotocol/ganache:latest"
cmd = "ganache-cli"
args = [
"--blockTime", "1",
"--chainId", "1440",
"--networkId", "1441",
"-h", "0.0.0.0",
"-p", "8546",
"-m", "fish tube jaguar bus lazy alley toast mule typical capable exhibit vote",
"--db", "/app/ganache-db",
]
static_port {
value = 8546
to = 8546
}
auth_soft_fail = true
}
}

smart_contracts_addresses_file = "./public_smart_contracts_addresses.json"
genesis_template = <<EOH
genesis_template = <<EOH
{
"app_state": {
"checkpoint": {
Expand Down Expand Up @@ -288,17 +307,17 @@ EOT
EOH

node_set "validators" {
count = 2
mode = "validator"
node_wallet_pass = "n0d3w4ll3t-p4ssphr4e3"
vega_wallet_pass = "w4ll3t-p4ssphr4e3"
count = 2
mode = "validator"
node_wallet_pass = "n0d3w4ll3t-p4ssphr4e3"
vega_wallet_pass = "w4ll3t-p4ssphr4e3"
ethereum_wallet_pass = "ch41nw4ll3t-3th3r3um-p4ssphr4e3"

config_templates {

// ============================
// ===== VegaNode Config ======
// ============================
// ============================
// ===== VegaNode Config ======
// ============================

vega = <<-EOT
[Admin]
Expand Down Expand Up @@ -326,18 +345,19 @@ EOT
[Ethereum]
RPCEndpoint = "{{.ETHEndpoint}}"
SecondaryRPCEndpoint = "{{.SecondaryETHEndpoint}}"
[Processor]
[Processor.Ratelimit]
Requests = 10000
PerNBlocks = 1
EOT

// ============================
// ==== Tendermint Config =====
// ============================
// ============================
// ==== Tendermint Config =====
// ============================

tendermint = <<-EOT
tendermint = <<-EOT
log_level = "info"
proxy_app = "tcp://127.0.0.1:266{{.NodeNumber}}8"
Expand Down Expand Up @@ -371,15 +391,15 @@ EOT
}

node_set "full" {
count = 1
mode = "full"
use_data_node = true
count = 1
mode = "full"
use_data_node = true

config_templates {

// ============================
// ===== VegaNode Config ======
// ============================
// ============================
// ===== VegaNode Config ======
// ============================

vega = <<-EOT
[Admin]
Expand All @@ -404,6 +424,7 @@ EOT
[Ethereum]
RPCEndpoint = "{{.ETHEndpoint}}"
SecondaryRPCEndpoint = "{{.SecondaryETHEndpoint}}"
[Processor]
[Processor.Ratelimit]
Expand All @@ -416,9 +437,9 @@ EOT
Enabled = true
EOT

// ============================
// ===== DataNode Config ======
// ============================
// ============================
// ===== DataNode Config ======
// ============================

data_node = <<-EOT
Expand Down Expand Up @@ -456,11 +477,11 @@ GatewayEnabled = true
EOT

// ============================
// ==== Tendermint Config =====
// ============================
// ============================
// ==== Tendermint Config =====
// ============================

tendermint = <<-EOT
tendermint = <<-EOT
log_level = "info"
proxy_app = "tcp://127.0.0.1:266{{.NodeNumber}}8"
Expand Down
Loading

0 comments on commit 365fe16

Please sign in to comment.