smartpy_io | Unsorted

Telegram-канал smartpy_io - SmartPy

429

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

Subscribe to a channel

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

I have seen it but think i dismissed it for my use-case (though I don’t remember why). I will have a look at it again too!

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

SmartPy

We also have an implementation of the threefry counter-based rng if you are interested? I think the template is called test_rng.py or something.

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

SmartPy

I'm using random bytes to draw random numbers in the contract and I'm trying to design different distributions over a subset of natural numbers. I just want to make sure the implementation's numerics work as expected so do some statistical analysis on the values i get

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

SmartPy

is there any way in a smartpy test to extract python literal values from a smart contracts storage? e.g. I would like to export my_contract.data.my_nat and continue processing as an integer using normal python

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

SmartPy

thanks a lot :) in the meantime i found an older version of the cli that gives me the same michelson 😁
i also tried to compile with the legacy online IDE and it worked but gave some differences in michelson like flipping of GT and LT and the one in the image i saw quite often :) just out of interest, are those simply optimizations that will in no way affect behaviour?

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

SmartPy

@tsmca - this template may also be helpful: https://smartpy.io/templates/test_with_storage.py

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

SmartPy

Hi, does this help:

https://smartpy.io/ide?code=eJzVVM2O2jAYvOcpLLgkXTY0QeoBKVKrPbaqetleI@N8gNXEjuyPXcLT139JAEHZ7m4P9QGwPRnPDPHwppUKiW6owrYjVBPdRtH01SOaksd2o2hFVzWQBylQUYYEtxTJToMmNW1WFdUGt0Vs9XI@RzhInW441nSVcjlvONtCraW4V7AGBYLBfIpdC_f@2beoi6LPuk0bWe1qiCpYk4ZyESfLiJiBnn9J7GGkMEmkfqWMzc9Vh6BndlFQnJFnjttSo1R0A8VEAa3unxVHmCTEk4W9YzYFTKoqfqL1DoqeiEmhMcwS96j7YDXV@ihLK6GPM@i1w3ooSy44lkYl1OsZcfTLQDgi7bCAtKJIUwcyqtz3FYxT5pUzqjFe9O6TaHjCxglGVddKLvBEFqM1C5Is3YzUcsPZso_5pjQHj@1SOA@zC2HuhyC7kxAxfxF4Rg7Fiakp@WbPJT9BaS4FyUi8N3BP6tyu18BQx9dfgKhPwDnIvIXRbXkU6eB6NrwwyQDciZayX1B5vJ_FAZwlZuFZ0bbUsoEYlJKqmDxQISSSx@8_vjx8nYxMCnCnxECY7sndOOkuG8@9cRPQ673n_8R7_o7ejyeHy0EshiDCZX19Hov_Kw8zyT@c9UGoUFpVpelDjBNXo_6n96UZCKq49FLtTtkvxZOx0IKkfivdZme7vgYzQ2NLOj2qQl@gH08JyF1h0P1f@KjBR06e@osc@FLXS9aQvfgux@OCyGw35EkS6qpwZ_uLfCbYEPN1FxvGsbaKYvFnlG97i7oqNP8boba_FpfU5i9S@@nNahfvovZGakFtdsPUKPc3kleqzw--

Basically you can add the effects specifier to module functions and they magically get access to self.data - its a bit nasty though and a bit tricky to get past the typechecker - see how I have to help convince it each time (lines 29, 36, 43).

I had to change a few things, mainly passing the logic lambda in as a parameter because having it on the storage - when it also has the storage effect - confuses the typechecker.

Apologies if that wasnt what you were after, maybe Jordan has some other ideas?

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

SmartPy

Michelleal Shaz has been banned! Reason: CAS ban.

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

SmartPy

also any way to compile lambdas? trying something like

class LambdaHelper(sp.Contract):
def __init__(self, code):
self.data = sp.cast(code, t_lambda)

then Instantiating in a "test", extracting the storage.tz and deploying via pytezos but I can't get it to work

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

SmartPy

thank you very much, cli version 10.0.1 would be awesome☺️🙏

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

SmartPy

any chance i could get an old binary or could you tell
me how to build an older version from source? 😁

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

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.

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

SmartPy

Nice, this seems like exactly what I was looking for! Will give it a try later today or tomorrow thanks a lot 🙌

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

SmartPy

Interesting, that's exactly the kind of use case we want to improve.
What you can do currently is scenario.verify(my_contract.data.some_value == 42). The == will be handled by SmartPy, not Python but that's already something.

If you really want to export it to Python, for now I can propose you this.
In this example I created a contract with an entrypoint that only accepts a sp.int and call it with c.data.x which is a sp.int and then used scenario.entrypoint_calls to extract the value and convert it to a Python value.
Notice that "arg_micheline" instead of "arg_michelson" would return a string that you can provide to the Python JSON parser to dig into more complex value types. What is important is that the test contract entrypoint has the same type as the contract storage you want to check.

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

SmartPy

We're working on it. What would you like to do exactly with that after?

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

SmartPy

Hi, glad you have found a workaround, if you have time I would recommend trying to upgrade to the latest smartpy.

Re the michelson differences, they *should* just be optimisations but I would check via testing on ghostnet that you are happy with the behaviour. Tezos and michelson and smartpy have all changed since then.

Another way to test would be to look at the .tz file which has comments at each line showing the stack types and see if you can understand what the changed michelson is doing.

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

SmartPy

@pifragile - we're still looking into this, im not sure how successful we are going to be rebuilding smartpy from that far back, did you try running your stuff with the last legacy CLI? https://legacy.smartpy.io/docs/cli

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

SmartPy

Sorry, I'll check in with the team today

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

SmartPy

hello, any update on this? :)

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

SmartPy

The legacy syntax has sp.utils.wrap_entry_point(...), it can be used in test() . The result is a compiled lambda.
https://legacy.smartpy.io/docs/helpers/utils#wrap-entrypoint

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

SmartPy

https://smartpy.io/ide?code=eJytk02PmzAQhu_8itHmAtqsU@gtElKrHFtVvaRXNIFJYhVsyzbbJL@@_gDCRrtt@uEL_njnncdmhndKagumQ23VGdCAUUmy@OuRLGCrDhob3LUEGymsxtqCPaKF3pCBFrtdg8bpjtYqs16tLF2kYQduW9wxLlcdr4_UGimeNO1Jk6hptbBnRU8x9l_okuSDUayTTd9S0tAeOuQizdYJuFG3aMwMP3XS8QaDxA8fVlVccFtVqaF2v4RnbHtaQisPvJ4p_fAC1qBFFkRQRvEbmuDgNOGbTCIPTQ7krCQX9gVJjW09UHiH32a_yZWGoLsy9cpp6XOIigl_fd9X7mLzNfg_6TkU01RL3aSn0s0F2iWch1kWxcVd4iVcprAQt4DACN9IGy4F5JCenDya@osEoDy9ea5eKKy_UxPTxVXQLB125jZ@aFSVkR2lpLXU5cMGhZAWtl@@ftx8esgmJ02212IyZCd4vC7Or0MWEdJd5oaz@BPO4j9yzheXoXGwaSpLxqZZaJ44jWimJoGay4jlT6pxK3249tSQfjxix_zmNHZi7mx8a7JZN4YKLt8NZVeG4_grX3rCY@kMxmfeGooB8DzWw5CCxdZRLLzgvMRyX11Flk0FtQ2lP_hYOVkVo9W8N65gRfY2RXEnhS_v9x7lJzf9pIc-

this example demonstrates how to update logic using a simple lambda. How does it work with lambdas that have read-write access to storage?

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

SmartPy

There is no public version of the source for the 10.1 but I have the private repo.
I'll try to build you the binary. I'll have a look on Monday.

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

SmartPy

this code is not public and security relevant, so i dont feel comfortable sharing it sorry 😊

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