Skip to content
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: rename contracts directory to contracts-signatures #1606

Merged
merged 2 commits into from
Aug 6, 2024
Merged

Conversation

dinhani-cw
Copy link
Contributor

@dinhani-cw dinhani-cw commented Aug 6, 2024

PR Type

enhancement


Description

  • Updated the directory path for listing and copying signature files in build.rs and contracts-compile.sh.
  • Added new signature files for various contracts including BRLCToken, BalanceTracker, CapybaraFinance_CreditLine, CapybaraFinance_LendingMarket, CapybaraFinance_LiquidityPool, CardPaymentProcessor, CardPaymentProcessorv2, CashbackDistributor, CompoundAgent, CompoundComptroller, CompoundMarket, MultiSigWallet, and PixCashier.

Changes walkthrough 📝

Relevant files
Enhancement
15 files
build.rs
Update directory path for signature files                               

build.rs

  • Updated the directory path for listing signature files.
+1/-1     
contracts-compile.sh
Update directory path for copying signature files               

e2e/cloudwalk-contracts/contracts-compile.sh

  • Updated the directory path for copying signature files.
+1/-1     
BRLCToken.signatures
Add BRLCToken signature file                                                         

static/contracts-signatures/BRLCToken.signatures

  • Added new signature file for BRLCToken.
+144/-1 
BalanceTracker.signatures
Add BalanceTracker signature file                                               

static/contracts-signatures/BalanceTracker.signatures

  • Added new signature file for BalanceTracker.
+28/-1   
CapybaraFinance_CreditLine.signatures
Add CapybaraFinance_CreditLine signature file                       

static/contracts-signatures/CapybaraFinance_CreditLine.signatures

  • Added new signature file for CapybaraFinance_CreditLine.
+58/-1   
CapybaraFinance_LendingMarket.signatures
Add CapybaraFinance_LendingMarket signature file                 

static/contracts-signatures/CapybaraFinance_LendingMarket.signatures

  • Added new signature file for CapybaraFinance_LendingMarket.
+92/-1   
CapybaraFinance_LiquidityPool.signatures
Add CapybaraFinance_LiquidityPool signature file                 

static/contracts-signatures/CapybaraFinance_LiquidityPool.signatures

  • Added new signature file for CapybaraFinance_LiquidityPool.
+19/-1   
CardPaymentProcessor.signatures
Add CardPaymentProcessor signature file                                   

static/contracts-signatures/CardPaymentProcessor.signatures

  • Added new signature file for CardPaymentProcessor.
+132/-1 
CardPaymentProcessorv2.signatures
Add CardPaymentProcessorv2 signature file                               

static/contracts-signatures/CardPaymentProcessorv2.signatures

  • Added new signature file for CardPaymentProcessorv2.
+125/-1 
CashbackDistributor.signatures
Add CashbackDistributor signature file                                     

static/contracts-signatures/CashbackDistributor.signatures

  • Added new signature file for CashbackDistributor.
+65/-1   
CompoundAgent.signatures
Add CompoundAgent signature file                                                 

static/contracts-signatures/CompoundAgent.signatures

  • Added new signature file for CompoundAgent.
+51/-1   
CompoundComptroller.signatures
Add CompoundComptroller signature file                                     

static/contracts-signatures/CompoundComptroller.signatures

  • Added new signature file for CompoundComptroller.
+106/-1 
CompoundMarket.signatures
Add CompoundMarket signature file                                               

static/contracts-signatures/CompoundMarket.signatures

  • Added new signature file for CompoundMarket.
+81/-1   
MultiSigWallet.signatures
Add MultiSigWallet signature file                                               

static/contracts-signatures/MultiSigWallet.signatures

  • Added new signature file for MultiSigWallet.
+48/-1   
PixCashier.signatures
Add PixCashier signature file                                                       

static/contracts-signatures/PixCashier.signatures

  • Added new signature file for PixCashier.
+83/-1   

💡 PR-Agent usage:
Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

Copy link

github-actions bot commented Aug 6, 2024

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Key issues to review

Code Smell
The function generate_signature_module_content does not log the initialization of the signature_files variable. Ensure that the initialization of core components or services is logged with all relevant configurations.

Code Smell
The script does not log the copying of signature files. Ensure that significant operations, such as copying files, are logged for better traceability.

Copy link

github-actions bot commented Aug 6, 2024

PR Code Suggestions ✨

CategorySuggestion                                                                                                                                    Score
Possible issue
Add error handling for the file listing function to manage potential runtime errors

Consider adding error handling for the list_files function to ensure that any issues
with file listing are properly managed, which can prevent potential runtime errors.

build.rs [155]

-let signature_files = list_files("static/contracts-signatures/*.signatures");
+let signature_files = match list_files("static/contracts-signatures/*.signatures") {
+    Ok(files) => files,
+    Err(e) => {
+        eprintln!("Error listing signature files: {}", e);
+        return String::new();
+    }
+};
 
Suggestion importance[1-10]: 9

Why: Adding error handling for the list_files function is crucial to prevent potential runtime errors, which can improve the robustness of the code.

9
Add error handling for the cp command to manage potential copy failures

Add a check to ensure that the cp command succeeds, and handle the error if it
fails, to avoid silent failures during the copy operation.

e2e/cloudwalk-contracts/contracts-compile.sh [21]

-cp repos/$repo/target/$contract.signatures ../../static/contracts-signatures/
+cp repos/$repo/target/$contract.signatures ../../static/contracts-signatures/ || {
+    echo "Failed to copy $contract.signatures to static/contracts-signatures/" >&2
+    exit 1
+}
 
Suggestion importance[1-10]: 8

Why: Adding error handling for the cp command ensures that any issues during the copy operation are caught and managed, preventing silent failures and improving script reliability.

8
Best practice
Ensure the file ends with a newline character for POSIX compliance

Ensure that the file ends with a newline character to comply with POSIX standards
and improve compatibility with various tools.

static/contracts-signatures/BRLCToken.signatures [143]

+5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa: Unpaused(address)
 
-
Suggestion importance[1-10]: 7

Why: Ensuring the file ends with a newline character is a good practice for POSIX compliance and improves compatibility with various tools, although it is a minor issue.

7
Add a newline at the end of the file to adhere to POSIX standards

Consider adding a newline at the end of the file to adhere to POSIX standards, which
can help avoid potential issues with various tools and systems that process the
file.

static/contracts-signatures/CardPaymentProcessor.signatures [131]

 131 +755dae8488072a64d01b55d8c2d2543bf4931988f2683ef8a28e8b10a4f4a0b0: UpdatePaymentSubsidized(bytes16,bytes16,address,uint256,uint256,bytes)
+132 +
 
Suggestion importance[1-10]: 7

Why: Adding a newline at the end of the file is a good practice for POSIX compliance and can help avoid potential issues with tools and systems that process the file. However, it is a minor improvement and not critical.

7
Add a newline at the end of the file to adhere to POSIX standards

Consider adding a newline at the end of the file to adhere to POSIX standards, which
can help avoid potential issues with file concatenation and version control systems.

static/contracts-signatures/CompoundAgent.signatures [50]

 +5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa: Unpaused(address)
++
 
Suggestion importance[1-10]: 7

Why: Adding a newline at the end of the file is a good practice that adheres to POSIX standards and can prevent potential issues with file concatenation and version control systems. However, it is a minor improvement.

7

@dinhani-cw dinhani-cw merged commit e4bba3e into main Aug 6, 2024
30 checks passed
@dinhani-cw dinhani-cw deleted the rename branch August 6, 2024 14:49
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