Skip to content

Commit 2a5e61c

Browse files
committed
Merge branch '1082-add-a-bitmap-in-ethereum-to-disable-verifiers' into 1082-bitmap-to-disable-verifiers-v2
2 parents ced922a + 698378a commit 2a5e61c

File tree

108 files changed

+6972
-5111
lines changed

Some content is hidden

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

108 files changed

+6972
-5111
lines changed

.github/workflows/build-and-test-go.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ jobs:
3131
run: make build_risc_zero_linux
3232
- name: Build Merkle Tree bindings
3333
run: make build_merkle_tree_linux
34-
- name: Build Old Merkle Tree bindings
35-
run: make build_merkle_tree_linux_old
3634
- name: Build operator
3735
run: go build operator/cmd/main.go
3836
- name: Build aggregator

Makefile

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ OS := $(shell uname -s)
66
CONFIG_FILE?=config-files/config.yaml
77
AGG_CONFIG_FILE?=config-files/config-aggregator.yaml
88

9-
OPERATOR_VERSION=v0.8.0
9+
OPERATOR_VERSION=v0.9.2
1010

1111
ifeq ($(OS),Linux)
1212
BUILD_ALL_FFI = $(MAKE) build_all_ffi_linux
@@ -17,7 +17,15 @@ ifeq ($(OS),Darwin)
1717
endif
1818

1919
ifeq ($(OS),Linux)
20-
export LD_LIBRARY_PATH := $(CURDIR)/operator/risc_zero/lib
20+
export LD_LIBRARY_PATH += $(CURDIR)/operator/risc_zero/lib
21+
endif
22+
23+
ifeq ($(OS),Linux)
24+
BUILD_OPERATOR = $(MAKE) build_operator_linux
25+
endif
26+
27+
ifeq ($(OS),Darwin)
28+
BUILD_OPERATOR = $(MAKE) build_operator_macos
2129
endif
2230

2331

@@ -120,6 +128,14 @@ operator_full_registration: operator_get_eth operator_register_with_eigen_layer
120128
operator_register_and_start: operator_full_registration operator_start
121129

122130
build_operator: deps
131+
$(BUILD_OPERATOR)
132+
133+
build_operator_macos:
134+
@echo "Building Operator..."
135+
@go build -ldflags "-X main.Version=$(OPERATOR_VERSION)" -o ./operator/build/aligned-operator ./operator/cmd/main.go
136+
@echo "Operator built into /operator/build/aligned-operator"
137+
138+
build_operator_linux:
123139
@echo "Building Operator..."
124140
@go build -ldflags "-X main.Version=$(OPERATOR_VERSION) -r $(LD_LIBRARY_PATH)" -o ./operator/build/aligned-operator ./operator/cmd/main.go
125141
@echo "Operator built into /operator/build/aligned-operator"
@@ -308,6 +324,16 @@ batcher_send_risc0_task:
308324
--rpc_url $(RPC_URL) \
309325
--network $(NETWORK)
310326

327+
batcher_send_risc0_task_no_pub_input:
328+
@echo "Sending Risc0 fibonacci task to Batcher..."
329+
@cd batcher/aligned/ && cargo run --release -- submit \
330+
--proving_system Risc0 \
331+
--proof ../../scripts/test_files/risc_zero/no_public_inputs/risc_zero_no_pub_input.proof \
332+
--vm_program ../../scripts/test_files/risc_zero/no_public_inputs/no_pub_input_id.bin \
333+
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
334+
--rpc_url $(RPC_URL) \
335+
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
336+
311337
batcher_send_risc0_burst:
312338
@echo "Sending Risc0 fibonacci task to Batcher..."
313339
@cd batcher/aligned/ && cargo run --release -- submit \
@@ -503,6 +529,11 @@ generate_sp1_fibonacci_proof:
503529
@mv scripts/test_files/sp1/fibonacci_proof_generator/script/sp1_fibonacci.proof scripts/test_files/sp1/
504530
@echo "Fibonacci proof and ELF generated in scripts/test_files/sp1 folder"
505531

532+
generate_risc_zero_empty_journal_proof:
533+
@cd scripts/test_files/risc_zero/no_public_inputs && RUST_LOG=info cargo run --release
534+
@echo "Fibonacci proof and ELF with empty journal generated in scripts/test_files/risc_zero/no_public_inputs folder"
535+
536+
506537
__RISC_ZERO_FFI__: ##
507538
build_risc_zero_macos:
508539
@cd operator/risc_zero/lib && cargo build $(RELEASE_FLAG)
@@ -535,29 +566,15 @@ build_merkle_tree_macos:
535566
@cp operator/merkle_tree/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.dylib operator/merkle_tree/lib/libmerkle_tree.dylib
536567
@cp operator/merkle_tree/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.a operator/merkle_tree/lib/libmerkle_tree.a
537568

538-
build_merkle_tree_macos_old:
539-
@cd operator/merkle_tree_old/lib && cargo build $(RELEASE_FLAG)
540-
@cp operator/merkle_tree_old/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.dylib operator/merkle_tree_old/lib/libmerkle_tree.dylib
541-
@cp operator/merkle_tree_old/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.a operator/merkle_tree_old/lib/libmerkle_tree.a
542-
543569
build_merkle_tree_linux:
544570
@cd operator/merkle_tree/lib && cargo build $(RELEASE_FLAG)
545571
@cp operator/merkle_tree/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.so operator/merkle_tree/lib/libmerkle_tree.so
546572
@cp operator/merkle_tree/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.a operator/merkle_tree/lib/libmerkle_tree.a
547573

548-
build_merkle_tree_linux_old:
549-
@cd operator/merkle_tree_old/lib && cargo build $(RELEASE_FLAG)
550-
@cp operator/merkle_tree_old/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.so operator/merkle_tree_old/lib/libmerkle_tree.so
551-
@cp operator/merkle_tree_old/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.a operator/merkle_tree_old/lib/libmerkle_tree.a
552-
553574
test_merkle_tree_rust_ffi:
554575
@echo "Testing Merkle Tree Rust FFI source code..."
555576
@cd operator/merkle_tree/lib && RUST_MIN_STACK=83886080 cargo t --release
556577

557-
test_merkle_tree_rust_ffi_old:
558-
@echo "Testing Old Merkle Tree Rust FFI source code..."
559-
@cd operator/merkle_tree_old/lib && RUST_MIN_STACK=83886080 cargo t --release
560-
561578
test_merkle_tree_go_bindings_macos: build_merkle_tree_macos
562579
@echo "Testing Merkle Tree Go bindings..."
563580
go test ./operator/merkle_tree/... -v
@@ -570,9 +587,6 @@ test_merkle_tree_old_go_bindings_macos: build_merkle_tree_macos_old
570587
@echo "Testing Old Merkle Tree Go bindings..."
571588
go test ./operator/merkle_tree_old/... -v
572589

573-
test_merkle_tree_go_bindings_linux_old: build_merkle_tree_linux_old
574-
@echo "Testing Merkle Tree Go bindings..."
575-
go test ./operator/merkle_tree_old/... -v
576590

577591
__BUILD_ALL_FFI__:
578592

@@ -585,18 +599,15 @@ build_all_ffi_macos: ## Build all FFIs for macOS
585599
@$(MAKE) build_sp1_macos
586600
@$(MAKE) build_risc_zero_macos
587601
@$(MAKE) build_merkle_tree_macos
588-
@$(MAKE) build_merkle_tree_macos_old
589602
@echo "All macOS FFIs built successfully."
590603

591604
build_all_ffi_linux: ## Build all FFIs for Linux
592605
@echo "Building all FFIs for Linux..."
593606
@$(MAKE) build_sp1_linux
594607
@$(MAKE) build_risc_zero_linux
595608
@$(MAKE) build_merkle_tree_linux
596-
@$(MAKE) build_merkle_tree_linux_old
597609
@echo "All Linux FFIs built successfully."
598610

599-
600611
__EXPLORER__:
601612
run_explorer: explorer_run_db explorer_ecto_setup_db
602613
@cd explorer/ && \

aggregator/internal/pkg/aggregator.go

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/prometheus/client_golang/prometheus"
1313
"github.com/yetanotherco/aligned_layer/metrics"
1414

15-
"github.com/Layr-Labs/eigensdk-go/chainio/clients"
1615
sdkclients "github.com/Layr-Labs/eigensdk-go/chainio/clients"
1716
"github.com/Layr-Labs/eigensdk-go/logging"
1817
"github.com/Layr-Labs/eigensdk-go/services/avsregistry"
@@ -80,8 +79,12 @@ type Aggregator struct {
8079

8180
logger logging.Logger
8281

82+
// Metrics
8383
metricsReg *prometheus.Registry
8484
metrics *metrics.Metrics
85+
86+
// Telemetry
87+
telemetry *Telemetry
8588
}
8689

8790
func NewAggregator(aggregatorConfig config.AggregatorConfig) (*Aggregator, error) {
@@ -119,7 +122,7 @@ func NewAggregator(aggregatorConfig config.AggregatorConfig) (*Aggregator, error
119122
aggregatorPrivateKey := aggregatorConfig.EcdsaConfig.PrivateKey
120123

121124
logger := aggregatorConfig.BaseConfig.Logger
122-
clients, err := clients.BuildAll(chainioConfig, aggregatorPrivateKey, logger)
125+
clients, err := sdkclients.BuildAll(chainioConfig, aggregatorPrivateKey, logger)
123126
if err != nil {
124127
logger.Errorf("Cannot create sdk clients", "err", err)
125128
return nil, err
@@ -148,6 +151,9 @@ func NewAggregator(aggregatorConfig config.AggregatorConfig) (*Aggregator, error
148151
reg := prometheus.NewRegistry()
149152
aggregatorMetrics := metrics.NewMetrics(aggregatorConfig.Aggregator.MetricsIpPortAddress, reg, logger)
150153

154+
// Telemetry
155+
aggregatorTelemetry := NewTelemetry(aggregatorConfig.Aggregator.TelemetryIpPortAddress, logger)
156+
151157
nextBatchIndex := uint32(0)
152158

153159
aggregator := Aggregator{
@@ -169,6 +175,7 @@ func NewAggregator(aggregatorConfig config.AggregatorConfig) (*Aggregator, error
169175
logger: logger,
170176
metricsReg: reg,
171177
metrics: aggregatorMetrics,
178+
telemetry: aggregatorTelemetry,
172179
}
173180

174181
return &aggregator, nil
@@ -209,11 +216,20 @@ func (agg *Aggregator) Start(ctx context.Context) error {
209216
const MaxSentTxRetries = 5
210217

211218
func (agg *Aggregator) handleBlsAggServiceResponse(blsAggServiceResp blsagg.BlsAggregationServiceResponse) {
219+
agg.taskMutex.Lock()
220+
agg.AggregatorConfig.BaseConfig.Logger.Info("- Locked Resources: Fetching task data")
221+
batchIdentifierHash := agg.batchesIdentifierHashByIdx[blsAggServiceResp.TaskIndex]
222+
batchData := agg.batchDataByIdentifierHash[batchIdentifierHash]
223+
taskCreatedBlock := agg.batchCreatedBlockByIdx[blsAggServiceResp.TaskIndex]
224+
agg.taskMutex.Unlock()
225+
agg.AggregatorConfig.BaseConfig.Logger.Info("- Unlocked Resources: Fetching task data")
226+
227+
// Finish task trace once the task is processed (either successfully or not)
228+
defer agg.telemetry.FinishTrace(batchData.BatchMerkleRoot)
229+
212230
if blsAggServiceResp.Err != nil {
213-
agg.taskMutex.Lock()
214-
batchIdentifierHash := agg.batchesIdentifierHashByIdx[blsAggServiceResp.TaskIndex]
231+
agg.telemetry.LogTaskError(batchData.BatchMerkleRoot, blsAggServiceResp.Err)
215232
agg.logger.Error("BlsAggregationServiceResponse contains an error", "err", blsAggServiceResp.Err, "batchIdentifierHash", hex.EncodeToString(batchIdentifierHash[:]))
216-
agg.taskMutex.Unlock()
217233
return
218234
}
219235
nonSignerPubkeys := []servicemanager.BN254G1Point{}
@@ -236,13 +252,7 @@ func (agg *Aggregator) handleBlsAggServiceResponse(blsAggServiceResp blsagg.BlsA
236252
NonSignerStakeIndices: blsAggServiceResp.NonSignerStakeIndices,
237253
}
238254

239-
agg.taskMutex.Lock()
240-
agg.AggregatorConfig.BaseConfig.Logger.Info("- Locked Resources: Fetching merkle root")
241-
batchIdentifierHash := agg.batchesIdentifierHashByIdx[blsAggServiceResp.TaskIndex]
242-
batchData := agg.batchDataByIdentifierHash[batchIdentifierHash]
243-
taskCreatedBlock := agg.batchCreatedBlockByIdx[blsAggServiceResp.TaskIndex]
244-
agg.AggregatorConfig.BaseConfig.Logger.Info("- Unlocked Resources: Fetching merkle root")
245-
agg.taskMutex.Unlock()
255+
agg.telemetry.LogQuorumReached(batchData.BatchMerkleRoot)
246256

247257
agg.logger.Info("Threshold reached", "taskIndex", blsAggServiceResp.TaskIndex,
248258
"batchIdentifierHash", "0x"+hex.EncodeToString(batchIdentifierHash[:]))
@@ -278,6 +288,7 @@ func (agg *Aggregator) handleBlsAggServiceResponse(blsAggServiceResp blsagg.BlsA
278288
"merkleRoot", "0x"+hex.EncodeToString(batchData.BatchMerkleRoot[:]),
279289
"senderAddress", "0x"+hex.EncodeToString(batchData.SenderAddress[:]),
280290
"batchIdentifierHash", "0x"+hex.EncodeToString(batchIdentifierHash[:]))
291+
agg.telemetry.LogTaskError(batchData.BatchMerkleRoot, err)
281292
}
282293

283294
// / Sends response to contract and waits for transaction receipt
@@ -294,6 +305,7 @@ func (agg *Aggregator) sendAggregatedResponse(batchIdentifierHash [32]byte, batc
294305
if err != nil {
295306
agg.walletMutex.Unlock()
296307
agg.logger.Infof("- Unlocked Wallet Resources: Error sending aggregated response for batch %s. Error: %s", hex.EncodeToString(batchIdentifierHash[:]), err)
308+
agg.telemetry.LogTaskError(batchMerkleRoot, err)
297309
return nil, err
298310
}
299311

@@ -303,6 +315,7 @@ func (agg *Aggregator) sendAggregatedResponse(batchIdentifierHash [32]byte, batc
303315
receipt, err := utils.WaitForTransactionReceipt(
304316
agg.AggregatorConfig.BaseConfig.EthRpcClient, context.Background(), *txHash)
305317
if err != nil {
318+
agg.telemetry.LogTaskError(batchMerkleRoot, err)
306319
return nil, err
307320
}
308321

@@ -312,6 +325,7 @@ func (agg *Aggregator) sendAggregatedResponse(batchIdentifierHash [32]byte, batc
312325
}
313326

314327
func (agg *Aggregator) AddNewTask(batchMerkleRoot [32]byte, senderAddress [20]byte, taskCreatedBlock uint32) {
328+
agg.telemetry.InitNewTrace(batchMerkleRoot)
315329
batchIdentifier := append(batchMerkleRoot[:], senderAddress[:]...)
316330
var batchIdentifierHash = *(*[32]byte)(crypto.Keccak256(batchIdentifier))
317331

@@ -358,6 +372,7 @@ func (agg *Aggregator) AddNewTask(batchMerkleRoot [32]byte, senderAddress [20]by
358372
agg.logger.Fatalf("BLS aggregation service error when initializing new task: %s", err)
359373
}
360374

375+
agg.metrics.IncAggregatorReceivedTasks()
361376
agg.taskMutex.Unlock()
362377
agg.AggregatorConfig.BaseConfig.Logger.Info("- Unlocked Resources: Adding new task")
363378
agg.logger.Info("New task added", "batchIndex", batchIndex, "batchIdentifierHash", "0x"+hex.EncodeToString(batchIdentifierHash[:]))

aggregator/internal/pkg/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
4949
"SenderAddress", "0x"+hex.EncodeToString(signedTaskResponse.SenderAddress[:]),
5050
"BatchIdentifierHash", "0x"+hex.EncodeToString(signedTaskResponse.BatchIdentifierHash[:]),
5151
"operatorId", hex.EncodeToString(signedTaskResponse.OperatorId[:]))
52-
5352
taskIndex := uint32(0)
5453
ok := false
5554

@@ -71,6 +70,7 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
7170
*reply = 1
7271
return nil
7372
}
73+
agg.telemetry.LogOperatorResponse(signedTaskResponse.BatchMerkleRoot, signedTaskResponse.OperatorId)
7474

7575
// Don't wait infinitely if it can't answer
7676
// Create a context with a timeout of 5 seconds

0 commit comments

Comments
 (0)