This commit is contained in:
str4d 2023-02-14 20:51:44 +00:00
parent 7a087fb238
commit a1576a3bed
9 changed files with 155 additions and 750 deletions

View File

@ -1,452 +0,0 @@
window.BENCHMARK_DATA = {
"lastUpdate": 1676404607689,
"repoUrl": "https://github.com/zcash/halo2",
"entries": {
"halo2 Benchmark": [
{
"commit": {
"author": {
"email": "jack@electriccoin.co",
"name": "str4d",
"username": "str4d"
},
"committer": {
"email": "noreply@github.com",
"name": "GitHub",
"username": "web-flow"
},
"distinct": true,
"id": "210483df8e144d07381f38f70fce170d29ed9ce2",
"message": "Merge pull request #734 from zcash/inferno-msrv-1.59\n\nConstrain `inferno` transitive dependency to our MSRV",
"timestamp": "2023-02-14T18:53:17Z",
"tree_id": "94606d48de0560074a5cc027d7406b5489b141b6",
"url": "https://github.com/zcash/halo2/commit/210483df8e144d07381f38f70fce170d29ed9ce2"
},
"date": 1676404597731,
"tool": "cargo",
"benches": [
{
"name": "WIDTH = 3, RATE = 2-prover",
"value": 99851323,
"range": "± 9462157",
"unit": "ns/iter"
},
{
"name": "WIDTH = 3, RATE = 2-verifier",
"value": 5455091,
"range": "± 508655",
"unit": "ns/iter"
},
{
"name": "WIDTH = 9, RATE = 8-prover",
"value": 184536414,
"range": "± 4306161",
"unit": "ns/iter"
},
{
"name": "WIDTH = 9, RATE = 8-verifier",
"value": 6793087,
"range": "± 571932",
"unit": "ns/iter"
},
{
"name": "WIDTH = 12, RATE = 11-prover",
"value": 251009730,
"range": "± 5337621",
"unit": "ns/iter"
},
{
"name": "WIDTH = 12, RATE = 11-verifier",
"value": 7640005,
"range": "± 731593",
"unit": "ns/iter"
},
{
"name": "Poseidon/2-to-1",
"value": 40364,
"range": "± 160",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/hash-to-point/510",
"value": 160293,
"range": "± 148",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/hash/510",
"value": 175476,
"range": "± 98",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/commit/510",
"value": 285103,
"range": "± 138",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/short-commit/510",
"value": 285134,
"range": "± 173",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/hash-to-point/520",
"value": 163671,
"range": "± 60",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/hash/520",
"value": 178835,
"range": "± 130",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/commit/520",
"value": 288397,
"range": "± 194",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/short-commit/520",
"value": 288383,
"range": "± 187",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/hash-to-point/1086",
"value": 342325,
"range": "± 181",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/hash/1086",
"value": 357363,
"range": "± 344",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/commit/1086",
"value": 467018,
"range": "± 182",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/short-commit/1086",
"value": 467089,
"range": "± 197",
"unit": "ns/iter"
},
{
"name": "double-and-add",
"value": 3466227,
"range": "± 2027",
"unit": "ns/iter"
},
{
"name": "dev-lookup/14",
"value": 5933246,
"range": "± 8051",
"unit": "ns/iter"
},
{
"name": "dev-lookup/15",
"value": 10250719,
"range": "± 28945",
"unit": "ns/iter"
},
{
"name": "dev-lookup/16",
"value": 21069491,
"range": "± 189274",
"unit": "ns/iter"
},
{
"name": "dev-lookup/17",
"value": 40317619,
"range": "± 148572",
"unit": "ns/iter"
},
{
"name": "dev-lookup/18",
"value": 79189648,
"range": "± 182346",
"unit": "ns/iter"
},
{
"name": "fft/k/3",
"value": 7101,
"range": "± 286",
"unit": "ns/iter"
},
{
"name": "fft/k/4",
"value": 8456,
"range": "± 299",
"unit": "ns/iter"
},
{
"name": "fft/k/5",
"value": 14933,
"range": "± 862",
"unit": "ns/iter"
},
{
"name": "fft/k/6",
"value": 19448,
"range": "± 709",
"unit": "ns/iter"
},
{
"name": "fft/k/7",
"value": 27061,
"range": "± 3093",
"unit": "ns/iter"
},
{
"name": "fft/k/8",
"value": 44799,
"range": "± 7181",
"unit": "ns/iter"
},
{
"name": "fft/k/9",
"value": 104305,
"range": "± 13708",
"unit": "ns/iter"
},
{
"name": "fft/k/10",
"value": 216046,
"range": "± 37971",
"unit": "ns/iter"
},
{
"name": "fft/k/11",
"value": 471659,
"range": "± 57297",
"unit": "ns/iter"
},
{
"name": "fft/k/12",
"value": 886706,
"range": "± 109660",
"unit": "ns/iter"
},
{
"name": "fft/k/13",
"value": 1677526,
"range": "± 154249",
"unit": "ns/iter"
},
{
"name": "fft/k/14",
"value": 3580704,
"range": "± 400610",
"unit": "ns/iter"
},
{
"name": "fft/k/15",
"value": 7904692,
"range": "± 702269",
"unit": "ns/iter"
},
{
"name": "fft/k/16",
"value": 16601233,
"range": "± 2050843",
"unit": "ns/iter"
},
{
"name": "fft/k/17",
"value": 35209453,
"range": "± 3167840",
"unit": "ns/iter"
},
{
"name": "fft/k/18",
"value": 74425390,
"range": "± 1949319",
"unit": "ns/iter"
},
{
"name": "hash-to-curve/Pallas",
"value": 34575,
"range": "± 27",
"unit": "ns/iter"
},
{
"name": "hash-to-curve/Vesta",
"value": 34687,
"range": "± 20",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/8",
"value": 173365184,
"range": "± 569379",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/9",
"value": 374622867,
"range": "± 3853271",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/10",
"value": 811351232,
"range": "± 7419022",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/11",
"value": 1739254736,
"range": "± 5615734",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/12",
"value": 3705681502,
"range": "± 12286072",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/13",
"value": 7941215852,
"range": "± 11353176",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/14",
"value": 16907045741,
"range": "± 24607757",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/15",
"value": 35860260547,
"range": "± 27054556",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/16",
"value": 75827009534,
"range": "± 58869576",
"unit": "ns/iter"
},
{
"name": "plonk-prover/8",
"value": 118323512,
"range": "± 4560313",
"unit": "ns/iter"
},
{
"name": "plonk-prover/9",
"value": 205415274,
"range": "± 6462135",
"unit": "ns/iter"
},
{
"name": "plonk-prover/10",
"value": 349629506,
"range": "± 8591855",
"unit": "ns/iter"
},
{
"name": "plonk-prover/11",
"value": 614745429,
"range": "± 10959764",
"unit": "ns/iter"
},
{
"name": "plonk-prover/12",
"value": 1142742043,
"range": "± 14496892",
"unit": "ns/iter"
},
{
"name": "plonk-prover/13",
"value": 2122870981,
"range": "± 16653156",
"unit": "ns/iter"
},
{
"name": "plonk-prover/14",
"value": 4050110846,
"range": "± 14975879",
"unit": "ns/iter"
},
{
"name": "plonk-prover/15",
"value": 7762791045,
"range": "± 17650577",
"unit": "ns/iter"
},
{
"name": "plonk-prover/16",
"value": 14873019542,
"range": "± 53560862",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/8",
"value": 5837169,
"range": "± 347200",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/9",
"value": 9064270,
"range": "± 676205",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/10",
"value": 14494456,
"range": "± 986832",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/11",
"value": 24451785,
"range": "± 2485121",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/12",
"value": 42024747,
"range": "± 1789173",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/13",
"value": 75298054,
"range": "± 5174400",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/14",
"value": 135585496,
"range": "± 6360911",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/15",
"value": 248278011,
"range": "± 10136442",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/16",
"value": 452216445,
"range": "± 6466544",
"unit": "ns/iter"
}
]
}
]
}
}

View File

@ -1,281 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes" />
<style>
html {
font-family: BlinkMacSystemFont,-apple-system,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
-webkit-font-smoothing: antialiased;
background-color: #fff;
font-size: 16px;
}
body {
color: #4a4a4a;
margin: 8px;
font-size: 1em;
font-weight: 400;
}
header {
margin-bottom: 8px;
display: flex;
flex-direction: column;
}
main {
width: 100%;
display: flex;
flex-direction: column;
}
a {
color: #3273dc;
cursor: pointer;
text-decoration: none;
}
a:hover {
color: #000;
}
button {
color: #fff;
background-color: #3298dc;
border-color: transparent;
cursor: pointer;
text-align: center;
}
button:hover {
background-color: #2793da;
flex: none;
}
.spacer {
flex: auto;
}
.small {
font-size: 0.75rem;
}
footer {
margin-top: 16px;
display: flex;
align-items: center;
}
.header-label {
margin-right: 4px;
}
.benchmark-set {
margin: 8px 0;
width: 100%;
display: flex;
flex-direction: column;
}
.benchmark-title {
font-size: 3rem;
font-weight: 600;
word-break: break-word;
text-align: center;
}
.benchmark-graphs {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
width: 100%;
}
.benchmark-chart {
max-width: 1000px;
}
</style>
<title>Benchmarks</title>
</head>
<body>
<header id="header">
<div class="header-item">
<strong class="header-label">Last Update:</strong>
<span id="last-update"></span>
</div>
<div class="header-item">
<strong class="header-label">Repository:</strong>
<a id="repository-link" rel="noopener"></a>
</div>
</header>
<main id="main"></main>
<footer>
<button id="dl-button">Download data as JSON</button>
<div class="spacer"></div>
<div class="small">Powered by <a rel="noopener" href="https://github.com/marketplace/actions/continuous-benchmark">github-action-benchmark</a></div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.2/dist/Chart.min.js"></script>
<script src="data.js"></script>
<script id="main-script">
'use strict';
(function() {
// Colors from https://github.com/github/linguist/blob/master/lib/linguist/languages.yml
const toolColors = {
cargo: '#dea584',
go: '#00add8',
benchmarkjs: '#f1e05a',
benchmarkluau: '#000080',
pytest: '#3572a5',
googlecpp: '#f34b7d',
catch2: '#f34b7d',
julia: '#a270ba',
jmh: '#b07219',
benchmarkdotnet: '#178600',
customBiggerIsBetter: '#38ff38',
customSmallerIsBetter: '#ff3838',
_: '#333333'
};
function init() {
function collectBenchesPerTestCase(entries) {
const map = new Map();
for (const entry of entries) {
const {commit, date, tool, benches} = entry;
for (const bench of benches) {
const result = { commit, date, tool, bench };
const arr = map.get(bench.name);
if (arr === undefined) {
map.set(bench.name, [result]);
} else {
arr.push(result);
}
}
}
return map;
}
const data = window.BENCHMARK_DATA;
// Render header
document.getElementById('last-update').textContent = new Date(data.lastUpdate).toString();
const repoLink = document.getElementById('repository-link');
repoLink.href = data.repoUrl;
repoLink.textContent = data.repoUrl;
// Render footer
document.getElementById('dl-button').onclick = () => {
const dataUrl = 'data:,' + JSON.stringify(data, null, 2);
const a = document.createElement('a');
a.href = dataUrl;
a.download = 'benchmark_data.json';
a.click();
};
// Prepare data points for charts
return Object.keys(data.entries).map(name => ({
name,
dataSet: collectBenchesPerTestCase(data.entries[name]),
}));
}
function renderAllChars(dataSets) {
function renderGraph(parent, name, dataset) {
const canvas = document.createElement('canvas');
canvas.className = 'benchmark-chart';
parent.appendChild(canvas);
const color = toolColors[dataset.length > 0 ? dataset[0].tool : '_'];
const data = {
labels: dataset.map(d => d.commit.id.slice(0, 7)),
datasets: [
{
label: name,
data: dataset.map(d => d.bench.value),
borderColor: color,
backgroundColor: color + '60', // Add alpha for #rrggbbaa
}
],
};
const options = {
scales: {
xAxes: [
{
scaleLabel: {
display: true,
labelString: 'commit',
},
}
],
yAxes: [
{
scaleLabel: {
display: true,
labelString: dataset.length > 0 ? dataset[0].bench.unit : '',
},
ticks: {
beginAtZero: true,
}
}
],
},
tooltips: {
callbacks: {
afterTitle: items => {
const {index} = items[0];
const data = dataset[index];
return '\n' + data.commit.message + '\n\n' + data.commit.timestamp + ' committed by @' + data.commit.committer.username + '\n';
},
label: item => {
let label = item.value;
const { range, unit } = dataset[item.index].bench;
label += ' ' + unit;
if (range) {
label += ' (' + range + ')';
}
return label;
},
afterLabel: item => {
const { extra } = dataset[item.index].bench;
return extra ? '\n' + extra : '';
}
}
},
onClick: (_mouseEvent, activeElems) => {
if (activeElems.length === 0) {
return;
}
// XXX: Undocumented. How can we know the index?
const index = activeElems[0]._index;
const url = dataset[index].commit.url;
window.open(url, '_blank');
},
};
new Chart(canvas, {
type: 'line',
data,
options,
});
}
function renderBenchSet(name, benchSet, main) {
const setElem = document.createElement('div');
setElem.className = 'benchmark-set';
main.appendChild(setElem);
const nameElem = document.createElement('h1');
nameElem.className = 'benchmark-title';
nameElem.textContent = name;
setElem.appendChild(nameElem);
const graphsElem = document.createElement('div');
graphsElem.className = 'benchmark-graphs';
setElem.appendChild(graphsElem);
for (const [benchName, benches] of benchSet.entries()) {
renderGraph(graphsElem, benchName, benches)
}
}
const main = document.getElementById('main');
for (const {name, dataSet} of dataSets) {
renderBenchSet(name, dataSet, main);
}
}
renderAllChars(init()); // Start
})();
</script>
</body>
</html>

View File

@ -151,6 +151,9 @@ minor version bump.</p>
<h2 id="controlling-parallelism"><a class="header" href="#controlling-parallelism">Controlling parallelism</a></h2>
<p><code>halo2</code> currently uses <a href="https://github.com/rayon-rs/rayon">rayon</a> for parallel computation.
The <code>RAYON_NUM_THREADS</code> environment variable can be used to set the number of threads.</p>
<p>You can disable <code>rayon</code> by disabling the <code>&quot;multicore&quot;</code> feature.
Warning! Halo2 will lose access to parallelism if you disable the <code>&quot;multicore&quot;</code> feature.
This will significantly degrade performance.</p>
<h2 id="license"><a class="header" href="#license">License</a></h2>
<p>Licensed under either of</p>
<ul>

View File

@ -177,6 +177,9 @@ minor version bump.</p>
<h2 id="index-controlling-parallelism"><a class="header" href="#index-controlling-parallelism">Controlling parallelism</a></h2>
<p><code>halo2</code> currently uses <a href="https://github.com/rayon-rs/rayon">rayon</a> for parallel computation.
The <code>RAYON_NUM_THREADS</code> environment variable can be used to set the number of threads.</p>
<p>You can disable <code>rayon</code> by disabling the <code>&quot;multicore&quot;</code> feature.
Warning! Halo2 will lose access to parallelism if you disable the <code>&quot;multicore&quot;</code> feature.
This will significantly degrade performance.</p>
<h2 id="index-license"><a class="header" href="#index-license">License</a></h2>
<p>Licensed under either of</p>
<ul>

View File

@ -13,18 +13,18 @@
});
});
</script>
</head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="logo-container" href="../../halo2_proofs/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../halo2_proofs/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">BatchVerifier</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.add_proof">add_proof</a></li><li><a href="#method.finalize">finalize</a></li><li><a href="#method.new">new</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Debug-for-BatchVerifier%3CC%3E">Debug</a></li><li><a href="#impl-Default-for-BatchVerifier%3CC%3E">Default</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-BatchVerifier%3CC%3E">RefUnwindSafe</a></li><li><a href="#impl-Send-for-BatchVerifier%3CC%3E">Send</a></li><li><a href="#impl-Sync-for-BatchVerifier%3CC%3E">Sync</a></li><li><a href="#impl-Unpin-for-BatchVerifier%3CC%3E">Unpin</a></li><li><a href="#impl-UnwindSafe-for-BatchVerifier%3CC%3E">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-BatchVerifier%3CC%3E">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-BatchVerifier%3CC%3E">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-BatchVerifier%3CC%3E">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-Conv-for-BatchVerifier%3CC%3E">Conv</a></li><li><a href="#impl-FmtForward-for-BatchVerifier%3CC%3E">FmtForward</a></li><li><a href="#impl-From%3CT%3E-for-BatchVerifier%3CC%3E">From&lt;T&gt;</a></li><li><a href="#impl-Instrument-for-BatchVerifier%3CC%3E">Instrument</a></li><li><a href="#impl-Into%3CU%3E-for-BatchVerifier%3CC%3E">Into&lt;U&gt;</a></li><li><a href="#impl-Pipe-for-BatchVerifier%3CC%3E">Pipe</a></li><li><a href="#impl-Pointable-for-BatchVerifier%3CC%3E">Pointable</a></li><li><a href="#impl-Tap-for-BatchVerifier%3CC%3E">Tap</a></li><li><a href="#impl-TryConv-for-BatchVerifier%3CC%3E">TryConv</a></li><li><a href="#impl-TryFrom%3CU%3E-for-BatchVerifier%3CC%3E">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-BatchVerifier%3CC%3E">TryInto&lt;U&gt;</a></li><li><a href="#impl-VZip%3CV%3E-for-BatchVerifier%3CC%3E">VZip&lt;V&gt;</a></li><li><a href="#impl-WithSubscriber-for-BatchVerifier%3CC%3E">WithSubscriber</a></li></ul></section><h2><a href="index.html">In halo2_proofs::plonk</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="../index.html">halo2_proofs</a>::<wbr><a href="index.html">plonk</a>::<wbr><a class="struct" href="#">BatchVerifier</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#50-52">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub struct BatchVerifier&lt;C: <a class="trait" href="../arithmetic/trait.CurveAffine.html" title="trait halo2_proofs::arithmetic::CurveAffine">CurveAffine</a>&gt; { /* private fields */ }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A verifier that checks multiple proofs in a batch. <strong>This requires the
</head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="logo-container" href="../../halo2_proofs/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../halo2_proofs/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">BatchVerifier</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.add_proof">add_proof</a></li><li><a href="#method.finalize">finalize</a></li><li><a href="#method.new">new</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Debug-for-BatchVerifier%3CC%3E">Debug</a></li><li><a href="#impl-Default-for-BatchVerifier%3CC%3E">Default</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-BatchVerifier%3CC%3E">RefUnwindSafe</a></li><li><a href="#impl-Send-for-BatchVerifier%3CC%3E">Send</a></li><li><a href="#impl-Sync-for-BatchVerifier%3CC%3E">Sync</a></li><li><a href="#impl-Unpin-for-BatchVerifier%3CC%3E">Unpin</a></li><li><a href="#impl-UnwindSafe-for-BatchVerifier%3CC%3E">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-BatchVerifier%3CC%3E">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-BatchVerifier%3CC%3E">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-BatchVerifier%3CC%3E">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-Conv-for-BatchVerifier%3CC%3E">Conv</a></li><li><a href="#impl-FmtForward-for-BatchVerifier%3CC%3E">FmtForward</a></li><li><a href="#impl-From%3CT%3E-for-BatchVerifier%3CC%3E">From&lt;T&gt;</a></li><li><a href="#impl-Instrument-for-BatchVerifier%3CC%3E">Instrument</a></li><li><a href="#impl-Into%3CU%3E-for-BatchVerifier%3CC%3E">Into&lt;U&gt;</a></li><li><a href="#impl-Pipe-for-BatchVerifier%3CC%3E">Pipe</a></li><li><a href="#impl-Pointable-for-BatchVerifier%3CC%3E">Pointable</a></li><li><a href="#impl-Tap-for-BatchVerifier%3CC%3E">Tap</a></li><li><a href="#impl-TryConv-for-BatchVerifier%3CC%3E">TryConv</a></li><li><a href="#impl-TryFrom%3CU%3E-for-BatchVerifier%3CC%3E">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-BatchVerifier%3CC%3E">TryInto&lt;U&gt;</a></li><li><a href="#impl-VZip%3CV%3E-for-BatchVerifier%3CC%3E">VZip&lt;V&gt;</a></li><li><a href="#impl-WithSubscriber-for-BatchVerifier%3CC%3E">WithSubscriber</a></li></ul></section><h2><a href="index.html">In halo2_proofs::plonk</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="../index.html">halo2_proofs</a>::<wbr><a href="index.html">plonk</a>::<wbr><a class="struct" href="#">BatchVerifier</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#53-55">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub struct BatchVerifier&lt;C: <a class="trait" href="../arithmetic/trait.CurveAffine.html" title="trait halo2_proofs::arithmetic::CurveAffine">CurveAffine</a>&gt; { /* private fields */ }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A verifier that checks multiple proofs in a batch. <strong>This requires the
<code>batch</code> crate feature to be enabled.</strong></p>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-BatchVerifier%3CC%3E" class="impl"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#54-64">source</a><a href="#impl-BatchVerifier%3CC%3E" class="anchor">§</a><h3 class="code-header">impl&lt;C: <a class="trait" href="../arithmetic/trait.CurveAffine.html" title="trait halo2_proofs::arithmetic::CurveAffine">CurveAffine</a>&gt; <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#56-58">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Constructs a new batch verifier.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_proof" class="method"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#61-63">source</a><h4 class="code-header">pub fn <a href="#method.add_proof" class="fn">add_proof</a>(&amp;mut self, instances: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;C::Scalar&gt;&gt;&gt;, proof: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;)</h4></section></summary><div class="docblock"><p>Adds a proof to the batch.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BatchVerifier%3CC%3E-1" class="impl"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#66-122">source</a><a href="#impl-BatchVerifier%3CC%3E-1" class="anchor">§</a><h3 class="code-header">impl&lt;C: <a class="trait" href="../arithmetic/trait.CurveAffine.html" title="trait halo2_proofs::arithmetic::CurveAffine">CurveAffine</a>&gt; <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;<span class="where fmt-newline">where
C::Scalar: FromUniformBytes&lt;64&gt;,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.finalize" class="method"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#78-121">source</a><h4 class="code-header">pub fn <a href="#method.finalize" class="fn">finalize</a>(self, params: &amp;<a class="struct" href="../poly/commitment/struct.Params.html" title="struct halo2_proofs::poly::commitment::Params">Params</a>&lt;C&gt;, vk: &amp;<a class="struct" href="struct.VerifyingKey.html" title="struct halo2_proofs::plonk::VerifyingKey">VerifyingKey</a>&lt;C&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Finalizes the batch and checks its validity.</p>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-BatchVerifier%3CC%3E" class="impl"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#57-67">source</a><a href="#impl-BatchVerifier%3CC%3E" class="anchor">§</a><h3 class="code-header">impl&lt;C: <a class="trait" href="../arithmetic/trait.CurveAffine.html" title="trait halo2_proofs::arithmetic::CurveAffine">CurveAffine</a>&gt; <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#59-61">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Constructs a new batch verifier.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_proof" class="method"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#64-66">source</a><h4 class="code-header">pub fn <a href="#method.add_proof" class="fn">add_proof</a>(&amp;mut self, instances: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;C::Scalar&gt;&gt;&gt;, proof: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;)</h4></section></summary><div class="docblock"><p>Adds a proof to the batch.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BatchVerifier%3CC%3E-1" class="impl"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#69-124">source</a><a href="#impl-BatchVerifier%3CC%3E-1" class="anchor">§</a><h3 class="code-header">impl&lt;C: <a class="trait" href="../arithmetic/trait.CurveAffine.html" title="trait halo2_proofs::arithmetic::CurveAffine">CurveAffine</a>&gt; <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;<span class="where fmt-newline">where
C::Scalar: FromUniformBytes&lt;64&gt;,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.finalize" class="method"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#81-123">source</a><h4 class="code-header">pub fn <a href="#method.finalize" class="fn">finalize</a>(self, params: &amp;<a class="struct" href="../poly/commitment/struct.Params.html" title="struct halo2_proofs::poly::commitment::Params">Params</a>&lt;C&gt;, vk: &amp;<a class="struct" href="struct.VerifyingKey.html" title="struct halo2_proofs::plonk::VerifyingKey">VerifyingKey</a>&lt;C&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Finalizes the batch and checks its validity.</p>
<p>Returns <code>false</code> if <em>some</em> proof was invalid. If the caller needs to identify
specific failing proofs, it must re-process the proofs separately.</p>
<p>This uses <a href="https://rust-random.github.io/rand/rand_core/os/struct.OsRng.html" title="OsRng"><code>OsRng</code></a> internally instead of taking an <code>R: RngCore</code> argument, because
the internal parallelization requires access to a RNG that is guaranteed to not
clone its internal state when shared between threads.</p>
</div></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-BatchVerifier%3CC%3E" class="impl"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#49">source</a><a href="#impl-Debug-for-BatchVerifier%3CC%3E" class="anchor">§</a><h3 class="code-header">impl&lt;C: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="../arithmetic/trait.CurveAffine.html" title="trait halo2_proofs::arithmetic::CurveAffine">CurveAffine</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#49">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-BatchVerifier%3CC%3E" class="impl"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#49">source</a><a href="#impl-Default-for-BatchVerifier%3CC%3E" class="anchor">§</a><h3 class="code-header">impl&lt;C: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="../arithmetic/trait.CurveAffine.html" title="trait halo2_proofs::arithmetic::CurveAffine">CurveAffine</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#49">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-BatchVerifier%3CC%3E" class="impl"><a href="#impl-RefUnwindSafe-for-BatchVerifier%3CC%3E" class="anchor">§</a><h3 class="code-header">impl&lt;C&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;<span class="where fmt-newline">where
</div></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-BatchVerifier%3CC%3E" class="impl"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#52">source</a><a href="#impl-Debug-for-BatchVerifier%3CC%3E" class="anchor">§</a><h3 class="code-header">impl&lt;C: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="../arithmetic/trait.CurveAffine.html" title="trait halo2_proofs::arithmetic::CurveAffine">CurveAffine</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#52">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-BatchVerifier%3CC%3E" class="impl"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#52">source</a><a href="#impl-Default-for-BatchVerifier%3CC%3E" class="anchor">§</a><h3 class="code-header">impl&lt;C: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="../arithmetic/trait.CurveAffine.html" title="trait halo2_proofs::arithmetic::CurveAffine">CurveAffine</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="srclink rightside" href="../../src/halo2_proofs/plonk/verifier/batch.rs.html#52">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-BatchVerifier%3CC%3E" class="impl"><a href="#impl-RefUnwindSafe-for-BatchVerifier%3CC%3E" class="anchor">§</a><h3 class="code-header">impl&lt;C&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;<span class="where fmt-newline">where
&lt;C as <a class="trait" href="../arithmetic/trait.CurveAffine.html" title="trait halo2_proofs::arithmetic::CurveAffine">CurveAffine</a>&gt;::<a class="associatedtype" href="../arithmetic/trait.CurveAffine.html#associatedtype.ScalarExt" title="type halo2_proofs::arithmetic::CurveAffine::ScalarExt">ScalarExt</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,</span></h3></section><section id="impl-Send-for-BatchVerifier%3CC%3E" class="impl"><a href="#impl-Send-for-BatchVerifier%3CC%3E" class="anchor">§</a><h3 class="code-header">impl&lt;C&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;</h3></section><section id="impl-Sync-for-BatchVerifier%3CC%3E" class="impl"><a href="#impl-Sync-for-BatchVerifier%3CC%3E" class="anchor">§</a><h3 class="code-header">impl&lt;C&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;</h3></section><section id="impl-Unpin-for-BatchVerifier%3CC%3E" class="impl"><a href="#impl-Unpin-for-BatchVerifier%3CC%3E" class="anchor">§</a><h3 class="code-header">impl&lt;C&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;<span class="where fmt-newline">where
&lt;C as <a class="trait" href="../arithmetic/trait.CurveAffine.html" title="trait halo2_proofs::arithmetic::CurveAffine">CurveAffine</a>&gt;::<a class="associatedtype" href="../arithmetic/trait.CurveAffine.html#associatedtype.ScalarExt" title="type halo2_proofs::arithmetic::CurveAffine::ScalarExt">ScalarExt</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</span></h3></section><section id="impl-UnwindSafe-for-BatchVerifier%3CC%3E" class="impl"><a href="#impl-UnwindSafe-for-BatchVerifier%3CC%3E" class="anchor">§</a><h3 class="code-header">impl&lt;C&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.BatchVerifier.html" title="struct halo2_proofs::plonk::BatchVerifier">BatchVerifier</a>&lt;C&gt;<span class="where fmt-newline">where
&lt;C as <a class="trait" href="../arithmetic/trait.CurveAffine.html" title="trait halo2_proofs::arithmetic::CurveAffine">CurveAffine</a>&gt;::<a class="associatedtype" href="../arithmetic/trait.CurveAffine.html#associatedtype.ScalarExt" title="type halo2_proofs::arithmetic::CurveAffine::ScalarExt">ScalarExt</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</span></h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-BatchVerifier%3CC%3E" class="impl"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#200">source</a><a href="#impl-Any-for-BatchVerifier%3CC%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<span class="where fmt-newline">where

View File

@ -22,14 +22,142 @@
<a href="#7" id="7">7</a>
<a href="#8" id="8">8</a>
<a href="#9" id="9">9</a>
<a href="#10" id="10">10</a>
<a href="#11" id="11">11</a>
<a href="#12" id="12">12</a>
<a href="#13" id="13">13</a>
<a href="#14" id="14">14</a>
<a href="#15" id="15">15</a>
<a href="#16" id="16">16</a>
<a href="#17" id="17">17</a>
<a href="#18" id="18">18</a>
<a href="#19" id="19">19</a>
<a href="#20" id="20">20</a>
<a href="#21" id="21">21</a>
<a href="#22" id="22">22</a>
<a href="#23" id="23">23</a>
<a href="#24" id="24">24</a>
<a href="#25" id="25">25</a>
<a href="#26" id="26">26</a>
<a href="#27" id="27">27</a>
<a href="#28" id="28">28</a>
<a href="#29" id="29">29</a>
<a href="#30" id="30">30</a>
<a href="#31" id="31">31</a>
<a href="#32" id="32">32</a>
<a href="#33" id="33">33</a>
<a href="#34" id="34">34</a>
<a href="#35" id="35">35</a>
<a href="#36" id="36">36</a>
<a href="#37" id="37">37</a>
<a href="#38" id="38">38</a>
<a href="#39" id="39">39</a>
<a href="#40" id="40">40</a>
<a href="#41" id="41">41</a>
<a href="#42" id="42">42</a>
<a href="#43" id="43">43</a>
<a href="#44" id="44">44</a>
<a href="#45" id="45">45</a>
<a href="#46" id="46">46</a>
<a href="#47" id="47">47</a>
<a href="#48" id="48">48</a>
<a href="#49" id="49">49</a>
<a href="#50" id="50">50</a>
<a href="#51" id="51">51</a>
<a href="#52" id="52">52</a>
<a href="#53" id="53">53</a>
<a href="#54" id="54">54</a>
<a href="#55" id="55">55</a>
<a href="#56" id="56">56</a>
<a href="#57" id="57">57</a>
<a href="#58" id="58">58</a>
<a href="#59" id="59">59</a>
<a href="#60" id="60">60</a>
<a href="#61" id="61">61</a>
<a href="#62" id="62">62</a>
<a href="#63" id="63">63</a>
<a href="#64" id="64">64</a>
<a href="#65" id="65">65</a>
<a href="#66" id="66">66</a>
<a href="#67" id="67">67</a>
<a href="#68" id="68">68</a>
<a href="#69" id="69">69</a>
<a href="#70" id="70">70</a>
<a href="#71" id="71">71</a>
<a href="#72" id="72">72</a>
<a href="#73" id="73">73</a>
</pre><pre class="rust"><code><span class="doccomment">//! An interface for dealing with the kinds of parallel computations involved in
//! `halo2`. It&#39;s currently just a (very!) thin wrapper around [`rayon`] but may
//! `halo2`. It&#39;s currently just a (very!) thin wrapper around `rayon` but may
//! be extended in the future to allow for various parallelism strategies.
</span><span class="kw">pub use </span>rayon::{
current_num_threads,
iter::{IndexedParallelIterator, IntoParallelIterator, ParallelIterator},
</span><span class="attr">#[cfg(all(
feature = <span class="string">&quot;multicore&quot;</span>,
target_arch = <span class="string">&quot;wasm32&quot;</span>,
not(target_feature = <span class="string">&quot;atomics&quot;</span>)
))]
</span><span class="macro">compile_error!</span>(
<span class="string">&quot;The multicore feature flag is not supported on wasm32 architectures without atomics&quot;
</span>);
<span class="kw">pub use </span>maybe_rayon::{
iter::{IntoParallelIterator, ParallelIterator},
join, scope, Scope,
};
<span class="attr">#[cfg(feature = <span class="string">&quot;multicore&quot;</span>)]
</span><span class="kw">pub use </span>maybe_rayon::{current_num_threads, iter::IndexedParallelIterator};
<span class="attr">#[cfg(not(feature = <span class="string">&quot;multicore&quot;</span>))]
</span><span class="kw">pub fn </span>current_num_threads() -&gt; usize {
<span class="number">1
</span>}
<span class="attr">#[cfg(not(feature = <span class="string">&quot;multicore&quot;</span>))]
</span><span class="kw">pub trait </span>IndexedParallelIterator: std::iter::Iterator {}
<span class="kw">pub trait </span>TryFoldAndReduce&lt;T, E&gt; {
<span class="doccomment">/// Implements `iter.try_fold().try_reduce()` for `rayon::iter::ParallelIterator`,
/// falling back on `Iterator::try_fold` when the `multicore` feature flag is
/// disabled.
/// The `try_fold_and_reduce` function can only be called by a iter with
/// `Result&lt;T, E&gt;` item type because the `fold_op` must meet the trait
/// bounds of both `try_fold` and `try_reduce` from rayon.
</span><span class="kw">fn </span>try_fold_and_reduce(
<span class="self">self</span>,
identity: <span class="kw">impl </span>Fn() -&gt; T + Send + Sync,
fold_op: <span class="kw">impl </span>Fn(T, <span class="prelude-ty">Result</span>&lt;T, E&gt;) -&gt; <span class="prelude-ty">Result</span>&lt;T, E&gt; + Send + Sync,
) -&gt; <span class="prelude-ty">Result</span>&lt;T, E&gt;;
}
<span class="attr">#[cfg(feature = <span class="string">&quot;multicore&quot;</span>)]
</span><span class="kw">impl</span>&lt;T, E, I&gt; TryFoldAndReduce&lt;T, E&gt; <span class="kw">for </span>I
<span class="kw">where
</span>T: Send + Sync,
E: Send + Sync,
I: maybe_rayon::iter::ParallelIterator&lt;Item = <span class="prelude-ty">Result</span>&lt;T, E&gt;&gt;,
{
<span class="kw">fn </span>try_fold_and_reduce(
<span class="self">self</span>,
identity: <span class="kw">impl </span>Fn() -&gt; T + Send + Sync,
fold_op: <span class="kw">impl </span>Fn(T, <span class="prelude-ty">Result</span>&lt;T, E&gt;) -&gt; <span class="prelude-ty">Result</span>&lt;T, E&gt; + Send + Sync,
) -&gt; <span class="prelude-ty">Result</span>&lt;T, E&gt; {
<span class="self">self</span>.try_fold(<span class="kw-2">&amp;</span>identity, <span class="kw-2">&amp;</span>fold_op)
.try_reduce(<span class="kw-2">&amp;</span>identity, |a, b| fold_op(a, <span class="prelude-val">Ok</span>(b)))
}
}
<span class="attr">#[cfg(not(feature = <span class="string">&quot;multicore&quot;</span>))]
</span><span class="kw">impl</span>&lt;T, E, I&gt; TryFoldAndReduce&lt;T, E&gt; <span class="kw">for </span>I
<span class="kw">where
</span>I: std::iter::Iterator&lt;Item = <span class="prelude-ty">Result</span>&lt;T, E&gt;&gt;,
{
<span class="kw">fn </span>try_fold_and_reduce(
<span class="kw-2">mut </span><span class="self">self</span>,
identity: <span class="kw">impl </span>Fn() -&gt; T + Send + Sync,
fold_op: <span class="kw">impl </span>Fn(T, <span class="prelude-ty">Result</span>&lt;T, E&gt;) -&gt; <span class="prelude-ty">Result</span>&lt;T, E&gt; + Send + Sync,
) -&gt; <span class="prelude-ty">Result</span>&lt;T, E&gt; {
<span class="self">self</span>.try_fold(identity(), fold_op)
}
}
</code></pre></div>
</section></main><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="halo2_proofs" data-themes="" data-resource-suffix="" data-rustdoc-version="1.69.0-nightly (065852def 2023-02-13)" data-search-js="search-abe1d547ad11c273.js" data-settings-js="settings-f0c5c39777a9a2f6.js" data-settings-css="settings-0bcba95ff279c1db.css" ></div></body></html>

View File

@ -135,18 +135,23 @@
<a href="#120" id="120">120</a>
<a href="#121" id="121">121</a>
<a href="#122" id="122">122</a>
<a href="#123" id="123">123</a>
<a href="#124" id="124">124</a>
</pre><pre class="rust"><code><span class="kw">use </span>group::ff::{Field, FromUniformBytes};
<span class="kw">use </span>pasta_curves::arithmetic::CurveAffine;
<span class="kw">use </span>rand_core::OsRng;
<span class="kw">use super</span>::{verify_proof, VerificationStrategy};
<span class="kw">use crate</span>::{
multicore::{IndexedParallelIterator, IntoParallelIterator, ParallelIterator},
multicore::{IntoParallelIterator, TryFoldAndReduce},
plonk::{Error, VerifyingKey},
poly::commitment::{Guard, Params, MSM},
transcript::{Blake2bRead, EncodedChallenge},
};
<span class="attr">#[cfg(feature = <span class="string">&quot;multicore&quot;</span>)]
</span><span class="kw">use </span><span class="kw">crate</span>::multicore::{IndexedParallelIterator, ParallelIterator};
<span class="doccomment">/// A proof verification strategy that returns the proof&#39;s MSM.
///
/// `BatchVerifier` handles the accumulation of the MSMs for the batched proofs.
@ -245,11 +250,10 @@
e
})
})
.try_fold(
.try_fold_and_reduce(
|| params.empty_msm(),
|msm, res| res.map(|proof_msm| accumulate_msm(msm, proof_msm)),
)
.try_reduce(|| params.empty_msm(), |a, b| <span class="prelude-val">Ok</span>(accumulate_msm(a, b)));
|acc, res| res.map(|proof_msm| accumulate_msm(acc, proof_msm)),
);
<span class="kw">match </span>final_msm {
<span class="prelude-val">Ok</span>(msm) =&gt; msm.eval(),

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long