diff --git a/.github/workflows/build-go.yml b/.github/workflows/build-go.yml index b581da925..420a54847 100644 --- a/.github/workflows/build-go.yml +++ b/.github/workflows/build-go.yml @@ -28,6 +28,8 @@ jobs: run: make build_halo2_ipa_linux - name: Build Merkle Tree bindings run: make build_merkle_tree_linux + - name: Build Mina bindings + run: make build_mina_linux - name: Build operator run: go build operator/cmd/main.go - name: Build aggregator diff --git a/aggregator/internal/pkg/aggregator.go b/aggregator/internal/pkg/aggregator.go index 2ee86b61b..65a768915 100644 --- a/aggregator/internal/pkg/aggregator.go +++ b/aggregator/internal/pkg/aggregator.go @@ -208,7 +208,7 @@ func (agg *Aggregator) handleBlsAggServiceResponse(blsAggServiceResp blsagg.BlsA if blsAggServiceResp.Err != nil { agg.taskMutex.Lock() batchMerkleRoot := agg.batchesRootByIdx[blsAggServiceResp.TaskIndex] - agg.logger.Error("BlsAggregationServiceResponse contains an error", "err", blsAggServiceResp.Err, "merkleRoot", hex.EncodeToString(batchMerkleRoot[:])) + agg.logger.Error("BlsAggregationServiceResponse contains an error", "err", blsAggServiceResp.Err, "merkleRoot", hex.EncodeToString(batchMerkleRoot[:])) agg.logger.Info("- Locking task mutex: Delete task from operator map", "taskIndex", blsAggServiceResp.TaskIndex) // Remove task from the list of tasks @@ -287,8 +287,10 @@ func (agg *Aggregator) handleBlsAggServiceResponse(blsAggServiceResp blsagg.BlsA "merkleRoot", hex.EncodeToString(batchMerkleRoot[:])) for i := 0; i < MaxSentTxRetries; i++ { - _, err = agg.sendAggregatedResponse(batchMerkleRoot, nonSignerStakesAndSignature) + receipt, err := agg.sendAggregatedResponse(batchMerkleRoot, nonSignerStakesAndSignature) if err == nil { + agg.logger.Info("Gas cost used to send aggregated response", "gasUsed", receipt.GasUsed) + agg.logger.Info("Aggregator successfully responded to task", "taskIndex", blsAggServiceResp.TaskIndex, "merkleRoot", hex.EncodeToString(batchMerkleRoot[:])) diff --git a/batcher/aligned-batcher/src/lib.rs b/batcher/aligned-batcher/src/lib.rs index d0c084c59..d6a3c429d 100644 --- a/batcher/aligned-batcher/src/lib.rs +++ b/batcher/aligned-batcher/src/lib.rs @@ -649,7 +649,10 @@ impl Batcher { ) .await { - Ok(_) => { + Ok(receipt) => { + if let Some(gas_used) = receipt.gas_used { + info!("Gas used to create new task: {}", gas_used); + } info!("Batch verification task created on Aligned contract"); Ok(()) } diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index e1f2f3cd4..e29460d5f 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -308,7 +308,8 @@ async fn _verify_proof_onchain( ) -> Result { let contract_address = match chain { Chain::Devnet => "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8", - Chain::Holesky => "0x58F280BeBE9B34c9939C3C39e0890C81f163B623", + // If we re-deploy the Aligned SM contract we need to change this value to the new contract address + Chain::Holesky => "0x0584313310bD52B77CF0b81b350Ca447B97Df5DF", Chain::HoleskyStage => "0x9C5231FC88059C086Ea95712d105A2026048c39B", }; diff --git a/operator/mina/mina.go b/operator/mina/mina.go index 5e673b3bf..fe00fb24e 100644 --- a/operator/mina/mina.go +++ b/operator/mina/mina.go @@ -8,6 +8,8 @@ package mina */ import "C" import ( + "fmt" + "time" "unsafe" ) @@ -15,7 +17,15 @@ import ( const MAX_PROOF_SIZE = 16 * 1024 const MAX_PUB_INPUT_SIZE = 6 * 1024 +func timer() func() { + start := time.Now() + return func() { + fmt.Printf("Mina block verification took %v\n", time.Since(start)) + } +} + func VerifyProtocolStateProof(proofBuffer [MAX_PROOF_SIZE]byte, proofLen uint, pubInputBuffer [MAX_PUB_INPUT_SIZE]byte, pubInputLen uint) bool { + defer timer()() proofPtr := (*C.uchar)(unsafe.Pointer(&proofBuffer[0])) pubInputPtr := (*C.uchar)(unsafe.Pointer(&pubInputBuffer[0])) return (bool)(C.verify_protocol_state_proof_ffi(proofPtr, (C.uint)(proofLen), pubInputPtr, (C.uint)(pubInputLen)))