feat: add contract tests and consolidate stream parameter structs (issues #658-661) - #711
Open
soma-enyi wants to merge 4 commits into
Open
feat: add contract tests and consolidate stream parameter structs (issues #658-661)#711soma-enyi wants to merge 4 commits into
soma-enyi wants to merge 4 commits into
Conversation
|
@soma-enyi 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 GitHub issues by adding comprehensive contract tests for edge cases and consolidating duplicate type definitions in the FlowStar streaming contract.
Changes Implemented
Issue #658: Test bump_stream() on Nonexistent Stream
contracts/streaming/src/test_security.rstest_bump_stream_nonexistent_stream_returns_stream_not_found()testbump_stream()with a nonexistent stream ID properly returnsStreamError::StreamNotFoundIssue #659: Test Batch Creation Rejects Contract as Recipient
contracts/streaming/src/test_batch.rstest_batch_rejects_contract_as_recipient()testcreate_streams_batch()has the same security guard ascreate_stream()to prevent the contract itself from being a stream recipientStreamError::InvalidRecipientIssue #660: Test Batch Creation Rejects Dust/Zero-Rate Streams
contracts/streaming/src/test_batch.rstest_batch_rejects_dust_stream()testStreamError::RateIsZerobefore any funds are transferredIssue #661: Consolidate CreateStreamInput and CreateStreamParams Structs
contracts/streaming/src/lib.rsCreateStreamInputstruct definition (lines 178-192)create_streams_batch()function signature to acceptVec<CreateStreamParams>instead ofVec<CreateStreamInput>Bonus Fix
contracts/streaming/src/test_features.rsAddressandEnvin line 10Files Modified
contracts/streaming/src/test_security.rs(+14 lines)contracts/streaming/src/test_batch.rs(+71 lines)CreateStreamInputreferences toCreateStreamParamscontracts/streaming/src/lib.rs(-16 lines)CreateStreamInputstructcreate_streams_batch()contracts/streaming/src/test_features.rs(-1 line)Test Results
All new tests pass successfully:
✅
test_bump_stream_nonexistent_stream_returns_stream_not_found✅
test_batch_rejects_contract_as_recipient✅
test_batch_rejects_dust_streamValidation
Closes #658
Closes #659
Closes #660
Closes #661