Skip to content

Commit 548e3f6

Browse files
giuliopjannotti
andauthored
AVM: new teal opcodes for the MiMC hash function to support Zero Knowledge Proofs (#5978)
Co-authored-by: John Jannotti <[email protected]>
1 parent f87ae8a commit 548e3f6

File tree

14 files changed

+7069
-39
lines changed

14 files changed

+7069
-39
lines changed

cmd/opdoc/opdoc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ func create(file string) *os.File {
443443
}
444444

445445
func main() {
446-
const docVersion = uint64(10)
446+
const docVersion = uint64(11)
447447

448448
opGroups := make(map[string][]string, len(logic.OpSpecs))
449449
for grp, names := range logic.OpGroups {

data/transactions/logic/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,8 @@ these results may contain leading zero bytes.
463463
| `keccak256` | Keccak256 hash of value A, yields [32]byte |
464464
| `sha512_256` | SHA512_256 hash of value A, yields [32]byte |
465465
| `sha3_256` | SHA3_256 hash of value A, yields [32]byte |
466+
| `sumhash512` | sumhash512 of value A, yields [64]byte |
467+
| `falcon_verify` | for (data A, compressed-format signature B, pubkey C) verify the signature of data against the pubkey |
466468
| `ed25519verify` | for (data A, signature B, pubkey C) verify the signature of ("ProgData" \|\| program_hash \|\| data) against the pubkey => {0 or 1} |
467469
| `ed25519verify_bare` | for (data A, signature B, pubkey C) verify the signature of the data against the pubkey => {0 or 1} |
468470
| `ecdsa_verify v` | for (data A, signature B, C and pubkey D, E) verify the signature of the data against the pubkey => {0 or 1} |
@@ -475,6 +477,7 @@ these results may contain leading zero bytes.
475477
| `ec_multi_scalar_mul g` | for curve points A and scalars B, return curve point B0A0 + B1A1 + B2A2 + ... + BnAn |
476478
| `ec_subgroup_check g` | 1 if A is in the main prime-order subgroup of G (including the point at infinity) else 0. Program fails if A is not in G at all. |
477479
| `ec_map_to g` | maps field element A to group G |
480+
| `mimc c` | MiMC hash of scalars A, using curve and parameters specified by configuration C |
478481

479482
### Loading Values
480483

@@ -631,6 +634,11 @@ Global fields are fields that are common to all the transactions in the group. I
631634
| 15 | AssetCreateMinBalance | uint64 | v10 | The additional minimum balance required to create (and opt-in to) an asset. |
632635
| 16 | AssetOptInMinBalance | uint64 | v10 | The additional minimum balance required to opt-in to an asset. |
633636
| 17 | GenesisHash | [32]byte | v10 | The Genesis Hash for the network. |
637+
| 18 | PayoutsEnabled | bool | v11 | Whether block proposal payouts are enabled. |
638+
| 19 | PayoutsGoOnlineFee | uint64 | v11 | The fee required in a keyreg transaction to make an account incentive eligible. |
639+
| 20 | PayoutsPercent | uint64 | v11 | The percentage of transaction fees in a block that can be paid to the block proposer. |
640+
| 21 | PayoutsMinBalance | uint64 | v11 | The minimum algo balance an account must have in the agreement round to receive block payouts in the proposal round. |
641+
| 22 | PayoutsMaxBalance | uint64 | v11 | The maximum algo balance an account can have in the agreement round to receive block payouts in the proposal round. |
634642

635643

636644
**Asset Fields**
@@ -694,6 +702,9 @@ Account fields used in the `acct_params_get` opcode.
694702
| 9 | AcctTotalAssets | uint64 | v8 | The numbers of ASAs held by this account (including ASAs this account created). |
695703
| 10 | AcctTotalBoxes | uint64 | v8 | The number of existing boxes created by this account's app. |
696704
| 11 | AcctTotalBoxBytes | uint64 | v8 | The total number of bytes used by this account's app's box keys and values. |
705+
| 12 | AcctIncentiveEligible | bool | v11 | Has this account opted into block payouts |
706+
| 13 | AcctLastProposed | uint64 | v11 | The round number of the last block this account proposed. |
707+
| 14 | AcctLastHeartbeat | uint64 | v11 | The round number of the last block this account sent a heartbeat. |
697708

698709

699710
### Flow Control
@@ -744,6 +755,8 @@ Account fields used in the `acct_params_get` opcode.
744755
| `asset_params_get f` | X is field F from asset A. Y is 1 if A exists, else 0 |
745756
| `app_params_get f` | X is field F from app A. Y is 1 if A exists, else 0 |
746757
| `acct_params_get f` | X is field F from account A. Y is 1 if A owns positive algos, else 0 |
758+
| `voter_params_get f` | X is field F from online account A as of the balance round: 320 rounds before the current round. Y is 1 if A had positive algos online in the agreement round, else Y is 0 and X is a type specific zero-value |
759+
| `online_stake` | the total online stake in the agreement round |
747760
| `log` | write A to log state of the current application |
748761
| `block f` | field F of block A. Fail unless A falls between txn.LastValid-1002 and txn.FirstValid (exclusive) |
749762

0 commit comments

Comments
 (0)