Skip to content

Commit

Permalink
Merge pull request #173 from algorand-devrel/feat/clone
Browse files Browse the repository at this point in the history
feat: add clone function #165
  • Loading branch information
joe-p authored Oct 18, 2023
2 parents 9318b69 + a1db949 commit fbe4ce6
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 92 deletions.
2 changes: 1 addition & 1 deletion examples/merkle/MerkleTreeClient.ts

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions examples/merkle/artifacts/MerkleTree.approval.teal
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ for_1:

// if0_condition
// examples/merkle/merkle.algo.ts:42
// this.isRightSibling(elem)
// this.isRightSibling(clone(elem))
frame_dig -2 // path: byte[33][3]
store 0 // full array
int 0 // initial offset
Expand All @@ -123,7 +123,7 @@ for_1:

// if0_consequent
// examples/merkle/merkle.algo.ts:43
// result = this.hashConcat(result, extract3(elem, 1, 32))
// result = this.hashConcat(clone(result), extract3(elem, 1, 32))
frame_dig -2 // path: byte[33][3]
store 0 // full array
int 0 // initial offset
Expand All @@ -143,7 +143,7 @@ for_1:

if0_else:
// examples/merkle/merkle.algo.ts:45
// result = this.hashConcat(extract3(elem, 1, 32), result)
// result = this.hashConcat(extract3(elem, 1, 32), clone(result))
frame_dig -1 // leaf: byte[32]
frame_dig -2 // path: byte[33][3]
store 0 // full array
Expand Down Expand Up @@ -237,7 +237,7 @@ verify:
proto 2 0

// examples/merkle/merkle.algo.ts:61
// assert(this.root.value === this.calcRoot(sha256(data), path))
// assert(this.root.value === this.calcRoot(sha256(data), clone(path)))
byte 0x726f6f74 // "root"
app_global_get
byte 0x; dup // push empty bytes to fill the stack frame for this subroutine's local variables
Expand Down Expand Up @@ -279,7 +279,7 @@ appendLeaf:
assert

// examples/merkle/merkle.algo.ts:66
// assert(this.root.value === this.calcRoot(EMPTY_HASH, path))
// assert(this.root.value === this.calcRoot(EMPTY_HASH, clone(path)))
byte 0x726f6f74 // "root"
app_global_get
byte 0x; dup // push empty bytes to fill the stack frame for this subroutine's local variables
Expand All @@ -293,7 +293,7 @@ appendLeaf:
assert

// examples/merkle/merkle.algo.ts:68
// this.root.value = this.calcRoot(sha256(data), path)
// this.root.value = this.calcRoot(sha256(data), clone(path))
byte 0x726f6f74 // "root"
byte 0x; dup // push empty bytes to fill the stack frame for this subroutine's local variables
frame_dig -2 // path: byte[33][3]
Expand Down Expand Up @@ -346,7 +346,7 @@ updateLeaf:
assert

// examples/merkle/merkle.algo.ts:75
// assert(this.root.value === this.calcRoot(sha256(oldData), path))
// assert(this.root.value === this.calcRoot(sha256(oldData), clone(path)))
byte 0x726f6f74 // "root"
app_global_get
byte 0x; dup // push empty bytes to fill the stack frame for this subroutine's local variables
Expand All @@ -358,7 +358,7 @@ updateLeaf:
assert

// examples/merkle/merkle.algo.ts:77
// this.root.value = this.calcRoot(sha256(newData), path)
// this.root.value = this.calcRoot(sha256(newData), clone(path))
byte 0x726f6f74 // "root"
byte 0x; dup // push empty bytes to fill the stack frame for this subroutine's local variables
frame_dig -3 // path: byte[33][3]
Expand Down
2 changes: 1 addition & 1 deletion examples/merkle/artifacts/MerkleTree.json

Large diffs are not rendered by default.

Loading

0 comments on commit fbe4ce6

Please sign in to comment.