Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Aug 12, 2023
1 parent 639c8b7 commit 2a281cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct Validator {
pub message: Vec<u8>,
pub message_byte_length: u32,
pub voting_power: u64,
pub validator_byte_length: u32,
pub validator_byte_length: usize,
pub enabled: bool,
pub signed: bool,
}
Expand Down Expand Up @@ -106,7 +106,7 @@ pub fn generate_step_inputs(block: usize) -> CelestiaBlockProof {
message: signed_vote.sign_bytes(),
message_byte_length: signed_vote.sign_bytes().len() as u32,
voting_power: validator.power(),
validator_byte_length: val_bytes.len() as u32,
validator_byte_length: val_bytes.len(),
enabled: true,
signed: true,
});
Expand Down
15 changes: 4 additions & 11 deletions src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,20 @@
//! The `pubkey` is encoded as the raw list of bytes used in the public key. The `varint` is
//! encoded using protobuf's default integer encoding, which consist of 7 bit payloads. You can
//! read more about them here: https://protobuf.dev/programming-guides/encoding/#varints.
use curta::plonky2::field::CubicParameters;
use plonky2::field::extension::Extendable;
use plonky2::iop::target::BoolTarget;
use plonky2::{hash::hash_types::RichField, plonk::circuit_builder::CircuitBuilder};
use plonky2x::ecc::ed25519::curve::curve_types::Curve;
use plonky2x::ecc::ed25519::curve::ed25519::Ed25519;
use plonky2x::ecc::ed25519::gadgets::curve::{AffinePointTarget, CircuitBuilderCurve};
use plonky2x::hash::sha::sha256::{sha256, sha256_variable_length_single_chunk};
use plonky2x::num::u32::gadgets::arithmetic_u32::{CircuitBuilderU32, U32Target};
use plonky2x::num::u32::gadgets::arithmetic_u32::CircuitBuilderU32;
use plonky2::iop::target::Target;

use crate::utils::{
EncTendermintHashTarget, I64Target, MarshalledValidatorTarget, TendermintHashTarget,
HASH_SIZE_BITS, NUM_POSSIBLE_VALIDATOR_BYTE_LENGTHS, PROTOBUF_HASH_SIZE_BITS,
VALIDATOR_BYTE_LENGTH_MAX, VALIDATOR_BYTE_LENGTH_MIN, VALIDATOR_SET_SIZE_MAX,
HASH_SIZE_BITS, PROTOBUF_HASH_SIZE_BITS,
VALIDATOR_BYTE_LENGTH_MAX, VALIDATOR_SET_SIZE_MAX,
VOTING_POWER_BITS_LENGTH_MAX, VOTING_POWER_BYTES_LENGTH_MAX, VALIDATOR_BIT_LENGTH_MAX,
};

Expand Down Expand Up @@ -475,9 +474,6 @@ impl<F: RichField + Extendable<D>, const D: usize> TendermintMarshaller<F, D>
#[cfg(test)]
pub(crate) mod tests {
use super::*;
use curta::math::goldilocks::cubic::GoldilocksCubicParameters;
use num::BigUint;
use plonky2::field::goldilocks_field::GoldilocksField;
use plonky2::field::types::Field;
use plonky2::iop::target::BoolTarget;
use plonky2::{
Expand All @@ -501,13 +497,10 @@ pub(crate) mod tests {
use plonky2x::num::u32::gadgets::arithmetic_u32::U32Target;

use crate::{
signature::TendermintSignature,
utils::{f_bits_to_bytes, to_be_bits},
validator::{I64Target, TendermintMarshaller},
};

use super::VALIDATOR_BYTE_LENGTH_MIN;

type C = PoseidonGoldilocksConfig;
type F = <C as GenericConfig<D>>::F;
type Curve = Ed25519;
Expand Down Expand Up @@ -543,7 +536,7 @@ pub(crate) mod tests {
validator_enabled[i] = builder._true();
}

for i in validators.len()..VALIDATOR_SET_SIZE_MAX {
for _ in validators.len()..VALIDATOR_SET_SIZE_MAX {
validator_byte_length.push(builder.constant(F::from_canonical_usize(0)));
}
return (validators_target, validator_byte_length, validator_enabled);
Expand Down

0 comments on commit 2a281cc

Please sign in to comment.