smartpy_io | Unsorted

Telegram-канал smartpy_io - SmartPy

429

https://smartpy.io/ https://twitter.com/smartpy_io

Subscribe to a channel

SmartPy

oh gotcha, thanks :)

Читать полностью…

SmartPy

im trying to call sp.send and sp.transfer in auxiliary functions and i keep getting __operations__ is not defined.. how to fix this?

Читать полностью…

SmartPy

Yes I mean I would expect smartpy to support all features of Tezos. Especially since some of them were supported in the past

Читать полностью…

SmartPy

For example provide "if x in y" instead of "if y.contains(x)".
Also being more integrated with Python tools and services.
Also having a simpler interaction with the test scenarios.
There is no plan for metaprogramming.

Читать полностью…

SmartPy

SmartPy will be available to use on TezLink.

Читать полностью…

SmartPy

Hi, wondering if there is there any sort of public roadmap for smartpy? In general just what's next for smartpy

Читать полностью…

SmartPy

hi guys I get conflicts when installing pytezos and smartpy-tezos (0.23.0) but not with tezos-smartpy (0.22). To reproduce:

this works:


python3.13 -m venv .venv && source .venv/bin/activate && pip install tezos-smartpy pytezos > /dev/null && python -c "import smartpy"


this fails:


python3.13 -m venv .venv && source .venv/bin/activate && pip install smartpy-tezos pytezos > /dev/null && python -c "import smartpy"


with:


Traceback (most recent call last):
File "<string>", line 1, in <module>
import smartpy
File "/Users/timothy/projects/repro-test/.venv/lib/python3.13/site-packages/smartpy/__init__.py", line 47, in <module>
init_runtime()
~~~~~~~~~~~~^^
File "/Users/timothy/projects/repro-test/.venv/lib/python3.13/site-packages/smartpy/platform/runtime.py", line 202, in init_runtime
_init_jupyter_standard()
~~~~~~~~~~~~~~~~~~~~~~^^
File "/Users/timothy/projects/repro-test/.venv/lib/python3.13/site-packages/smartpy/platform/runtime.py", line 164, in _init_jupyter_standard
js_content = get_wheel_file("jupyter-web-components.js")
File "/Users/timothy/projects/repro-test/.venv/lib/python3.13/site-packages/smartpy/internal/utils.py", line 10, in get_wheel_file
with open(file_path, "r") as file:
~~~~^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/timothy/projects/repro-test/.venv/lib/python3.13/site-packages/smartpy/static/jupyter-web-components.js'
Uncaught exception:

End_of_file

Raised at Stdlib.input_line.scan in file "stdlib.ml", line 456, characters 14-31
Called from Oasis_lib__Smartpy_oasis.loop in file "oasis/main/smartpy_oasis.ml", line 8, characters 7-19
Called from Oasis_lib__Smartpy_oasis.Main.main in file "oasis/main/smartpy_oasis.ml", line 16, characters 4-23
Called from Dune__exe__Smartpy_oasis_native in file "oasis/main/smartpy_oasis_native.ml", line 3, characters 8-58


Seems like it's because pytezos installs jupyter and smartpy detects this it expects to be running in a Jupyter notebook?

Читать полностью…

SmartPy

I can't get it to work even with the correct value. not even with this:


import smartpy as sp

@sp.module
def dummy_utils():
def dummy_function(param) -> sp.nat:
return sp.nat(1)

@sp.add_test()
def _():
s = sp.test_scenario("simple assert")
assert s.verify(dummy_utils.dummy_function(()) == sp.nat(1))

Читать полностью…

SmartPy

That's because the invert bytes is not doing the reverse of bytes. See https://smartpy.tezos.com/manual/data-types/strings-and-bytes.html
The invert bytes of 0x1234 is 0xedcb
See https://smartpy.tezos.com/manual/data-types/strings-and-bytes.html

Читать полностью…

SmartPy

Yes it is.
You have a parenthesis problem and you want to use s.verify or s.verify_equal:


import smartpy as sp

@sp.module
def dummy_utils():
def dummy_function(param: sp.bytes) -> sp.bytes:
return sp.invert_bytes(param)

@sp.add_test()
def _():
s = sp.test_scenario("Hex to Ascii")
assert s.verify(dummy_utils.dummy_function(sp.bytes("0x1234")) == sp.bytes("0x3412"))

Читать полностью…

SmartPy

Thanks again @pifragile , we'll take a look

Читать полностью…

SmartPy

ok, thanks for that, its a documentation bug I think

Читать полностью…

SmartPy

Hi, sorry about this but it is a known confusion for smartpy users, when you are in contract code you need to wrap the args in an sp.record:
https://smartpy.io/ide?code=eJxVUEFuAyEMvPMKK71AW6Gmai@VkCrtF3qPHHBUJBYQZg_7@5pNGmV9wuPxjIc419I68Iyt1xWQgatS31ztXMKSSAW6wIwxa_OlQGrrl9RjTavGVzjf8FGN@tIyIDzDWW2oT8gMkxa9qeTe0PcH_rAhQddaYu53eFhQ1Uzp8kAeJWIk1979Zb@RLy1odB9yi_s0BpyD9zelnuCHuPOWBUM4dem02fJcn1dp9pSxxQJOktsxOf1D@jAUDmbHs7_HHe6Psjk@yE56z4QXJ9MbyUogo_4A6pNopg--

we actually have someone working on this currently.

When you say there was some documentation - did you mean you copied it and changed it or was there an example exactly as you posted?

Читать полностью…

SmartPy

📣📣 We have released a new SmartPy v0.23.0! 🎉🎉

https://smartpy.tezos.com

This release includes
* The new Seoul protocol as the default choice for protocols, Paris protocol is removed & we've updated to octez-client 23.0,
* We are now on PyPi (https://pypi.org/project/smartpy-tezos) and have renamed the main installable to smartpy-tezos - just do
pip install smartpy-tezos . Old versions can be removed with pip uninstall smartpy-tezos ,
* More syntax additions (pattern matching the head/tail of a list), third-party library updates and documentation improvements.

Please see the release notes (https://smartpy.tezos.com/releases.html) for more details. 🚀🚀

Читать полностью…

SmartPy

welcome back @jorion42 😄

Читать полностью…

SmartPy

Hey there, sounds like you need to set the with_operations=True effects decorator:
https://smartpy.tezos.com/manual/data-types/effects.html

Читать полностью…

SmartPy

📣 We have released a minor upgrade - SmartPy v0.23.1 📣

https://smartpy.tezos.com

This is a bugfix release which includes:

# Documentation
- Corrected the SmartPy documentation example for calling auxillary functions,
- Added SmartPy documentation for sp.to_bytes.

# Bug fixes
- Fixed match/case return type check - assert all cases are unit,
- Fixed frontend contract link share,
- Fixed frontend search bug,
- Fixed frontend origination/explorer page render problem,
- Fixed TZcomet link,
- Fixed import issue for installing when IPython is present.

Please see the release notes (https://smartpy.tezos.com/releases.html) for more details. 🚀🔥🎉

Читать полностью…

SmartPy

Do you have things you'd want us to do? Are you expecting sapling, global constants or anything else?

Читать полностью…

SmartPy

What about things like global constants, sapling etc? Closer alignment with python meaning brining back some meta programming capabilities? Also i feel compilation testing is quite awkward currently and in general to use it requires quite a bit of boilerplate.

Читать полностью…

SmartPy

Hi, there is no public roadmap. At a high level, our focus for SmartPy will remain on closer alignment with Python, continued improvements to the developer experience, and maintaining alignment with the evolution of Tezos.

Читать полностью…

SmartPy

You're right, do you mind adding this in /Users/timothy/projects/repro-test/.venv/lib/python3.13/site-packages/smartpy/static/ for now? We'll ship a fix latter.

Читать полностью…

SmartPy

s.verify is already asserting, you don't need an assert. The error is not great, thank you for the report. Just remove the assert

Читать полностью…

SmartPy

ohh that makes sense. was confused by the error message

Читать полностью…

SmartPy

Traceback (most recent call last):
File "/lib/python3.12/site-packages/smartpy/platform/runtime.py", line 137, in evalRun
import main
File "/home/pyodide/main.py", line 8, in <module>
@sp.add_test()
File "/lib/python3.12/site-packages/smartpy/public/scenario.py", line 423, in r
f()
File "/home/pyodide/main.py", line 11, in _
assert s.verify(dummy_utils.dummy_function(sp.bytes("0x1234")) == sp.bytes("0x3412"))
File "/lib/python3.12/site-packages/smartpy/public/scenario.py", line 270, in verify
self.action(data)
File "/lib/python3.12/site-packages/smartpy/public/scenario.py", line 227, in action
return interact({"request": "scenario_action", "ix": self.ix, "action": x})
File "/lib/python3.12/site-packages/smartpy/platform/services.py", line 150, in interact
raise RuntimeException(**error["context"])
RuntimeException: (SmartPy)
File "main.py", line 11, in <module>
(source code not available)
Verification error: dummy_utils.dummy_function(sp.bytes('0x1234')) == sp.bytes('0x3412')

Читать полностью…

SmartPy

Hi guys, is something like this possible:


import smartpy as sp

@sp.module
def dummy_utils():
def dummy_function(param: sp.bytes) -> sp.bytes:
return sp.invert_bytes(param)

@sp.add_test()
def _():
s = sp.test_scenario("Hex to Ascii")
assert s.compute(dummy_utils.dummy_function(sp.bytes("0x1234"))) == sp.bytes("0x3412")


so testing without having to wrap in a contract entrypoint?

Читать полностью…

SmartPy

search seems broken
https://smartpy.tezos.com/

Читать полностью…

SmartPy

ah ok thanks :)
no, copied as is
https://smartpy.tezos.com/manual/syntax/contracts.html#auxiliary-functions

Читать полностью…

SmartPy

hello :) can somebody help me out here? i copied the example from the doc but get an error
https://smartpy.io/ide?code=eJxVUEFOxDAMvOcV1nJJAEUsggtSJKR@gfvK23pFpDSJYvfQ3@N0F9j6ZI8nM57EuZYmwDM2qSsgA1djPrn6uUxLIjPRBWaM2boPA1rbvCSJNa0Wn@F8w3s1kqVlQHiEs9nQMSEzDFb1hpKl4Sh3_G5Diq61xCx_cLegapnS5Y7cS8VIr_33D296QXh3EAK8vhjzAF_EwlsAnKaT6GTdFuLaXvV4pIwtFgga1_fN6Reyh65wcDue_z7u8PGoL_uv@MHumfAUdHsjeU3hzA_zK2TF

Читать полностью…

SmartPy

Marco has been banned! Reason: CAS ban.

Читать полностью…

SmartPy

There was an implementation called threefry.spy I think, and then I wrote a wrapper that used tickets to hold the data because I was thinking about hiding the seeds within a sapling transaction (didn't manage to implement that bit though).

Suffice to say the tickets part isn't necessary if privacy isn't needed.

Читать полностью…
Subscribe to a channel