Skip to content

Commit

Permalink
changed names to be more descriptive
Browse files Browse the repository at this point in the history
  • Loading branch information
barnjamin committed May 9, 2023
1 parent 682557e commit d9ca502
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions data/transactions/logic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ assembly time to do type checking and to provide more informative error messages
| Name | Bound | AVM Type |
| ---- | ---- | -------- |
| uint64 | x <= 18446744073709551615 | uint64 |
| stateKey | len(x) <= 64 | []byte |
| none | | none |
| name | 1 <= len(x) <= 64 | []byte |
| method | len(x) == 4 | []byte |
| key | len(x) <= 64 | []byte |
| boxName | 1 <= len(x) <= 64 | []byte |
| bool | x <= 1 | uint64 |
| bigint | len(x) <= 64 | []byte |
| any | | any |
Expand Down
14 changes: 7 additions & 7 deletions data/transactions/logic/TEAL_opcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ The notation A,B indicates that A and B are interpreted as a uint128 value, with
## box_create

- Bytecode: 0xb9
- Stack: ..., A: name, B: uint64 &rarr; ..., bool
- Stack: ..., A: boxName, B: uint64 &rarr; ..., bool
- create a box named A, of length B. Fail if A is empty or B exceeds 32,768. Returns 0 if A already existed, else 1
- Availability: v8
- Mode: Application
Expand All @@ -1500,39 +1500,39 @@ Newly created boxes are filled with 0 bytes. `box_create` will fail if the refer
## box_extract

- Bytecode: 0xba
- Stack: ..., A: name, B: uint64, C: uint64 &rarr; ..., []byte
- Stack: ..., A: boxName, B: uint64, C: uint64 &rarr; ..., []byte
- read C bytes from box A, starting at offset B. Fail if A does not exist, or the byte range is outside A's size.
- Availability: v8
- Mode: Application

## box_replace

- Bytecode: 0xbb
- Stack: ..., A: name, B: uint64, C: []byte &rarr; ...
- Stack: ..., A: boxName, B: uint64, C: []byte &rarr; ...
- write byte-array C into box A, starting at offset B. Fail if A does not exist, or the byte range is outside A's size.
- Availability: v8
- Mode: Application

## box_del

- Bytecode: 0xbc
- Stack: ..., A: name &rarr; ..., bool
- Stack: ..., A: boxName &rarr; ..., bool
- delete box named A if it exists. Return 1 if A existed, 0 otherwise
- Availability: v8
- Mode: Application

## box_len

- Bytecode: 0xbd
- Stack: ..., A: name &rarr; ..., X: uint64, Y: bool
- Stack: ..., A: boxName &rarr; ..., X: uint64, Y: bool
- X is the length of box A if A exists, else 0. Y is 1 if A exists, else 0.
- Availability: v8
- Mode: Application

## box_get

- Bytecode: 0xbe
- Stack: ..., A: name &rarr; ..., X: []byte, Y: bool
- Stack: ..., A: boxName &rarr; ..., X: []byte, Y: bool
- X is the contents of box A if A exists, else ''. Y is 1 if A exists, else 0.
- Availability: v8
- Mode: Application
Expand All @@ -1542,7 +1542,7 @@ For boxes that exceed 4,096 bytes, consider `box_create`, `box_extract`, and `bo
## box_put

- Bytecode: 0xbf
- Stack: ..., A: name, B: []byte &rarr; ...
- Stack: ..., A: boxName, B: []byte &rarr; ...
- replaces the contents of box A with byte-array B. Fails if A exists and len(B) != len(box A). Creates A if it does not exist
- Availability: v8
- Mode: Application
Expand Down
8 changes: 4 additions & 4 deletions data/transactions/logic/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,10 +697,10 @@ var (
StackBigInt = NewStackType(avmBytes, bound(0, maxByteMathSize), "bigint")
// StackMethodSelector represents a bytestring that should be treated like a method selector
StackMethodSelector = NewStackType(avmBytes, static(4), "method")
// StackStorageKey represents a bytestring that can be used as a key to some storage (global/local/box)
StackStorageKey = NewStackType(avmBytes, bound(0, 64), "key")
// StackStateKey represents a bytestring that can be used as a key to some storage (global/local/box)
StackStateKey = NewStackType(avmBytes, bound(0, 64), "stateKey")
// StackBoxName represents a bytestring that can be used as a key to a box
StackBoxName = NewStackType(avmBytes, bound(1, 64), "name")
StackBoxName = NewStackType(avmBytes, bound(1, 64), "boxName")

// StackZeroUint64 is a StackUint64 with a minimum value of 0 and a maximum value of 0
StackZeroUint64 = NewStackType(avmUint64, bound(0, 0), "0")
Expand All @@ -720,7 +720,7 @@ var (
'T': StackBoolean,
'H': StackBytes32,
'M': StackMethodSelector,
'K': StackStorageKey,
'K': StackStateKey,
'N': StackBoxName,
}
)
Expand Down
38 changes: 19 additions & 19 deletions data/transactions/logic/langspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
"AVMType": "uint64"
},
{
"Name": "none",
"Abbreviation": "x",
"Name": "stateKey",
"Abbreviation": "K",
"Bound": [
0,
0
64
],
"AVMType": "none"
"AVMType": "[]byte"
},
{
"Name": "name",
"Abbreviation": "N",
"Name": "none",
"Abbreviation": "x",
"Bound": [
1,
64
0,
0
],
"AVMType": "[]byte"
"AVMType": "none"
},
{
"Name": "method",
Expand All @@ -39,10 +39,10 @@
"AVMType": "[]byte"
},
{
"Name": "key",
"Abbreviation": "K",
"Name": "boxName",
"Abbreviation": "N",
"Bound": [
0,
1,
64
],
"AVMType": "[]byte"
Expand Down Expand Up @@ -4055,7 +4055,7 @@
"Opcode": 185,
"Name": "box_create",
"Args": [
"name",
"boxName",
"uint64"
],
"Returns": [
Expand All @@ -4073,7 +4073,7 @@
"Opcode": 186,
"Name": "box_extract",
"Args": [
"name",
"boxName",
"uint64",
"uint64"
],
Expand All @@ -4091,7 +4091,7 @@
"Opcode": 187,
"Name": "box_replace",
"Args": [
"name",
"boxName",
"uint64",
"[]byte"
],
Expand All @@ -4106,7 +4106,7 @@
"Opcode": 188,
"Name": "box_del",
"Args": [
"name"
"boxName"
],
"Returns": [
"bool"
Expand All @@ -4122,7 +4122,7 @@
"Opcode": 189,
"Name": "box_len",
"Args": [
"name"
"boxName"
],
"Returns": [
"uint64",
Expand All @@ -4139,7 +4139,7 @@
"Opcode": 190,
"Name": "box_get",
"Args": [
"name"
"boxName"
],
"Returns": [
"[]byte",
Expand All @@ -4157,7 +4157,7 @@
"Opcode": 191,
"Name": "box_put",
"Args": [
"name",
"boxName",
"[]byte"
],
"Size": 1,
Expand Down

0 comments on commit d9ca502

Please sign in to comment.