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

Cackle gate #1124

Merged
merged 4 commits into from
Oct 23, 2023
Merged

Cackle gate #1124

merged 4 commits into from
Oct 23, 2023

Conversation

graydon
Copy link
Contributor

@graydon graydon commented Oct 20, 2023

This adds a transitive-API-usage-checker called cackle to the soroban build. It is currently (with a few exceptions) wired to prohibit most uses of the filesystem, network, time, the environment, threading, random numbers or hashtables. It's configured by cackle.toml and there's a new Makefile and github action target for it.

I also took the opportunity to eliminate all uses of HashMap and thread_rng (see #810).

Thanks to @SirTyson for suggesting this tool! It was a little tricky to get working right but once working it seems good.

@graydon graydon requested review from sisuresh and a team as code owners October 20, 2023 04:38
@graydon graydon force-pushed the cackle-gate branch 5 times, most recently from 31c43b6 to bffdaf6 Compare October 21, 2023 00:41
@graydon graydon requested a review from dmkozh October 21, 2023 00:52
@dmkozh dmkozh added this pull request to the merge queue Oct 23, 2023
Merged via the queue into main with commit 62da7a1 Oct 23, 2023
10 checks passed
@dmkozh dmkozh deleted the cackle-gate branch October 23, 2023 15:25
github-merge-queue bot pushed a commit to stellar/rs-soroban-sdk that referenced this pull request Oct 24, 2023
### What

Use a seeded StdRng instead of thread_rng in arbitrary tests.

### Why

Per stellar/rs-soroban-env#810 randomized test
cases should be deterministic.

### Known limitations

This is different from the approach in soroban-env-host from
stellar/rs-soroban-env#1124, where a test prng
is attached to the env / host.

There are two more uses of thread_rng in this crate, but I don't know
enough about that code to know how they should be removed, i.e. if they
should follow a pattern similar to soroban-env-host. I am willing to
replace all uses of thread_rng if given guidance about the preferred way
to do it.

The implementation of StdRng is allowed to change in the future, so it's
possible the exact numbers generated could change. I could import
rand_chacha instead if desired.

Co-authored-by: Leigh McCulloch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants