tweaks to blog view
This commit is contained in:
parent
b340cfd2f0
commit
c3f39d430d
|
@ -13,10 +13,25 @@ article {
|
|||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
article>section> :is(p, h1, h2, h3, h4, h5, h6) {
|
||||
article>section> :is(pre, p, h1, h2, h3, h4, h5, h6) {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
article>section {
|
||||
font-family: "Lucida" Grande, sans-serif;
|
||||
}
|
||||
|
||||
article>section> :is(h1, h2, h3, h4, h5, h6, code) {
|
||||
font-family: "jetbrains-mono";
|
||||
}
|
||||
|
||||
article>section>blockquote {
|
||||
padding: 1rem;
|
||||
border-left-width: 4px;
|
||||
border-color: rgb(239 68 68);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
article>section>h1 {
|
||||
margin-top: 2rem;
|
||||
font-size: 3rem;
|
||||
|
@ -27,7 +42,6 @@ article>section>h1::before {
|
|||
}
|
||||
|
||||
article>section>h2 {
|
||||
margin-top: 2rem;
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
|
@ -35,10 +49,18 @@ article>section>h2::before {
|
|||
content: "## ";
|
||||
}
|
||||
|
||||
article>section>h3 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
article>section>h3::before {
|
||||
content: "### ";
|
||||
}
|
||||
|
||||
article>section>h4 {
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
article>section>h4::before {
|
||||
content: "#### ";
|
||||
}
|
||||
|
@ -61,6 +83,11 @@ article a:hover {
|
|||
}
|
||||
|
||||
article ul {
|
||||
margin-left: 2rem;
|
||||
list-style-type: "❯ ";
|
||||
margin-left: 1rem;
|
||||
list-style-type: "- ";
|
||||
}
|
||||
|
||||
article ol {
|
||||
margin-left: 1rem;
|
||||
list-style: decimal inside;
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,3 @@
|
|||
/* PrismJS 1.29.0
|
||||
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+bash+haskell+json+nix+racket+rust+scheme */
|
||||
code[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#999}.token.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#690}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url{color:#9a6e3a;background:hsla(0,0%,100%,.5)}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.class-name,.token.function{color:#dd4a68}.token.important,.token.regex,.token.variable{color:#e90}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}
|
|
@ -1,108 +0,0 @@
|
|||
---
|
||||
title: Are we zk-Cardano yet?
|
||||
date: 2023-08-07
|
||||
---
|
||||
|
||||
Not so long ago Emurgo announced they were doing a Cardano centered hackathon.
|
||||
It was a welcome prospect - very few similar such events seem to exist in the space.
|
||||
Things went monotonically south ever since the announcement, but that's a different story.
|
||||
|
||||
One particularly interesting quirk was that of the three "tracks" of the hackathon,
|
||||
one was _Zero Knowledge_ (aka zk).
|
||||
Why particularly interesting quirk? In some sense it is not suprising:
|
||||
zK has been very trendy these last few years around blockchains.
|
||||
However, building on Cardano is notoriously challenging.
|
||||
Building with zk on a zk-native blockchain is itself a very steep learning curve.
|
||||
So combining the two, zk on Cardano seemed... a bit mad.
|
||||
|
||||
This post is bourne out of a best effort of how far "zk on cardano" can be pushed.
|
||||
|
||||
## What is zk?
|
||||
|
||||
There is no shortage of explanations describing what zk is [TODO: Links].
|
||||
There is also a reasonable breath to the field of zk that includes things like distributed compute.
|
||||
Zk involves some really neat maths that lets you do some seemingly magical feats,
|
||||
and pairs well with blockchain in extending what is functionally possible.
|
||||
Let's stick to a simple and prototypical example.
|
||||
|
||||
Suppose Alice and Bob are playing battleships.
|
||||
The game begins with Alice and Bob placing their ships within their own coordinate grid.
|
||||
They then take in terms picking coordinates to "bomb".
|
||||
If they hit nothing, then their turn ends, but if they hit a ship then they guess again.
|
||||
The winner is the first to sink all their oponents ships.
|
||||
|
||||
Alice knows Bob has a reputation of being a notorious liar; how can she enjoy the game?
|
||||
Each guess she makes, Bob says gleefully shouts "Miss!".
|
||||
She can't ask Bob to show he's not lying by revealing the actual locations of the ships.
|
||||
She could ask Charlie to independently verify Bob's not lying,
|
||||
but then what if Charlie is actually on team Bob and also lies.
|
||||
Or Bob might suspect Charlie is actually on team Alice, slyly brought in to give could Alice some hints.
|
||||
|
||||
Is there a way that Bob can prove to Alice that each guess is a miss,
|
||||
but without revealing the locations of the ships either to Alice or anyone else?
|
||||
|
||||
The answer is yes.
|
||||
Using zk Bob can produce a proof each time Alice's guess misses if and only if it honestly does.
|
||||
Alice can inspect each proof and verify Bob's response.
|
||||
Alice can interogate the proof as much as she wants, but she won't learn anything more than
|
||||
her guess was a miss.
|
||||
|
||||
There are multiplitude of different ways to do this,
|
||||
but essentially it involves modelling the problem as a bunch of algebra
|
||||
over finite fields - like a lot of cryptography.
|
||||
|
||||
What's the snark of zk-snark?
|
||||
Snark stands for _Succinct Non-Interactive Argument of Knowledge_.
|
||||
And without saying anything more: it means that Alice has to do way less algebra than Bob.
|
||||
In applications this is important, because Bob might not be able to lie anymore,
|
||||
but he could still waste Alice's time.
|
||||
|
||||
|
||||
## Sudoku snark
|
||||
|
||||
Sudoku snark was the entrant to Emurgo hackathon.
|
||||
The summary/ pitch/ story deck is [here](https://pub.kompact.io/sudoku-snark).
|
||||
Links to associated repos [plutus-zk]() and [sudoku-snark]().
|
||||
|
||||
Just after the hackathon got underway there was a large PR merged into the main branch of plutus.
|
||||
It's a mammoth PR that is the culmination of many many months of work.
|
||||
In it were some fundamental primitives needed for running zk algos.
|
||||
|
||||
The idea of the project was as follows:
|
||||
|
||||
- write a validator implementing a zk algorithm with the new primitives
|
||||
- write a programme to generate the setup and proofs
|
||||
- try to get a version of hydra running this newest version of plutus.
|
||||
|
||||
Unsurprisingly to anyone who's hung around the Cardano repos long enough,
|
||||
this final part is where things got stuck.
|
||||
Things got as far as running a cluster of nodes in the conway era supposedly with the latest plutus
|
||||
but some unrelated changes seemed to thwart any chance of building transactions.
|
||||
|
||||
The validator uses [groth16].
|
||||
In part because this was already mostly available from the plutus repo itself.
|
||||
It is also the most obvious candidate to begin with.
|
||||
It's relatively mature, relatively simple, can be implemented from the new primitives,
|
||||
and, importantly in cardano land, has small proof size.
|
||||
(As far as I know, the smallest of comparable algos.)
|
||||
|
||||
The program to generate the setup and proofs uses the arkworks framework.
|
||||
Again this was initially inspired by a script from the IOG team.
|
||||
|
||||
The choice of game, sudoku, was in turn inspired by an arkworks example.
|
||||
It's not the most compelling of choices, but it did for now.
|
||||
|
||||
The intended game play involved locking ada at a utxo
|
||||
spendable only if a player could provide proof you knew the solution.
|
||||
And through the magic of zk, not disclosing to the competition the solution itself.
|
||||
Other details were TBC: is it first and second prizes? are players whitelisted?
|
||||
|
||||
## So are we zk-Cardano yet?
|
||||
|
||||
We're close.
|
||||
|
||||
There is potentially still quite a stretch between being in the plutus repo and being run on-chain.
|
||||
The word on the street is that it might happen before the end of 2023.
|
||||
|
||||
Before it's available on mainnet there will be versions the cardano node available,
|
||||
and so possibly plumbable into hydra without causing oneself an aneurysm.
|
|
@ -1,3 +1,8 @@
|
|||
---
|
||||
title: Tracing Aiken Build
|
||||
date: 2023-09-02
|
||||
---
|
||||
|
||||
Aims:
|
||||
|
||||
> Describe the pipeline and components getting from Aiken to Uplc.
|
||||
|
@ -50,7 +55,8 @@ To redeem it, some (possibly large) sections remain black boxes.
|
|||
## Aiken build
|
||||
|
||||
Tracing `aiken build`, the pipeline is roughly:
|
||||
```
|
||||
|
||||
```sample
|
||||
. -> Project::read_source_files ->
|
||||
Vec<Source> -> Project::parse_sources ->
|
||||
ParsedModules -> Project::type_check ->
|
||||
|
@ -60,6 +66,7 @@ Tracing `aiken build`, the pipeline is roughly:
|
|||
Program / Term<Name> -> serialize ->
|
||||
.
|
||||
```
|
||||
|
||||
We'll pick our way through these steps
|
||||
|
||||
At a high level we are trying to do something straightforward: reformulate Aiken code as Uplc.
|
||||
|
@ -129,9 +136,13 @@ More on what an airtree is and its construction below.
|
|||
At the same time `self` is treated as `mut`, so we need to keep an eye on this too.
|
||||
The method which is called and uses this mutability of self is `self.assignment`.
|
||||
It does so by
|
||||
|
||||
```sample
|
||||
self.assignment >> self.expect_type_assign >> self.code_gen_functions.insert
|
||||
- self.assignment
|
||||
└ self.expect_type_assign
|
||||
└ self.code_gen_functions.insert
|
||||
```
|
||||
|
||||
and thus is creating a hashmap of all the functions that appear in the definition.
|
||||
From the call to return of `assign` covers > 600 LoC so we'll leave this as a black box.
|
||||
(`self.handle_each_clause` is also called with `mut` which in turn calls `self.build` for which `mut` it is needed.)
|
||||
|
@ -149,7 +160,8 @@ Script context is the final argument of a validator - for any script purpose.
|
|||
The importance of this is not immediate, and I've still yet to appreciate why this happens.
|
||||
|
||||
Let's take a look at what AirTree actually is
|
||||
```rust
|
||||
|
||||
```language-rust
|
||||
pub enum AirTree {
|
||||
Statement {
|
||||
statement: AirStatement,
|
||||
|
@ -159,6 +171,7 @@ pub enum AirTree {
|
|||
UnhoistedSequence(Vec<AirTree>),
|
||||
}
|
||||
```
|
||||
|
||||
Note that `AirStatement` and `AirExpression` are mutually recursive definitions with `AirTree`.
|
||||
Otherwise, it would be unclear from first inspection how tree-like this really is.
|
||||
|
||||
|
@ -257,7 +270,7 @@ The generated program can now be serialized and included in the blueprint.
|
|||
### Plutus Core Signposting
|
||||
|
||||
All this fuss is to get us to a point where we can write Uplc - and good Uplc at that.
|
||||
Note that there are many ways to generate code and most of them are bad.
|
||||
Note that there are many ways to generate code and most of them are bad.
|
||||
The various design decisions and compilation steps make more sense
|
||||
when we have a better understanding of the target language.
|
||||
|
File diff suppressed because one or more lines are too long
|
@ -6,9 +6,9 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" type="image/x-icon" href="/favicon.png">
|
||||
<link href="/css/mini.css" rel="stylesheet">
|
||||
<link href="/css/prism.css" rel="stylesheet" />
|
||||
<title>$title$</title>
|
||||
</head>
|
||||
|
||||
<script>
|
||||
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
|
||||
function updateTheme() {
|
||||
|
@ -37,4 +37,6 @@
|
|||
</div>
|
||||
</body>
|
||||
|
||||
<script src="/scripts/prism.js"></script>
|
||||
|
||||
</html>
|
|
@ -1,4 +1,4 @@
|
|||
<article>
|
||||
<article class="mx-auto px-4 max-w-prose">
|
||||
<section class="header">
|
||||
<h1>
|
||||
$title$
|
||||
|
|
Loading…
Reference in New Issue