-
Notifications
You must be signed in to change notification settings - Fork 13
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
Refactor testent and previewnet integration tests #65
base: main
Are you sure you want to change the base?
Refactor testent and previewnet integration tests #65
Conversation
Merge testent and integration test into one file
Warning Rate limit exceeded@illia-malachyn has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 8 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe changes encompass modifications to the Makefile for better organization of integration tests and cleanup processes, the introduction of utility functions in Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant RosettaAPI
participant FlowAccount
User->>CLI: Start integration test
CLI->>FlowAccount: Create originator account
FlowAccount-->>CLI: Return account details
CLI->>RosettaAPI: Setup Rosetta server
CLI->>FlowAccount: Create accounts for Alice and Bob
FlowAccount-->>CLI: Return account details
CLI->>FlowAccount: Transfer assets between accounts
FlowAccount-->>CLI: Confirm transfer
CLI->>User: Display transfer status
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration 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.
Actionable comments posted: 24
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (9)
- Makefile (1 hunks)
- tests/helpers.py (1 hunks)
- tests/integration_test.py (1 hunks)
- tests/localnet_integration_test.py (9 hunks)
- tests/previewnet.json (3 hunks)
- tests/previewnet_account_signer.json (1 hunks)
- tests/rosetta.py (1 hunks)
- tests/testnet.json (1 hunks)
- tests/testnet_account_signer.json (1 hunks)
Additional context used
Gitleaks
tests/previewnet_account_signer.json
8-8: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
tests/testnet_account_signer.json
8-8: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
tests/helpers.py
18-18: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
125-125: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
Ruff
tests/integration_test.py
3-3:
from rosetta import *
used; unable to detect undefined names(F403)
4-4:
from helpers import *
used; unable to detect undefined names(F403)
9-9:
sys
may be undefined, or defined from star imports(F405)
16-16:
read_account
may be undefined, or defined from star imports(F405)
18-18:
rosetta_create_account_transaction
may be undefined, or defined from star imports(F405)
24-24:
rosetta_create_account_transaction
may be undefined, or defined from star imports(F405)
30-30:
rosetta_transfer
may be undefined, or defined from star imports(F405)
39-39:
rosetta_transfer
may be undefined, or defined from star imports(F405)
49-49:
read_account
may be undefined, or defined from star imports(F405)
50-50:
rosetta_proxy_transfer
may be undefined, or defined from star imports(F405)
70-70:
sys
may be undefined, or defined from star imports(F405)
72-72:
sys
may be undefined, or defined from star imports(F405)
72-72:
sys
may be undefined, or defined from star imports(F405)
103-103:
subprocess
may be undefined, or defined from star imports(F405)
103-103:
subprocess
may be undefined, or defined from star imports(F405)
109-109:
read_account_signer
may be undefined, or defined from star imports(F405)
110-110:
save_account_to_flow_json
may be undefined, or defined from star imports(F405)
121-121:
create_flow_account
may be undefined, or defined from star imports(F405)
134-134:
save_account_to_flow_json
may be undefined, or defined from star imports(F405)
136-136:
deploy_contract
may be undefined, or defined from star imports(F405)
140-140:
json
may be undefined, or defined from star imports(F405)
144-144:
json
may be undefined, or defined from star imports(F405)
148-148:
convert_to_rosetta_address
may be undefined, or defined from star imports(F405)
152-152:
json
may be undefined, or defined from star imports(F405)
163-163:
create_flow_account
may be undefined, or defined from star imports(F405)
164-164:
convert_to_rosetta_address
may be undefined, or defined from star imports(F405)
166-166:
save_account
may be undefined, or defined from star imports(F405)
175-175:
subprocess
may be undefined, or defined from star imports(F405)
175-175:
subprocess
may be undefined, or defined from star imports(F405)
tests/localnet_integration_test.py
42-42: Use context handler for opening files
(SIM115)
tests/rosetta.py
1-1:
from helpers import *
used; unable to detect undefined names(F403)
29-29:
generate_keys
may be undefined, or defined from star imports(F405)
47-47: f-string without any placeholders
Remove extraneous
f
prefix(F541)
52-52: f-string without any placeholders
Remove extraneous
f
prefix(F541)
58-58: f-string without any placeholders
Remove extraneous
f
prefix(F541)
64-64:
subprocess
may be undefined, or defined from star imports(F405)
64-64:
subprocess
may be undefined, or defined from star imports(F405)
93-93:
save_account
may be undefined, or defined from star imports(F405)
146-146:
read_account_keys
may be undefined, or defined from star imports(F405)
152-152:
subprocess
may be undefined, or defined from star imports(F405)
152-152:
subprocess
may be undefined, or defined from star imports(F405)
247-247:
read_account
may be undefined, or defined from star imports(F405)
250-250:
subprocess
may be undefined, or defined from star imports(F405)
250-250:
subprocess
may be undefined, or defined from star imports(F405)
276-276:
read_account
may be undefined, or defined from star imports(F405)
279-279:
subprocess
may be undefined, or defined from star imports(F405)
279-279:
subprocess
may be undefined, or defined from star imports(F405)
332-332:
request_router
may be undefined, or defined from star imports(F405)
357-357:
request_router
may be undefined, or defined from star imports(F405)
386-386:
request_router
may be undefined, or defined from star imports(F405)
434-434:
request_router
may be undefined, or defined from star imports(F405)
459-459:
request_router
may be undefined, or defined from star imports(F405)
Additional comments not posted (14)
Makefile (1)
30-31
: Review oftestnet-integration-test
andpreviewnet-integration-test
targetsThe integration test targets have been renamed and updated to execute a specific Python script with network parameters. Here are the key points:
- Script Execution: Both targets now explicitly call
python3 tests/integration_test.py
with a network-specific parameter (--network testnet
fortestnet-integration-test
and--network previewnet
forpreviewnet-integration-test
). This is a clear and straightforward way to specify the test environment.- Consistency and Clarity: The update enhances clarity by specifying the network context directly in the make target, which helps in understanding and running the correct tests for the desired network.
These changes are well-aligned with the PR's objectives to streamline and clarify the testing process. No issues are observed with the current implementation.
Also applies to: 34-34
tests/testnet.json (2)
23-23
: Updated spork version to "51".The change in spork version from "50" to "51" is noted. This update is crucial as it likely corresponds to a new set of operational parameters for the blockchain. Ensure that this version update is consistent with the intended upgrades or changes in the blockchain configuration.
29-29
: Updatedroot_block
value to 211176670.The
root_block
value has been updated from185185854
to211176670
. This change is significant as it adjusts the starting point for the blockchain's operations under the new spork. It's important to verify that this newroot_block
value is correct and aligns with the blockchain's historical data and planned operations.tests/previewnet.json (3)
9-9
: Verify the new contract address forflow_cold_storage_proxy
.The contract address has been updated to
0x05f842cd1b178690
. It is crucial to verify that this address is correct and corresponds to an active contract on the network.Run the following script to verify the contract address:
31-31
: Verify the newroot_block
value.The
root_block
value has been updated to29859120
. It is important to verify that this value is correct and reflects the current state of the network, especially in terms of synchronization and accessing historical data.Run the following script to verify the
root_block
value:
19-19
: Verify the new address in theoriginators
array.The
originators
array now includes the address0x05f842cd1b178690
. Ensure that this address is correctly included and has the appropriate permissions or roles within the network.Run the following script to verify the address in the
originators
array:tests/localnet_integration_test.py (8)
72-72
: Approved path update ininit_flow_json
.The update to use a relative path for
flow.json
is consistent with the PR's objectives to improve path management.
115-115
: Approved path updates ingen_contract_account
.The updates to use relative paths for
flow.json
andaccount-keys.csv
are consistent with the PR's objectives to improve path management.Also applies to: 125-125
130-130
: Approved path update indeploy_contracts
.The update to use a relative path for the contract file is consistent with the PR's objectives to improve path management.
143-143
: Approved path update inseed_contract_accounts
.The update to use a relative path for
account-keys.csv
is consistent with the PR's objectives to improve path management.
167-167
: Approved path update inget_account_keys
.The update to use a relative path for
account-keys.csv
is consistent with the PR's objectives to improve path management.
211-211
: Approved path update inrosetta_create_account
.The update to use a relative path for
account-keys.csv
is consistent with the PR's objectives to improve path management.
243-243
: Approved path update inrosetta_create_proxy_account
.The update to use a relative path for
account-keys.csv
is consistent with the PR's objectives to improve path management.
479-487
: Approved activation of previously commented-out functions in the main script.The activation of these functions enhances the script's functionality by ensuring that account creation and transfers are executed as part of the main flow.
{ | ||
"address": "941840a945dddfd0", | ||
"key": { | ||
"type": "hex", | ||
"index": 0, | ||
"signatureAlgorithm": "ECDSA_secp256k1", | ||
"hashAlgorithm": "SHA3_256", | ||
"privateKey": "573e4f583fa08997e3ca91a4adcbcd5831ccb0b4d8e47476bec0b305c3e5b79a" | ||
} | ||
} |
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.
Critical Security Issue: Exposed Private Key
The inclusion of a private key directly in the JSON configuration file poses a significant security risk. This could potentially expose sensitive operations and access to various services.
To mitigate this risk, consider the following actions:
- Remove the private key from the file.
- Use environment variables or a secure vault solution to handle sensitive data securely.
Would you like assistance in implementing these changes?
Tools
Gitleaks
8-8: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
"index": 0, | ||
"signatureAlgorithm": "ECDSA_secp256k1", | ||
"hashAlgorithm": "SHA3_256", | ||
"privateKey": "8ad6b3c4ab1cb753139285870c9361590269ed633356f7349067c74b8080e834" |
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.
Critical Security Issue: Exposed Private Key
The inclusion of a private key directly in the JSON file poses a significant security risk. This can lead to unauthorized access and should be avoided.
Consider the following alternatives to enhance security:
- Remove the private key from the file and instead load it from environment variables or a secure vault solution.
- If the key must remain in the file for local or testing purposes, ensure this file is never included in version control or accessible in production environments.
- "privateKey": "8ad6b3c4ab1cb753139285870c9361590269ed633356f7349067c74b8080e834"
+ "privateKey": "<REDACTED>"
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"privateKey": "8ad6b3c4ab1cb753139285870c9361590269ed633356f7349067c74b8080e834" | |
"privateKey": "<REDACTED>" |
Tools
Gitleaks
8-8: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
receiver_address=alice_account_rosetta["address"], | ||
amount=50, | ||
i=0) | ||
time.sleep(20) # Hacky fix to not check nonce |
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.
Consider alternatives to using time.sleep
for handling nonces.
Using time.sleep
as a hacky fix to avoid nonce issues is not reliable and can lead to unpredictable behavior in automated tests.
Explore more robust methods for handling nonces, such as checking transaction status or implementing a retry mechanism with backoff until the nonce is updated.
Also applies to: 46-46
i=0) | ||
time.sleep(20) | ||
|
||
# TODO: Proxy transfer doesn't work for now. Make it work |
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.
Address the TODO comment regarding proxy transfers.
The TODO comment indicates that proxy transfers do not work currently. This should be addressed to ensure the functionality is complete.
Would you like assistance in debugging and implementing the proxy transfer functionality? I can help by looking into the issue or opening a GitHub issue to track this task.
Merge testnet and integration test into one file
Summary by CodeRabbit
New Features
Bug Fixes
Documentation