Skip to content

Commit 11d1801

Browse files
MarcosNicolaugabrielbosioxqftMauroToscanoJuArce
authored
feat: mina verifiers (#2163)
Co-authored-by: gabrielbosio <[email protected]> Co-authored-by: Estéfano Bargas <[email protected]> Co-authored-by: Gabriel Bosio <[email protected]> Co-authored-by: Mauro Toscano <[email protected]> Co-authored-by: Julian Arce <[email protected]> Co-authored-by: Nicolas Rampoldi <[email protected]> Co-authored-by: Urix <[email protected]> Co-authored-by: Gian <[email protected]> Co-authored-by: cliraa <[email protected]> Co-authored-by: Mariano A. Nicolini <[email protected]> Co-authored-by: Tatu <[email protected]> Co-authored-by: Diego K <[email protected]> Co-authored-by: PatStiles <[email protected]> Co-authored-by: Tatu <[email protected]> Co-authored-by: taturosati <“[email protected]”> Co-authored-by: taturosati <[email protected]> Co-authored-by: Santos Rosati <[email protected]>
1 parent 9a8a88d commit 11d1801

Some content is hidden

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

44 files changed

+20806
-763
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ jobs:
3939

4040
- name: Build Merkle Tree bindings
4141
run: make build_merkle_tree_linux
42-
42+
43+
- name: Build Mina bindings
44+
run: make build_mina_linux
45+
46+
- name: Build Mina Account bindings
47+
run: make build_mina_account_linux
48+
4349
- name: Build operator
4450
run: go build operator/cmd/main.go
4551

.github/workflows/test-mina.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: test-mina
2+
3+
on:
4+
merge_group:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: ["*"]
9+
paths:
10+
- 'operator/mina/**'
11+
- 'operator/mina_account/**'
12+
- '.github/workflows/test-mina.yml'
13+
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-go@v5
20+
with:
21+
go-version: '1.22'
22+
cache: false
23+
- uses: actions-rs/toolchain@v1
24+
with:
25+
toolchain: stable
26+
- name: Test Mina Rust
27+
run: make test_mina_rust_ffi
28+
- name: Test Mina go bindings
29+
run: make test_mina_go_bindings_linux
30+
- name: Test Mina Account Rust
31+
run: make test_mina_account_rust_ffi
32+
- name: Test Mina Account go bindings
33+
run: make test_mina_account_go_bindings_linux

Makefile

Lines changed: 127 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ ifeq ($(OS),Darwin)
3232
endif
3333

3434
ifeq ($(OS),Linux)
35-
export LD_LIBRARY_PATH+=$(CURDIR)/operator/risc_zero/lib:$(CURDIR)/operator/sp1/lib
36-
OPERATOR_FFIS=$(CURDIR)/operator/risc_zero/lib:$(CURDIR)/operator/sp1/lib
35+
export LD_LIBRARY_PATH+=$(CURDIR)/operator/risc_zero/lib:$(CURDIR)/operator/sp1/lib:$(CURDIR)/operator/mina/lib:$(CURDIR)/operator/mina_account/lib
36+
OPERATOR_FFIS=$(CURDIR)/operator/risc_zero/lib:$(CURDIR)/operator/sp1/lib:$(CURDIR)/operator/mina/lib:$(CURDIR)/operator/mina_account/lib
3737
endif
3838

3939
ifeq ($(OS),Linux)
@@ -703,6 +703,58 @@ batcher_send_circom_groth16_bn256_no_pub_input_burst: crates/target/release/alig
703703
--rpc_url $(RPC_URL) \
704704
--network $(NETWORK)
705705

706+
batcher_send_mina_task:
707+
@echo "Sending Mina state task to Batcher..."
708+
@cd crates/cli/ && cargo run --release -- submit \
709+
--proving_system Mina \
710+
--proof ../../scripts/test_files/mina/devnet_mina_state.proof \
711+
--public_input ../../scripts/test_files/mina/devnet_mina_state.pub \
712+
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
713+
--rpc_url $(RPC_URL) \
714+
--network $(NETWORK)
715+
716+
batcher_send_mina_task_bad_hash:
717+
@echo "Sending Mina state task to Batcher..."
718+
@cd crates/cli/ && cargo run --release -- submit \
719+
--proving_system Mina \
720+
--proof ../../scripts/test_files/mina/devnet_mina_state.proof \
721+
--public_input ../../scripts/test_files/mina/mina_state_bad_hash.pub \
722+
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
723+
--rpc_url $(RPC_URL) \
724+
--network $(NETWORK)
725+
726+
batcher_send_mina_burst:
727+
@echo "Sending Mina state task to Batcher..."
728+
@cd crates/cli/ && cargo run --release -- submit \
729+
--proving_system Mina \
730+
--proof ../../scripts/test_files/mina/devnet_mina_state.proof \
731+
--public_input ../../scripts/test_files/mina/devnet_mina_state.pub \
732+
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
733+
--repetitions $(BURST_SIZE) \
734+
--rpc_url $(RPC_URL) \
735+
--network $(NETWORK)
736+
737+
batcher_send_mina_account_task:
738+
@echo "Sending Mina account task to Batcher..."
739+
@cd crates/cli/ && cargo run --release -- submit \
740+
--proving_system MinaAccount \
741+
--proof ../../scripts/test_files/mina_account/mina_account.proof \
742+
--public_input ../../scripts/test_files/mina_account/mina_account.pub \
743+
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
744+
--rpc_url $(RPC_URL) \
745+
--network $(NETWORK)
746+
747+
batcher_send_mina_account_burst:
748+
@echo "Sending Mina account task to Batcher..."
749+
@cd crates/cli/ && cargo run --release -- submit \
750+
--proving_system MinaAccount \
751+
--proof ../../scripts/test_files/mina_account/mina_account.proof \
752+
--public_input ../../scripts/test_files/mina_account/mina_account.pub \
753+
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
754+
--repetitions $(BURST_SIZE) \
755+
--rpc_url $(RPC_URL) \
756+
--network $(NETWORK)
757+
706758
batcher_send_proof_with_random_address: ## Send a proof with a random address to Batcher. Parameters: RPC_URL, NETWORK, PROOF_TYPE, REPETITIONS
707759
@cd crates/cli/ && ./send_proof_with_random_address.sh
708760

@@ -968,6 +1020,48 @@ test_merkle_tree_go_bindings_linux: build_merkle_tree_linux
9681020
@echo "Testing Merkle Tree Go bindings..."
9691021
go test ./operator/merkle_tree/... -v
9701022

1023+
__MINA_FFI__: ##
1024+
build_mina_macos:
1025+
@cd operator/mina/lib && cargo build --release ${MINA_FEATURES_FLAG}
1026+
@cp operator/mina/lib/target/release/libmina_state_verifier_ffi.dylib operator/mina/lib/libmina_state_verifier_ffi.dylib
1027+
1028+
build_mina_linux:
1029+
@cd operator/mina/lib && cargo build --release ${MINA_FEATURES_FLAG}
1030+
@cp operator/mina/lib/target/release/libmina_state_verifier_ffi.so operator/mina/lib/libmina_state_verifier_ffi.so
1031+
1032+
test_mina_rust_ffi:
1033+
@echo "Testing Mina Rust FFI source code..."
1034+
@cd operator/mina/lib && cargo t --release
1035+
1036+
test_mina_go_bindings_macos: build_mina_macos
1037+
@echo "Testing Mina Go bindings..."
1038+
go test ./operator/mina/... -v
1039+
1040+
test_mina_go_bindings_linux: build_mina_linux
1041+
@echo "Testing Mina Go bindings..."
1042+
go test ./operator/mina/... -v
1043+
1044+
__MINA_ACCOUNT_FFI__: ##
1045+
build_mina_account_macos:
1046+
@cd operator/mina_account/lib && cargo build --release
1047+
@cp operator/mina_account/lib/target/release/libmina_account_verifier_ffi.dylib operator/mina_account/lib/libmina_account_verifier_ffi.dylib
1048+
1049+
build_mina_account_linux:
1050+
@cd operator/mina_account/lib && cargo build --release
1051+
@cp operator/mina_account/lib/target/release/libmina_account_verifier_ffi.so operator/mina_account/lib/libmina_account_verifier_ffi.so
1052+
1053+
test_mina_account_rust_ffi:
1054+
@echo "Testing Mina Account Rust FFI source code..."
1055+
@cd operator/mina_account/lib && cargo t --release
1056+
1057+
test_mina_account_go_bindings_macos: build_mina_account_macos
1058+
@echo "Testing Mina Account Go bindings..."
1059+
go test ./operator/mina_account/... -v
1060+
1061+
test_mina_account_go_bindings_linux: build_mina_account_linux
1062+
@echo "Testing Mina Account Go bindings..."
1063+
go test ./operator/mina_account/... -v
1064+
9711065
__FFI__: ## ____
9721066

9731067
build_all_ffi: ## Build all FFIs
@@ -979,13 +1073,17 @@ build_all_ffi_macos: ## Build all FFIs for macOS
9791073
@$(MAKE) build_sp1_macos
9801074
@$(MAKE) build_risc_zero_macos
9811075
@$(MAKE) build_merkle_tree_macos
1076+
@$(MAKE) build_mina_macos
1077+
@$(MAKE) build_mina_account_macos
9821078
@echo "All macOS FFIs built successfully."
9831079

9841080
build_all_ffi_linux: ## Build all FFIs for Linux
9851081
@echo "Building all FFIs for Linux..."
9861082
@$(MAKE) build_sp1_linux
9871083
@$(MAKE) build_risc_zero_linux
9881084
@$(MAKE) build_merkle_tree_linux
1085+
@$(MAKE) build_mina_linux
1086+
@$(MAKE) build_mina_account_linux
9891087
@echo "All Linux FFIs built successfully."
9901088

9911089
__EXPLORER__: ## ____
@@ -1193,6 +1291,30 @@ docker_batcher_send_circom_groth16_bn256_no_pub_input_burst:
11931291
--rpc_url $(DOCKER_RPC_URL) \
11941292
--max_fee 0.1ether
11951293

1294+
docker_batcher_send_mina_burst:
1295+
@echo "Sending Mina state task to Batcher..."
1296+
docker exec $(shell docker ps | grep batcher | awk '{print $$1}') aligned submit \
1297+
--private_key $(DOCKER_PROOFS_PRIVATE_KEY) \
1298+
--proving_system Mina \
1299+
--proof ./scripts/test_files/mina/devnet_mina_state.proof \
1300+
--public_input ./scripts/test_files/mina/devnet_mina_state.pub \
1301+
--repetitions $(DOCKER_BURST_SIZE) \
1302+
--proof_generator_addr $(PROOF_GENERATOR_ADDRESS) \
1303+
--rpc_url $(DOCKER_RPC_URL) \
1304+
--max_fee 0.1ether
1305+
1306+
docker_batcher_send_mina_account_burst:
1307+
@echo "Sending Mina account task to Batcher..."
1308+
docker exec $(shell docker ps | grep batcher | awk '{print $$1}') aligned submit \
1309+
--private_key $(DOCKER_PROOFS_PRIVATE_KEY) \
1310+
--proving_system MinaAccount \
1311+
--proof ./scripts/test_files/mina_account/mina_account.proof \
1312+
--public_input ./scripts/test_files/mina_account/mina_account.pub \
1313+
--repetitions $(DOCKER_BURST_SIZE) \
1314+
--proof_generator_addr $(PROOF_GENERATOR_ADDRESS) \
1315+
--rpc_url $(DOCKER_RPC_URL) \
1316+
--max_fee 0.1ether
1317+
11961318
# Update target as new proofs are supported.
11971319
docker_batcher_send_all_proofs_burst:
11981320
@$(MAKE) docker_batcher_send_sp1_burst
@@ -1202,6 +1324,8 @@ docker_batcher_send_all_proofs_burst:
12021324
@$(MAKE) docker_batcher_send_gnark_groth16_burst
12031325
@$(MAKE) docker_batcher_send_circom_groth16_bn256_burst
12041326
@$(MAKE) docker_batcher_send_circom_groth16_bn256_no_pub_input_burst
1327+
@$(MAKE) docker_batcher_send_mina_burst
1328+
@$(MAKE) docker_batcher_send_mina_account_burst
12051329

12061330
docker_batcher_send_infinite_groth16:
12071331
docker exec $(shell docker ps | grep batcher | awk '{print $$1}') \
@@ -1239,7 +1363,7 @@ docker_verify_proofs_onchain:
12391363
'
12401364

12411365
DOCKER_PROOFS_WAIT_TIME=60
1242-
DOCKER_SENT_PROOFS=7
1366+
DOCKER_SENT_PROOFS=9
12431367

12441368
docker_verify_proof_submission_success:
12451369
@echo "Verifying proofs were successfully submitted..."

aggregator/pkg/aggregator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ func (agg *Aggregator) handleBlsAggServiceResponse(blsAggServiceResp blsagg.BlsA
300300
txHash = receipt.TxHash.String()
301301
effectiveGasPrice = receipt.EffectiveGasPrice.String()
302302
}
303+
agg.logger.Info("Gas cost used to send aggregated response", "gasUsed", receipt.GasUsed)
303304
agg.telemetry.TaskSentToEthereum(batchData.BatchMerkleRoot, txHash, effectiveGasPrice)
304305
agg.logger.Info("Aggregator successfully responded to task",
305306
"taskIndex", blsAggServiceResp.TaskIndex,

common/proving_systems.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ const (
1717
SP1
1818
Risc0
1919
CircomGroth16Bn256
20+
Mina
21+
MinaAccount
2022
)
2123

2224
func (t *ProvingSystemId) String() string {
23-
return [...]string{"GnarkPlonkBls12_381", "GnarkPlonkBn254", "GnarkGroth16Bn254", "SP1"}[*t]
25+
return [...]string{"GnarkPlonkBls12_381", "GnarkPlonkBn254", "GnarkGroth16Bn254", "SP1", "Mina", "MinaAccount"}[*t]
2426
}
2527

2628
func ProvingSystemIdFromString(provingSystem string) (ProvingSystemId, error) {
@@ -37,6 +39,10 @@ func ProvingSystemIdFromString(provingSystem string) (ProvingSystemId, error) {
3739
return Risc0, nil
3840
case "CircomGroth16Bn256":
3941
return CircomGroth16Bn256, nil
42+
case "Mina":
43+
return Mina, nil
44+
case "MinaAccount":
45+
return MinaAccount, nil
4046
}
4147

4248
return 0, fmt.Errorf("unknown proving system: %s", provingSystem)
@@ -56,6 +62,10 @@ func ProvingSystemIdToString(provingSystem ProvingSystemId) (string, error) {
5662
return "Risc0", nil
5763
case CircomGroth16Bn256:
5864
return "CircomGroth16Bn256", nil
65+
case Mina:
66+
return "Mina", nil
67+
case MinaAccount:
68+
return "MinaAccount", nil
5969
}
6070

6171
return "", fmt.Errorf("unknown proving system: %d", provingSystem)
@@ -112,6 +122,10 @@ func (s *ProvingSystemId) UnmarshalCBOR(data []byte) error {
112122
*s = Risc0
113123
case "CircomGroth16Bn256":
114124
*s = CircomGroth16Bn256
125+
case "Mina":
126+
*s = Mina
127+
case "MinaAccount":
128+
*s = MinaAccount
115129
}
116130

117131
return nil

0 commit comments

Comments
 (0)