429
https://smartpy.io/ https://twitter.com/smartpy_io
💡 Ju announces a $30 million AI-focused investment fund.
Backed by listed companies and industrial capital, aiming for real impact, not hype.
Kennethwils Mchrraursobez has been banned! Reason: CAS ban.
Читать полностью…
You're right, that's an error from our simulator. Sorry for that. I'll come back with a fix and a more elegant way of testing that.
Notice that it's only the test system that has a problem, the contracts will behave as expected on-chain.
I don't know if that's clear but setting a contract as the sender doesn't correspond to anything on-chain, that's more a convenient way of writing tests without plumbing the whole.
If you really want to test this way before the fix, you can have add an entrypoint to Wallet that calls MyContract.
im trying to call sp.send and sp.transfer in auxiliary functions and i keep getting __operations__ is not defined.. how to fix this?
Yes I mean I would expect smartpy to support all features of Tezos. Especially since some of them were supported in the past
Читать полностью…
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.
Hi, wondering if there is there any sort of public roadmap for smartpy? In general just what's next for 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"
python3.13 -m venv .venv && source .venv/bin/activate && pip install smartpy-tezos pytezos > /dev/null && python -c "import smartpy"
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
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))
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
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"))
ok, thanks for that, its a documentation bug I think
Читать полностью…
🥳🎉Announcing - SmartPy alpha release v0.24.0a1 🎄☃️
https://releases.smartpy.io/0.24.0a1/
This is the alpha release for the next Tezos protocol update Tallinn.
New Features
* Added Tallinn as the default protocol,
* Updated to octez-client version 24.0-rc1,
* Added support for sp.index_address (implements Michelson instruction INDEX_ADDRESS),
* Added support for sp.get_address_index(implements Michelson instruction GET_ADDRESS_INDEX),
* Added a new Boolean effect with_index_address ,
* Added support for the Python in operation in contract code,
* Added support for shadownet ,
and more ...
Please see https://releases.smartpy.io/0.24.0a1/releases#v0-24-0a1 - also available as a Jupyter Notebook: https://releases.smartpy.io/0.24.0a1/experimental-notebook/lab/index.html?path=releases%2F0.24.ipynb.
🎄🎁❄️
i am trying to test balances of accounts interacting with contracts. below an example with comments. can you confirm that this is expected behavior and what is the reasoning behind that?
also, is there a more elegant and consistent way to test such behaviour using test accounts?
https://smartpy.io/ide?code=eJyVUlFLwzAQfu@vOLqHpTgKnW9CYXOILzpBhD2G2GYskKYxSZX6602aVBtXwR2UJpe7@7777hLWyFYZ0A1RRvZANGiZJBst86atO06Tmh6hIUyg7CYBaxUnWsNjv2uFUaQyyIaO5xDizKVhzAQzGCNN@XHy5kzaKsm3x@FRW6OXLRMGZVEZSfq5CrYAdcxl_ko4ERWFsnQ3Qz9Rka0gPTw_7e_x7fZhu9_dpf8EU_Sto9rMAdo0TUWNwp@q1Q9cFkUmE6UOhHP6l0obiLhETOxHOj7LZBDvHHAYG6lrbFwH2TA6f_TpuqKCKNZC0EkbPLrQ8sVel1kUl58KlFZF6r2EM6fxsAx56GryYjUxw7wZ4ThMBAV91kGfqhjzJ_sTY8JVacPOXAOE73IBAQXGuTMN65j4O1Xs2CNP7Hw9HB@vmGeVuxXDfqilT7IyKqr1CjBp2k6Y8teoF_Bx6kG0BorLoUfYcdlmoX_jXNbitcX5AgqwHaE-
Hey there, sounds like you need to set the with_operations=True effects decorator:
https://smartpy.tezos.com/manual/data-types/effects.html
📣 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. 🚀🔥🎉
Do you have things you'd want us to do? Are you expecting sapling, global constants or anything else?
Читать полностью…
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.
Читать полностью…
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.
Читать полностью…
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.
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
ohh that makes sense. was confused by the error message
Читать полностью…
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')
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")
ah ok thanks :)
no, copied as is
https://smartpy.tezos.com/manual/syntax/contracts.html#auxiliary-functions