Maintenance: Storage optimization, shared zero-address helper, and Docker v2 support - #722
Merged
JSE19 merged 4 commits intoJul 30, 2026
Conversation
Add runtime detection for docker compose (v2) with fallback to docker-compose (v1). Introduce overridable DOCKER_COMPOSE variable used by both docker-up and docker-down targets.
Add pub(crate) zero_address helper to lib.rs to consolidate the construction of zero addresses. Replace five manual instances across admin.rs and internal.rs with crate::zero_address(). Update related test files to use the shared helper and remove redundant local definitions.
Replace the obsolete 'deduct_and_transfer' function name with 'transfer_with_protocol_fee' in the test_sep41 module documentation. This cleans up the final remaining reference to the old fee collection behavior.
Optimize persistent storage access by removing the redundant existence check. Replace the consecutive has() and get().unwrap() calls with a single get() match statement, preserving identical fallback behavior and TTL extension logic while reducing I/O operations.
|
@Musab1258 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses four distinct issues related to performance, code quality, and developer experience:
load_basket_tokensby replacing the redundant.has()+.get()pattern (two storage reads) with a single.get()followed by pattern matching.crate::zero_address(env)helper function, replacing five manual re-computations acrossadmin.rsandinternal.rs.deduct_and_transferaccounting model intest_sep41.rs, ensuring the codebase correctly reflects the direct-to-fee-collector payout model.Makefileto auto-detect betweendocker compose(v2) anddocker-compose(v1), ensuring compatibility with newer Docker installations while allowing manual overrides.Related Issues:
Testing
cargo test). Note: Verified that 2 pre-existing errors inadmin.rsandinstructions.rsare unrelated to these changes.zero_addresshelper.Documentation
Code Quality
cargo fmt).cargo clippy).Breaking Changes
Additional Notes
Makefileupdate uses a dynamic check (shell command -v ...) to maintain backward compatibility for developers on older environments.zero_addresshelper uses the existingZERO_ADDRESS_STRconstant to ensure address consistency across the contract.