add FIELD_SIZE_IN_BITS constant embed
This commit is contained in:
parent
85dca36161
commit
c2e1f3d544
7 changed files with 87 additions and 2 deletions
|
@ -14,6 +14,7 @@ use std::fmt;
|
|||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use crate::absy::types::UnresolvedType;
|
||||
use typed_arena::Arena;
|
||||
use zokrates_common::Resolver;
|
||||
use zokrates_field::{Bn128Field, Field};
|
||||
|
@ -156,6 +157,17 @@ impl Importer {
|
|||
id: symbol.get_alias(),
|
||||
symbol: Symbol::Flat(FlatEmbed::U8FromBits),
|
||||
},
|
||||
"FIELD_SIZE_IN_BITS" => SymbolDeclaration {
|
||||
id: symbol.get_alias(),
|
||||
symbol: Symbol::Here(SymbolDefinition::Constant(
|
||||
ConstantDefinition {
|
||||
ty: UnresolvedType::Uint(32).into(),
|
||||
expression: Expression::U32Constant(T::get_required_bits() as u32)
|
||||
.into(),
|
||||
}
|
||||
.start_end(pos.0, pos.1),
|
||||
)),
|
||||
},
|
||||
s => {
|
||||
return Err(CompileErrorInner::ImportError(
|
||||
Error::new(format!("Embed {} not found", s)).with_pos(Some(pos)),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"entry_point": "./tests/tests/cached_condition.zok",
|
||||
"max_constraint_count": 2015
|
||||
"entry_point": "./tests/tests/cached_condition.zok",
|
||||
"max_constraint_count": 2015,
|
||||
"tests": []
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
from "EMBED" import FIELD_SIZE_IN_BITS
|
||||
|
||||
def main() -> u32:
|
||||
return FIELD_SIZE_IN_BITS
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"entry_point": "./tests/tests/constants/field_size_in_bits.zok",
|
||||
"max_constraint_count": 1,
|
||||
"curves": ["Bls12_377"],
|
||||
"tests": [
|
||||
{
|
||||
"input": {
|
||||
"values": []
|
||||
},
|
||||
"output": {
|
||||
"Ok": {
|
||||
"values": ["253"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"entry_point": "./tests/tests/constants/field_size_in_bits.zok",
|
||||
"max_constraint_count": 1,
|
||||
"curves": ["Bls12_381"],
|
||||
"tests": [
|
||||
{
|
||||
"input": {
|
||||
"values": []
|
||||
},
|
||||
"output": {
|
||||
"Ok": {
|
||||
"values": ["255"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"entry_point": "./tests/tests/constants/field_size_in_bits.zok",
|
||||
"max_constraint_count": 1,
|
||||
"curves": ["Bn128"],
|
||||
"tests": [
|
||||
{
|
||||
"input": {
|
||||
"values": []
|
||||
},
|
||||
"output": {
|
||||
"Ok": {
|
||||
"values": ["254"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"entry_point": "./tests/tests/constants/field_size_in_bits.zok",
|
||||
"max_constraint_count": 1,
|
||||
"curves": ["Bw6_761"],
|
||||
"tests": [
|
||||
{
|
||||
"input": {
|
||||
"values": []
|
||||
},
|
||||
"output": {
|
||||
"Ok": {
|
||||
"values": ["377"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue