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

[PLA-2068] Fix event should go to public key channels #286

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

leonardocustodio
Copy link
Member

@leonardocustodio leonardocustodio commented Nov 7, 2024

PR Type

enhancement


Description

  • Replaced the address field with public_key in both TransactionCreated and TransactionUpdated classes.
  • Updated the fallback method to Account::daemonPublicKey() for obtaining the public key.
  • Adjusted the condition checks to ensure public_key is not null before proceeding.

Changes walkthrough 📝

Relevant files
Enhancement
TransactionCreated.php
Replace address with public key in TransactionCreated       

src/Events/Global/TransactionCreated.php

  • Replaced usage of address with public_key.
  • Updated the fallback method to Account::daemonPublicKey().
  • Modified the condition check to use public_key.
  • +3/-3     
    TransactionUpdated.php
    Replace address with public key in TransactionUpdated       

    src/Events/Global/TransactionUpdated.php

  • Replaced usage of address with public_key.
  • Updated the fallback method to Account::daemonPublicKey().
  • Modified the condition check to use public_key.
  • +3/-3     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Signed-off-by: Leonardo Custodio <[email protected]>
    Signed-off-by: Leonardo Custodio <[email protected]>
    Copy link

    github-actions bot commented Nov 7, 2024

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Null Check
    The null check for publicKey should be more robust to handle unexpected data types and ensure the flow does not proceed with invalid data.

    Null Check
    Similar to TransactionCreated.php, the null check for publicKey needs to be more comprehensive to handle various data scenarios securely.

    Copy link

    github-actions bot commented Nov 7, 2024

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Use strict comparison for null checks to avoid unintended type coercions

    Replace the equality check == with the identity check === to ensure strict
    comparison when checking if $publicKey is null.

    src/Events/Global/TransactionCreated.php [33-35]

    -if ($publicKey == null) {
    +if ($publicKey === null) {
         return;
     }
    Suggestion importance[1-10]: 7

    Why: Using '===' for null checks in PHP is a best practice to avoid type coercion issues. This change enhances the robustness of the condition check.

    7

    @leonardocustodio leonardocustodio changed the title Update TransactionCreated.php [PLA-2068] Fix event should go to public key channels Nov 7, 2024
    @leonardocustodio leonardocustodio self-assigned this Nov 7, 2024
    @leonardocustodio leonardocustodio merged commit 0a13da2 into master Nov 7, 2024
    7 checks passed
    @leonardocustodio leonardocustodio deleted the upgrade-address branch November 7, 2024 14:24
    leonardocustodio added a commit that referenced this pull request Nov 7, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Development

    Successfully merging this pull request may close these issues.

    3 participants