Skip to content

Commit

Permalink
chore: rename v3/v4 to lo/hi for coordinator
Browse files Browse the repository at this point in the history
  • Loading branch information
roynalnaruto committed Jul 22, 2024
1 parent 4f011ab commit 6f29a6e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions coordinator/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ type VerifierConfig struct {
ForkName string `json:"fork_name"`
MockMode bool `json:"mock_mode"`
ParamsPath string `json:"params_path"`
AssetsPathV3 string `json:"assets_path_v3"`
AssetsPathV4 string `json:"assets_path_v4"`
AssetsPathLo string `json:"assets_path_lo"` // lower version Verifier
AssetsPathHI string `json:"assets_path_hi"` // higher version Verifier
}

// NewConfig returns a new instance of Config.
Expand Down
18 changes: 9 additions & 9 deletions coordinator/internal/logic/verifier/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ func NewVerifier(cfg *config.VerifierConfig) (*Verifier, error) {
return &Verifier{cfg: cfg, ChunkVKMap: chunkVKMap, BatchVKMap: batchVKMap, BundleVkMap: bundleVKMap}, nil
}
paramsPathStr := C.CString(cfg.ParamsPath)
assetsPathV3Str := C.CString(cfg.AssetsPathV3)
assetsPathV4Str := C.CString(cfg.AssetsPathV4)
assetsPathLoStr := C.CString(cfg.AssetsPathLo)
assetsPathHiStr := C.CString(cfg.AssetsPathHi)
defer func() {
C.free(unsafe.Pointer(paramsPathStr))
C.free(unsafe.Pointer(assetsPathV3Str))
C.free(unsafe.Pointer(assetsPathV4Str))
C.free(unsafe.Pointer(assetsPathLoStr))
C.free(unsafe.Pointer(assetsPathHiStr))
}()

C.init_batch_verifier(paramsPathStr, assetsPathV4Str)
C.init_chunk_verifier(paramsPathStr, assetsPathV3Str, assetsPathV4Str)
C.init_batch_verifier(paramsPathStr, assetsPathHiStr)
C.init_chunk_verifier(paramsPathStr, assetsPathLoStr, assetsPathHiStr)

v := &Verifier{
cfg: cfg,
Expand All @@ -54,15 +54,15 @@ func NewVerifier(cfg *config.VerifierConfig) (*Verifier, error) {
BundleVkMap: make(map[string]string),
}

bundleVK, err := v.readVK(path.Join(cfg.AssetsPathV4, "vk_bundle.vkey"))
bundleVK, err := v.readVK(path.Join(cfg.AssetsPathHi, "vk_bundle.vkey"))
if err != nil {
return nil, err
}
batchVK, err := v.readVK(path.Join(cfg.AssetsPathV4, "vk_batch.vkey"))
batchVK, err := v.readVK(path.Join(cfg.AssetsPathHi, "vk_batch.vkey"))
if err != nil {
return nil, err
}
chunkVK, err := v.readVK(path.Join(cfg.AssetsPathV4, "vk_chunk.vkey"))
chunkVK, err := v.readVK(path.Join(cfg.AssetsPathHi, "vk_chunk.vkey"))
if err != nil {
return nil, err
}
Expand Down
10 changes: 6 additions & 4 deletions coordinator/internal/logic/verifier/verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import (

var (
paramsPath = flag.String("params", "/assets/test_params", "params dir")
assetsPath = flag.String("assets", "/assets/test_assets", "assets dir")
assetsPathLo = flag.String("assets", "/assets/test_assets_lo", "assets dir")
assetsPathHi = flag.String("assets", "/assets/test_assets_hi", "assets dir")
batchProofPath = flag.String("batch_proof", "/assets/proof_data/batch_proof", "batch proof file path")
chunkProofPath1 = flag.String("chunk_proof1", "/assets/proof_data/chunk_proof1", "chunk proof file path 1")
chunkProofPath2 = flag.String("chunk_proof2", "/assets/proof_data/chunk_proof2", "chunk proof file path 2")
Expand All @@ -28,9 +29,10 @@ func TestFFI(t *testing.T) {
as := assert.New(t)

cfg := &config.VerifierConfig{
MockMode: false,
ParamsPath: *paramsPath,
AssetsPath: *assetsPath,
MockMode: false,
ParamsPath: *paramsPath,
AssetsPathLo: *assetsPathLo,
AssetsPathHi: *assetsPathHi,
}

v, err := NewVerifier(cfg)
Expand Down

0 comments on commit 6f29a6e

Please sign in to comment.