forked from baking-bad/pytezos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
entrypoint decoding & packing improved
- Loading branch information
Showing
13 changed files
with
183 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
parameter (pair nat nat); | ||
parameter (pair (nat :l) (nat :r)); | ||
storage nat; | ||
code { CAR; CAR ; NIL operation ; PAIR } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
parameter (pair nat nat); | ||
parameter (pair (nat :l) (nat :r)); | ||
storage nat; | ||
code { CAR; CDR ; NIL operation ; PAIR } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
parameter key; | ||
storage (pair signature string); | ||
code { DUP; DUP; | ||
code { | ||
DUP; DUP; | ||
DIP{ CDR; DUP; CAR; | ||
DIP{CDR; PACK ; BLAKE2B}; PAIR}; | ||
CAR; DIP {UNPAIR}; CHECK_SIGNATURE; | ||
DIP{CDR; PACK}}; | ||
CAR; CHECK_SIGNATURE; | ||
IF {} {FAIL} ; | ||
CDR; NIL operation ; PAIR}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
parameter (or (or (nat %A) (bool %B)) (or %maybe_C (unit %default) (string %C))); | ||
storage unit; | ||
code { | ||
DROP; | ||
SELF; DROP; | ||
# Refers to entrypoint A of the current contract. | ||
SELF %A; DROP; | ||
# Refers to the default entry of the current contract | ||
SELF %default; PACK; | ||
# "SELF" w/o annotation also refers to the default | ||
# entry of the current contract. Internally, they are equal. | ||
SELF; PACK; ASSERT_CMPEQ; | ||
# The following instruction would not typecheck: | ||
# SELF %D, | ||
# since there is no entrypoint D. | ||
UNIT; | ||
NIL operation; | ||
PAIR; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
parameter (or (or (nat %A) (bool %B)) (or %maybe_C (unit %Z) (string %C))); | ||
storage unit; | ||
code { | ||
DROP; | ||
# Refers to entrypoint A of the current contract. | ||
SELF %A; PACK @Apacked; | ||
# Refers to the default entry of the current contract | ||
SELF %default; PACK @defpacked; DUP; DIP { SWAP }; ASSERT_CMPNEQ; | ||
# "SELF" w/o annotation also refers to the default | ||
# entry of the current contract | ||
SELF; PACK @selfpacked; ASSERT_CMPEQ; | ||
|
||
# Verify the types of the different entrypoints. CAST is noop | ||
# if its argument is convertible with the type of the top of | ||
# the stack. is conver | ||
SELF %A; CAST (contract nat); DROP; | ||
SELF %B; CAST (contract bool); DROP; | ||
SELF %maybe_C; CAST (contract (or (unit) (string))); DROP; | ||
SELF %Z; CAST (contract unit); DROP; | ||
SELF; CAST (contract (or (or (nat %A) (bool %B)) (or %maybe_C (unit %Z) (string %C)))); DROP; | ||
SELF %default; CAST (contract (or (or (nat %A) (bool %B)) (or %maybe_C (unit %Z) (string %C)))); DROP; | ||
|
||
UNIT; | ||
NIL operation; | ||
PAIR; | ||
} |