Skip to content

Commit

Permalink
Merge pull request #2 from shramee/workspace
Browse files Browse the repository at this point in the history
rewrite packages as workspace
  • Loading branch information
shramee authored Jul 27, 2024
2 parents 5621ea6 + 695cb1e commit a31d6c5
Show file tree
Hide file tree
Showing 131 changed files with 11,403 additions and 58 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ src/fields/fq_6_torus.cairo
profile.pb.gz
/bn_contracts
scripts/__pycache__
miller_steps.py
61 changes: 61 additions & 0 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,70 @@ version = 1
name = "bn"
version = "0.1.0"

[[package]]
name = "bn254_u256"
version = "0.1.0"
dependencies = [
"bn_ate_loop",
"ec_groups",
"fast_mod",
"fq_types",
"pairing",
"schwartz_zippel",
]

[[package]]
name = "bn254_u256_contract"
version = "0.1.0"
dependencies = [
"bn254_u256",
]

[[package]]
name = "bn_ate_loop"
version = "0.1.0"
dependencies = [
"ec_groups",
"fq_types",
]

[[package]]
name = "bn_contracts"
version = "0.1.0"
dependencies = [
"bn",
]

[[package]]
name = "cairo_pairing"
version = "0.1.0"

[[package]]
name = "ec_groups"
version = "0.1.0"
dependencies = [
"fq_types",
]

[[package]]
name = "fast_mod"
version = "0.1.0"

[[package]]
name = "fq_types"
version = "0.1.0"

[[package]]
name = "pairing"
version = "0.1.0"
dependencies = [
"ec_groups",
"fq_types",
]

[[package]]
name = "schwartz_zippel"
version = "0.1.0"
dependencies = [
"fq_types",
]
25 changes: 16 additions & 9 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
[workspace]

members = [
"bn_contracts",
"packages/*",
"legacy/*",
]

[package]
name = "bn"
[workspace.package]
version = "0.1.0"
cairo-version = "2.6.2"

[workspace.dependencies]
# cairo_test = "2.7.0-rc.0"

[package]
name = "cairo_pairing" # the name of the package
version = "0.1.0" # the current version, obeying semver

# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html

[scripts]
new = "scarb new --no-vcs"
addchain_gen_t = "addchain gen -tmpl addchain/tpl addchain/t"
contracts = "scarb build -p bn_contracts"
# Declares class for the contract
ktn_declare = "starkli declare target/dev/bn_contracts_BN_Pairing.contract_class.json --account katana --rpc=http://localhost:5050"
ktn_declare = "starkli declare target/dev/bn254_u256_contract_BN_Pairing.contract_class.json"
# Deploys the contract for input classhash
ktn_deploy = "starkli deploy $1 --account katana --rpc=http://localhost:5050"
ktn_deploy = "starkli deploy --account katana --rpc=http://localhost:5050"
# Invokes final_exponentiation_bench on input contract address
ktn_expo = "starkli invoke $1 final_exponentiation_bench --account katana --rpc=http://localhost:5050"
ktn_expo = "starkli invoke final_exponentiation_bench --account katana --rpc=http://localhost:5050"
# Invokes miller_bench on input contract address
ktn_miller = "starkli invoke $1 miller_bench --account katana --rpc=http://localhost:5050"
ktn_miller = "starkli invoke miller_bench --account katana --rpc=http://localhost:5050"
# Invokes pairing_bench on input contract address
ktn_pair = "starkli invoke $1 pairing_bench --account katana --rpc=http://localhost:5050"
ktn_pair = "starkli invoke pairing_bench --account katana --rpc=http://localhost:5050"
1 change: 0 additions & 1 deletion bn_contracts/src/lib.cairo

This file was deleted.

2 changes: 0 additions & 2 deletions cairo_project.toml

This file was deleted.

File renamed without changes.
4 changes: 2 additions & 2 deletions bn_contracts/Scarb.lock → legacy/bn_contracts/Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ version = 1

[[package]]
name = "bn"
version = "0.1.0"
version.workspace = true

[[package]]
name = "bn_contracts"
version = "0.1.0"
version.workspace = true
dependencies = [
"bn",
]
5 changes: 2 additions & 3 deletions bn_contracts/Scarb.toml → legacy/bn_contracts/Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[package]
name = "bn_contracts"
version = "0.1.0"
edition = "2023_11"
version.workspace = true

[dependencies]
bn = { path = ".." }
bn = { path = "../bn_legacy" }
starknet = "2.5.0"

[[target.starknet-contract]]
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ mod BN_Pairing {
inputs: Array<u256>,
) {
let lines = LinesArray { gamma: array![], delta: array![] };
let circuit_setup = setup_precompute(alpha, beta, gamma, delta, ic, lines);
let _circuit_setup = setup_precompute(alpha, beta, gamma, delta, ic, lines);

let verified = verify(pi_a, pi_b, pi_c, inputs, circuit_setup);
// let verified = verify(pi_a, pi_b, pi_c, inputs, circuit_setup);
let verified = false;

assert(verified, 'verification failed');
}
Expand Down
Loading

0 comments on commit a31d6c5

Please sign in to comment.