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

Add Ethereum Execution Tests #5

Merged
merged 42 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
bce8cbe
ecadd tests
ilitteri Jul 28, 2023
eb18443
ecmul tests
ilitteri Jul 28, 2023
067c16e
Add test utils
ilitteri Jul 28, 2023
36af2b6
Add test suit generator
ilitteri Jul 28, 2023
1a8fa73
Remove old tests
ilitteri Jul 28, 2023
69f44fc
Update tests
ilitteri Aug 1, 2023
00500c5
Fix ecadd
ilitteri Aug 1, 2023
f0db051
Fix ecmul
ilitteri Aug 1, 2023
eb08ec9
Handle modexp tests
ilitteri Aug 1, 2023
d795f87
Add modexp tests
ilitteri Aug 1, 2023
9b3073b
Update call helper function
ilitteri Aug 1, 2023
ca6645c
Fix helper function
ilitteri Aug 2, 2023
032f93c
Fix test utils
ilitteri Aug 2, 2023
aaefd0a
Improve ecmul precompile
IAvecilla Aug 4, 2023
2afbca8
Add test helper
ilitteri Aug 4, 2023
f858171
Add python script to test double and add algorithm (#13)
IAvecilla Aug 4, 2023
545e701
Merge branch 'add_eth_tests' of github.com:lambdaclass/zksync_era_pre…
ilitteri Aug 4, 2023
0491085
Add montgomery reduction algorithm
ilitteri Aug 4, 2023
d084888
Add Rust playground crate
ilitteri Aug 4, 2023
cba561e
Update montgomery reduction script
ilitteri Aug 4, 2023
b3ced8d
Add Montgomery reduction precompile
ilitteri Aug 4, 2023
69d4596
ecAdd refactor
ilitteri Aug 7, 2023
ce87027
Montgomery fix
ilitteri Aug 7, 2023
d8ef6d3
Add montgomery inv & modexp
ilitteri Aug 7, 2023
24732ab
Fix N'
ilitteri Aug 8, 2023
bb48215
Fix REDC
ilitteri Aug 8, 2023
36b5f3d
Fix Montgomery modular inverse
ilitteri Aug 8, 2023
de3c03e
Remove comments
ilitteri Aug 8, 2023
88dff03
Fix prints
ilitteri Aug 8, 2023
813d15b
Change to bytes comparison instead of decoded output
IAvecilla Aug 9, 2023
e9590d9
Patch tests with extra check for errors in ecadd and ecmul
IAvecilla Aug 9, 2023
8a59ba6
Add EOL
IAvecilla Aug 9, 2023
11c6a35
Update modexp precompile
IAvecilla Aug 10, 2023
5f4988d
Finish optimizing ecAdd & ecMul
ilitteri Aug 11, 2023
2b73a7e
Implement optimized montgomery invmod
ilitteri Aug 11, 2023
44f1ead
modexpGasCost
ilitteri Aug 13, 2023
8a87322
Cleanup
ilitteri Aug 13, 2023
15d43bc
Last version of ecAdd, ecMul & modexp
ilitteri Aug 13, 2023
6b93802
Fix modexp tests calldata
ilitteri Aug 14, 2023
a4b3f88
Fix modexp tests to pass with actual vm state
IAvecilla Aug 15, 2023
4f45d16
Update Montgomery precompile
ilitteri Aug 16, 2023
4a28703
Add EOL
ilitteri Aug 17, 2023
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
1 change: 1 addition & 0 deletions playground/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
194 changes: 194 additions & 0 deletions playground/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions playground/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "playground"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
lambdaworks-math ={ git = "https://github.com/lambdaclass/lambdaworks"}
16 changes: 16 additions & 0 deletions playground/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use lambdaworks_math::{field::{fields::montgomery_backed_prime_fields::{IsModulus, U256PrimeField}, element::FieldElement}, unsigned_integer::element::{U256, UnsignedInteger}};

#[derive(Clone, Debug)]
struct AltBn128Modulus;
impl IsModulus<U256> for AltBn128Modulus {
const MODULUS: U256 = UnsignedInteger::from_hex_unchecked(
"30644E72E131A029B85045B68181585D97816A916871CA8D3C208C16D87CFD47",
);
}

type AltBn128PrimeField = U256PrimeField<AltBn128Modulus>;
type AltBn128FieldElement = FieldElement<AltBn128PrimeField>;

fn main() {
println!("{:?}", AltBn128FieldElement::from(3).value().to_string())
}
Loading