Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static chip preprocessed trace #142

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c2b4bfb
wip: static data chip: using a preprocessed trace
morganthomas Apr 5, 2024
656e2e2
Merge branch 'morgan/issue/133' of github.com:valida-xyz/valida into …
morganthomas Apr 5, 2024
1d9ecf9
wip: preprocessed traces
morganthomas Apr 6, 2024
f9f6bac
issue/143: duplicate basic crate
morganthomas Apr 6, 2024
7bb573f
issue/143: remove macros from basic machine
morganthomas Apr 6, 2024
c13fadf
issue/143: wip: de-macroify run
morganthomas Apr 6, 2024
ac02d95
issue/143: wip: de-macroify prove
morganthomas Apr 6, 2024
5c90dd1
issue/143: wip: de-macroify verify
morganthomas Apr 6, 2024
b71d2ae
issue/143: bugfixes
morganthomas Apr 6, 2024
1c51e9c
issue/143: cargo fmt
morganthomas Apr 6, 2024
4e16400
issue/143: remove no_std from basic_macro lib (is breaking ci?)
morganthomas Apr 6, 2024
93678d9
Merge branch 'main' into morgan/issue/143
morganthomas Apr 8, 2024
8314901
issue/143: fix merge
morganthomas Apr 9, 2024
125b33b
issue/143: cargo fmt
morganthomas Apr 9, 2024
982a157
Merge branch 'morgan/issue/143' into morgan/issue/140
morganthomas Apr 9, 2024
d61efe8
issue/140: fix merge of morgan/issue/143
morganthomas Apr 9, 2024
15c4c2f
issue/140: wip: bugfix static data chip
morganthomas Apr 9, 2024
28c147a
issue/140: wip: bugfix static data chip
morganthomas Apr 10, 2024
f115fe8
issue/140: more specific failures to verify
morganthomas Apr 11, 2024
77fae7b
issue/140: wip: bugfix preprocessed stuff
morganthomas Apr 11, 2024
11c2bed
issue/140: wip: bugfix preprocessed stuff
morganthomas Apr 11, 2024
35ce1c0
issue/140: wip: bugfix preprocessed stuff
morganthomas Apr 12, 2024
0cadb44
issue/140: wip: bugfix preprocessed stuff
morganthomas Apr 12, 2024
c1a47a0
issue/140: wip: bugfix preprocessed stuff
morganthomas Apr 12, 2024
6dc4511
issue/140: add a redundant check of the preprocessed commitment (for …
morganthomas Apr 14, 2024
c0a0abe
issue/140: wip: un-batch the opening proofs to figure out which one i…
morganthomas Apr 15, 2024
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
Prev Previous commit
Next Next commit
issue/143: remove macros from basic machine
morganthomas committed Apr 6, 2024
commit 7bb573fa554df305f03bd96acd5a5b3d8e7cce95
109 changes: 25 additions & 84 deletions basic/src/lib.rs
Original file line number Diff line number Diff line change
@@ -38,7 +38,6 @@ use valida_cpu::{
Store32Instruction,
};
use valida_cpu::{CpuChip, MachineWithCpuChip};
use valida_derive::Machine;
use valida_machine::{
AdviceProvider, BusArgument, Chip, ChipProof, Instruction, Machine, MachineProof, ProgramROM,
ValidaAirBuilder,
@@ -52,142 +51,84 @@ use valida_static_data::{MachineWithStaticDataChip, StaticDataChip};
use p3_maybe_rayon::prelude::*;
use valida_machine::StarkConfig;

#[derive(Machine, Default)]
#[machine_fields(F)]
#[derive(Default)]
pub struct BasicMachine<F: PrimeField32 + TwoAdicField> {
// Core instructions
#[instruction]
load32: Load32Instruction,

#[instruction]
store32: Store32Instruction,

#[instruction]
jal: JalInstruction,

#[instruction]
jalv: JalvInstruction,

#[instruction]
beq: BeqInstruction,

#[instruction]
bne: BneInstruction,

#[instruction]
imm32: Imm32Instruction,

#[instruction]
stop: StopInstruction,

#[instruction]
loadfp: LoadFpInstruction,

// ALU instructions
#[instruction(add_u32)]
add32: Add32Instruction,

#[instruction(sub_u32)]
sub32: Sub32Instruction,

#[instruction(mul_u32)]
mul32: Mul32Instruction,

#[instruction(mul_u32)]
mulhs32: Mulhs32Instruction,

#[instruction(mul_u32)]
mulhu32: Mulhu32Instruction,

#[instruction(div_u32)]
div32: Div32Instruction,

#[instruction(div_u32)]
sdiv32: SDiv32Instruction,

#[instruction(shift_u32)]
shl32: Shl32Instruction,

#[instruction(shift_u32)]
shr32: Shr32Instruction,

#[instruction(shift_u32)]
sra32: Sra32Instruction,

#[instruction(lt_u32)]
lt32: Lt32Instruction,

#[instruction(lt_u32)]
lte32: Lte32Instruction,

#[instruction(bitwise_u32)]
and32: And32Instruction,

#[instruction(bitwise_u32)]
or32: Or32Instruction,

#[instruction(bitwise_u32)]
xor32: Xor32Instruction,

#[instruction(com_u32)]
ne32: Ne32Instruction,

#[instruction(com_u32)]
eq32: Eq32Instruction,

// Input/output instructions
#[instruction]
read: ReadAdviceInstruction,

#[instruction(output)]
write: WriteInstruction,

#[chip]
// Chips
cpu: CpuChip,

#[chip]
program: ProgramChip,

#[chip]
mem: MemoryChip,

#[chip]
add_u32: Add32Chip,

#[chip]
sub_u32: Sub32Chip,

#[chip]
mul_u32: Mul32Chip,

#[chip]
div_u32: Div32Chip,

#[chip]
shift_u32: Shift32Chip,

#[chip]
lt_u32: Lt32Chip,

#[chip]
com_u32: Com32Chip,

#[chip]
bitwise_u32: Bitwise32Chip,

#[chip]
output: OutputChip,

#[chip]
range: RangeCheckerChip<256>,

#[chip]
#[static_data_chip]
static_data: StaticDataChip,

_phantom_sc: PhantomData<fn() -> F>,
}

impl<F: PrimeField32 + TwoAdicField> Machine<F> for BasicMachine<F> {
fn run<Adv>(&mut self, program: &ProgramROM<i32>, advice: &mut Adv)
where
Adv: AdviceProvider
{
todo!()
}

fn prove<SC>(&self, config: &SC) -> MachineProof<SC>
where
SC: StarkConfig<Val = F>
{
todo!()
}

fn verify<SC>(&self, config: &SC, proof: &MachineProof<SC>) -> Result<(), ()>
where
SC: StarkConfig<Val = F>
{
todo!()
}
}

impl<F: PrimeField32 + TwoAdicField> MachineWithGeneralBus<F> for BasicMachine<F> {
fn general_bus(&self) -> BusArgument {
BusArgument::Global(0)