|
1 | | -use openvm_poseidon2_air::POSEIDON2_WIDTH; |
2 | | -use openvm_stark_sdk::config::baby_bear_poseidon2::D_EF; |
| 1 | +use openvm_stark_sdk::config::baby_bear_poseidon2::{D_EF, DIGEST_SIZE}; |
3 | 2 | use recursion_circuit::{ |
4 | 3 | bus as upstream, define_typed_per_proof_lookup_bus, define_typed_per_proof_permutation_bus, |
5 | 4 | }; |
@@ -274,3 +273,249 @@ pub struct TowerMainPointMessage<T> { |
274 | 273 | } |
275 | 274 |
|
276 | 275 | define_typed_per_proof_lookup_bus!(TowerMainPointBus, TowerMainPointMessage); |
| 276 | + |
| 277 | +#[repr(u8)] |
| 278 | +#[derive(Debug, Clone, Copy)] |
| 279 | +pub enum PcsBasefoldQueryStage { |
| 280 | + ReducedOpening = 0, |
| 281 | + FinalFolded = 1, |
| 282 | + QueryIndex = 2, |
| 283 | + FinalCodewordStart = 3, |
| 284 | +} |
| 285 | + |
| 286 | +impl PcsBasefoldQueryStage { |
| 287 | + pub const fn as_usize(self) -> usize { |
| 288 | + self as usize |
| 289 | + } |
| 290 | +} |
| 291 | + |
| 292 | +#[repr(C)] |
| 293 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 294 | +pub struct PcsBasefoldQueryMessage<T> { |
| 295 | + pub query_idx: T, |
| 296 | + pub stage: T, |
| 297 | + pub round: T, |
| 298 | + pub value: [T; D_EF], |
| 299 | +} |
| 300 | + |
| 301 | +define_typed_per_proof_permutation_bus!(PcsBasefoldQueryBus, PcsBasefoldQueryMessage); |
| 302 | + |
| 303 | +#[repr(C)] |
| 304 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 305 | +pub struct PcsBaseInputOpeningMessage<T> { |
| 306 | + pub query_idx: T, |
| 307 | + pub opening_idx: T, |
| 308 | + pub reduced_index: T, |
| 309 | + pub value_idx: T, |
| 310 | + pub elem_idx: T, |
| 311 | + pub log2_height: T, |
| 312 | + pub opened_value: [T; D_EF], |
| 313 | +} |
| 314 | + |
| 315 | +define_typed_per_proof_permutation_bus!(PcsBaseInputOpeningBus, PcsBaseInputOpeningMessage); |
| 316 | + |
| 317 | +#[repr(C)] |
| 318 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 319 | +pub struct PcsFinalMessageMessage<T> { |
| 320 | + pub tidx: T, |
| 321 | + pub value: [T; D_EF], |
| 322 | +} |
| 323 | + |
| 324 | +define_typed_per_proof_lookup_bus!(PcsFinalMessageBus, PcsFinalMessageMessage); |
| 325 | + |
| 326 | +#[repr(C)] |
| 327 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 328 | +pub struct PcsQuerySampleMessage<T> { |
| 329 | + pub tidx: T, |
| 330 | + pub value: T, |
| 331 | +} |
| 332 | + |
| 333 | +define_typed_per_proof_lookup_bus!(PcsQuerySampleBus, PcsQuerySampleMessage); |
| 334 | + |
| 335 | +#[repr(C)] |
| 336 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 337 | +pub struct PcsCommitmentRootMessage<T> { |
| 338 | + pub commit_major: T, |
| 339 | + pub commit_minor: T, |
| 340 | + pub root: [T; DIGEST_SIZE], |
| 341 | +} |
| 342 | + |
| 343 | +define_typed_per_proof_lookup_bus!(PcsCommitmentRootBus, PcsCommitmentRootMessage); |
| 344 | + |
| 345 | +#[repr(C)] |
| 346 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 347 | +pub struct PcsCommitPhaseLeafMessage<T> { |
| 348 | + pub query_idx: T, |
| 349 | + pub round: T, |
| 350 | + pub leaf_idx: T, |
| 351 | + pub left: [T; D_EF], |
| 352 | + pub right: [T; D_EF], |
| 353 | +} |
| 354 | + |
| 355 | +define_typed_per_proof_permutation_bus!(PcsCommitPhaseLeafBus, PcsCommitPhaseLeafMessage); |
| 356 | + |
| 357 | +#[repr(C)] |
| 358 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 359 | +pub struct PcsSumcheckClaimMessage<T> { |
| 360 | + pub idx: T, |
| 361 | + pub claim: [T; D_EF], |
| 362 | +} |
| 363 | + |
| 364 | +define_typed_per_proof_permutation_bus!(PcsSumcheckClaimBus, PcsSumcheckClaimMessage); |
| 365 | + |
| 366 | +#[repr(C)] |
| 367 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 368 | +pub struct PcsSumcheckInputMessage<T> { |
| 369 | + pub idx: T, |
| 370 | + pub claim: [T; D_EF], |
| 371 | +} |
| 372 | + |
| 373 | +define_typed_per_proof_permutation_bus!(PcsSumcheckInputBus, PcsSumcheckInputMessage); |
| 374 | + |
| 375 | +#[repr(C)] |
| 376 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 377 | +pub struct PcsSumcheckOutputMessage<T> { |
| 378 | + pub idx: T, |
| 379 | + pub claim: [T; D_EF], |
| 380 | +} |
| 381 | + |
| 382 | +define_typed_per_proof_permutation_bus!(PcsSumcheckOutputBus, PcsSumcheckOutputMessage); |
| 383 | + |
| 384 | +#[repr(C)] |
| 385 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 386 | +pub struct PcsBasefoldFinalExpectedMessage<T> { |
| 387 | + pub sumcheck_idx: T, |
| 388 | + pub expected: [T; D_EF], |
| 389 | +} |
| 390 | + |
| 391 | +define_typed_per_proof_permutation_bus!( |
| 392 | + PcsBasefoldFinalExpectedBus, |
| 393 | + PcsBasefoldFinalExpectedMessage |
| 394 | +); |
| 395 | + |
| 396 | +#[repr(C)] |
| 397 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 398 | +pub struct PcsBasefoldFinalPointMessage<T> { |
| 399 | + pub sumcheck_idx: T, |
| 400 | + pub point_idx: T, |
| 401 | + pub coord_idx: T, |
| 402 | + pub value: [T; D_EF], |
| 403 | +} |
| 404 | + |
| 405 | +define_typed_per_proof_permutation_bus!(PcsBasefoldFinalPointBus, PcsBasefoldFinalPointMessage); |
| 406 | + |
| 407 | +#[repr(C)] |
| 408 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 409 | +pub struct PcsFoldChallengeMessage<T> { |
| 410 | + pub sumcheck_idx: T, |
| 411 | + pub round: T, |
| 412 | + pub challenge: [T; D_EF], |
| 413 | +} |
| 414 | + |
| 415 | +define_typed_per_proof_lookup_bus!(PcsFoldChallengeBus, PcsFoldChallengeMessage); |
| 416 | + |
| 417 | +#[repr(C)] |
| 418 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 419 | +pub struct PcsBatchCoeffMessage<T> { |
| 420 | + pub global_coeff_idx: T, |
| 421 | + pub coeff: [T; D_EF], |
| 422 | +} |
| 423 | + |
| 424 | +define_typed_per_proof_lookup_bus!(PcsBatchCoeffBus, PcsBatchCoeffMessage); |
| 425 | + |
| 426 | +#[repr(C)] |
| 427 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 428 | +pub struct PcsBatchAlphaMessage<T> { |
| 429 | + pub tidx: T, |
| 430 | + pub alpha: [T; D_EF], |
| 431 | +} |
| 432 | + |
| 433 | +define_typed_per_proof_lookup_bus!(PcsBatchAlphaBus, PcsBatchAlphaMessage); |
| 434 | + |
| 435 | +#[repr(C)] |
| 436 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 437 | +pub struct PcsBasefoldEvalMessage<T> { |
| 438 | + pub tidx: T, |
| 439 | + pub value: [T; D_EF], |
| 440 | +} |
| 441 | + |
| 442 | +define_typed_per_proof_lookup_bus!(PcsBasefoldEvalBus, PcsBasefoldEvalMessage); |
| 443 | + |
| 444 | +#[repr(C)] |
| 445 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 446 | +pub struct PcsTranscriptExtMessage<T> { |
| 447 | + pub tidx: T, |
| 448 | + pub value: [T; D_EF], |
| 449 | +} |
| 450 | + |
| 451 | +define_typed_per_proof_lookup_bus!(PcsTranscriptExtBus, PcsTranscriptExtMessage); |
| 452 | + |
| 453 | +#[repr(C)] |
| 454 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 455 | +pub struct PcsJaggedFEvalMessage<T> { |
| 456 | + pub sumcheck_idx: T, |
| 457 | + pub tidx: T, |
| 458 | + pub value: [T; D_EF], |
| 459 | +} |
| 460 | + |
| 461 | +define_typed_per_proof_lookup_bus!(PcsJaggedFEvalBus, PcsJaggedFEvalMessage); |
| 462 | + |
| 463 | +#[repr(C)] |
| 464 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 465 | +pub struct PcsOpeningEvalMessage<T> { |
| 466 | + pub opening_idx: T, |
| 467 | + pub commit_kind: T, |
| 468 | + pub eval_idx: T, |
| 469 | + pub value: [T; D_EF], |
| 470 | +} |
| 471 | + |
| 472 | +define_typed_per_proof_lookup_bus!(PcsOpeningEvalBus, PcsOpeningEvalMessage); |
| 473 | + |
| 474 | +#[repr(C)] |
| 475 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 476 | +pub struct PcsEqProductMessage<T> { |
| 477 | + pub kind: T, |
| 478 | + pub round_idx: T, |
| 479 | + pub term_idx: T, |
| 480 | + pub value: [T; D_EF], |
| 481 | +} |
| 482 | + |
| 483 | +define_typed_per_proof_lookup_bus!(PcsEqProductBus, PcsEqProductMessage); |
| 484 | + |
| 485 | +#[repr(C)] |
| 486 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 487 | +pub struct PcsSuffixProductMessage<T> { |
| 488 | + pub round_idx: T, |
| 489 | + pub term_idx: T, |
| 490 | + pub value: [T; D_EF], |
| 491 | +} |
| 492 | + |
| 493 | +define_typed_per_proof_lookup_bus!(PcsSuffixProductBus, PcsSuffixProductMessage); |
| 494 | + |
| 495 | +#[repr(C)] |
| 496 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 497 | +pub struct PcsJaggedAssistHMessage<T> { |
| 498 | + pub round_idx: T, |
| 499 | + pub value: [T; D_EF], |
| 500 | +} |
| 501 | + |
| 502 | +define_typed_per_proof_lookup_bus!(PcsJaggedAssistHBus, PcsJaggedAssistHMessage); |
| 503 | + |
| 504 | +#[repr(C)] |
| 505 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 506 | +pub struct PcsJaggedAssistQMessage<T> { |
| 507 | + pub round_idx: T, |
| 508 | + pub value: [T; D_EF], |
| 509 | +} |
| 510 | + |
| 511 | +define_typed_per_proof_lookup_bus!(PcsJaggedAssistQBus, PcsJaggedAssistQMessage); |
| 512 | + |
| 513 | +#[repr(C)] |
| 514 | +#[derive(stark_recursion_circuit_derive::AlignedBorrow, Debug, Clone, Copy)] |
| 515 | +pub struct PcsCommitHeightMessage<T> { |
| 516 | + pub commitment_kind: T, |
| 517 | + pub height_idx: T, |
| 518 | + pub value: T, |
| 519 | +} |
| 520 | + |
| 521 | +define_typed_per_proof_lookup_bus!(PcsCommitHeightBus, PcsCommitHeightMessage); |
0 commit comments