-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-config.sh
More file actions
executable file
·142 lines (112 loc) · 4.1 KB
/
Copy pathupdate-config.sh
File metadata and controls
executable file
·142 lines (112 loc) · 4.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/bash
# Update config.toml with generated peer IDs and configuration
# Run this after setup-development.sh
set -e
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
# Files
CONFIG_FILE="./config.toml"
TRUST_BASE="./test-nodes/trust-base.json"
UNI_NODE_INFO="./test-nodes/uni-evm/node-info.json"
SHARD_CONF="./test-nodes/shard-conf-8_0.json"
echo -e "${BLUE}Updating config.toml with generated configuration${NC}"
echo ""
# Check if files exist
if [ ! -f "$TRUST_BASE" ]; then
echo -e "${RED}ERROR: Trust base not found at $TRUST_BASE${NC}"
echo "Please run ./setup-development.sh first"
exit 1
fi
if [ ! -f "$UNI_NODE_INFO" ]; then
echo -e "${RED}ERROR: uni-evm node-info not found at $UNI_NODE_INFO${NC}"
echo "Please run ./setup-development.sh first"
exit 1
fi
# Extract root node peer ID
ROOT_PEER_ID=$(grep -o '"nodeId": "[^"]*"' "$TRUST_BASE" | head -1 | cut -d'"' -f4)
echo "Root node peer ID: $ROOT_PEER_ID"
# Extract uni-evm peer ID
UNI_PEER_ID=$(grep -o '"nodeId": "[^"]*"' "$UNI_NODE_INFO" | head -1 | cut -d'"' -f4)
echo "uni-evm peer ID: $UNI_PEER_ID"
# Extract uni-evm signing key
UNI_SIG_KEY=$(grep -o '"signingPublicKey": "[^"]*"' "$UNI_NODE_INFO" | head -1 | cut -d'"' -f4)
echo "Signing key: $UNI_SIG_KEY"
# Extract BOTH keys from keys.json
if [ -f "./test-nodes/uni-evm/keys.json" ]; then
# Extract sigKey (for signing certification requests)
SIG_KEY=$(grep -A3 '"sigKey"' "./test-nodes/uni-evm/keys.json" | grep privateKey | cut -d'"' -f4 | sed 's/0x//')
# Extract authKey (for libp2p peer ID / node authentication)
AUTH_KEY=$(grep -A3 '"authKey"' "./test-nodes/uni-evm/keys.json" | grep privateKey | cut -d'"' -f4 | sed 's/0x//')
# Create keys directory and save both keys
mkdir -p ./keys
echo "$SIG_KEY" > ./keys/signing.key
echo "$AUTH_KEY" > ./keys/auth.key
chmod 600 ./keys/signing.key ./keys/auth.key
echo "✓ Extracted signing key to ./keys/signing.key"
echo "✓ Extracted auth key to ./keys/auth.key (for libp2p peer ID)"
fi
echo ""
# Backup config.toml
if [ -f "$CONFIG_FILE" ]; then
cp "$CONFIG_FILE" "${CONFIG_FILE}.backup"
echo -e "${GREEN}✓ Backed up config.toml to ${CONFIG_FILE}.backup${NC}"
fi
# Create updated config
cat > "$CONFIG_FILE" << EOF
# uni-evm Configuration
# Auto-generated by update-config.sh
[network]
partition_id = 8
shard_id = 128 # 0x80 (empty bitstring = default shard)
node_id = "$UNI_PEER_ID" # Auto-generated from node-info.json
chain_id = 1
genesis_file_path = "./genesis.json"
[bft_core]
# BFT Core root chain peer IDs
root_chain_peers = ["$ROOT_PEER_ID"]
# BFT Core root chain multiaddrs (full libp2p addresses)
root_chain_addrs = ["/ip4/127.0.0.1/tcp/26866/p2p/$ROOT_PEER_ID"]
# libp2p listen address for BFT Core communication
libp2p_listen_addr = "/ip4/0.0.0.0/tcp/9000"
# Path to secp256k1 signing key (hex-encoded, extracted from BFT keys - for signing certifications)
signing_key_path = "./keys/signing.key"
# Path to secp256k1 auth key (hex-encoded, extracted from BFT keys - for libp2p peer ID)
auth_key_path = "./keys/auth.key"
[prover]
# Use "exec" for testing without proofs, "sp1" for production
prover_type = "exec"
proof_format = "compressed"
[sequencer]
block_time_ms = 5000
gas_limit = 30000000
[rpc]
http_addr = "127.0.0.1"
http_port = 8545
[trust_base]
# Path to trust-base.json file (contains validator public keys)
filesystem_path = "./test-nodes/trust-base.json"
# BFT Core REST API endpoint (optional, for dynamic updates)
bft_core_endpoint = "http://localhost:25866"
# Update interval in seconds (how often to refresh trust base)
update_interval_secs = 3600
EOF
echo -e "${GREEN}✓ config.toml updated${NC}"
echo ""
echo "Configuration summary:"
echo " Partition ID: 8"
echo " Network ID: 3"
echo " Root validator: $ROOT_PEER_ID"
echo " uni-evm node: $UNI_PEER_ID"
echo ""
echo "Files to review:"
echo " - config.toml"
echo " - ./test-nodes/trust-base.json"
echo " - ./test-nodes/shard-conf-8_0.json"
echo ""
echo -e "${BLUE}Next step: Build and run uni-evm${NC}"
echo " cargo build --release"
echo " ./target/release/uni-evm"