mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-13 16:08:04 -05:00
Compare commits
39 Commits
test/code
...
multi_veri
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11cd211de4 | ||
|
|
141a05f2c6 | ||
|
|
5955329cff | ||
|
|
3292128919 | ||
|
|
497fd783a3 | ||
|
|
e7d4b10451 | ||
|
|
e7f868b467 | ||
|
|
8dd288c22d | ||
|
|
4dce379232 | ||
|
|
d8019b2dfb | ||
|
|
cf2fdfda9f | ||
|
|
02e6f77221 | ||
|
|
3e3f39a3f2 | ||
|
|
00f906f612 | ||
|
|
7f86fe65da | ||
|
|
df3fac89ae | ||
|
|
0892f0f876 | ||
|
|
0b9d6d04fa | ||
|
|
0c12773b78 | ||
|
|
36a4964aa5 | ||
|
|
cd4158c80d | ||
|
|
3e01d3de83 | ||
|
|
5344a73c5b | ||
|
|
50829cae9c | ||
|
|
2044a052ec | ||
|
|
1e2ce2d655 | ||
|
|
66e802fb55 | ||
|
|
716d01fda5 | ||
|
|
399404172c | ||
|
|
364a8f8850 | ||
|
|
76ba845d0f | ||
|
|
f729b8e0ab | ||
|
|
e6b0c61878 | ||
|
|
a7a65b60e5 | ||
|
|
160287e6cc | ||
|
|
bdc1957f27 | ||
|
|
8ee49ed515 | ||
|
|
c90d1414d9 | ||
|
|
87b1a7a63e |
4555
common/libzkp/impl/Cargo.lock.new
Normal file
4555
common/libzkp/impl/Cargo.lock.new
Normal file
File diff suppressed because it is too large
Load Diff
4555
common/libzkp/impl/Cargo.lock.old
Normal file
4555
common/libzkp/impl/Cargo.lock.old
Normal file
File diff suppressed because it is too large
Load Diff
@@ -28,8 +28,15 @@ var commit = func() string {
|
|||||||
// The default `000000-000000` is set for integration test, and will be overwritten by coordinator's & prover's actual compilations (see their Makefiles).
|
// The default `000000-000000` is set for integration test, and will be overwritten by coordinator's & prover's actual compilations (see their Makefiles).
|
||||||
var ZkVersion = "000000-000000"
|
var ZkVersion = "000000-000000"
|
||||||
|
|
||||||
// Version denote the version of scroll protocol, including the l2geth, relayer, coordinator, prover, contracts and etc.
|
// OldZkVersion is the last version of ZkVersion.
|
||||||
var Version = fmt.Sprintf("%s-%s-%s", tag, commit, ZkVersion)
|
var OldZkVersion = "000000-000000"
|
||||||
|
|
||||||
|
var (
|
||||||
|
// Version denote the version of scroll protocol, including the l2geth, relayer, coordinator, prover, contracts and etc.
|
||||||
|
Version = fmt.Sprintf("%s-%s-%s", tag, commit, ZkVersion)
|
||||||
|
// OldVersion is the last version of Version.
|
||||||
|
OldVersion = fmt.Sprintf("%s-%s-%s", tag, commit, OldZkVersion)
|
||||||
|
)
|
||||||
|
|
||||||
// CheckScrollProverVersion check the "scroll-prover" version, if it's different from the local one, return false
|
// CheckScrollProverVersion check the "scroll-prover" version, if it's different from the local one, return false
|
||||||
func CheckScrollProverVersion(proverVersion string) bool {
|
func CheckScrollProverVersion(proverVersion string) bool {
|
||||||
|
|||||||
@@ -5,28 +5,38 @@ IMAGE_VERSION=latest
|
|||||||
REPO_ROOT_DIR=./..
|
REPO_ROOT_DIR=./..
|
||||||
|
|
||||||
ifeq (4.3,$(firstword $(sort $(MAKE_VERSION) 4.3)))
|
ifeq (4.3,$(firstword $(sort $(MAKE_VERSION) 4.3)))
|
||||||
ZKEVM_VERSION=$(shell grep -m 1 "scroll-prover" ../common/libzkp/impl/Cargo.lock | cut -d "#" -f2 | cut -c-7)
|
ZKEVM_VERSION=$(shell grep -m 1 "scroll-prover" ../common/libzkp/impl/Cargo.lock.new | cut -d "#" -f2 | cut -c-7)
|
||||||
HALO2_VERSION=$(shell grep -m 1 "halo2.git" ../common/libzkp/impl/Cargo.lock | cut -d "#" -f2 | cut -c-7)
|
HALO2_VERSION=$(shell grep -m 1 "halo2.git" ../common/libzkp/impl/Cargo.lock.new | cut -d "#" -f2 | cut -c-7)
|
||||||
|
OLD_ZKEVM_VERSION=$(shell grep -m 1 "scroll-prover" ../common/libzkp/impl/Cargo.lock.old | cut -d "#" -f2 | cut -c-7)
|
||||||
|
OLD_HALO2_VERSION=$(shell grep -m 1 "halo2.git" ../common/libzkp/impl/Cargo.lock.old | cut -d "#" -f2 | cut -c-7)
|
||||||
else
|
else
|
||||||
ZKEVM_VERSION=$(shell grep -m 1 "scroll-prover" ../common/libzkp/impl/Cargo.lock | cut -d "\#" -f2 | cut -c-7)
|
ZKEVM_VERSION=$(shell grep -m 1 "scroll-prover" ../common/libzkp/impl/Cargo.lock.new | cut -d "\#" -f2 | cut -c-7)
|
||||||
HALO2_VERSION=$(shell grep -m 1 "halo2.git" ../common/libzkp/impl/Cargo.lock | cut -d "\#" -f2 | cut -c-7)
|
HALO2_VERSION=$(shell grep -m 1 "halo2.git" ../common/libzkp/impl/Cargo.lock.new | cut -d "\#" -f2 | cut -c-7)
|
||||||
|
OLD_ZKEVM_VERSION=$(shell grep -m 1 "scroll-prover" ../common/libzkp/impl/Cargo.lock.old | cut -d "\#" -f2 | cut -c-7)
|
||||||
|
OLD_HALO2_VERSION=$(shell grep -m 1 "halo2.git" ../common/libzkp/impl/Cargo.lock.old | cut -d "\#" -f2 | cut -c-7)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ZK_VERSION=${ZKEVM_VERSION}-${HALO2_VERSION}
|
ZK_VERSION=${ZKEVM_VERSION}-${HALO2_VERSION}
|
||||||
|
OLD_ZK_VERSION=${OLD_ZKEVM_VERSION}-${OLD_HALO2_VERSION}
|
||||||
|
|
||||||
|
pre-upgrade-zk:
|
||||||
|
cd ../common/libzkp/impl && cp Cargo.lock.old Cargo.lock && cargo clean && cargo build --release && cp ./target/release/libzkp.so ../interface/liboldzkp.so
|
||||||
|
cp -r ../common/libzkp/interface ./internal/logic/old_verifier/lib && rm ../common/libzkp/interface/liboldzkp.so
|
||||||
|
find ../common | grep libzktrie.so | xargs -I{} cp {} ./internal/logic/old_verifier/lib/liboldzktrie.so
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test -v -race -coverprofile=coverage.txt -covermode=atomic -p 1 $(PWD)/...
|
go test -v -race -coverprofile=coverage.txt -covermode=atomic -p 1 $(PWD)/...
|
||||||
|
|
||||||
libzkp:
|
libzkp: pre-upgrade-zk
|
||||||
cd ../common/libzkp/impl && cargo clean && cargo build --release && cp ./target/release/libzkp.so ../interface/
|
cd ../common/libzkp/impl && cp Cargo.lock.new Cargo.lock && cargo clean && cargo build --release && cp ./target/release/libzkp.so ../interface/
|
||||||
rm -rf ./internal/logic/verifier/lib && cp -r ../common/libzkp/interface ./internal/logic/verifier/lib
|
cp -r ../common/libzkp/interface ./internal/logic/verifier/lib
|
||||||
find ../common | grep libzktrie.so | xargs -I{} cp {} ./internal/logic/verifier/lib
|
find ../common | grep libzktrie.so | xargs -I{} cp {} ./internal/logic/verifier/lib
|
||||||
|
|
||||||
coordinator: libzkp ## Builds the Coordinator instance.
|
coordinator: libzkp ## Builds the Coordinator instance.
|
||||||
go build -ldflags "-X scroll-tech/common/version.ZkVersion=${ZK_VERSION}" -o $(PWD)/build/bin/coordinator ./cmd
|
go build -ldflags "-X scroll-tech/common/version.ZkVersion=${ZK_VERSION} -X scroll-tech/common/version.OldZkVersion=${OLD_ZK_VERSION}" -o $(PWD)/build/bin/coordinator ./cmd
|
||||||
|
|
||||||
coordinator_skip_libzkp:
|
coordinator_skip_libzkp:
|
||||||
go build -ldflags "-X scroll-tech/common/version.ZkVersion=${ZK_VERSION}" -o $(PWD)/build/bin/coordinator ./cmd
|
go build -ldflags "-X scroll-tech/common/version.ZkVersion=${ZK_VERSION} -X scroll-tech/common/version.OldZkVersion=${OLD_ZK_VERSION}" -o $(PWD)/build/bin/coordinator ./cmd
|
||||||
|
|
||||||
mock_coordinator: ## Builds the mocked Coordinator instance.
|
mock_coordinator: ## Builds the mocked Coordinator instance.
|
||||||
go build -tags="mock_prover mock_verifier" -o $(PWD)/build/bin/coordinator ./cmd
|
go build -tags="mock_prover mock_verifier" -o $(PWD)/build/bin/coordinator ./cmd
|
||||||
|
|||||||
@@ -8,6 +8,11 @@
|
|||||||
"params_path": "",
|
"params_path": "",
|
||||||
"assets_path": ""
|
"assets_path": ""
|
||||||
},
|
},
|
||||||
|
"old_verifier": {
|
||||||
|
"mock_mode": true,
|
||||||
|
"params_path": "",
|
||||||
|
"assets_path": ""
|
||||||
|
},
|
||||||
"max_verifier_workers": 4
|
"max_verifier_workers": 4
|
||||||
},
|
},
|
||||||
"db": {
|
"db": {
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ type ProverManager struct {
|
|||||||
SessionAttempts uint8 `json:"session_attempts"`
|
SessionAttempts uint8 `json:"session_attempts"`
|
||||||
// Zk verifier config.
|
// Zk verifier config.
|
||||||
Verifier *VerifierConfig `json:"verifier"`
|
Verifier *VerifierConfig `json:"verifier"`
|
||||||
|
// Old Zk version config
|
||||||
|
OldVerifier *VerifierConfig `json:"old_verifier"`
|
||||||
// Proof collection time (in seconds).
|
// Proof collection time (in seconds).
|
||||||
CollectionTimeSec int `json:"collection_time_sec"`
|
CollectionTimeSec int `json:"collection_time_sec"`
|
||||||
// Max number of workers in verifier worker pool
|
// Max number of workers in verifier worker pool
|
||||||
|
|||||||
35
coordinator/internal/logic/old_verifier/mock.go
Normal file
35
coordinator/internal/logic/old_verifier/mock.go
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
//go:build mock_verifier
|
||||||
|
|
||||||
|
package old_verifier
|
||||||
|
|
||||||
|
import (
|
||||||
|
"scroll-tech/common/types/message"
|
||||||
|
|
||||||
|
"scroll-tech/coordinator/internal/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
const InvalidTestProof = "this is a invalid proof"
|
||||||
|
|
||||||
|
// OldVerifier represents a mock halo2 verifier.
|
||||||
|
type OldVerifier struct{}
|
||||||
|
|
||||||
|
// NewVerifier Sets up a mock verifier.
|
||||||
|
func NewOldVerifier(_ *config.VerifierConfig) (*OldVerifier, error) {
|
||||||
|
return &OldVerifier{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// VerifyChunkProof return a mock verification result for a ChunkProof.
|
||||||
|
func (v *OldVerifier) VerifyChunkProof(proof *message.ChunkProof) (bool, error) {
|
||||||
|
if string(proof.Proof) == InvalidTestProof {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// VerifyBatchProof return a mock verification result for a BatchProof.
|
||||||
|
func (v *OldVerifier) VerifyBatchProof(proof *message.BatchProof) (bool, error) {
|
||||||
|
if string(proof.Proof) == InvalidTestProof {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
98
coordinator/internal/logic/old_verifier/old_verifier.go
Normal file
98
coordinator/internal/logic/old_verifier/old_verifier.go
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
//go:build !mock_verifier
|
||||||
|
|
||||||
|
package old_verifier
|
||||||
|
|
||||||
|
/*
|
||||||
|
#cgo LDFLAGS: -loldzkp -lm -ldl -loldzktrie -L${SRCDIR}/lib/ -Wl,-rpath=${SRCDIR}/lib
|
||||||
|
#cgo gpu LDFLAGS: -loldzkp -lm -ldl -lgmp -lstdc++ -lprocps -loldzktrie -L/usr/local/cuda/lib64/ -lcudart -L${SRCDIR}/lib/ -Wl,-rpath=${SRCDIR}/lib
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "./lib/libzkp.h"
|
||||||
|
*/
|
||||||
|
import "C" //nolint:typecheck
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"scroll-tech/common/types/message"
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
"scroll-tech/coordinator/internal/logic/verifier"
|
||||||
|
|
||||||
|
"github.com/scroll-tech/go-ethereum/log"
|
||||||
|
|
||||||
|
"scroll-tech/coordinator/internal/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OldVerifier represents a rust ffi to a halo2 verifier.
|
||||||
|
type OldVerifier struct {
|
||||||
|
cfg *config.VerifierConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOldVerifier Sets up a rust ffi to call verify.
|
||||||
|
func NewOldVerifier(cfg *config.VerifierConfig) (*OldVerifier, error) {
|
||||||
|
if cfg.MockMode {
|
||||||
|
return &OldVerifier{cfg: cfg}, nil
|
||||||
|
}
|
||||||
|
paramsPathStr := C.CString(cfg.ParamsPath)
|
||||||
|
assetsPathStr := C.CString(cfg.AssetsPath)
|
||||||
|
defer func() {
|
||||||
|
C.free(unsafe.Pointer(paramsPathStr))
|
||||||
|
C.free(unsafe.Pointer(assetsPathStr))
|
||||||
|
}()
|
||||||
|
|
||||||
|
log.Info("Init old verifier!")
|
||||||
|
|
||||||
|
C.init_batch_verifier(paramsPathStr, assetsPathStr)
|
||||||
|
C.init_chunk_verifier(paramsPathStr, assetsPathStr)
|
||||||
|
|
||||||
|
return &OldVerifier{cfg: cfg}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// VerifyBatchProof Verify a ZkProof by marshaling it and sending it to the Halo2 OldVerifier.
|
||||||
|
func (v *OldVerifier) VerifyBatchProof(proof *message.BatchProof) (bool, error) {
|
||||||
|
if v.cfg.MockMode {
|
||||||
|
log.Info("Mock mode, batch verifier disabled")
|
||||||
|
if string(proof.Proof) == verifier.InvalidTestProof {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
buf, err := json.Marshal(proof)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
proofStr := C.CString(string(buf))
|
||||||
|
defer func() {
|
||||||
|
C.free(unsafe.Pointer(proofStr))
|
||||||
|
}()
|
||||||
|
|
||||||
|
log.Info("Start to verify batch proof ...")
|
||||||
|
verified := C.verify_batch_proof(proofStr)
|
||||||
|
return verified != 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// VerifyChunkProof Verify a ZkProof by marshaling it and sending it to the Halo2 OldVerifier.
|
||||||
|
func (v *OldVerifier) VerifyChunkProof(proof *message.ChunkProof) (bool, error) {
|
||||||
|
if v.cfg.MockMode {
|
||||||
|
log.Info("Mock mode, verifier disabled")
|
||||||
|
if string(proof.Proof) == verifier.InvalidTestProof {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
buf, err := json.Marshal(proof)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
proofStr := C.CString(string(buf))
|
||||||
|
defer func() {
|
||||||
|
C.free(unsafe.Pointer(proofStr))
|
||||||
|
}()
|
||||||
|
|
||||||
|
log.Info("Start to verify chunk proof ...")
|
||||||
|
verified := C.verify_chunk_proof(proofStr)
|
||||||
|
return verified != 0, nil
|
||||||
|
}
|
||||||
@@ -5,8 +5,13 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"scroll-tech/common/version"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"scroll-tech/coordinator/internal/logic/old_verifier"
|
||||||
|
|
||||||
|
jwt "github.com/appleboy/gin-jwt/v2"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||||
@@ -27,6 +32,8 @@ var (
|
|||||||
ErrValidatorFailureProofMsgStatusNotOk = errors.New("validator failure proof msg status not ok")
|
ErrValidatorFailureProofMsgStatusNotOk = errors.New("validator failure proof msg status not ok")
|
||||||
// ErrValidatorFailureProverTaskEmpty get none prover task
|
// ErrValidatorFailureProverTaskEmpty get none prover task
|
||||||
ErrValidatorFailureProverTaskEmpty = errors.New("validator failure get none prover task for the proof")
|
ErrValidatorFailureProverTaskEmpty = errors.New("validator failure get none prover task for the proof")
|
||||||
|
// ErrInvalidProverVersion means prover version is invalid.
|
||||||
|
ErrInvalidProverVersion = errors.New("prover version invalid")
|
||||||
// ErrValidatorFailureProverTaskCannotSubmitTwice prove task can not submit proof twice
|
// ErrValidatorFailureProverTaskCannotSubmitTwice prove task can not submit proof twice
|
||||||
ErrValidatorFailureProverTaskCannotSubmitTwice = errors.New("validator failure prove task cannot submit proof twice")
|
ErrValidatorFailureProverTaskCannotSubmitTwice = errors.New("validator failure prove task cannot submit proof twice")
|
||||||
// ErrValidatorFailureProofTimeout the submit proof is timeout
|
// ErrValidatorFailureProofTimeout the submit proof is timeout
|
||||||
@@ -44,7 +51,8 @@ type ProofReceiverLogic struct {
|
|||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
cfg *config.ProverManager
|
cfg *config.ProverManager
|
||||||
|
|
||||||
verifier *verifier.Verifier
|
verifier *verifier.Verifier
|
||||||
|
oldVerifier *old_verifier.OldVerifier
|
||||||
|
|
||||||
proofReceivedTotal prometheus.Counter
|
proofReceivedTotal prometheus.Counter
|
||||||
proofSubmitFailure prometheus.Counter
|
proofSubmitFailure prometheus.Counter
|
||||||
@@ -64,6 +72,10 @@ func NewSubmitProofReceiverLogic(cfg *config.ProverManager, db *gorm.DB, reg pro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic("proof receiver new verifier failure")
|
panic("proof receiver new verifier failure")
|
||||||
}
|
}
|
||||||
|
oldVf, err := old_verifier.NewOldVerifier(cfg.OldVerifier)
|
||||||
|
if err != nil {
|
||||||
|
panic("proof receiver new OldVerifier failure")
|
||||||
|
}
|
||||||
return &ProofReceiverLogic{
|
return &ProofReceiverLogic{
|
||||||
chunkOrm: orm.NewChunk(db),
|
chunkOrm: orm.NewChunk(db),
|
||||||
batchOrm: orm.NewBatch(db),
|
batchOrm: orm.NewBatch(db),
|
||||||
@@ -72,7 +84,8 @@ func NewSubmitProofReceiverLogic(cfg *config.ProverManager, db *gorm.DB, reg pro
|
|||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
db: db,
|
db: db,
|
||||||
|
|
||||||
verifier: vf,
|
verifier: vf,
|
||||||
|
oldVerifier: oldVf,
|
||||||
|
|
||||||
proofReceivedTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{
|
proofReceivedTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{
|
||||||
Name: "coordinator_submit_proof_total",
|
Name: "coordinator_submit_proof_total",
|
||||||
@@ -150,9 +163,9 @@ func (m *ProofReceiverLogic) HandleZkProof(ctx *gin.Context, proofMsg *message.P
|
|||||||
var success bool
|
var success bool
|
||||||
var verifyErr error
|
var verifyErr error
|
||||||
if proofMsg.Type == message.ProofTypeChunk {
|
if proofMsg.Type == message.ProofTypeChunk {
|
||||||
success, verifyErr = m.verifier.VerifyChunkProof(proofMsg.ChunkProof)
|
success, verifyErr = m.verifyChunkProof(ctx, proofMsg.ChunkProof)
|
||||||
} else if proofMsg.Type == message.ProofTypeBatch {
|
} else if proofMsg.Type == message.ProofTypeBatch {
|
||||||
success, verifyErr = m.verifier.VerifyBatchProof(proofMsg.BatchProof)
|
success, verifyErr = m.verifyBatchProof(ctx, proofMsg.BatchProof)
|
||||||
}
|
}
|
||||||
|
|
||||||
if verifyErr != nil || !success {
|
if verifyErr != nil || !success {
|
||||||
@@ -383,3 +396,27 @@ func (m *ProofReceiverLogic) updateProverTaskProof(ctx context.Context, pk strin
|
|||||||
}
|
}
|
||||||
return m.proverTaskOrm.UpdateProverTaskProof(ctx, proofMsg.Type, proofMsg.ID, pk, proofBytes)
|
return m.proverTaskOrm.UpdateProverTaskProof(ctx, proofMsg.Type, proofMsg.ID, pk, proofBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *ProofReceiverLogic) verifyChunkProof(c *gin.Context, proof *message.ChunkProof) (bool, error) {
|
||||||
|
claims := jwt.ExtractClaims(c)
|
||||||
|
proverVersion := claims[coordinatorType.ProverVersion]
|
||||||
|
switch proverVersion.(string) {
|
||||||
|
case version.Version:
|
||||||
|
return m.verifier.VerifyChunkProof(proof)
|
||||||
|
case version.OldVersion:
|
||||||
|
return m.oldVerifier.VerifyChunkProof(proof)
|
||||||
|
}
|
||||||
|
return false, ErrInvalidProverVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ProofReceiverLogic) verifyBatchProof(c *gin.Context, proof *message.BatchProof) (bool, error) {
|
||||||
|
claims := jwt.ExtractClaims(c)
|
||||||
|
proverVersion := claims[coordinatorType.ProverVersion]
|
||||||
|
switch proverVersion.(string) {
|
||||||
|
case version.Version:
|
||||||
|
return m.verifier.VerifyBatchProof(proof)
|
||||||
|
case version.OldVersion:
|
||||||
|
return m.oldVerifier.VerifyBatchProof(proof)
|
||||||
|
}
|
||||||
|
return false, ErrInvalidProverVersion
|
||||||
|
}
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ func NewVerifier(cfg *config.VerifierConfig) (*Verifier, error) {
|
|||||||
C.free(unsafe.Pointer(assetsPathStr))
|
C.free(unsafe.Pointer(assetsPathStr))
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
log.Info("Init verifier!")
|
||||||
|
|
||||||
C.init_batch_verifier(paramsPathStr, assetsPathStr)
|
C.init_batch_verifier(paramsPathStr, assetsPathStr)
|
||||||
C.init_chunk_verifier(paramsPathStr, assetsPathStr)
|
C.init_chunk_verifier(paramsPathStr, assetsPathStr)
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,8 @@ func setupCoordinator(t *testing.T, proversPerSession uint8, coordinatorURL stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setEnv(t *testing.T) {
|
func setEnv(t *testing.T) {
|
||||||
version.Version = "v1.2.3-aaa-bbb-ccc"
|
version.Version = "v1.2.3-commit-prover-halo2"
|
||||||
|
version.OldZkVersion = "prover_old"
|
||||||
|
|
||||||
base = docker.NewDockerApp()
|
base = docker.NewDockerApp()
|
||||||
base.RunDBImage(t)
|
base.RunDBImage(t)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)"
|
|||||||
PROJ_DIR=$DIR"/.."
|
PROJ_DIR=$DIR"/.."
|
||||||
|
|
||||||
mkdir -p $PROJ_DIR/assets/params
|
mkdir -p $PROJ_DIR/assets/params
|
||||||
wget https://circuit-release.s3.us-west-2.amazonaws.com/circuit-release/release-1220/test_seed -O $PROJ_DIR/assets/seed
|
wget https://circuit-release.s3.us-west-2.amazonaws.com/setup/params19 -O $PROJ_DIR/assets/params/params19
|
||||||
wget https://circuit-release.s3.us-west-2.amazonaws.com/circuit-release/params-0320/params20 -O $PROJ_DIR/assets/params/params20
|
wget https://circuit-release.s3.us-west-2.amazonaws.com/setup/params20 -O $PROJ_DIR/assets/params/params20
|
||||||
wget https://circuit-release.s3.us-west-2.amazonaws.com/circuit-release/params-0320/params26 -O $PROJ_DIR/assets/params/params26
|
wget https://circuit-release.s3.us-west-2.amazonaws.com/setup/params24 -O $PROJ_DIR/assets/params/params24
|
||||||
|
wget https://circuit-release.s3.us-west-2.amazonaws.com/setup/params25 -O $PROJ_DIR/assets/params/params25
|
||||||
Reference in New Issue
Block a user