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

Naming recommendations #357

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
},
sha256::sha256,
},
target_to_le_bits, verify_proof,
target_to_be_bits, verify_proof,
},
validators_commitment_mapper::first_level::ValidatorsCommitmentMapperFirstLevel,
};
Expand Down Expand Up @@ -264,28 +264,28 @@ fn hash_public_inputs<F: RichField + Extendable<D>, const D: usize>(

let block_number_bits = biguint_to_bits_target(builder, &input.execution_block_number);

let number_of_non_activated_validators_bits = target_to_le_bits(
let number_of_non_activated_validators_bits = target_to_be_bits(
builder,
balance_aggregation_pis
.accumulated_data
.validator_status_stats
.non_activated_count,
);
let number_of_active_validators_bits = target_to_le_bits(
let number_of_active_validators_bits = target_to_be_bits(
builder,
balance_aggregation_pis
.accumulated_data
.validator_status_stats
.active_count,
);
let number_of_exited_validators_bits = target_to_le_bits(
let number_of_exited_validators_bits = target_to_be_bits(
builder,
balance_aggregation_pis
.accumulated_data
.validator_status_stats
.exited_count,
);
let number_of_slashed_validators_bits = target_to_le_bits(
let number_of_slashed_validators_bits = target_to_be_bits(
builder,
balance_aggregation_pis
.accumulated_data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ impl Circuit for DepositAccumulatorBalanceAggregatorDivaFirstLevel {

let validator_hash_tree_root = hash_validator_poseidon(builder, &input.validator);

let is_valid = validate_merkle_proof_poseidon(
let validator_proof_is_valid = validate_merkle_proof_poseidon(
builder,
&validator_hash_tree_root,
&input.validators_commitment_mapper_root,
&input.validators_commitment_mapper_branch,
&input.validator_gindex,
);

builder.assert_implication(deposit_is_real, is_valid);
builder.assert_implication(deposit_is_real, validator_proof_is_valid);

assert_bool_arrays_are_equal(builder, &input.validator.pubkey, &input.deposit_pubkey);

Expand All @@ -129,15 +129,15 @@ impl Circuit for DepositAccumulatorBalanceAggregatorDivaFirstLevel {
let balance = get_balance_from_leaf(builder, &input.balance_leaf, balance_inner_index);
let balance_gindex = builder.div_biguint(&input.validator_gindex, &four);

let is_valid = validate_merkle_proof_sha256(
let balance_proof_is_valid = validate_merkle_proof_sha256(
builder,
&input.balance_leaf,
&input.balances_root,
&input.balance_branch,
&balance_gindex,
);

builder.assert_implication(deposit_is_real, is_valid);
builder.assert_implication(deposit_is_real, balance_proof_is_valid);

let (is_non_activated, is_active, is_exited) = get_validator_status(
builder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
merkle::{sha256::assert_merkle_proof_is_valid_const_sha256, ssz::ssz_num_to_bits},
sha256::sha256,
},
target_to_le_bits, verify_proof,
target_to_be_bits, verify_proof,
},
validators_commitment_mapper::first_level::ValidatorsCommitmentMapperFirstLevel,
};
Expand Down Expand Up @@ -256,33 +256,33 @@ fn hash_public_inputs<F: RichField + Extendable<D>, const D: usize>(

let block_number_bits = biguint_to_bits_target(builder, &input.execution_block_number);

let deposits_count_bits = target_to_le_bits(
let deposits_count_bits = target_to_be_bits(
builder,
balance_aggregation_pis.accumulated_data.deposits_count,
);

let number_of_non_activated_validators_bits = target_to_le_bits(
let number_of_non_activated_validators_bits = target_to_be_bits(
builder,
balance_aggregation_pis
.accumulated_data
.validator_status_stats
.non_activated_count,
);
let number_of_active_validators_bits = target_to_le_bits(
let number_of_active_validators_bits = target_to_be_bits(
builder,
balance_aggregation_pis
.accumulated_data
.validator_status_stats
.active_count,
);
let number_of_exited_validators_bits = target_to_le_bits(
let number_of_exited_validators_bits = target_to_be_bits(
builder,
balance_aggregation_pis
.accumulated_data
.validator_status_stats
.exited_count,
);
let number_of_slashed_validators_bits = target_to_le_bits(
let number_of_slashed_validators_bits = target_to_be_bits(
builder,
balance_aggregation_pis
.accumulated_data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub fn select_biguint<F: RichField + Extendable<D>, const D: usize>(
result
}

pub fn target_to_le_bits<F: RichField + Extendable<D>, const D: usize>(
pub fn target_to_be_bits<F: RichField + Extendable<D>, const D: usize>(
builder: &mut CircuitBuilder<F, D>,
number: Target,
) -> [BoolTarget; 64] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
merkle::{sha256::assert_merkle_proof_is_valid_const_sha256, ssz::ssz_num_to_bits},
sha256::sha256,
},
target_to_le_bits, verify_proof,
target_to_be_bits, verify_proof,
},
validators_commitment_mapper::first_level::ValidatorsCommitmentMapperFirstLevel,
withdrawal_credentials_balance_aggregator::first_level::WithdrawalCredentialsBalanceAggregatorFirstLevel,
Expand Down Expand Up @@ -132,15 +132,15 @@ impl<const WITHDRAWAL_CREDENTIALS_COUNT: usize> Circuit
.cloned()
.collect_vec();

let number_of_non_activated_validators_bits = target_to_le_bits(
let number_of_non_activated_validators_bits = target_to_be_bits(
builder,
balance_verification_pi.number_of_non_activated_validators,
);
let number_of_active_validators_bits =
target_to_le_bits(builder, balance_verification_pi.number_of_active_validators);
target_to_be_bits(builder, balance_verification_pi.number_of_active_validators);
let number_of_exited_validators_bits =
target_to_le_bits(builder, balance_verification_pi.number_of_exited_validators);
let number_of_slashed_validators_bits = target_to_le_bits(
target_to_be_bits(builder, balance_verification_pi.number_of_exited_validators);
let number_of_slashed_validators_bits = target_to_be_bits(
builder,
balance_verification_pi.number_of_slashed_validators,
);
Expand Down