-
Notifications
You must be signed in to change notification settings - Fork 11
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
Integration Tests Atomic Swap Nominal Use Case (PLT-9263, part of PLT-9226) #171
Conversation
WalkthroughThe recent updates involve tweaks to transaction handling, with a focus on the use of Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (6)
- packages/language/examples/src/atomicSwap.ts (12 hunks)
- packages/runtime/client/rest/src/contract/rolesConfigurations.ts (1 hunks)
- packages/runtime/lifecycle/src/api.ts (1 hunks)
- packages/runtime/lifecycle/test/examples/swap.ada.token.e2e.spec.ts (5 hunks)
- packages/runtime/lifecycle/test/generic/contracts.e2e.spec.ts (1 hunks)
- packages/testing-kit/src/wallet/lucid/index.ts (2 hunks)
Additional comments: 16
packages/runtime/lifecycle/test/generic/contracts.e2e.spec.ts (1)
- 22-22: The removal of
.skip
enables the test case "can create a Marlowe Contract" to be executed, which is a positive change assuming the test is ready to be included in the test suite.packages/testing-kit/src/wallet/lucid/index.ts (2)
- 66-67: Adding a newline before returning from the
waitRuntimeSyncingTillCurrentWalletTip
function improves readability of the output, and increasing the sleep duration from 5 to 15 seconds may help with synchronization issues in tests.- 83-83: Using
process.stdout.write
instead oflogWarning
for output in theisRuntimeChainMoreAdvancedThan
function is a minor change that does not affect functionality but may improve the output formatting.packages/runtime/client/rest/src/contract/rolesConfigurations.ts (1)
- 212-212: The comment update in the
useMintedRoles
function clarifies the minting process for Role Tokens, making it more general and potentially more accurate.packages/runtime/lifecycle/test/examples/swap.ada.token.e2e.spec.ts (6)
- 13-13: The addition of
payoutId
to the imported entities is necessary for the test to use this identifier in payout-related operations.- 26-26: The addition of
logError
to the imported entities allows for better error logging within the test suite.- 30-39: Importing additional entities such as
onlyByContractIds
,RuntimeLifecycle
,Action
,Closed
,Scheme
, andmintRole
is necessary for the expanded test coverage and utility functions at the end of the file.- 75-75: Modifying the
seller
address assignment within thescheme
object to useawait seller.wallet.getChangeAddress()
ensures that the correct address is used in the test.- 96-106: The additional logging and contract manipulation operations within the
describe("swap")
block provide more detailed output and control over the contract lifecycle in the test.- 217-264: The addition of several utility functions at the end of the file, such as
getClosedState
,getAvailableActions
,shouldBeAClosedContract
, andgetMarloweStatefromAnActiveContract
, enhances the test suite's capabilities to interact with and verify the contract's state.packages/runtime/lifecycle/src/api.ts (1)
- 285-285: The added comment clarifies the expected behavior of the
Withdraw
method in thePayoutsAPI
interface, which is to not wait for confirmation behind the scenes and to return aTxId
.packages/language/examples/src/atomicSwap.ts (5)
- 72-72: The addition of the
SingleInputTx
import is necessary for the updated functions that now use this type instead ofInput
.- 158-168: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [152-165]
Commenting out the
RetrieveMinimumLovelaceAdded
type indicates that this action is no longer part of the atomic swap contract lifecycle, which could be due to a change in the contract's requirements or behavior.
- 211-226: Renaming the error handling classes to
UnexpectedActiveSwapContractState
andUnexpectedClosedSwapContractState
provides clearer semantics on the type of error state encountered in the swap contract.- 259-263: Commenting out the
RetrieveMinimumLovelaceAdded
action within thegetAvailableActions
function aligns with the earlier comment-out of the type, maintaining consistency in the contract's logic.- 345-355: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [302-362]
The modifications to the
getState
,getClosedState
, andgetActiveState
functions to useSingleInputTx
instead ofInput
are consistent with the import change and are necessary for the functions to operate correctly with the updated contract structure.
d3dd96c
to
8a3b78f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (6)
- packages/language/examples/src/atomicSwap.ts (12 hunks)
- packages/runtime/client/rest/src/contract/rolesConfigurations.ts (1 hunks)
- packages/runtime/lifecycle/src/api.ts (1 hunks)
- packages/runtime/lifecycle/test/examples/swap.ada.token.e2e.spec.ts (5 hunks)
- packages/runtime/lifecycle/test/generic/contracts.e2e.spec.ts (1 hunks)
- packages/testing-kit/src/wallet/lucid/index.ts (2 hunks)
Files skipped from review as they are similar to previous changes (6)
- packages/language/examples/src/atomicSwap.ts
- packages/runtime/client/rest/src/contract/rolesConfigurations.ts
- packages/runtime/lifecycle/src/api.ts
- packages/runtime/lifecycle/test/examples/swap.ada.token.e2e.spec.ts
- packages/runtime/lifecycle/test/generic/contracts.e2e.spec.ts
- packages/testing-kit/src/wallet/lucid/index.ts
8a3b78f
to
9a5dc22
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (6)
- packages/language/examples/src/atomicSwap.ts (12 hunks)
- packages/runtime/client/rest/src/contract/rolesConfigurations.ts (1 hunks)
- packages/runtime/lifecycle/src/api.ts (1 hunks)
- packages/runtime/lifecycle/test/examples/swap.ada.token.e2e.spec.ts (5 hunks)
- packages/runtime/lifecycle/test/generic/contracts.e2e.spec.ts (1 hunks)
- packages/testing-kit/src/wallet/lucid/index.ts (2 hunks)
Files skipped from review as they are similar to previous changes (5)
- packages/language/examples/src/atomicSwap.ts
- packages/runtime/client/rest/src/contract/rolesConfigurations.ts
- packages/runtime/lifecycle/src/api.ts
- packages/runtime/lifecycle/test/generic/contracts.e2e.spec.ts
- packages/testing-kit/src/wallet/lucid/index.ts
Additional comments: 7
packages/runtime/lifecycle/test/examples/swap.ada.token.e2e.spec.ts (7)
- 13-13: The addition of
payoutId
to the imported entities is noted and appears to be in line with the PR objectives to enhance testing for atomic swaps.- 26-26: The addition of
logError
function to the imported entities is approved as it likely aids in better error logging during the integration tests.- 30-35: The addition of new imports such as
onlyByContractIds
,RuntimeLifecycle
,Action
,Closed
,Scheme
, andmintRole
is approved, assuming these are necessary for the expanded testing functionality.- 71-71: The modification of the
seller
address assignment within thescheme
object to dynamically retrieve the address is approved, as it likely ensures that the correct address is used during tests.- 92-101: The addition of logging and contract manipulation operations within the
describe("swap")
block is approved, assuming these are part of the new integration tests for atomic swaps.- 110-206: The extensive changes within the
describe("swap")
block, including additional logging, contract manipulation operations, and error handling, are approved. These changes seem to align with the PR's objective to enhance the testing framework.- 214-261: The addition of several utility functions at the end of the file, such as
getClosedState
,getAvailableActions
, andshouldBeAClosedContract
, is approved. These functions likely contribute to the robustness of the integration tests by providing necessary operations for atomic swap testing.
@@ -63,7 +63,8 @@ const waitRuntimeSyncingTillCurrentWalletTip = | |||
await waitForPredicatePromise( | |||
isRuntimeChainMoreAdvancedThan(client, currentLucidSlot) | |||
); | |||
return sleep(5); | |||
process.stdout.write("\n"); | |||
return sleep(15); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👁️ ...
what is this sleep 5 turned into 15?
Why are we sleeping on a random number? Could you add a comment to it?
This PR is part of #147, it covers only the integration tests and not the unit ones.
It fixes also #168
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Withdraw
method in the Payouts API.Refactor
Style