Skip to content

Commit

Permalink
Use the new 2 argument form of substr from clvm 0.9.5 for a smaller d…
Browse files Browse the repository at this point in the history
…eserializer
  • Loading branch information
aqk authored and hoffmang9 committed Apr 8, 2021
1 parent bee0a42 commit 8b97545
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions chia/wallet/puzzles/chialisp_deserialisation.clvm
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

(defun sexp_from_stream (input_stream)
(if (= (substr input_stream 0 1) CONS_BOX_MARKER)
(cons_sexp_from_stream (sexp_from_stream (substr input_stream 1 (strlen input_stream))))
(atom_from_stream (substr input_stream 1 (strlen input_stream)) (substr input_stream 0 1))
(cons_sexp_from_stream (sexp_from_stream (substr input_stream 1)))
(atom_from_stream (substr input_stream 1) (substr input_stream 0 1))
)
)

Expand Down Expand Up @@ -44,15 +44,15 @@
(if (>s input_bits MAX_THREE_BYTE)
(x "bad encoding")
;three byte length prefix
(list (concat (logand (quote 0x1f) input_bits) (substr input_file 0 1)) (substr input_file 1 (strlen input_file)))
(list (concat (logand (quote 0x1f) input_bits) (substr input_file 0 1)) (substr input_file 1))
)
;two byte length prefix
(list (logand (quote 0x3f) input_bits) input_file)
)
)

(defun atom_from_stream_part_two ((size_to_read input_file))
(list (substr input_file 0 size_to_read) (substr input_file size_to_read (strlen input_file)))
(list (substr input_file 0 size_to_read) (substr input_file size_to_read))
)

; main
Expand Down
2 changes: 1 addition & 1 deletion chia/wallet/puzzles/chialisp_deserialisation.clvm.hex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ff02ffff01ff05ffff02ff3effff04ff02ffff04ff05ff8080808080ffff04ffff01ffffff81ff7fff81df81bfffffff02ffff03ffff09ff0bffff01818080ffff01ff04ff80ffff04ff05ff808080ffff01ff02ffff03ffff0aff0bff1880ffff01ff02ff1affff04ff02ffff04ffff02ffff03ffff0aff0bff1c80ffff01ff02ffff03ffff0aff0bff1480ffff01ff08ffff018c62616420656e636f64696e6780ffff01ff04ffff0effff18ffff011fff0b80ffff0cff05ff80ffff01018080ffff04ffff0cff05ffff0101ffff0dff058080ff80808080ff0180ffff01ff04ffff18ffff013fff0b80ffff04ff05ff80808080ff0180ff80808080ffff01ff04ff0bffff04ff05ff80808080ff018080ff0180ff04ffff0cff15ff80ff0980ffff04ffff0cff15ff09ffff0dff158080ff808080ffff04ffff04ff05ff1380ffff04ff2bff808080ffff02ff16ffff04ff02ffff04ff09ffff04ffff02ff3effff04ff02ffff04ff15ff80808080ff8080808080ff02ffff03ffff09ffff0cff05ff80ffff010180ff1080ffff01ff02ff2effff04ff02ffff04ffff02ff3effff04ff02ffff04ffff0cff05ffff0101ffff0dff058080ff80808080ff80808080ffff01ff02ff12ffff04ff02ffff04ffff0cff05ffff0101ffff0dff058080ffff04ffff0cff05ff80ffff010180ff808080808080ff0180ff018080
ff02ffff01ff05ffff02ff3effff04ff02ffff04ff05ff8080808080ffff04ffff01ffffff81ff7fff81df81bfffffff02ffff03ffff09ff0bffff01818080ffff01ff04ff80ffff04ff05ff808080ffff01ff02ffff03ffff0aff0bff1880ffff01ff02ff1affff04ff02ffff04ffff02ffff03ffff0aff0bff1c80ffff01ff02ffff03ffff0aff0bff1480ffff01ff08ffff018c62616420656e636f64696e6780ffff01ff04ffff0effff18ffff011fff0b80ffff0cff05ff80ffff01018080ffff04ffff0cff05ffff010180ff80808080ff0180ffff01ff04ffff18ffff013fff0b80ffff04ff05ff80808080ff0180ff80808080ffff01ff04ff0bffff04ff05ff80808080ff018080ff0180ff04ffff0cff15ff80ff0980ffff04ffff0cff15ff0980ff808080ffff04ffff04ff05ff1380ffff04ff2bff808080ffff02ff16ffff04ff02ffff04ff09ffff04ffff02ff3effff04ff02ffff04ff15ff80808080ff8080808080ff02ffff03ffff09ffff0cff05ff80ffff010180ff1080ffff01ff02ff2effff04ff02ffff04ffff02ff3effff04ff02ffff04ffff0cff05ffff010180ff80808080ff80808080ffff01ff02ff12ffff04ff02ffff04ffff0cff05ffff010180ffff04ffff0cff05ff80ffff010180ff808080808080ff0180ff018080
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d402dac5ac7307f6c8e39c81d722b7e382f24a049df020ed19b9f0873b5c1e95
4bc89f6455077b0a1527adf2d19f1ee2315eaf11e5540a3d43fbf2824af41eb4

0 comments on commit 8b97545

Please sign in to comment.