Skip to content

Commit 8206d66

Browse files
committed
Updated constantine version
1 parent 74c94f2 commit 8206d66

10 files changed

+247
-223
lines changed

.github/workflows/backend-benchmarks.yml

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
exclude:
3434
- os: windows-latest
3535
backend: mcl
36+
- os: macos-latest
37+
backend: constantine
3638

3739
steps:
3840
- uses: actions/checkout@v2

.github/workflows/backend-tests.yml

+2
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ jobs:
9898
exclude:
9999
- os: windows-latest
100100
backend: mcl
101+
- os: macos-latest
102+
backend: constantine
101103

102104
steps:
103105
- uses: actions/checkout@v2

Cargo.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

constantine/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ blst = "0.3.11"
88
kzg = { path = "../kzg", default-features = false }
99
libc = { version = "0.2.148", default-features = false }
1010
once_cell = { version = "1.18.0", features = ["critical-section"], default-features = false }
11-
constantine-ethereum-kzg = { 'git' = 'https://github.com/mratsim/constantine.git' , branch='constantine-public-sys' }
12-
constantine-sys = { 'git' = 'https://github.com/mratsim/constantine.git' , branch='constantine-public-sys' }
13-
constantine-core = { 'git' = 'https://github.com/mratsim/constantine.git' , branch='constantine-public-sys' }
11+
constantine-ethereum-kzg = { 'git' = 'https://github.com/mratsim/constantine.git', rev = "3ed6eeac4f0a9b0092bb4234b61768dfde25cdbe" } # branch constantine-public-sys
12+
constantine-sys = { 'git' = 'https://github.com/mratsim/constantine.git', rev = "3ed6eeac4f0a9b0092bb4234b61768dfde25cdbe" } # branch constantine-public-sys
13+
constantine-core = { 'git' = 'https://github.com/mratsim/constantine.git', rev = "3ed6eeac4f0a9b0092bb4234b61768dfde25cdbe" } # branch constantine-public-sys
1414
rand = { version = "0.8.5", optional = true }
1515
rayon = { version = "1.8.0", optional = true }
1616
smallvec = { version = "1.11.1", features = ["const_generics"] }

constantine/benches/eip_4844_constantine_no_conv.rs

+28-85
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use kzg::eip_4844::{BYTES_PER_BLOB, TRUSTED_SETUP_PATH};
99

1010
use kzg_bench::set_trusted_setup_dir;
1111
use kzg_bench::tests::eip_4844::{generate_random_blob_bytes, generate_random_field_element_bytes};
12+
use rand::random;
1213
use rust_kzg_constantine::mixed_kzg::mixed_kzg_settings::CttContext;
1314

1415
fn bench_eip_4844_constantine_no_conv_(c: &mut Criterion) {
@@ -23,104 +24,59 @@ fn bench_eip_4844_constantine_no_conv_(c: &mut Criterion) {
2324

2425
let commitments: Vec<[u8; 48]> = blobs
2526
.iter()
26-
.map(|blob| ctx.ctx.blob_to_kzg_commitment(blob).unwrap())
27+
.map(|blob| ctx.blob_to_kzg_commitment(blob).unwrap())
2728
.collect();
2829

2930
let proofs: Vec<[u8; 48]> = blobs
3031
.iter()
3132
.zip(commitments.iter())
32-
.map(|(blob, commitment)| ctx.ctx.compute_blob_kzg_proof(blob, commitment).unwrap())
33+
.map(|(blob, commitment)| ctx.compute_blob_kzg_proof(blob, commitment).unwrap())
3334
.collect();
3435

3536
let fields: Vec<[u8; 32]> = (0..MAX_COUNT)
3637
.map(|_| generate_random_field_element_bytes(&mut rng))
3738
.collect();
3839

3940
c.bench_function("blob_to_kzg_commitment", |b| {
40-
#[cfg(feature = "parallel")]
41-
b.iter(|| {
42-
ctx.ctx
43-
.blob_to_kzg_commitment_parallel(&ctx.pool, blobs.first().unwrap())
44-
});
45-
46-
#[cfg(not(feature = "parallel"))]
47-
b.iter(|| ctx.ctx.blob_to_kzg_commitment(blobs.first().unwrap()));
41+
b.iter(|| ctx.blob_to_kzg_commitment(blobs.first().unwrap()));
4842
});
4943

5044
c.bench_function("compute_kzg_proof", |b| {
51-
#[cfg(feature = "parallel")]
52-
b.iter(|| {
53-
ctx.ctx.compute_kzg_proof_parallel(
54-
&ctx.pool,
55-
blobs.first().unwrap(),
56-
fields.first().unwrap(),
57-
)
58-
});
59-
60-
#[cfg(not(feature = "parallel"))]
61-
b.iter(|| {
62-
ctx.ctx
63-
.compute_kzg_proof(blobs.first().unwrap(), fields.first().unwrap())
64-
});
45+
b.iter(|| ctx.compute_kzg_proof(blobs.first().unwrap(), fields.first().unwrap()));
6546
});
6647

6748
c.bench_function("verify_kzg_proof", |b| {
6849
b.iter(|| {
69-
ctx.ctx
70-
.verify_kzg_proof(
71-
commitments.first().unwrap(),
72-
fields.first().unwrap(),
73-
fields.first().unwrap(),
74-
proofs.first().unwrap(),
75-
)
76-
.unwrap()
50+
ctx.verify_kzg_proof(
51+
commitments.first().unwrap(),
52+
fields.first().unwrap(),
53+
fields.first().unwrap(),
54+
proofs.first().unwrap(),
55+
)
56+
.unwrap()
7757
})
7858
});
7959

8060
c.bench_function("compute_blob_kzg_proof", |b| {
81-
#[cfg(feature = "parallel")]
82-
b.iter(|| {
83-
ctx.ctx.compute_blob_kzg_proof_parallel(
84-
&ctx.pool,
85-
blobs.first().unwrap(),
86-
commitments.first().unwrap(),
87-
)
88-
});
89-
90-
#[cfg(not(feature = "parallel"))]
9161
b.iter(|| {
92-
ctx.ctx
93-
.compute_blob_kzg_proof(blobs.first().unwrap(), commitments.first().unwrap())
62+
ctx.compute_blob_kzg_proof(blobs.first().unwrap(), commitments.first().unwrap())
63+
.unwrap();
9464
});
9565
});
9666

9767
c.bench_function("verify_blob_kzg_proof", |b| {
98-
#[cfg(feature = "parallel")]
9968
b.iter(|| {
100-
ctx.ctx
101-
.verify_blob_kzg_proof_parallel(
102-
&ctx.pool,
103-
blobs.first().unwrap(),
104-
commitments.first().unwrap(),
105-
proofs.first().unwrap(),
106-
)
107-
.unwrap()
108-
});
109-
110-
#[cfg(not(feature = "parallel"))]
111-
b.iter(|| {
112-
ctx.ctx
113-
.verify_blob_kzg_proof(
114-
blobs.first().unwrap(),
115-
commitments.first().unwrap(),
116-
proofs.first().unwrap(),
117-
)
118-
.unwrap()
69+
ctx.verify_blob_kzg_proof(
70+
blobs.first().unwrap(),
71+
commitments.first().unwrap(),
72+
proofs.first().unwrap(),
73+
)
74+
.unwrap()
11975
});
12076
});
12177

12278
let mut group = c.benchmark_group("verify_blob_kzg_proof_batch");
123-
let rand_thing = [0u8; 32];
79+
let rand_thing = random();
12480
for count in [1, 2, 4, 8, 16, 32, 64] {
12581
group.throughput(Throughput::Elements(count as u64));
12682
group.bench_with_input(BenchmarkId::from_parameter(count), &count, |b, &count| {
@@ -137,26 +93,13 @@ fn bench_eip_4844_constantine_no_conv_(c: &mut Criterion) {
13793
(blobs_subset, commitments_subset, proofs_subset)
13894
},
13995
|(blobs_subset, commitments_subset, proofs_subset)| {
140-
#[cfg(feature = "parallel")]
141-
ctx.ctx
142-
.verify_blob_kzg_proof_batch_parallel(
143-
&ctx.pool,
144-
blobs_subset,
145-
commitments_subset,
146-
proofs_subset,
147-
&rand_thing,
148-
)
149-
.unwrap();
150-
151-
#[cfg(not(feature = "parallel"))]
152-
ctx.ctx
153-
.verify_blob_kzg_proof_batch(
154-
blobs_subset,
155-
commitments_subset,
156-
proofs_subset,
157-
&rand_thing,
158-
)
159-
.unwrap();
96+
ctx.verify_blob_kzg_proof_batch(
97+
blobs_subset,
98+
commitments_subset,
99+
proofs_subset,
100+
&rand_thing,
101+
)
102+
.unwrap();
160103
},
161104
BatchSize::LargeInput,
162105
);

0 commit comments

Comments
 (0)