Suyash Bagad
Cryptography Engineer
March 22, 2023
/**
* L2 Contract
*
* Name: Ping
* Contract Address: 0xbd28a63...
*
**/
// Computes p^2 + 4p - 3
fn A(p: i32, q: u64) -> i64 {
// Calls B from another contract (pong)
let p_sq: u64 = pong::B(p);
// Calls C from another contract (pong)
let p_four: u64 = pong::C(u64::from(p), 4);
// Calls D twice from the same contract
let temp: i64 = D(i64::from(p_sq), p_four);
let result: i64 = D(temp, i64::from(-3));
return result;
}
// Computes q + r
fn D(q: i64, r: i64) -> i64 {
return (q + r);
}
/**
* L2 Contract
*
* Name: Pong
* Contract Address: 0xae4821f...
*
**/
// Computes p^2
fn B(p: i32) -> u64 {
let p_: u64 = u64::from(p);
return u64::pow(p_, 2);
}
// Computes q * r
fn C(q: u64, r: u8) -> u64 {
return (q * r);
}
\(\ast\)
\(+\)
\(\ast\)
\(+\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
\(V\)
Final Private Kernel Proof
bool verify(proof π) {
auto pa = compute_pa(π); // cost: 70, uses G1 MSM op
auto pb = compute_pb(π); // cost: 10, uses G1 MSM op
bool res = (pa == pb * x); // cost: 900, uses pairing op
return res;
}
bool verify(proof π₁, proof π₂) {
auto pa₁ = compute_p0(π₁, vk_1); // cost: 70
auto pb₁ = compute_p1(π₁, vk_1); // cost: 10
auto pa₂ = compute_p0(π₂, vk_2); // cost: 70
auto pb₂ = compute_p1(π₂, vk_2); // cost: 10
auto pa = pa₁ + u * pa₂; // Aggregate pa's
auto pb = pb₁ + u * pb₂; // Aggregate pb's
bool res = (pa₁ == pb₁ * x); // cost: 900
return res;
}
bool verify(proof π₁, proof π₂, ..., proof πₘ) {
auto pa = 0, pb = 0; // initialise
for(i = 0; i < m; i++) {
auto paᵢ = compute_p0(πᵢ); // cost: 70%
auto pbᵢ = compute_p1(πᵢ); // cost: 10%
pa += uᵢ * paᵢ; // aggregate pa
pb += uᵢ * pbᵢ; // aggregate pb
}
return (pa, pb); // returns aggregated object
}
\(V\)
\(V\)
\(V\)
\(V\)
Private kernel proofs
Tx proofs
Base rollup
Merge rollup
Merge rollup
Honk
Ultra
Std
/**
* @title Rollup Processor
* @dev Smart contract responsible for processing Aztec zkRollups,
* including relaying them to a verifier
* contract for validation and performing
*. all relevant ERC20 token transfers
*/
contract RollupProcessor is IRollupProcessor, Decoder, Ownable, Pausable {
using SafeMath for uint256;
bytes32 public dataRoot = 0x2708a627...;
bytes32 public nullRoot = 0x2694dbe3...;
bytes32 public rootRoot = 0x2d264e93...;
...
...
...
}
By Suyash Bagad
A brief presentation on the planned rollup circuit in Aztec 3.0.