Skip to content

Commit

Permalink
Merge branch 'dev' into threading-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangxiecrypto committed Jun 28, 2024
2 parents 1be0596 + b8ae7ac commit efd28e3
Show file tree
Hide file tree
Showing 72 changed files with 5,149 additions and 1,098 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Automatic Rebase
on:
issue_comment:
types: [created]
jobs:
rebase:
name: Rebase
runs-on: ubuntu-latest
if: >-
github.event.issue.pull_request != '' &&
contains(github.event.comment.body, '/rebase') &&
(
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'COLLABORATOR'
)
steps:
- name: Checkout the latest code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.8
with:
autosquash: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76 changes: 43 additions & 33 deletions crates/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
[workspace]
members = [
"mpz-core",
"mpz-common",
"mpz-fields",
"mpz-circuits",
"mpz-circuits-macros",
"mpz-cointoss",
"mpz-cointoss-core",
"mpz-ot",
"mpz-ot-core",
"mpz-garble",
"mpz-garble-core",
"mpz-share-conversion",
"mpz-share-conversion-core",
"matrix-transpose",
"clmul",
"crates/mpz-core",
"crates/mpz-common",
"crates/mpz-fields",
"crates/mpz-circuits",
"crates/mpz-circuits-macros",
"crates/mpz-cointoss",
"crates/mpz-cointoss-core",
"crates/mpz-ot",
"crates/mpz-ot-core",
"crates/mpz-garble",
"crates/mpz-garble-core",
"crates/mpz-share-conversion-core",
"crates/mpz-share-conversion",
"crates/matrix-transpose",
"crates/clmul",
"crates/mpz-ole-core",
"crates/mpz-ole",
]
resolver = "2"

Expand All @@ -25,24 +27,25 @@ resolver = "2"
# enum_glob_use = "deny"

[workspace.dependencies]
mpz-core = { path = "mpz-core" }
mpz-common = { path = "mpz-common" }
mpz-fields = { path = "mpz-fields" }
mpz-circuits = { path = "mpz-circuits" }
mpz-circuits-macros = { path = "mpz-circuits-macros" }
mpz-cointoss = { path = "mpz-cointoss" }
mpz-cointoss-core = { path = "mpz-cointoss-core" }
mpz-ot = { path = "mpz-ot" }
mpz-ot-core = { path = "mpz-ot-core" }
mpz-garble = { path = "mpz-garble" }
mpz-garble-core = { path = "mpz-garble-core" }
mpz-share-conversion = { path = "mpz-share-conversion" }
mpz-share-conversion-core = { path = "mpz-share-conversion-core" }
clmul = { path = "clmul" }
matrix-transpose = { path = "matrix-transpose" }
mpz-core = { path = "crates/mpz-core" }
mpz-common = { path = "crates/mpz-common" }
mpz-fields = { path = "crates/mpz-fields" }
mpz-circuits = { path = "crates/mpz-circuits" }
mpz-circuits-macros = { path = "crates/mpz-circuits-macros" }
mpz-cointoss = { path = "crates/mpz-cointoss" }
mpz-cointoss-core = { path = "crates/mpz-cointoss-core" }
mpz-ot = { path = "crates/mpz-ot" }
mpz-ot-core = { path = "crates/mpz-ot-core" }
mpz-garble = { path = "crates/mpz-garble" }
mpz-garble-core = { path = "crates/mpz-garble-core" }
mpz-share-conversion-core = { path = "crates/mpz-share-conversion-core" }
mpz-ole = { path = "crates/mpz-ole" }
mpz-ole-core = { path = "crates/mpz-ole-core" }
clmul = { path = "crates/clmul" }
matrix-transpose = { path = "crates/matrix-transpose" }

tlsn-utils = { git = "https://github.com/tlsnotary/tlsn-utils", rev = "8f2fc9e" }
tlsn-utils-aio = { git = "https://github.com/tlsnotary/tlsn-utils", rev = "8f2fc9e" }
tlsn-utils = { git = "https://github.com/tlsnotary/tlsn-utils", rev = "6e0be94" }
tlsn-utils-aio = { git = "https://github.com/tlsnotary/tlsn-utils", rev = "6e0be94" }

# rand
rand_chacha = "0.3"
Expand Down Expand Up @@ -72,6 +75,8 @@ futures-util = "0.3"
tokio = "1.23"
tokio-util = "0.7"
scoped-futures = "0.1.3"
pollster = "0.3"
pin-project-lite = "0.2"

# serialization
ark-serialize = "0.4"
Expand All @@ -83,7 +88,10 @@ prost-build = "0.9"
bytes = "1"
yamux = "0.10"
bytemuck = { version = "1.13", features = ["derive"] }
serio = { git = "https://github.com/tlsnotary/tlsn-utils", rev = "8f2fc9e" }
serio = "0.1"

# io
uid-mux = "0.1"

# testing
prost = "0.9"
Expand All @@ -110,6 +118,8 @@ hex = "0.4"
lazy_static = "1"
derive_builder = "0.11"
once_cell = "1"
hybrid-array = "0.2.0-rc.8"
typenum = "1"
# DO NOT BUMP, SEE https://github.com/privacy-scaling-explorations/mpz/issues/61
generic-array = "0.14"
itybity = "0.2"
Expand Down
28 changes: 26 additions & 2 deletions crates/mpz-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,40 @@ edition = "2021"

[features]
default = ["sync"]
sync = []
test-utils = []
sync = ["tokio/sync"]
test-utils = ["uid-mux/test-utils"]
ideal = []
rayon = ["dep:rayon"]
force-st = []

[dependencies]
mpz-core.workspace = true

futures.workspace = true
async-trait.workspace = true
pin-project-lite.workspace = true
scoped-futures.workspace = true
thiserror.workspace = true
serio.workspace = true
uid-mux.workspace = true
serde = { workspace = true, features = ["derive"] }
pollster.workspace = true
rayon = { workspace = true, optional = true }
cfg-if.workspace = true
tokio = { workspace = true, optional = true }

[dev-dependencies]
tokio = { workspace = true, features = [
"io-util",
"macros",
"rt-multi-thread",
] }
tokio-util = { workspace = true, features = ["compat"] }
uid-mux = { workspace = true, features = ["test-utils"] }
tracing-subscriber = { workspace = true, features = ["fmt"] }
criterion.workspace = true

[[bench]]
name = "context"
harness = false
required-features = ["test-utils", "rayon"]
53 changes: 53 additions & 0 deletions crates/mpz-common/benches/context.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use mpz_common::{
executor::{test_mt_executor, test_st_executor},
Context,
};
use pollster::block_on;
use scoped_futures::ScopedFutureExt;

fn criterion_benchmark(c: &mut Criterion) {
let mut group = c.benchmark_group("context");

// Measures the overhead of making a `Context::blocking` call, which
// moves the context to a worker thread and back.
group.bench_function("st/blocking", |b| {
let (mut ctx, _) = test_st_executor(1024);
b.iter(|| {
block_on(async {
ctx.blocking(|ctx| {
async move {
black_box(ctx.id());
}
.scope_boxed()
})
.await
.unwrap();
});
})
});

// Measures the overhead of making a `Context::blocking` call, which
// moves the context to a worker thread and back.
group.bench_function("mt/blocking", |b| {
let (mut exec_a, _) = test_mt_executor(8);

let mut ctx = block_on(exec_a.new_thread()).unwrap();

b.iter(|| {
block_on(async {
ctx.blocking(|ctx| {
async move {
black_box(ctx.id());
}
.scope_boxed()
})
.await
.unwrap();
});
})
});
}

criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);
Loading

0 comments on commit efd28e3

Please sign in to comment.