Skip to content

Commit

Permalink
docVersion and bump pairing ops
Browse files Browse the repository at this point in the history
  • Loading branch information
jannotti committed Sep 16, 2022
1 parent d705b0c commit 928966a
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/opdoc/opdoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/algorand/go-algorand/protocol"
)

var docVersion = 7
var docVersion = 8

func opGroupMarkdownTable(names []string, out io.Writer) {
fmt.Fprint(out, `| Opcode | Description |
Expand Down
1 change: 1 addition & 0 deletions data/transactions/logic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ Account fields used in the `acct_params_get` opcode.
| `assert` | immediately fail unless A is a non-zero number |
| `callsub target` | branch unconditionally to TARGET, saving the next instruction on the call stack |
| `retsub` | pop the top instruction from the call stack and branch to it |
| `switchi target ...` | branch to the Ath label. Continue at following instruction if index A exceeds the number of labels. |

### State Access

Expand Down
7 changes: 7 additions & 0 deletions data/transactions/logic/TEAL_opcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,13 @@ The call stack is separate from the data stack. Only `callsub` and `retsub` mani

The call stack is separate from the data stack. Only `callsub` and `retsub` manipulate it.

## switchi target ...

- Opcode: 0x8a {uint8 branch count} [{int16 branch offset, big-endian}, ...]
- Stack: ..., A: uint64 → ...
- branch to the Ath label. Continue at following instruction if index A exceeds the number of labels.
- Availability: v8

## shl

- Opcode: 0x90
Expand Down
11 changes: 9 additions & 2 deletions data/transactions/logic/assembler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,9 @@ switch_label1:
pushint 1
`

const v8Nonsense = v7Nonsense + pairingNonsense + switchNonsense
const v8Nonsense = v7Nonsense + switchNonsense

const v9Nonsense = v8Nonsense + pairingNonsense

const v6Compiled = "2004010002b7a60c26050242420c68656c6c6f20776f726c6421070123456789abcd208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d047465737400320032013202320380021234292929292b0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e01022581f8acd19181cf959a1281f8acd19181cf951a81f8acd19181cf1581f8acd191810f082209240a220b230c240d250e230f23102311231223132314181b1c28171615400003290349483403350222231d4a484848482b50512a632223524100034200004322602261222704634848222862482864286548482228246628226723286828692322700048482371004848361c0037001a0031183119311b311d311e311f312023221e312131223123312431253126312731283129312a312b312c312d312e312f447825225314225427042455220824564c4d4b0222382124391c0081e80780046a6f686e2281d00f23241f880003420001892224902291922494249593a0a1a2a3a4a5a6a7a8a9aaabacadae24af3a00003b003c003d816472064e014f012a57000823810858235b235a2359b03139330039b1b200b322c01a23c1001a2323c21a23c3233e233f8120af06002a494905002a49490700b53a03b6b7043cb8033a0c2349c42a9631007300810881088120978101c53a8101c6003a"

Expand All @@ -411,7 +413,11 @@ const randomnessCompiled = "81ffff03d101d000"
const v7Compiled = v6Compiled + "5e005f018120af060180070123456789abcd49490501988003012345494984" +
randomnessCompiled + "800243218001775c0280018881015d"

const v8Compiled = v7Compiled + pairingCompiled + "81018a02fff800008101"
const switchCompiled = "81018a02fff800008101"

const v8Compiled = v7Compiled + switchCompiled

const v9Compiled = v7Compiled + pairingCompiled

var nonsense = map[uint64]string{
1: v1Nonsense,
Expand All @@ -422,6 +428,7 @@ var nonsense = map[uint64]string{
6: v6Nonsense,
7: v7Nonsense,
8: v8Nonsense,
9: v9Nonsense,
}

var compiled = map[uint64]string{
Expand Down
13 changes: 12 additions & 1 deletion data/transactions/logic/langspec.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"EvalMaxVersion": 7,
"EvalMaxVersion": 8,
"LogicSigVersion": 7,
"Ops": [
{
Expand Down Expand Up @@ -1576,6 +1576,17 @@
"Flow Control"
]
},
{
"Opcode": 138,
"Name": "switchi",
"Args": "U",
"Size": 0,
"Doc": "branch to the Ath label. Continue at following instruction if index A exceeds the number of labels.",
"ImmediateNote": "{uint8 branch count} [{int16 branch offset, big-endian}, ...]",
"Groups": [
"Flow Control"
]
},
{
"Opcode": 144,
"Name": "shl",
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/opcodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const randomnessVersion = 7 // vrf_verify, block
// EXPERIMENTAL. These should be revisited whenever a new LogicSigVersion is
// moved from vFuture to a new consensus version. If they remain unready, bump
// their version, and fixup TestAssemble() in assembler_test.go.
const pairingVersion = 8 // bn256 opcodes. will add bls12-381, and unify the available opcodes.
const pairingVersion = 9 // bn256 opcodes. will add bls12-381, and unify the available opcodes.

type linearCost struct {
baseCost int
Expand Down

0 comments on commit 928966a

Please sign in to comment.