Skip to content

Commit

Permalink
fix: v1.0.8-testnet (succinctlabs#957)
Browse files Browse the repository at this point in the history
Co-authored-by: John Guibas <[email protected]>
  • Loading branch information
ctian1 and jtguibas authored Jun 20, 2024
1 parent b35be42 commit 14eb569
Show file tree
Hide file tree
Showing 26 changed files with 175 additions and 91 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check branch
if: github.head_ref != 'dev'
if: github.head_ref != 'dev' && !startsWith(github.ref, 'release/') && !startsWith(github.ref, 'hotfix/')
run: |
echo "ERROR: You can only merge to main from dev."
echo "ERROR: You can only merge to main from dev, release/*, or hotfix/*."
exit 1
40 changes: 20 additions & 20 deletions Cargo.lock

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

36 changes: 18 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@ debug = true
debug-assertions = true

[workspace.dependencies]
p3-air = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-field = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-commit = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-matrix = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-air = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-field = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-commit = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-matrix = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-baby-bear = { git = "https://github.com/Plonky3/Plonky3.git", features = [
"nightly-features",
], rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-util = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-challenger = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-dft = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-fri = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-keccak = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-keccak-air = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-blake3 = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-merkle-tree = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-poseidon2 = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-symmetric = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-uni-stark = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-maybe-rayon = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
p3-bn254-fr = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" }
], rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-util = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-challenger = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-dft = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-fri = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-keccak = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-keccak-air = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-blake3 = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-merkle-tree = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-poseidon2 = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-symmetric = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-uni-stark = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-maybe-rayon = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }
p3-bn254-fr = { git = "https://github.com/Plonky3/Plonky3.git", rev = "88ea2b866e41329817e4761429b4a5a2a9751c07" }

# For local development.

Expand Down
2 changes: 1 addition & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ use stark::StarkGenericConfig;
/// This string should be updated whenever any step in verifying an SP1 proof changes, including
/// core, recursion, and plonk-bn254. This string is used to download SP1 artifacts and the gnark
/// docker image.
pub const SP1_CIRCUIT_VERSION: &str = "v1.0.7-testnet";
pub const SP1_CIRCUIT_VERSION: &str = "v1.0.8-testnet";
46 changes: 22 additions & 24 deletions core/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,9 @@ impl<'a> Runtime<'a> {
Entry::Occupied(entry) => entry.into_mut(),
Entry::Vacant(entry) => {
// If addr has a specific value to be initialized with, use that, otherwise 0.
let value = self.state.uninitialized_memory.remove(&addr).unwrap_or(0);

// Do not emit memory initialize events for address 0 as that is done in initialize.
if addr != 0 {
self.record
.memory_initialize_events
.push(MemoryInitializeFinalizeEvent::initialize(addr, value, true));
}
let value = self.state.uninitialized_memory.get(&addr).unwrap_or(&0);
entry.insert(MemoryRecord {
value,
value: *value,
shard: 0,
timestamp: 0,
})
Expand Down Expand Up @@ -312,16 +305,10 @@ impl<'a> Runtime<'a> {
Entry::Occupied(entry) => entry.into_mut(),
Entry::Vacant(entry) => {
// If addr has a specific value to be initialized with, use that, otherwise 0.
let value = self.state.uninitialized_memory.remove(&addr).unwrap_or(0);
let value = self.state.uninitialized_memory.get(&addr).unwrap_or(&0);

// Do not emit memory initialize events for address 0 as that is done in initialize.
if addr != 0 {
self.record
.memory_initialize_events
.push(MemoryInitializeFinalizeEvent::initialize(addr, value, true));
}
entry.insert(MemoryRecord {
value,
value: *value,
shard: 0,
timestamp: 0,
})
Expand Down Expand Up @@ -1026,11 +1013,6 @@ impl<'a> Runtime<'a> {
},
);
}

// Create init event for register 0 because it needs to be the first row in MemoryInit.
self.record
.memory_initialize_events
.push(MemoryInitializeFinalizeEvent::initialize(0, 0, true));
}

pub fn run_untraced(&mut self) -> Result<(), ExecutionError> {
Expand Down Expand Up @@ -1134,13 +1116,29 @@ impl<'a> Runtime<'a> {
addr_0_final_record,
));

let memory_initialize_events = &mut self.record.memory_initialize_events;
let addr_0_initialize_event =
MemoryInitializeFinalizeEvent::initialize(0, 0, addr_0_record.is_some());
memory_initialize_events.push(addr_0_initialize_event);

for addr in self.state.memory.keys() {
if addr == &0 {
continue; // We handle addr = 0 separately above.
// Handled above.
continue;
}

let record = *self.state.memory.get(addr).unwrap();
// Program memory is initialized in the MemoryProgram chip and doesn't require any events,
// so we only send init events for other memory addresses.
if !self.record.program.memory_image.contains_key(addr) {
let initial_value = self.state.uninitialized_memory.get(addr).unwrap_or(&0);
memory_initialize_events.push(MemoryInitializeFinalizeEvent::initialize(
*addr,
*initial_value,
true,
));
}

let record = *self.state.memory.get(addr).unwrap();
memory_finalize_events.push(MemoryInitializeFinalizeEvent::finalize_from_record(
*addr, &record,
));
Expand Down
8 changes: 4 additions & 4 deletions core/src/runtime/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,11 @@ impl MachineRecord for ExecutionRecord {
self.nonce_lookup.insert(event.lookup_id, i as u32);
}

first
.memory_initialize_events
// Put MemoryInit / MemoryFinalize events in the last shard.
let last = shards.last_mut().unwrap();
last.memory_initialize_events
.extend_from_slice(&self.memory_initialize_events);
first
.memory_finalize_events
last.memory_finalize_events
.extend_from_slice(&self.memory_finalize_events);

// Copy the nonce lookup to all shards.
Expand Down
12 changes: 12 additions & 0 deletions core/src/stark/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,18 @@ pub mod tests {
run_test(program).unwrap();
}

#[test]
fn test_fibonacci_prove_checkpoints() {
setup_logger();

let program = fibonacci_program();
let stdin = SP1Stdin::new();
let mut opts = SP1CoreOpts::default();
opts.shard_size = 1024;
opts.shard_batch_size = 2;
prove(program, &stdin, BabyBearPoseidon2::new(), opts).unwrap();
}

#[test]
fn test_fibonacci_prove_batch() {
setup_logger();
Expand Down
2 changes: 1 addition & 1 deletion core/src/stark/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub struct ShardOpenedValues<T: Serialize> {
/// The maximum number of elements that can be stored in the public values vec. Both SP1 and recursive
/// proofs need to pad their public_values vec to this length. This is required since the recursion
/// verification program expects the public values vec to be fixed length.
pub const PROOF_MAX_NUM_PVS: usize = 240;
pub const PROOF_MAX_NUM_PVS: usize = 241;

#[derive(Serialize, Deserialize, Clone)]
#[serde(bound = "")]
Expand Down
3 changes: 3 additions & 0 deletions examples/Cargo.lock

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

2 changes: 1 addition & 1 deletion examples/aggregation/program/Cargo.lock

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

Binary file modified examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf
Binary file not shown.
Loading

0 comments on commit 14eb569

Please sign in to comment.