Skip to content

LINTER PR 6: eliminate usage of unsafe #651

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

Closed
wants to merge 62 commits into from

Conversation

faddat
Copy link
Contributor

@faddat faddat commented Apr 22, 2025

This pull request eliminates usages of unsafe, as many as possible without a full redesign of ffi.

It should be reviewed after #589 which may be broken into sub components to ensure that it is an easy fit.

faddat added 25 commits April 18, 2025 10:14
… for better clarity and maintainability; enable all revive rules in golangci-lint configuration
… vectors

- Introduced `validate_memory_size` function to enforce memory limits.
- Added `SafeByteSlice` and `SafeUnmanagedVector` to prevent double consumption.
- Updated `do_init_cache`, `do_store_code`, and other functions to utilize safe wrappers and perform memory validation.
- Created a new file `wasmvm-description.mdc` with project guidelines for Go and Rust development.
- Replaced unsafe calls to `go_error.into_result` with `go_error.into_result_safe` in `api.rs` and `storage.rs` to enhance safety and eliminate unsafe blocks.
- Removed `SafeUnmanagedVector` from imports and code where it was unnecessary.
- Added a new method `into_result_safe` in `GoError` to ensure safe error handling without risking reuse of error messages.
- Updated `GoIter` and `GoQuerier` implementations to replace unsafe calls to `go_result.into_result` with `go_result.into_result_safe`, enhancing safety in error handling.
- This change improves the overall robustness of the Go API by eliminating unsafe blocks in the iterator and querier modules.
@faddat faddat changed the title eliminate usages of unsafe LINTER PR 6: eliminate usage of unsafe Apr 22, 2025
- Modified error messages in `iterator_test.go` and `lib_test.go` to provide more specific feedback regarding gas limit and checksum format issues.
- Enhanced clarity of error reporting to improve debugging and user experience.
@faddat
Copy link
Contributor Author

faddat commented Apr 22, 2025

I will make the one with deny.toml into its own PR with only the deny related changes so that we can get these landed.

@faddat
Copy link
Contributor Author

faddat commented Apr 22, 2025

closing in favor of #652

@faddat faddat closed this Apr 22, 2025
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.

1 participant