Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Cookbook page on randomness #1882

Open
anton-trunov opened this issue Feb 18, 2025 · 1 comment
Open

Improve Cookbook page on randomness #1882

anton-trunov opened this issue Feb 18, 2025 · 1 comment
Assignees
Labels
kind: docs Documentation for docs.tact-lang.org kept in docs folder
Milestone

Comments

@anton-trunov
Copy link
Member

It's mostly a stub now: https://docs.tact-lang.org/cookbook/random/

We should better explain how to use our random, randomInt, nativePrepareRandom and nativeRandomizeLt functions, list common pitfalls, explain how validators can attack contracts using randomness and how those attacks can be mitigated.

@anton-trunov anton-trunov added the kind: docs Documentation for docs.tact-lang.org kept in docs folder label Feb 18, 2025
@anton-trunov anton-trunov added this to the Doc: 2025-03 milestone Feb 18, 2025
@Gusarich
Copy link
Member

how those attacks can be mitigated.

there's no way to protect from a theoretical validator attack on random-dependent smart contract. but in order to protect from regular users you just can call random/randInt (they call nativePrepareRandom by default) or nativeRandomizeLt once before all cals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: docs Documentation for docs.tact-lang.org kept in docs folder
Projects
None yet
Development

No branches or pull requests

3 participants