Skip to content
Open
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
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ repository = "https://github.com/scroll-tech/scroll"
version = "4.5.8"

[workspace.dependencies]
scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "ad0efe7" }
scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "ad0efe7" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "ad0efe7" }
scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "07ecd62" }
scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "07ecd62" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "07ecd62" }

sbv-primitives = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "chore/openvm-1.3", features = ["scroll"] }
sbv-utils = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "chore/openvm-1.3" }
Expand Down
2 changes: 1 addition & 1 deletion common/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime/debug"
)

var tag = "v4.5.45"
var tag = "v4.5.46"

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
Expand Down
17 changes: 17 additions & 0 deletions coordinator/internal/logic/libzkp/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,20 @@ func DumpVk(forkName, filePath string) error {

return nil
}

// UnivTaskCompatibilityFix calls the universal task compatibility fix function
func UnivTaskCompatibilityFix(taskJSON string) (string, error) {
cTaskJSON := goToCString(taskJSON)
defer freeCString(cTaskJSON)

resultPtr := C.univ_task_compatibility_fix(cTaskJSON)
if resultPtr == nil {
return "", fmt.Errorf("univ_task_compatibility_fix failed")
}

// Convert result to Go string and free C memory
result := C.GoString(resultPtr)
C.release_string(resultPtr)

return result, nil
}
3 changes: 3 additions & 0 deletions coordinator/internal/logic/libzkp/libzkp.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@ char* gen_wrapped_proof(char* proof_json, char* metadata, char* vk, size_t vk_le
// Release memory allocated for a string returned by gen_wrapped_proof
void release_string(char* string_ptr);

// Universal task compatibility fix function
char* univ_task_compatibility_fix(char* task_json);

#endif /* LIBZKP_H */
8 changes: 8 additions & 0 deletions coordinator/internal/logic/provertask/batch_prover_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ func (bp *BatchProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
return nil, ErrCoordinatorInternalFailure
}
proverTask.Metadata = metadata

if isCompatibilityFixingVersion(taskCtx.ProverVersion) {
log.Info("Apply compatibility fixing for prover", "version", taskCtx.ProverVersion)
if err := fixCompatibility(taskMsg); err != nil {
log.Error("apply compatibility failure", "err", err)
return nil, ErrCoordinatorInternalFailure
}
}
}

// Store session info.
Expand Down
8 changes: 8 additions & 0 deletions coordinator/internal/logic/provertask/bundle_prover_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ func (bp *BundleProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinat
// bundle proof require snark
taskMsg.UseSnark = true
proverTask.Metadata = metadata

if isCompatibilityFixingVersion(taskCtx.ProverVersion) {
log.Info("Apply compatibility fixing for prover", "version", taskCtx.ProverVersion)
if err := fixCompatibility(taskMsg); err != nil {
log.Error("apply compatibility failure", "err", err)
return nil, ErrCoordinatorInternalFailure
}
}
}

// Store session info.
Expand Down
18 changes: 18 additions & 0 deletions coordinator/internal/logic/provertask/prover_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"gorm.io/gorm"

"scroll-tech/common/types/message"
"scroll-tech/common/version"

"scroll-tech/coordinator/internal/config"
"scroll-tech/coordinator/internal/logic/libzkp"
Expand Down Expand Up @@ -201,6 +202,23 @@ func (b *BaseProverTask) applyUniversal(schema *coordinatorType.GetTaskSchema) (
return schema, []byte(metadata), nil
}

const CompatibilityVersion = "4.5.43"

func isCompatibilityFixingVersion(ver string) bool {
return !version.CheckScrollRepoVersion(ver, CompatibilityVersion)
}
Comment on lines +205 to +209
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Version gate likely inverted and threshold appears inconsistent with PR intent.

  • Current code applies the fix when proverVersion < CompatibilityVersion due to the negation.
  • PR title/description says “Compatible with prover from 4.5.33,” but the constant is "4.5.43". If the fix is required for 4.5.33 and newer, the predicate should not be negated and the constant should be 4.5.33. If instead the fix is for older provers, set the constant accordingly and keep the negation. Please confirm the intended direction.

Proposed if the fix targets >= 4.5.33:

-const CompatibilityVersion = "4.5.43"
+const CompatibilityVersion = "4.5.33"
@@
-func isCompatibilityFixingVersion(ver string) bool {
-    return !version.CheckScrollRepoVersion(ver, CompatibilityVersion)
-}
+func isCompatibilityFixingVersion(ver string) bool {
+    // apply fix for provers >= 4.5.33
+    return version.CheckScrollRepoVersion(ver, CompatibilityVersion)
+}

To verify usages and avoid regressions, run:

If the fix is intended for “older than X,” replace X with the true minimum and keep the negation, but please update the comment to state that explicitly.


🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -nP 'CompatibilityVersion|isCompatibilityFixingVersion\s*\(' -C3
rg -nP 'CheckScrollRepoVersion\(' common/version

Length of output: 2956


🏁 Script executed:

#!/bin/bash
set -euo pipefail
# Dump implementation of CheckScrollRepoVersion
sed -n '1,200p' common/version/prover_version.go
# Dump tests for CheckScrollRepoVersion
sed -n '1,200p' common/version/prover_version_test.go

Length of output: 3503


Align CompatibilityVersion and predicate with intended target version

  • CompatibilityVersion is set to "4.5.43" but the PR description specifies compatibility from 4.5.33; update the constant to the actual minimum version.
  • The !CheckScrollRepoVersion negation means fixes apply only to provers < CompatibilityVersion; if the fix should target provers ≥ the minimum version, remove the negation (i.e. use return CheckScrollRepoVersion(ver, CompatibilityVersion)).
🤖 Prompt for AI Agents
In coordinator/internal/logic/provertask/prover_task.go around lines 205 to 209,
the CompatibilityVersion constant and predicate are wrong for the intended
target; change the constant value from "4.5.43" to "4.5.33" and remove the
negation so the function returns version.CheckScrollRepoVersion(ver,
CompatibilityVersion) (i.e., fixes apply to provers >= the minimum version).


func fixCompatibility(schema *coordinatorType.GetTaskSchema) error {

fixedTask, err := libzkp.UnivTaskCompatibilityFix(schema.TaskData)
if err != nil {
return err
}
schema.TaskData = fixedTask

return nil
}

func newGetTaskCounterVec(factory promauto.Factory, taskType string) *prometheus.CounterVec {
getTaskCounterInitOnce.Do(func() {
getTaskCounterVec = factory.NewCounterVec(prometheus.CounterOpts{
Expand Down
2 changes: 1 addition & 1 deletion coordinator/test/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func setupCoordinator(t *testing.T, proversPerSession uint8, coordinatorURL stri
func setEnv(t *testing.T) {
var err error

version.Version = "v4.4.89"
version.Version = "v4.5.45"

glogger := log.NewGlogHandler(log.StreamHandler(os.Stderr, log.LogfmtFormat()))
glogger.Verbosity(log.LvlInfo)
Expand Down
14 changes: 7 additions & 7 deletions crates/gpu_override/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions crates/libzkp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,47 @@ pub fn checkout_chunk_task(
Ok(ret)
}

/// Convert the universal task json into compatible form for old prover
pub fn univ_task_compatibility_fix(task_json: &str) -> eyre::Result<String> {
use scroll_zkvm_types::proof::VmInternalStarkProof;

let u_task: tasks::ProvingTask = serde_json::from_str(task_json)?;
let aggregated_proofs: Vec<VmInternalStarkProof> = u_task
.aggregated_proofs
.into_iter()
.map(|proof| VmInternalStarkProof {
proofs: proof.proofs,
public_values: proof.public_values,
})
.collect();

#[derive(Serialize)]
struct CompatibleProvingTask {
/// seralized witness which should be written into stdin first
pub serialized_witness: Vec<Vec<u8>>,
/// aggregated proof carried by babybear fields, should be written into stdin
/// followed `serialized_witness`
pub aggregated_proofs: Vec<VmInternalStarkProof>,
/// Fork name specify
pub fork_name: String,
/// The vk of app which is expcted to prove this task
pub vk: Vec<u8>,
/// An identifier assigned by coordinator, it should be kept identify for the
/// same task (for example, using chunk, batch and bundle hashes)
pub identifier: String,
}

let compatible_u_task = CompatibleProvingTask {
serialized_witness: u_task.serialized_witness,
aggregated_proofs,
fork_name: u_task.fork_name,
vk: u_task.vk,
identifier: u_task.identifier,
};

Ok(serde_json::to_string(&compatible_u_task)?)
}

/// Generate required staff for proving tasks
/// return (pi_hash, metadata, task)
pub fn gen_universal_task(
Expand Down
13 changes: 13 additions & 0 deletions crates/libzkp_c/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,19 @@ pub unsafe extern "C" fn gen_wrapped_proof(
}
}

/// # Safety
#[no_mangle]
pub unsafe extern "C" fn univ_task_compatibility_fix(task_json: *const c_char) -> *mut c_char {
let task_json_str = c_char_to_str(task_json);
match libzkp::univ_task_compatibility_fix(task_json_str) {
Ok(result) => CString::new(result).unwrap().into_raw(),
Err(e) => {
tracing::error!("univ_task_compability_fix failed, error: {:#}", e);
std::ptr::null_mut()
}
}
}

/// # Safety
#[no_mangle]
pub unsafe extern "C" fn release_string(ptr: *mut c_char) {
Expand Down
Loading