Skip to content

Commit 6e7373f

Browse files
committed
tests.TestP2PDistribution seems to be working in basic terms
1 parent be1df66 commit 6e7373f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+6467
-2264
lines changed

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,12 @@ else
7777
rm -f $(BIN_NAME)
7878
endif
7979

80+
# Cap'n Proto code generation
81+
.PHONY: capnp
82+
capnp: ## Generate Go code from Cap'n Proto schemas
83+
@echo "Generating Cap'n Proto code..."
84+
@export PATH=$$PATH:$$HOME/go/bin && \
85+
capnp compile -I `go list -m -f '{{.Dir}}' capnproto.org/go/capnp/v3`/std -ogo protocols/capn/schema/db.capnp
86+
8087
# eBPF-specific commands wrapped under ebpf namespace
8188
.PHONY: ebpf-build ebpf-load ebpf-unload ebpf-clean

accounts/account.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,5 +175,31 @@ func (a *Account) ExtraPermissions() map[types.Role][]types.Permission {
175175
}
176176

177177
func (a *Account) MarshalPublicKey() ([]byte, error) {
178-
return libp2pCrypto.MarshalPublicKey(a.masterPublicKey)
178+
return a.masterPublicKey.Raw()
179+
}
180+
181+
// Sign signs the provided data using the account's master private key
182+
func (a *Account) Sign(data []byte) ([]byte, error) {
183+
a.mu.RLock()
184+
defer a.mu.RUnlock()
185+
186+
if a.masterPrivateKey == nil {
187+
return nil, errors.New("no master private key available for signing")
188+
}
189+
190+
// Use the libp2p private key to sign the data
191+
return a.masterPrivateKey.Sign(data)
192+
}
193+
194+
// Verify checks if the signature is valid for the given data using the account's master public key
195+
func (a *Account) Verify(data []byte, signature []byte) (bool, error) {
196+
a.mu.RLock()
197+
defer a.mu.RUnlock()
198+
199+
if a.masterPublicKey == nil {
200+
return false, errors.New("no master public key available for verification")
201+
}
202+
203+
// Use the libp2p public key to verify the signature
204+
return a.masterPublicKey.Verify(data, signature)
179205
}

benchmark.yaml

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
# ======================================================================================
2+
# LOGGER RELATED CONFIGURATIONS
3+
# ======================================================================================
14
logger:
25
enabled: true
36
environment: development
47
level: debug
58

9+
# ======================================================================================
10+
# MDBX RELATED CONFIGURATIONS
11+
# ======================================================================================
612
mdbx:
713
enabled: true
814
nodes:
@@ -14,18 +20,32 @@ mdbx:
1420
growthStep: 4096 # Growth step size (4 KB)
1521
filePermissions: 0600 # File permissions for the database
1622

23+
# ======================================================================================
24+
# NODE RELATED CONFIGURATION
25+
# ======================================================================================
26+
node:
27+
# In blockchain world there is full node, light node, sequencer, validator, etc...
28+
# This is practically the same concept have RBAC (Role-Based Access Control) and
29+
# that is how node types are defined. Reusing this system to not pollute the system with
30+
# multiple nodes and role types and making things even more confusing than it is.
31+
roles:
32+
- node
33+
- sequencer
34+
- validator
35+
36+
1737
# ======================================================================================
1838
# IDENTITY MANAGER RELATED CONFIGURATION
1939
# ======================================================================================
2040
# Identity manager is responsible for generating P2P, BLS, and other keys.
2141
identity:
2242
enabled: true # Enable or disable the identity manager.
23-
basePath: /Users/nevio/.fdb/keystore # Directory where keys are stored.
43+
basePath: /Users/nevio/.fdb/keystore # Path where keys are stored.
2444
# Optional: List keys manually if needed.
25-
# keys:
45+
# Keys:
2646
# - name: node-key
2747
# type: bls # Example types: bls, ecdsa, frost.
28-
# path: /path/to/key/file
48+
# Path: /path/to/key/file
2949

3050
# ======================================================================================
3151
# P2P NETWORKING RELATED CONFIGURATION
@@ -43,8 +63,11 @@ networking:
4363
bootstrapNode: true # Set to true if this node is the bootstrap node in the network.
4464
mdns: true # Enable or disable Multicast DNS (mDNS) discovery.
4565
enableRelay: true # Enable relay connections if needed.
46-
interface_name: "en0" # Network interface name for eBPF (if applicable)
66+
interface_name: "en0" # Network interface name for eBPF (if applicable)
4767

68+
# ======================================================================================
69+
# TRANSPORTS RELATED CONFIGURATIONS
70+
# ======================================================================================
4871
transports:
4972
- type: dummy
5073
enabled: true
@@ -85,4 +108,35 @@ transports:
85108
dtls:
86109
insecure: true
87110
key: ./data/certs/key.pem
88-
cert: ./data/certs/cert.pem
111+
cert: ./data/certs/cert.pem
112+
113+
# ======================================================================================
114+
# RPC RELATED CONFIGURATIONS
115+
# ======================================================================================
116+
rpc:
117+
poolMaxSize: 10_000
118+
transport:
119+
enabled: true
120+
type: "tcp"
121+
ipv4: 0.0.0.0
122+
port: 8845
123+
124+
# ======================================================================================
125+
# OBSERVABILITY CONFIGURATION (Metrics and Tracing)
126+
# ======================================================================================
127+
# Observability helps in monitoring system health, performance, and errors.
128+
# It includes metrics (Prometheus) and tracing (OpenTelemetry).
129+
observability:
130+
metrics:
131+
enable: true # Enable or disable metrics collection.
132+
endpoint: "0.0.0.0:4317" # Endpoint for metrics collector.
133+
exportInterval: 15s # Interval to export metrics data.
134+
useTLS: false # Set this to false to disable TLS.
135+
136+
tracing:
137+
enable: true # Enable or disable tracing.
138+
endpoint: "0.0.0.0:4317" # Endpoint for tracing collector.
139+
headers: {} # Additional headers for tracing requests.
140+
sampler: "always_on" # Options: always_on, probability.
141+
samplingRate: 0.1 # Sampling rate for probabilistic sampling.
142+
useTLS: false # Set this to false to disable TLS.

0 commit comments

Comments
 (0)