Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: golangci-lint
on:
push:
branches:
- master
- main
- testnet
- staging
pull_request:
paths:
- 'operator/**'
Expand All @@ -26,13 +26,13 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version: '1.24'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v8
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.54
version: v2.1.6
args: --timeout=5m
6 changes: 3 additions & 3 deletions aggregator/pkg/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t

if err != nil {
agg.logger.Warnf("BLS aggregation service error: %s", err)
done<- 1
done <- 1
// todo shouldn't we here close the channel with a reply = 1?
} else {
agg.logger.Info("BLS process succeeded")
done<- 0
done <- 0
}

close(done)
Expand Down Expand Up @@ -136,7 +136,7 @@ func (agg *Aggregator) GetTaskIndexRetryable(batchIdentifierHash [32]byte, confi
taskIndex, ok := agg.batchesIdxByIdentifierHash[batchIdentifierHash]
agg.taskMutex.Unlock()
if !ok {
return taskIndex, fmt.Errorf("Task not found in the internal map")
return taskIndex, fmt.Errorf("task not found in the internal map")
} else {
return taskIndex, nil
}
Expand Down
7 changes: 6 additions & 1 deletion aggregator/pkg/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ func (t *Telemetry) sendTelemetryMessage(endpoint string, message interface{}) e
t.logger.Warn("[Telemetry] Error sending POST request", "error", err)
return fmt.Errorf("error making POST request: %w", err)
}
defer resp.Body.Close()
defer func(Body io.ReadCloser) {
err := Body.Close()
if err != nil {
t.logger.Warn("[Telemetry] Error closing response body", "error", err)
}
}(resp.Body)

respBody, err := io.ReadAll(resp.Body)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions core/chainio/avs_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ func (r *AvsReader) IsOperatorRegistered(address ethcommon.Address) (bool, error
}

func (r *AvsReader) DisabledVerifiers() (*big.Int, error) {
num, err := r.AvsContractBindings.ServiceManager.ContractAlignedLayerServiceManagerCaller.DisabledVerifiers(&bind.CallOpts{})
num, err := r.AvsContractBindings.ServiceManager.DisabledVerifiers(&bind.CallOpts{})
if err != nil {
// Retry with fallback client
num, err = r.AvsContractBindings.ServiceManagerFallback.ContractAlignedLayerServiceManagerCaller.DisabledVerifiers(&bind.CallOpts{})
num, err = r.AvsContractBindings.ServiceManagerFallback.DisabledVerifiers(&bind.CallOpts{})
if err != nil {
r.logger.Error("Failed to fetch DisabledVerifiers", "err", err)
}
Expand All @@ -102,7 +102,7 @@ func (r *AvsReader) GetNotRespondedTasksFrom(fromBlock uint64) ([]servicemanager
// now check if its finalized or not before appending
batchIdentifier := append(task.BatchMerkleRoot[:], task.SenderAddress[:]...)
batchIdentifierHash := *(*[32]byte)(crypto.Keccak256(batchIdentifier))
state, err := r.AvsContractBindings.ServiceManager.ContractAlignedLayerServiceManagerCaller.BatchesState(nil, batchIdentifierHash)
state, err := r.AvsContractBindings.ServiceManager.BatchesState(nil, batchIdentifierHash)

if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion core/chainio/retryable.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (s *AvsSubscriber) BatchesStateRetryable(opts *bind.CallOpts, arg0 [32]byte
Responded bool
RespondToTaskFeeLimit *big.Int
}, error) {
return s.AvsContractBindings.ServiceManager.ContractAlignedLayerServiceManagerCaller.BatchesState(opts, arg0)
return s.AvsContractBindings.ServiceManager.BatchesState(opts, arg0)
}

return retry.RetryWithData(batchState_func, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ fn main() {
client.verify(&proof, &vk).expect("failed to verify proof");
println!("Successfully verified proof!");

// Print ELF
println!("{}", hex::encode(vk.hash_bytes()));

proof
.save("../sp1_fibonacci.proof")
.expect("failed to save proof");
Expand Down
4 changes: 2 additions & 2 deletions operator/merkle_tree/merkle_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func VerifyMerkleTreeBatch(batchBuffer []byte, merkleRootBuffer [32]byte) (isVer
defer func() {
rec := recover()
if rec != nil {
err = fmt.Errorf("Panic was caught while verifying merkle tree batch: %s", rec)
err = fmt.Errorf("panic was caught while verifying merkle tree batch: %s", rec)
}
}()

Expand All @@ -32,7 +32,7 @@ func VerifyMerkleTreeBatch(batchBuffer []byte, merkleRootBuffer [32]byte) (isVer
r := (C.int32_t)(C.verify_merkle_tree_batch_ffi(batchPtr, (C.uint)(len(batchBuffer)), merkleRootPtr))

if r == -1 {
err = fmt.Errorf("Panic happened on FFI while verifying merkle tree batch")
err = fmt.Errorf("panic happened on FFI while verifying merkle tree batch")
return isVerified, err
}

Expand Down
2 changes: 1 addition & 1 deletion operator/pkg/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (o *Operator) getBatchFromDataService(ctx context.Context, batchURL string,
o.Logger.Infof("Verifying batch merkle tree...")
merkle_root_check, err := merkle_tree.VerifyMerkleTreeBatch(batchBytes, expectedMerkleRoot)
if err != nil || !merkle_root_check {
return nil, fmt.Errorf("Error while verifying merkle tree batch")
return nil, fmt.Errorf("error while verifying merkle tree batch")
}
o.Logger.Infof("Batch merkle tree verified")

Expand Down
4 changes: 2 additions & 2 deletions operator/risc_zero/risc_zero.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func VerifyRiscZeroReceipt(innerReceiptBuffer []byte, imageIdBuffer []byte, publ
defer func() {
rec := recover()
if rec != nil {
err = fmt.Errorf("Panic was caught while verifying risc0 proof: %s", rec)
err = fmt.Errorf("panic was caught while verifying risc0 proof: %s", rec)
}
}()

Expand All @@ -42,7 +42,7 @@ func VerifyRiscZeroReceipt(innerReceiptBuffer []byte, imageIdBuffer []byte, publ
}

if r == -1 {
err = fmt.Errorf("Panic happened on FFI while verifying risc0 proof")
err = fmt.Errorf("panic happened on FFI while verifying risc0 proof")
return isVerified, err
}

Expand Down
4 changes: 2 additions & 2 deletions operator/sp1/sp1.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func VerifySp1Proof(proofBuffer []byte, elfBuffer []byte) (isVerified bool, err
defer func() {
rec := recover()
if rec != nil {
err = fmt.Errorf("Panic was caught while verifying sp1 proof: %s", rec)
err = fmt.Errorf("panic was caught while verifying sp1 proof: %s", rec)
}
}()

Expand All @@ -34,7 +34,7 @@ func VerifySp1Proof(proofBuffer []byte, elfBuffer []byte) (isVerified bool, err
r := (C.int32_t)(C.verify_sp1_proof_ffi(proofPtr, (C.uint32_t)(len(proofBuffer)), elfPtr, (C.uint32_t)(len(elfBuffer))))

if r == -1 {
err = fmt.Errorf("Panic happened on FFI while verifying sp1 proof")
err = fmt.Errorf("panic happened on FFI while verifying sp1 proof")
return isVerified, err
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,24 @@ func GenerateIneqProof(x int, outputDir string) {
if err != nil {
panic(err)
}
defer proofFile.Close()
defer vkFile.Close()
defer witnessFile.Close()
defer func(proofFile *os.File) {
err := proofFile.Close()
if err != nil {
log.Fatal("could not close proof file:", err)
}
}(proofFile)
defer func(vkFile *os.File) {
err := vkFile.Close()
if err != nil {
log.Fatal("could not close verification key file:", err)
}
}(vkFile)
defer func(witnessFile *os.File) {
err := witnessFile.Close()
if err != nil {
log.Fatal("could not close witness file:", err)
}
}(witnessFile)

_, err = proof.WriteTo(proofFile)
if err != nil {
Expand Down
27 changes: 21 additions & 6 deletions scripts/test_files/gnark_groth16_bn254_script/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ func main() {
// r1cs := ccs.(*cs.SparseR1CS)
// as srs is not used in the setup, we can remove it
// srs, err := test.NewKZGSRS(r1cs)
if err != nil {
panic("KZG setup error")
}
//if err != nil {
// panic("KZG setup error")
//}

// no need to use srs in the setup
pk, vk, _ := groth16.Setup(ccs)
Expand Down Expand Up @@ -94,9 +94,24 @@ func main() {
if err != nil {
panic(err)
}
defer proofFile.Close()
defer vkFile.Close()
defer witnessFile.Close()
defer func(proofFile *os.File) {
err := proofFile.Close()
if err != nil {
log.Fatal("could not close proof file:", err)
}
}(proofFile)
defer func(vkFile *os.File) {
err := vkFile.Close()
if err != nil {
log.Fatal("could not close verification key file:", err)
}
}(vkFile)
defer func(witnessFile *os.File) {
err := witnessFile.Close()
if err != nil {
log.Fatal("could not close witness file:", err)
}
}(witnessFile)

_, err = proof.WriteTo(proofFile)
if err != nil {
Expand Down
21 changes: 18 additions & 3 deletions scripts/test_files/gnark_plonk_bls12_381_script/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,24 @@ func main() {
if err != nil {
panic(err)
}
defer proofFile.Close()
defer vkFile.Close()
defer witnessFile.Close()
defer func(proofFile *os.File) {
err := proofFile.Close()
if err != nil {
log.Fatal("could not close proof file:", err)
}
}(proofFile)
defer func(vkFile *os.File) {
err := vkFile.Close()
if err != nil {
log.Fatal("could not close verification key file:", err)
}
}(vkFile)
defer func(witnessFile *os.File) {
err := witnessFile.Close()
if err != nil {
log.Fatal("could not close witness file:", err)
}
}(witnessFile)

_, err = proof.WriteTo(proofFile)
if err != nil {
Expand Down
21 changes: 18 additions & 3 deletions scripts/test_files/gnark_plonk_bn254_script/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,24 @@ func main() {
if err != nil {
panic(err)
}
defer proofFile.Close()
defer vkFile.Close()
defer witnessFile.Close()
defer func(proofFile *os.File) {
err := proofFile.Close()
if err != nil {
log.Fatal("could not close proof file:", err)
}
}(proofFile)
defer func(vkFile *os.File) {
err := vkFile.Close()
if err != nil {
log.Fatal("could not close verification key file:", err)
}
}(vkFile)
defer func(witnessFile *os.File) {
err := witnessFile.Close()
if err != nil {
log.Fatal("could not close witness file:", err)
}
}(witnessFile)

_, err = proof.WriteTo(proofFile)
if err != nil {
Expand Down
Loading