Skip to content

Commit

Permalink
Merge pull request #64 from xJonathanLEI/dev/stark_proof_clone
Browse files Browse the repository at this point in the history
feat: derive `Clone` for `StarkProof`
  • Loading branch information
Okm165 authored Jan 5, 2025
2 parents a9f8048 + 22ea2f3 commit ccd16d3
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/air/src/public_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub const MAX_ADDRESS: Felt = Felt::from_hex_unchecked("0xffffffffffffffff");
pub const INITIAL_PC: Felt = Felt::from_hex_unchecked("0x1");

#[serde_as]
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PublicInput {
#[cfg_attr(
feature = "std",
Expand Down
2 changes: 1 addition & 1 deletion crates/air/src/trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use starknet_crypto::Felt;
// Commitment values for the Traces component. Used to generate a commitment by "reading" these
// values from the channel.
#[serde_as]
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct UnsentCommitment {
#[cfg_attr(
feature = "std",
Expand Down
8 changes: 4 additions & 4 deletions crates/air/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use serde_with::serde_as;
use starknet_crypto::Felt;

#[serde_as]
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SegmentInfo {
// Start address of the memory segment.
#[cfg_attr(
Expand All @@ -22,7 +22,7 @@ pub struct SegmentInfo {
}

#[serde_as]
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AddrValue {
#[cfg_attr(
feature = "std",
Expand All @@ -36,7 +36,7 @@ pub struct AddrValue {
pub value: Felt,
}

#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Page(pub Vec<AddrValue>);

impl Deref for Page {
Expand Down Expand Up @@ -73,7 +73,7 @@ impl Page {
// z = interaction_elements.memory_multi_column_perm_perm__interaction_elm
// alpha = interaction_elements.memory_multi_column_perm_hash_interaction_elm0
#[serde_as]
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ContinuousPageHeader {
// Start address.
#[cfg_attr(
Expand Down
2 changes: 1 addition & 1 deletion crates/pow/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
const MAX_PROOF_OF_WORK_BITS: u8 = 50;
const MIN_PROOF_OF_WORK_BITS: u8 = 20;

#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Config {
// Proof of work difficulty (number of bits required to be 0).
pub n_bits: u8,
Expand Down
2 changes: 1 addition & 1 deletion crates/pow/src/pow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::config::Config;

const MAGIC: u64 = 0x0123456789abcded;

#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct UnsentCommitment {
pub nonce: u64,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/stark/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use starknet_crypto::Felt;
use swiftness_commitment::vector;

#[serde_as]
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StarkConfig {
pub traces: swiftness_air::trace::config::Config,
pub composition: swiftness_commitment::table::config::Config,
Expand Down
6 changes: 3 additions & 3 deletions crates/stark/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use starknet_crypto::Felt;

use crate::config;

#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StarkProof {
pub config: config::StarkConfig,
pub public_input: swiftness_air::public_memory::PublicInput,
Expand All @@ -14,7 +14,7 @@ pub struct StarkProof {
}

#[serde_as]
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StarkUnsentCommitment {
pub traces: swiftness_air::trace::UnsentCommitment,
#[cfg_attr(
Expand Down Expand Up @@ -57,7 +57,7 @@ pub struct StarkCommitment<InteractionElements> {
pub fri: swiftness_fri::types::Commitment,
}

#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StarkWitness {
pub traces_decommitment: swiftness_air::trace::Decommitment,
pub traces_witness: swiftness_air::trace::Witness,
Expand Down

0 comments on commit ccd16d3

Please sign in to comment.