get jwt proverVersion

This commit is contained in:
Lawliet-Chan
2023-08-10 13:10:49 +08:00
parent 1e2ce2d655
commit 2044a052ec
2 changed files with 7 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
jwt "github.com/appleboy/gin-jwt/v2"
"scroll-tech/common/version"
"time"
@@ -324,7 +325,8 @@ func (m *ProofReceiverLogic) checkIsTimeoutFailure(ctx context.Context, hash, pr
}
func (m *ProofReceiverLogic) verifyChunkProof(c *gin.Context, proof *message.ChunkProof) (bool, error) {
proverVersion := c.GetString(coordinatorType.ProverVersion)
claims := jwt.ExtractClaims(c)
proverVersion := claims[coordinatorType.ProverVersion]
switch proverVersion {
case version.ZkVersion:
return m.verifier.VerifyChunkProof(proof)
@@ -335,7 +337,8 @@ func (m *ProofReceiverLogic) verifyChunkProof(c *gin.Context, proof *message.Chu
}
func (m *ProofReceiverLogic) verifyBatchProof(c *gin.Context, proof *message.BatchProof) (bool, error) {
proverVersion := c.GetString(coordinatorType.ProverVersion)
claims := jwt.ExtractClaims(c)
proverVersion := claims[coordinatorType.ProverVersion]
switch proverVersion {
case version.ZkVersion:
return m.verifier.VerifyBatchProof(proof)

View File

@@ -108,7 +108,8 @@ func setupCoordinator(t *testing.T, proversPerSession uint8, coordinatorURL stri
}
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.RunDBImage(t)