This commit is contained in:
str4d 2022-06-22 20:59:35 +00:00
parent 4bab36b53b
commit a38f3ff864
12 changed files with 88 additions and 762 deletions

View File

@ -1,452 +0,0 @@
window.BENCHMARK_DATA = {
"lastUpdate": 1655920162042,
"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": "f6efecc596813860e75cd4d0aa9b8c279c61a29c",
"message": "Merge pull request #603 from zcash/batch-verifier-return-rng\n\nAdd `BatchVerifier::finalize_and_return_rng`",
"timestamp": "2022-06-22T17:43:50+01:00",
"tree_id": "cd512349c5cff8881a6d84a07ac3421ef7b45295",
"url": "https://github.com/zcash/halo2/commit/f6efecc596813860e75cd4d0aa9b8c279c61a29c"
},
"date": 1655920154820,
"tool": "cargo",
"benches": [
{
"name": "WIDTH = 3, RATE = 2-prover",
"value": 79865010,
"range": "± 1952360",
"unit": "ns/iter"
},
{
"name": "WIDTH = 3, RATE = 2-verifier",
"value": 3873679,
"range": "± 23478",
"unit": "ns/iter"
},
{
"name": "WIDTH = 9, RATE = 8-prover",
"value": 182686180,
"range": "± 4012871",
"unit": "ns/iter"
},
{
"name": "WIDTH = 9, RATE = 8-verifier",
"value": 5785719,
"range": "± 102979",
"unit": "ns/iter"
},
{
"name": "WIDTH = 12, RATE = 11-prover",
"value": 253400813,
"range": "± 1683130",
"unit": "ns/iter"
},
{
"name": "WIDTH = 12, RATE = 11-verifier",
"value": 6774720,
"range": "± 62623",
"unit": "ns/iter"
},
{
"name": "Poseidon/2-to-1",
"value": 47193,
"range": "± 33",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/hash-to-point/510",
"value": 163153,
"range": "± 146",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/hash/510",
"value": 178404,
"range": "± 101",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/commit/510",
"value": 291563,
"range": "± 327",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/short-commit/510",
"value": 291843,
"range": "± 1669",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/hash-to-point/520",
"value": 166592,
"range": "± 186",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/hash/520",
"value": 181923,
"range": "± 82",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/commit/520",
"value": 295149,
"range": "± 144",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/short-commit/520",
"value": 294871,
"range": "± 697",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/hash-to-point/1086",
"value": 348425,
"range": "± 149",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/hash/1086",
"value": 363838,
"range": "± 193",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/commit/1086",
"value": 477051,
"range": "± 189",
"unit": "ns/iter"
},
{
"name": "Sinsemilla/short-commit/1086",
"value": 476946,
"range": "± 351",
"unit": "ns/iter"
},
{
"name": "double-and-add",
"value": 3658751,
"range": "± 2485",
"unit": "ns/iter"
},
{
"name": "dev-lookup/14",
"value": 6040002,
"range": "± 2251",
"unit": "ns/iter"
},
{
"name": "dev-lookup/15",
"value": 10493148,
"range": "± 31863",
"unit": "ns/iter"
},
{
"name": "dev-lookup/16",
"value": 23231374,
"range": "± 39901",
"unit": "ns/iter"
},
{
"name": "dev-lookup/17",
"value": 42237162,
"range": "± 38537",
"unit": "ns/iter"
},
{
"name": "dev-lookup/18",
"value": 81741001,
"range": "± 95692",
"unit": "ns/iter"
},
{
"name": "fft/k/3",
"value": 7380,
"range": "± 294",
"unit": "ns/iter"
},
{
"name": "fft/k/4",
"value": 8694,
"range": "± 846",
"unit": "ns/iter"
},
{
"name": "fft/k/5",
"value": 15870,
"range": "± 368",
"unit": "ns/iter"
},
{
"name": "fft/k/6",
"value": 20291,
"range": "± 507",
"unit": "ns/iter"
},
{
"name": "fft/k/7",
"value": 29561,
"range": "± 284",
"unit": "ns/iter"
},
{
"name": "fft/k/8",
"value": 50043,
"range": "± 1020",
"unit": "ns/iter"
},
{
"name": "fft/k/9",
"value": 103332,
"range": "± 8602",
"unit": "ns/iter"
},
{
"name": "fft/k/10",
"value": 200137,
"range": "± 10687",
"unit": "ns/iter"
},
{
"name": "fft/k/11",
"value": 408943,
"range": "± 14538",
"unit": "ns/iter"
},
{
"name": "fft/k/12",
"value": 858474,
"range": "± 10908",
"unit": "ns/iter"
},
{
"name": "fft/k/13",
"value": 1803825,
"range": "± 15403",
"unit": "ns/iter"
},
{
"name": "fft/k/14",
"value": 3812155,
"range": "± 41219",
"unit": "ns/iter"
},
{
"name": "fft/k/15",
"value": 8139709,
"range": "± 167840",
"unit": "ns/iter"
},
{
"name": "fft/k/16",
"value": 17600963,
"range": "± 192207",
"unit": "ns/iter"
},
{
"name": "fft/k/17",
"value": 37377602,
"range": "± 203533",
"unit": "ns/iter"
},
{
"name": "fft/k/18",
"value": 81144063,
"range": "± 872478",
"unit": "ns/iter"
},
{
"name": "hash-to-curve/Pallas",
"value": 34855,
"range": "± 19",
"unit": "ns/iter"
},
{
"name": "hash-to-curve/Vesta",
"value": 35005,
"range": "± 23",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/8",
"value": 178758835,
"range": "± 833099",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/9",
"value": 384109000,
"range": "± 1897369",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/10",
"value": 829941385,
"range": "± 1481639",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/11",
"value": 1786689595,
"range": "± 4998608",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/12",
"value": 3827297083,
"range": "± 3289395",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/13",
"value": 8180966995,
"range": "± 67767787",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/14",
"value": 17415591964,
"range": "± 18291281",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/15",
"value": 36979403719,
"range": "± 21901240",
"unit": "ns/iter"
},
{
"name": "plonk-keygen/16",
"value": 78218758763,
"range": "± 64759300",
"unit": "ns/iter"
},
{
"name": "plonk-prover/8",
"value": 110662588,
"range": "± 613457",
"unit": "ns/iter"
},
{
"name": "plonk-prover/9",
"value": 190267402,
"range": "± 2538470",
"unit": "ns/iter"
},
{
"name": "plonk-prover/10",
"value": 337302916,
"range": "± 2194555",
"unit": "ns/iter"
},
{
"name": "plonk-prover/11",
"value": 614451337,
"range": "± 1254940",
"unit": "ns/iter"
},
{
"name": "plonk-prover/12",
"value": 1144615213,
"range": "± 5414567",
"unit": "ns/iter"
},
{
"name": "plonk-prover/13",
"value": 2160992463,
"range": "± 6052865",
"unit": "ns/iter"
},
{
"name": "plonk-prover/14",
"value": 4110972738,
"range": "± 9893111",
"unit": "ns/iter"
},
{
"name": "plonk-prover/15",
"value": 7936573650,
"range": "± 15899786",
"unit": "ns/iter"
},
{
"name": "plonk-prover/16",
"value": 15259453664,
"range": "± 24390515",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/8",
"value": 5989891,
"range": "± 72116",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/9",
"value": 9267426,
"range": "± 79632",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/10",
"value": 15142601,
"range": "± 80193",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/11",
"value": 25411667,
"range": "± 278189",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/12",
"value": 43309831,
"range": "± 1471239",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/13",
"value": 77163763,
"range": "± 1511627",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/14",
"value": 137924338,
"range": "± 776308",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/15",
"value": 251886282,
"range": "± 3522871",
"unit": "ns/iter"
},
{
"name": "plonk-verifier/16",
"value": 460147011,
"range": "± 2169261",
"unit": "ns/iter"
}
]
}
]
}
}

View File

@ -1,280 +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',
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

@ -20,7 +20,7 @@
</a><h2 class="location"><a href="#">Module plonk</a></h2><div class="sidebar-elems"><section><div class="block"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></div></section></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../halo2_proofs/index.html"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><button type="button" id="help-button" title="help">?</button><div id="settings-menu" tabindex="-1">
<a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div>
</div></form></nav></div><section id="main-content" class="content"><div class="main-heading">
<h1 class="fqn"><span class="in-band">Module <a href="../index.html">halo2_proofs</a>::<wbr><a class="mod" href="#">plonk</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../src/halo2_proofs/plonk.rs.html#1-142">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This module provides an implementation of a variant of (Turbo)<a href="https://eprint.iacr.org/2019/953">PLONK</a>
<h1 class="fqn"><span class="in-band">Module <a href="../index.html">halo2_proofs</a>::<wbr><a class="mod" href="#">plonk</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../src/halo2_proofs/plonk.rs.html#1-171">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This module provides an implementation of a variant of (Turbo)<a href="https://eprint.iacr.org/2019/953">PLONK</a>
that is designed specifically for the polynomial commitment scheme described
in the <a href="https://eprint.iacr.org/2019/1021">Halo</a> paper.</p>
</div></details><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -161,6 +161,35 @@
<span id="140">140</span>
<span id="141">141</span>
<span id="142">142</span>
<span id="143">143</span>
<span id="144">144</span>
<span id="145">145</span>
<span id="146">146</span>
<span id="147">147</span>
<span id="148">148</span>
<span id="149">149</span>
<span id="150">150</span>
<span id="151">151</span>
<span id="152">152</span>
<span id="153">153</span>
<span id="154">154</span>
<span id="155">155</span>
<span id="156">156</span>
<span id="157">157</span>
<span id="158">158</span>
<span id="159">159</span>
<span id="160">160</span>
<span id="161">161</span>
<span id="162">162</span>
<span id="163">163</span>
<span id="164">164</span>
<span id="165">165</span>
<span id="166">166</span>
<span id="167">167</span>
<span id="168">168</span>
<span id="169">169</span>
<span id="170">170</span>
<span id="171">171</span>
</pre><pre class="rust"><code><span class="doccomment">//! This module provides an implementation of a variant of (Turbo)[PLONK][plonk]</span>
<span class="doccomment">//! that is designed specifically for the polynomial commitment scheme described</span>
<span class="doccomment">//! in the [Halo][halo] paper.</span>
@ -169,6 +198,7 @@
<span class="doccomment">//! [plonk]: https://eprint.iacr.org/2019/953</span>
<span class="kw">use</span> <span class="ident">blake2b_simd::Params</span> <span class="kw">as</span> <span class="ident">Blake2bParams</span>;
<span class="kw">use</span> <span class="ident">group::ff::Field</span>;
<span class="kw">use</span> <span class="ident"><span class="kw">crate</span>::arithmetic</span>::{<span class="ident">CurveAffine</span>, <span class="ident">FieldExt</span>};
<span class="kw">use</span> <span class="ident"><span class="kw">crate</span>::helpers::CurveRead</span>;
@ -206,26 +236,54 @@
<span class="ident">fixed_commitments</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">C</span><span class="op">&gt;</span>,
<span class="ident">permutation</span>: <span class="ident">permutation::VerifyingKey</span><span class="op">&lt;</span><span class="ident">C</span><span class="op">&gt;</span>,
<span class="ident">cs</span>: <span class="ident">ConstraintSystem</span><span class="op">&lt;</span><span class="ident">C::Scalar</span><span class="op">&gt;</span>,
<span class="doccomment">/// Cached maximum degree of `cs` (which doesn&#39;t change after construction).</span>
<span class="ident">cs_degree</span>: <span class="ident">usize</span>,
<span class="doccomment">/// The representative of this `VerifyingKey` in transcripts.</span>
<span class="ident">transcript_repr</span>: <span class="ident">C::Scalar</span>,
}
<span class="kw">impl</span><span class="op">&lt;</span><span class="ident">C</span>: <span class="ident">CurveAffine</span><span class="op">&gt;</span> <span class="ident">VerifyingKey</span><span class="op">&lt;</span><span class="ident">C</span><span class="op">&gt;</span> {
<span class="doccomment">/// Hashes a verification key into a transcript.</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">hash_into</span><span class="op">&lt;</span><span class="ident">E</span>: <span class="ident">EncodedChallenge</span><span class="op">&lt;</span><span class="ident">C</span><span class="op">&gt;</span>, <span class="ident">T</span>: <span class="ident">Transcript</span><span class="op">&lt;</span><span class="ident">C</span>, <span class="ident">E</span><span class="op">&gt;</span><span class="op">&gt;</span>(
<span class="kw-2">&amp;</span><span class="self">self</span>,
<span class="ident">transcript</span>: <span class="kw-2">&amp;mut</span> <span class="ident">T</span>,
) -&gt; <span class="ident">io::Result</span><span class="op">&lt;</span>()<span class="op">&gt;</span> {
<span class="kw">fn</span> <span class="ident">from_parts</span>(
<span class="ident">domain</span>: <span class="ident">EvaluationDomain</span><span class="op">&lt;</span><span class="ident">C::Scalar</span><span class="op">&gt;</span>,
<span class="ident">fixed_commitments</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">C</span><span class="op">&gt;</span>,
<span class="ident">permutation</span>: <span class="ident">permutation::VerifyingKey</span><span class="op">&lt;</span><span class="ident">C</span><span class="op">&gt;</span>,
<span class="ident">cs</span>: <span class="ident">ConstraintSystem</span><span class="op">&lt;</span><span class="ident">C::Scalar</span><span class="op">&gt;</span>,
) -&gt; <span class="self">Self</span> {
<span class="comment">// Compute cached values.</span>
<span class="kw">let</span> <span class="ident">cs_degree</span> <span class="op">=</span> <span class="ident">cs</span>.<span class="ident">degree</span>();
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vk</span> <span class="op">=</span> <span class="self">Self</span> {
<span class="ident">domain</span>,
<span class="ident">fixed_commitments</span>,
<span class="ident">permutation</span>,
<span class="ident">cs</span>,
<span class="ident">cs_degree</span>,
<span class="comment">// Temporary, this is not pinned.</span>
<span class="ident">transcript_repr</span>: <span class="ident">C::Scalar::zero</span>(),
};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">hasher</span> <span class="op">=</span> <span class="ident">Blake2bParams::new</span>()
.<span class="ident">hash_length</span>(<span class="number">64</span>)
.<span class="ident">personal</span>(<span class="string">b&quot;Halo2-Verify-Key&quot;</span>)
.<span class="ident">to_state</span>();
<span class="kw">let</span> <span class="ident">s</span> <span class="op">=</span> <span class="macro">format!</span>(<span class="string">&quot;{:?}&quot;</span>, <span class="self">self</span>.<span class="ident">pinned</span>());
<span class="kw">let</span> <span class="ident">s</span> <span class="op">=</span> <span class="macro">format!</span>(<span class="string">&quot;{:?}&quot;</span>, <span class="ident">vk</span>.<span class="ident">pinned</span>());
<span class="ident">hasher</span>.<span class="ident">update</span>(<span class="kw-2">&amp;</span>(<span class="ident">s</span>.<span class="ident">len</span>() <span class="kw">as</span> <span class="ident">u64</span>).<span class="ident">to_le_bytes</span>());
<span class="ident">hasher</span>.<span class="ident">update</span>(<span class="ident">s</span>.<span class="ident">as_bytes</span>());
<span class="comment">// Hash in final Blake2bState</span>
<span class="ident">transcript</span>.<span class="ident">common_scalar</span>(<span class="ident">C::Scalar::from_bytes_wide</span>(<span class="ident">hasher</span>.<span class="ident">finalize</span>().<span class="ident">as_array</span>()))<span class="question-mark">?</span>;
<span class="ident">vk</span>.<span class="ident">transcript_repr</span> <span class="op">=</span> <span class="ident">C::Scalar::from_bytes_wide</span>(<span class="ident">hasher</span>.<span class="ident">finalize</span>().<span class="ident">as_array</span>());
<span class="ident">vk</span>
}
<span class="doccomment">/// Hashes a verification key into a transcript.</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">hash_into</span><span class="op">&lt;</span><span class="ident">E</span>: <span class="ident">EncodedChallenge</span><span class="op">&lt;</span><span class="ident">C</span><span class="op">&gt;</span>, <span class="ident">T</span>: <span class="ident">Transcript</span><span class="op">&lt;</span><span class="ident">C</span>, <span class="ident">E</span><span class="op">&gt;</span><span class="op">&gt;</span>(
<span class="kw-2">&amp;</span><span class="self">self</span>,
<span class="ident">transcript</span>: <span class="kw-2">&amp;mut</span> <span class="ident">T</span>,
) -&gt; <span class="ident">io::Result</span><span class="op">&lt;</span>()<span class="op">&gt;</span> {
<span class="ident">transcript</span>.<span class="ident">common_scalar</span>(<span class="self">self</span>.<span class="ident">transcript_repr</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}

View File

@ -591,12 +591,12 @@
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">poly</span><span class="op">|</span> <span class="ident">params</span>.<span class="ident">commit_lagrange</span>(<span class="ident">poly</span>, <span class="ident">Blind::default</span>()).<span class="ident">to_affine</span>())
.<span class="ident">collect</span>();
<span class="prelude-val">Ok</span>(<span class="ident">VerifyingKey</span> {
<span class="prelude-val">Ok</span>(<span class="ident">VerifyingKey::from_parts</span>(
<span class="ident">domain</span>,
<span class="ident">fixed_commitments</span>,
<span class="ident">permutation</span>: <span class="ident">permutation_vk</span>,
<span class="ident">permutation_vk</span>,
<span class="ident">cs</span>,
})
))
}
<span class="doccomment">/// Generate a `ProvingKey` from a `VerifyingKey` and an instance of `Circuit`.</span>

View File

@ -522,8 +522,8 @@
<span class="comment">// We need to multiply by z(X) and (1 - (l_last(X) + l_blind(X))). This</span>
<span class="comment">// will never underflow because of the requirement of at least a degree</span>
<span class="comment">// 3 circuit for the permutation argument.</span>
<span class="macro">assert!</span>(<span class="ident">pk</span>.<span class="ident">vk</span>.<span class="ident">cs</span>.<span class="ident">degree</span>() <span class="op">&gt;</span><span class="op">=</span> <span class="number">3</span>);
<span class="kw">let</span> <span class="ident">chunk_len</span> <span class="op">=</span> <span class="ident">pk</span>.<span class="ident">vk</span>.<span class="ident">cs</span>.<span class="ident">degree</span>() <span class="op">-</span> <span class="number">2</span>;
<span class="macro">assert!</span>(<span class="ident">pk</span>.<span class="ident">vk</span>.<span class="ident">cs_degree</span> <span class="op">&gt;</span><span class="op">=</span> <span class="number">3</span>);
<span class="kw">let</span> <span class="ident">chunk_len</span> <span class="op">=</span> <span class="ident">pk</span>.<span class="ident">vk</span>.<span class="ident">cs_degree</span> <span class="op">-</span> <span class="number">2</span>;
<span class="kw">let</span> <span class="ident">blinding_factors</span> <span class="op">=</span> <span class="ident">pk</span>.<span class="ident">vk</span>.<span class="ident">cs</span>.<span class="ident">blinding_factors</span>();
<span class="comment">// Each column gets its own delta power.</span>
@ -664,7 +664,7 @@
<span class="ident">Constructed</span><span class="op">&lt;</span><span class="ident">C</span><span class="op">&gt;</span>,
<span class="kw">impl</span> <span class="ident">Iterator</span><span class="op">&lt;</span><span class="ident">Item</span> <span class="op">=</span> <span class="ident">poly::Ast</span><span class="op">&lt;</span><span class="ident">Ev</span>, <span class="ident">C::Scalar</span>, <span class="ident">ExtendedLagrangeCoeff</span><span class="op">&gt;</span><span class="op">&gt;</span> <span class="op">+</span> <span class="lifetime">&#39;a</span>,
) {
<span class="kw">let</span> <span class="ident">chunk_len</span> <span class="op">=</span> <span class="ident">pk</span>.<span class="ident">vk</span>.<span class="ident">cs</span>.<span class="ident">degree</span>() <span class="op">-</span> <span class="number">2</span>;
<span class="kw">let</span> <span class="ident">chunk_len</span> <span class="op">=</span> <span class="ident">pk</span>.<span class="ident">vk</span>.<span class="ident">cs_degree</span> <span class="op">-</span> <span class="number">2</span>;
<span class="kw">let</span> <span class="ident">blinding_factors</span> <span class="op">=</span> <span class="ident">pk</span>.<span class="ident">vk</span>.<span class="ident">cs</span>.<span class="ident">blinding_factors</span>();
<span class="kw">let</span> <span class="ident">last_rotation</span> <span class="op">=</span> <span class="ident">Rotation</span>(<span class="op">-</span>((<span class="ident">blinding_factors</span> <span class="op">+</span> <span class="number">1</span>) <span class="kw">as</span> <span class="ident">i32</span>));

View File

@ -312,7 +312,7 @@
<span class="ident">vk</span>: <span class="kw-2">&amp;</span><span class="ident">plonk::VerifyingKey</span><span class="op">&lt;</span><span class="ident">C</span><span class="op">&gt;</span>,
<span class="ident">transcript</span>: <span class="kw-2">&amp;mut</span> <span class="ident">T</span>,
) -&gt; <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="ident">Committed</span><span class="op">&lt;</span><span class="ident">C</span><span class="op">&gt;</span>, <span class="ident">Error</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">chunk_len</span> <span class="op">=</span> <span class="ident">vk</span>.<span class="ident">cs</span>.<span class="ident">degree</span>() <span class="op">-</span> <span class="number">2</span>;
<span class="kw">let</span> <span class="ident">chunk_len</span> <span class="op">=</span> <span class="ident">vk</span>.<span class="ident">cs_degree</span> <span class="op">-</span> <span class="number">2</span>;
<span class="kw">let</span> <span class="ident">permutation_product_commitments</span> <span class="op">=</span> <span class="self">self</span>
.<span class="ident">columns</span>
@ -387,7 +387,7 @@
<span class="ident">gamma</span>: <span class="ident">ChallengeGamma</span><span class="op">&lt;</span><span class="ident">C</span><span class="op">&gt;</span>,
<span class="ident">x</span>: <span class="ident">ChallengeX</span><span class="op">&lt;</span><span class="ident">C</span><span class="op">&gt;</span>,
) -&gt; <span class="kw">impl</span> <span class="ident">Iterator</span><span class="op">&lt;</span><span class="ident">Item</span> <span class="op">=</span> <span class="ident">C::Scalar</span><span class="op">&gt;</span> <span class="op">+</span> <span class="lifetime">&#39;a</span> {
<span class="kw">let</span> <span class="ident">chunk_len</span> <span class="op">=</span> <span class="ident">vk</span>.<span class="ident">cs</span>.<span class="ident">degree</span>() <span class="op">-</span> <span class="number">2</span>;
<span class="kw">let</span> <span class="ident">chunk_len</span> <span class="op">=</span> <span class="ident">vk</span>.<span class="ident">cs_degree</span> <span class="op">-</span> <span class="number">2</span>;
<span class="ident">iter::empty</span>()
<span class="comment">// Enforce only for the first set.</span>
<span class="comment">// l_0(X) * (1 - z_0(X)) = 0</span>