Skip to content
Closed
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
31 changes: 21 additions & 10 deletions crates/precompile/src/bls12_381.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::PrecompileWithAddress;
use cfg_if::cfg_if;

mod g1;
pub mod g1_add;
Expand All @@ -13,14 +14,24 @@ mod utils;

/// Returns the BLS12-381 precompiles with their addresses.
pub fn precompiles() -> impl Iterator<Item = PrecompileWithAddress> {
[
g1_add::PRECOMPILE,
g1_msm::PRECOMPILE,
g2_add::PRECOMPILE,
g2_msm::PRECOMPILE,
pairing::PRECOMPILE,
map_fp_to_g1::PRECOMPILE,
map_fp2_to_g2::PRECOMPILE,
]
.into_iter()
cfg_if! {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in the wrong place it should be in fn prague function

if #[cfg(not(feature = "std"))] { // If no_std is enabled
vec![
PrecompileWithAddress(
u64_to_address(0x0A),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All addresses should be covered, not just one

|_,_| Err(PrecompileError::Fatal("no_std is not supported for BLS12-381".into()))
)
].into_iter()
} else {
vec![
g1_add::PRECOMPILE,
g1_msm::PRECOMPILE,
g2_add::PRECOMPILE,
g2_msm::PRECOMPILE,
pairing::PRECOMPILE,
map_fp_to_g1::PRECOMPILE,
map_fp2_to_g2::PRECOMPILE,
].into_iter()
}
}
}
Loading