Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
fix on memory offset + readme
Browse files Browse the repository at this point in the history
  • Loading branch information
erhant committed Oct 2, 2023
1 parent 7629368 commit d2cebde
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 88 deletions.
84 changes: 0 additions & 84 deletions LEGACY.md

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<a href="https://opensource.org/licenses/MIT" target="_blank">
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-yellow.svg">
</a>
<a href="./.github/workflows/test.yml" target="_blank">
<img alt="Workflow: Tests" src="https://github.com/erhant/huffd1/actions/workflows/tests.yml/badge.svg?branch=main">
<a href="./.github/workflows/tests.yml" target="_blank">
<img alt="Workflow: Tests" src="https://github.com/erhant/huffd1/actions/workflows/tests.yaml/badge.svg?branch=main">
</a>
</p>

Expand Down Expand Up @@ -65,7 +65,7 @@ To find the balance of an address, iterate over all tokens and call `ownerOf`, c
To transfer a token $t$ from address $a \to b$, update $P(x)$ to be $P(x) + L_t(x)(b - a)$. Here, $L_t(x)$ is the Lagrange basis of the token, defined as a polynomial that is equal to 1 at $t$ and 0 on all other points. These polynomials are computed before deploying the contract, and are stored within the contract bytecode.
We have a Sage script that can export the basis polynomials, one for each token id, as a codetable where the coefficients of each polynomial are concatenated.
We have a [Sage script](./src/Huffd1.sage) that can export the basis polynomials, one for each token id, as a codetable where the coefficients of each polynomial are concatenated.
```c
// basis polynomials coefficients
Expand Down
5 changes: 4 additions & 1 deletion src/Huffd1.huff
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@
// [t, v, mP, l, c, o]
add // [t, v, mP, l, c] (codeOffset)
[COEFF_SIZE] // [t, v, mP, l, c, s] (coefficient size)
0xFFFF // [t, v, mP, l, c, s, mQ] (memOffset)
dup4 // [t, v, mP, l, c, s, mP]
dup4 // [t, v, mP, l, c, s, mP, l] (length)
0x20 mul // [t, v, mP, l, c, s, mP, l'] (l' := l * 32)
add // [t, v, mP, l, c, s, mQ] (memory offset)
dup4 // [t, v, mP, l, c, s, mQ, l] (length)
POLY_CODECOPY() // [t, v, mP, l, mQ, l]
pop swap1 // [t, v, mP, mQ, l]
Expand Down
File renamed without changes.

0 comments on commit d2cebde

Please sign in to comment.