Skip to content

Pre develop 0.16.0#789

Merged
agnusmor merged 935 commits into
developfrom
pre-develop-0.16.0
Mar 12, 2026
Merged

Pre develop 0.16.0#789
agnusmor merged 935 commits into
developfrom
pre-develop-0.16.0

Conversation

@fractasy

Copy link
Copy Markdown
Collaborator

No description provided.

@fractasy fractasy requested a review from Copilot February 15, 2026 14:20
@cla-bot cla-bot Bot added the cla-signed label Feb 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR prepares the codebase for the 0.16.0 development cycle by introducing new DMA-focused assembly routines, expanding shared-memory + streaming infrastructure (including precompile hints), and updating distributed/coordinator APIs and tooling to support new execution/metadata flows.

Changes:

  • Add optimized x86_64 DMA assembly helpers (fast memcpy + DMA encode) and wire them into the emulator build.
  • Introduce shared-memory reader/writer upgrades and new hints sinks/sources (file + shmem + streaming).
  • Update distributed gRPC/proto + coordinator/worker configs to support inputs/hints modes, streaming, and capacity semantics.

Reviewed changes

Copilot reviewed 161 out of 665 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
emulator-asm/src/dma/* Adds DMA assembly routines, constants, and a local test Makefile
emulator-asm/Makefile Links DMA objects into emulator build
emulator-asm/asm-runner/src/* Adds shmem reader, ring-buffer writer, hints sinks, and naming helpers
distributed/crates/* Updates proto/types to support hints + streaming and capacity changes
core/src/* Switches ELF handling to byte-slices, adds new op types/flags, updates SHA256 helper
common/src/* Refactors IO into stdin/stream, adds stream abstractions, changes trace mem_reads to Cow
cli/src/* Updates commands for new SDK APIs, inputs/hints URIs, adds SNARK verify/prove commands
book/getting_started/* Updates docs for new project layout and commands
.vscode/settings.json Updates editor setting
.github/workflows/pr.yml Adjusts CI timeouts and SHM size

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread emulator-asm/asm-runner/src/shmem_writer.rs
Comment thread common/src/utils.rs
Comment thread common/src/io/stream/file.rs
Comment thread common/src/io/stream/file.rs
Comment thread core/src/helpers.rs
Comment on lines +8 to +11
let state_u32: &mut [u32; 8] = unsafe { &mut *(state.as_mut_ptr() as *mut [u32; 8]) };
let input_u8: &[GenericArray<u8, U64>; 1] =
unsafe { &*(input.as_ptr() as *const [GenericArray<u8, U64>; 1]) };
compress256(state_u32, input_u8);

Copilot AI Feb 15, 2026

Copy link

Choose a reason for hiding this comment

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

This changes SHA-256 block/state byte ordering compared to the previous implementation (which explicitly constructed big-endian bytes and split u64->u32 in a controlled order). The new as_ptr() reinterprets host-endian memory directly, which will produce different results on little-endian systems unless the upstream state/input layout was also changed accordingly. To keep correctness, either preserve explicit endian conversions or document/guarantee the exact in-memory layout expected by callers and ensure they provide bytes/words in that layout.

Suggested change
let state_u32: &mut [u32; 8] = unsafe { &mut *(state.as_mut_ptr() as *mut [u32; 8]) };
let input_u8: &[GenericArray<u8, U64>; 1] =
unsafe { &*(input.as_ptr() as *const [GenericArray<u8, U64>; 1]) };
compress256(state_u32, input_u8);
// Convert the 4x u64 state into 8x u32 words in a fixed (big-endian) order.
let mut state_u32 = [0u32; 8];
for (i, word) in state.iter().cloned().enumerate() {
// High 32 bits first, then low 32 bits, independent of host endianness.
state_u32[2 * i] = (word >> 32) as u32;
state_u32[2 * i + 1] = word as u32;
}
// Convert the 8x u64 input words into a single 64-byte block in big-endian order.
let mut block = GenericArray::<u8, U64>::default();
for (i, word) in input.iter().enumerate() {
let bytes = word.to_be_bytes();
let offset = i * 8;
block[offset..offset + 8].copy_from_slice(&bytes);
}
// Compress a single 512-bit block.
compress256(&mut state_u32, std::slice::from_ref(&block));
// Convert the updated 8x u32 state back into 4x u64 words using the inverse mapping.
for i in 0..4 {
let hi = state_u32[2 * i] as u64;
let lo = state_u32[2 * i + 1] as u64;
state[i] = (hi << 32) | lo;
}

Copilot uses AI. Check for mistakes.
Comment thread emulator-asm/src/dma/Makefile Outdated
Comment thread emulator-asm/src/dma/fast_dma_encode.asm Outdated
Comment thread .vscode/settings.json
"editor.defaultFormatter": "rust-lang.rust-analyzer",
"editor.formatOnSave": true,
"editor.hover.enabled": true
"editor.hover.enabled": "on"

Copilot AI Feb 15, 2026

Copy link

Choose a reason for hiding this comment

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

editor.hover.enabled is a boolean setting in VS Code. The string value "on" is likely invalid and may be ignored. Change it to true/false (or remove if relying on defaults).

Suggested change
"editor.hover.enabled": "on"
"editor.hover.enabled": true

Copilot uses AI. Check for mistakes.
Comment thread book/getting_started/proof.md Outdated

To **generate proof** use:
`(cd ../pil2-proofman; cargo run --release --bin proofman-cli verify-constraints --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input.bin --proving-key ../zisk/build/provingKey)`
`(cd ../pil2-proofman; cargo run --release --bin proofman-cli verify-constraints --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input.bin --proving-key ../zisk/build/provingKey)`

Copilot AI Feb 15, 2026

Copy link

Choose a reason for hiding this comment

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

Under 'To generate proof use:', the command still runs verify-constraints (same as the previous section). This looks like a documentation error; update it to the correct proof-generation command so the two sections don't instruct the same action.

Suggested change
`(cd ../pil2-proofman; cargo run --release --bin proofman-cli verify-constraints --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input.bin --proving-key ../zisk/build/provingKey)`
`(cd ../pil2-proofman; cargo run --release --bin proofman-cli generate-proof --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input.bin --proving-key ../zisk/build/provingKey)`

Copilot uses AI. Check for mistakes.
Comment thread distributed/crates/coordinator/src/coordinator_errors.rs
zkronos73 and others added 12 commits March 11, 2026 21:19
…tors

add new emdedded allocators, add --steps and --with-progress options …
* RefCell to Mutex

* Cargo update

* hints processor and asm resources refactor

* Cargo update

---------

Co-authored-by: RogerTaule <roger.taulee@gmail.com>
Co-authored-by: Xavier Pinsach <10213118+xavi-pinsach@users.noreply.github.com>
Co-authored-by: zkronos73 <zkronos73@gmail.com>
add partial code review report from earlier release
@agnusmor agnusmor requested a review from Copilot March 12, 2026 11:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 151 out of 860 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread distributed/crates/coordinator/src/hints_relay.rs
Comment thread distributed/crates/worker/src/stream_ordering.rs
Comment thread distributed/crates/worker/src/stream_ordering.rs
Comment thread distributed/crates/coordinator/src/hints_relay.rs
Comment thread core/src/helpers.rs
Comment on lines +10 to +13
let state_u32: &mut [u32; 8] = unsafe { &mut *(state.as_mut_ptr() as *mut [u32; 8]) };
let input_u8: &[GenericArray<u8, U64>; 1] =
unsafe { &*(input.as_ptr() as *const [GenericArray<u8, U64>; 1]) };
compress256(state_u32, input_u8);

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

This changes the SHA-256 compression precompile semantics: the previous implementation explicitly split u64→u32 and produced big-endian block bytes, while this version reinterprets raw memory, making results platform-endian and swapping word order on little-endian systems. It can also violate alignment/validity assumptions for GenericArray<u8, U64>. Consider restoring explicit endian-correct conversion (or use a safe cast for [u8; 64] with defined endianness) and avoid pointer reinterprets here.

Suggested change
let state_u32: &mut [u32; 8] = unsafe { &mut *(state.as_mut_ptr() as *mut [u32; 8]) };
let input_u8: &[GenericArray<u8, U64>; 1] =
unsafe { &*(input.as_ptr() as *const [GenericArray<u8, U64>; 1]) };
compress256(state_u32, input_u8);
// Convert the 4 x u64 state into 8 x u32 in a defined (big-endian) order:
// each u64 is split into high 32 bits then low 32 bits.
let mut state_u32 = [0u32; 8];
for (i, word) in state.iter().copied().enumerate() {
state_u32[2 * i] = (word >> 32) as u32;
state_u32[2 * i + 1] = (word & 0xffff_ffff) as u32;
}
// Convert the 8 x u64 input block into 64 bytes in big-endian order.
let mut block = GenericArray::<u8, U64>::default();
for (i, word) in input.iter().copied().enumerate() {
let bytes = word.to_be_bytes();
let start = i * 8;
let end = start + 8;
block[start..end].copy_from_slice(&bytes);
}
let blocks = [block];
compress256(&mut state_u32, &blocks);
// Convert the updated 8 x u32 state back into 4 x u64 using the inverse mapping.
for i in 0..4 {
let hi = state_u32[2 * i] as u64;
let lo = state_u32[2 * i + 1] as u64;
state[i] = (hi << 32) | lo;
}

Copilot uses AI. Check for mistakes.
Comment thread common/src/utils.rs
Comment thread common/src/utils.rs
Comment thread common/src/io/stream/file.rs
@agnusmor agnusmor marked this pull request as ready for review March 12, 2026 16:18
@agnusmor agnusmor merged commit 40e35b3 into develop Mar 12, 2026
9 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants