Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
cargo clippy -p warp-core --features native_rule_bootstrap,trusted_runtime,host_test --test executable_operation_pipeline_tests -- -D warnings -D missing_docs

- name: cargo clippy (compiler-produced pure evaluation)
run: cargo clippy -p warp-core --features trusted_runtime --lib --test edict_pure_evaluation_tests --test edict_pure_unsigned_subtraction_tests --test edict_pure_byte_length_tests -- -D warnings -D missing_docs
run: cargo clippy -p warp-core --features trusted_runtime --lib --test edict_pure_evaluation_tests --test edict_pure_unsigned_subtraction_tests --test edict_pure_byte_length_tests --test edict_byte_equality_tests -- -D warnings -D missing_docs

clippy-det-fixed:
name: Clippy (det_fixed)
Expand Down Expand Up @@ -314,7 +314,7 @@ jobs:
cargo test -p warp-core --features native_rule_bootstrap,trusted_runtime,host_test --test executable_operation_pipeline_tests
- name: cargo test (compiler-produced pure evaluation)
run: |
cargo test -p warp-core --features trusted_runtime --test edict_pure_evaluation_tests --test edict_pure_unsigned_subtraction_tests --test edict_pure_byte_length_tests
cargo test -p warp-core --features trusted_runtime --test edict_pure_evaluation_tests --test edict_pure_unsigned_subtraction_tests --test edict_pure_byte_length_tests --test edict_byte_equality_tests
cargo test -p warp-core --features trusted_runtime --lib edict_pure::
- name: cargo test --doc (warp-core)
run: cargo test -p warp-core --doc
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@

### Fixed

- Byte-equality fixture reproduction guidance now requires guarded reusable
compiler storage and preserves the limits of its frozen provider evidence.

- Byte-equality evaluator tests now require `trusted_runtime` in Cargo and run
in the feature-enabled CI and opt-in local test routes. Selecting the target
without the feature can no longer produce a zero-test success.

- The ordered-publication compiler witness retains the return code and raw
streams when unexpected output violates JSONL, instead of hiding the compiler
result behind a JSON decoding or non-object error.
Expand Down Expand Up @@ -51,6 +58,11 @@

### Added

- The package-pinned pure evaluator now supports equality of bounded byte
values, including nominal IDs. It charges the larger operand's byte length
before comparing, independent of mismatch position. Byte ordering and mixed
operand predicates still refuse; this adds no graph-read or admission API.

- Explicit opt-in admission of Edict's ordered-instruction contract publication,
with exact schema/manifest pins and a bounded manifest size. The original
admission API retains its original publication. This authenticates schema
Expand Down
4 changes: 4 additions & 0 deletions crates/warp-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ required-features = ["trusted_runtime"]
name = "edict_pure_byte_length_tests"
required-features = ["trusted_runtime"]

[[test]]
name = "edict_byte_equality_tests"
required-features = ["trusted_runtime"]

[build-dependencies]
blake3 = "1.0"

Expand Down
4 changes: 2 additions & 2 deletions crates/warp-core/src/edict_pure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct EvaluationLimits {
pub max_package_bytes: usize,
/// Maximum encoded application input size before canonical decoding.
pub max_input_bytes: usize,
/// Maximum number of interpreted operations.
/// Maximum deterministic work units, including one per byte-comparison position.
pub max_steps: u64,
/// Maximum cumulative materialized value bytes, including copies.
pub max_allocated_bytes: u64,
Expand All @@ -34,7 +34,7 @@ pub struct EvaluationLimits {
pub struct EvaluationResult {
/// Canonical application result bytes.
pub output: Vec<u8>,
/// Interpreted operation count.
/// Deterministic work units, including the full aperture of byte comparisons.
pub steps: u64,
/// Cumulative charged value storage.
pub allocated_bytes: u64,
Expand Down
29 changes: 21 additions & 8 deletions crates/warp-core/src/edict_pure/evaluate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ impl Meter {
if depth > MAX_DEPTH {
return Err(Error::UnsupportedProgram);
}
self.steps = self.steps.checked_add(1).ok_or(Error::StepBudgetExceeded)?;
self.charge_steps(1)
}

fn charge_steps(&mut self, count: u64) -> Result<(), Error> {
self.steps = self
.steps
.checked_add(count)
.ok_or(Error::StepBudgetExceeded)?;
if self.steps > self.limits.max_steps {
return Err(Error::StepBudgetExceeded);
}
Expand Down Expand Up @@ -208,13 +215,19 @@ fn predicate(
meter.step(depth)?;
let left = expression(&predicate.left, locals, helpers, meter, depth + 1)?;
let right = expression(&predicate.right, locals, helpers, meter, depth + 1)?;
let (Value::Integer(left), Value::Integer(right)) = (left, right) else {
return Err(Error::UnsupportedProgram);
};
Ok(match predicate.op {
Comparison::Equal => left == right,
Comparison::LessOrEqual => left <= right,
})
match (&predicate.op, left, right) {
(Comparison::Equal, Value::Integer(left), Value::Integer(right)) => Ok(left == right),
(Comparison::LessOrEqual, Value::Integer(left), Value::Integer(right)) => Ok(left <= right),
(Comparison::Equal, Value::Bytes(left), Value::Bytes(right)) => {
// Charge the full operand aperture before comparing, including unequal
// lengths. Cost cannot depend on a library's short-circuit behavior.
let count = u64::try_from(left.len().max(right.len()))
.map_err(|_| Error::StepBudgetExceeded)?;
meter.charge_steps(count)?;
Ok(left == right)
}
_ => Err(Error::UnsupportedProgram),
}
}

fn validate(value: &Value, ty: &RuntimeType, meter: &mut Meter, depth: usize) -> Result<(), Error> {
Expand Down
Loading
Loading