gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source.
https://gno.land/
Other
880 stars 364 forks source link

Packages missing in Portal Loop #1795

Closed leohhhn closed 2 weeks ago

leohhhn commented 6 months ago

Description

Some packages from the examples folder, such as p/demo/rand are unavailable on the Portal Loop for some reason. https://gno.land/p/demo/rand. As a further addition, it would be cool to have a "path does not contain any files", or "package/realm doesn't exist" message instead of a 500 error.

Can we get this checked out @albttx?

harry-hov commented 6 months ago

Because some packages/realms are marked as Draft. Draft packages and packages importing them will not be published automatically on gnoland start. https://github.com/gnolang/gno/blob/b93032a05aa8a48b2f204129e01df267b3de38f6/examples/gno.land/p/demo/rand/gno.mod#L1-L3

The reason for marking p/demo/rand as Draft is that it imports "math/rand". We don't have "math/rand" in stdlibs.

albttx commented 6 months ago

@harry-hov Thanks for the answers, i wasn't understanding since it was present in the portal-loop image

root@f237fa52bef2:/opt/gno/src# ls /opt/gno/src/examples/gno.land/p/demo/rand/
gno.mod  rand.gno  rand0_filetest.gno  rand_test.gno
leohhhn commented 6 months ago

@harry-hov

Would you have the bandwidth to remove this package/ fix it up?

Random will not really be used for anything production grade, as random values are guessable in the blockchain context. I'm assuming this is why math/rand was removed.

moul commented 5 months ago

Please, do not remove this package, we need it.

The actual fix is to port "math/rand".