diff --git a/coordinator/internal/logic/auth/login.go b/coordinator/internal/logic/auth/login.go index aa4268380e..4c1f229ece 100644 --- a/coordinator/internal/logic/auth/login.go +++ b/coordinator/internal/logic/auth/login.go @@ -35,15 +35,15 @@ func NewLoginLogic(db *gorm.DB, cfg *config.Config, vf *verifier.Verifier) *Logi challengeOrm: orm.NewChallenge(db), } - for _, vk := range vf.ChunkVKMap { + for vk := range vf.ChunkVKMap { l.chunkVks[vk] = struct{}{} } - for _, vk := range vf.BatchVKMap { + for vk := range vf.BatchVKMap { l.batchVKs[vk] = struct{}{} } - for _, vk := range vf.BundleVkMap { + for vk := range vf.BundleVkMap { l.bundleVks[vk] = struct{}{} } diff --git a/coordinator/internal/logic/verifier/legacy_vk/agg_vk.vkey b/coordinator/internal/logic/verifier/legacy_vk/agg_vk.vkey deleted file mode 100644 index 0b4ab2657c..0000000000 Binary files a/coordinator/internal/logic/verifier/legacy_vk/agg_vk.vkey and /dev/null differ diff --git a/coordinator/internal/logic/verifier/legacy_vk/upgrade_vks.sh b/coordinator/internal/logic/verifier/legacy_vk/upgrade_vks.sh index bc5fad9bd4..c362314f04 100755 --- a/coordinator/internal/logic/verifier/legacy_vk/upgrade_vks.sh +++ b/coordinator/internal/logic/verifier/legacy_vk/upgrade_vks.sh @@ -6,6 +6,7 @@ echo $work_dir rm $work_dir/*.vkey -version=release-v0.11.4 -wget https://circuit-release.s3.us-west-2.amazonaws.com/${version}/chunk_vk.vkey -O $work_dir/chunk_vk.vkey -wget https://circuit-release.s3.us-west-2.amazonaws.com/${version}/agg_vk.vkey -O $work_dir/agg_vk.vkey \ No newline at end of file +version=release-v0.12.0 +wget https://circuit-release.s3.us-west-2.amazonaws.com/${version}/vk_chunk.vkey -O $work_dir/vk_chunk.vkey +wget https://circuit-release.s3.us-west-2.amazonaws.com/${version}/vk_batch.vkey -O $work_dir/vk_batch.vkey +wget https://circuit-release.s3.us-west-2.amazonaws.com/${version}/vk_bundle.vkey -O $work_dir/vk_bundle.vkey \ No newline at end of file diff --git a/coordinator/internal/logic/verifier/legacy_vk/vk_batch.vkey b/coordinator/internal/logic/verifier/legacy_vk/vk_batch.vkey new file mode 100644 index 0000000000..b3540d0f79 Binary files /dev/null and b/coordinator/internal/logic/verifier/legacy_vk/vk_batch.vkey differ diff --git a/coordinator/internal/logic/verifier/legacy_vk/vk_bundle.vkey b/coordinator/internal/logic/verifier/legacy_vk/vk_bundle.vkey new file mode 100644 index 0000000000..df9ce5840b Binary files /dev/null and b/coordinator/internal/logic/verifier/legacy_vk/vk_bundle.vkey differ diff --git a/coordinator/internal/logic/verifier/legacy_vk/chunk_vk.vkey b/coordinator/internal/logic/verifier/legacy_vk/vk_chunk.vkey similarity index 100% rename from coordinator/internal/logic/verifier/legacy_vk/chunk_vk.vkey rename to coordinator/internal/logic/verifier/legacy_vk/vk_chunk.vkey diff --git a/coordinator/internal/logic/verifier/types.go b/coordinator/internal/logic/verifier/types.go index 9d4fdba931..2d831d53ed 100644 --- a/coordinator/internal/logic/verifier/types.go +++ b/coordinator/internal/logic/verifier/types.go @@ -10,7 +10,7 @@ const InvalidTestProof = "this is a invalid proof" // Verifier represents a rust ffi to a halo2 verifier. type Verifier struct { cfg *config.VerifierConfig - ChunkVKMap map[string]string - BatchVKMap map[string]string - BundleVkMap map[string]string + ChunkVKMap map[string]struct{} + BatchVKMap map[string]struct{} + BundleVkMap map[string]struct{} } diff --git a/coordinator/internal/logic/verifier/verifier.go b/coordinator/internal/logic/verifier/verifier.go index 2a616f126d..dcc28ded6e 100644 --- a/coordinator/internal/logic/verifier/verifier.go +++ b/coordinator/internal/logic/verifier/verifier.go @@ -60,9 +60,9 @@ func NewVerifier(cfg *config.VerifierConfig) (*Verifier, error) { v := &Verifier{ cfg: cfg, - ChunkVKMap: make(map[string]string), - BatchVKMap: make(map[string]string), - BundleVkMap: make(map[string]string), + ChunkVKMap: make(map[string]struct{}), + BatchVKMap: make(map[string]struct{}), + BundleVkMap: make(map[string]struct{}), } bundleVK, err := v.readVK(path.Join(cfg.HighVersionCircuit.AssetsPath, "vk_bundle.vkey")) @@ -77,9 +77,9 @@ func NewVerifier(cfg *config.VerifierConfig) (*Verifier, error) { if err != nil { return nil, err } - v.BundleVkMap[cfg.ForkName] = bundleVK - v.BatchVKMap[cfg.ForkName] = batchVK - v.ChunkVKMap[cfg.ForkName] = chunkVK + v.BundleVkMap[bundleVK] = struct{}{} + v.BatchVKMap[batchVK] = struct{}{} + v.ChunkVKMap[chunkVK] = struct{}{} if err := v.loadEmbedVK(); err != nil { return nil, err @@ -190,19 +190,27 @@ func (v *Verifier) readVK(filePat string) (string, error) { var legacyVKFS embed.FS func (v *Verifier) loadEmbedVK() error { - batchVKBytes, err := fs.ReadFile(legacyVKFS, "legacy_vk/agg_vk.vkey") + chunkVKBytes, err := fs.ReadFile(legacyVKFS, "legacy_vk/vk_chunk.vkey") + if err != nil { + log.Error("load embed chunk vk failure", "err", err) + return err + } + + batchVKBytes, err := fs.ReadFile(legacyVKFS, "legacy_vk/vk_batch.vkey") if err != nil { log.Error("load embed batch vk failure", "err", err) return err } - chunkVkBytes, err := fs.ReadFile(legacyVKFS, "legacy_vk/chunk_vk.vkey") + bundleVKBytes, err := fs.ReadFile(legacyVKFS, "legacy_vk/vk_bundle.vkey") if err != nil { log.Error("load embed chunk vk failure", "err", err) return err } - v.BatchVKMap["curie"] = base64.StdEncoding.EncodeToString(batchVKBytes) - v.ChunkVKMap["curie"] = base64.StdEncoding.EncodeToString(chunkVkBytes) + v.ChunkVKMap[base64.StdEncoding.EncodeToString(chunkVKBytes)] = struct{}{} + v.BatchVKMap[base64.StdEncoding.EncodeToString(batchVKBytes)] = struct{}{} + v.BundleVkMap[base64.StdEncoding.EncodeToString(bundleVKBytes)] = struct{}{} + return nil }