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

Serialize tx into raw hex trx #44

Merged
merged 24 commits into from
Jun 21, 2024
Merged

Conversation

pedrxlz
Copy link
Contributor

@pedrxlz pedrxlz commented Jun 17, 2024

Description

Added TRX raw_data serialization

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have confirmed all checks make check

Summary by CodeRabbit

  • New Features

    • Added new serialization function for TRX data.
    • Introduced initialization functions for BTC and ETH modules using environment configurations.
    • Enhanced Bitcoin module to use a hardcoded explorer URL.
  • Bug Fixes

    • Updated test cases with new token addresses and improved assertions in the Klever module.
  • Chores

    • Updated workflow commands for environment file handling.

Copy link

coderabbitai bot commented Jun 17, 2024

Walkthrough

Our latest update introduces significant improvements across various modules of the kos-sdk. Key enhancements include new initialization functions using dotenv for environment configuration, refining testing methodologies, and hardcoding URL endpoints for stability. The addition of serialize_raw_data_into_hex_string in the TRX module further strengthens data handling. We've also updated the Cargo.toml dependencies to streamline the build process.

Changes

Files/Directories Change Summaries
packages/kos-sdk/src/chains/tron/mod.rs Added serialize_raw_data_into_hex_string for TRX module.
Cargo.toml Removed elliptic-curve dependency; updated members; added dotenvy and dotenv-build.
packages/kos-sdk/src/chains/bitcoin/mod.rs Added _init and _INIT to handle dotenv initialization. Modified test_send_and_sign to set node to None.
packages/kos-sdk/src/chains/bitcoin/requests.rs Hardcoded Bitcoin explorer URL in test functions.
packages/kos-sdk/src/chains/ethereum/mod.rs Added imports and functions for dotenv initialization; modified test_get_balance_erc20 to adjust token address casing.
packages/kos-sdk/src/chains/klever/klever_test.rs Renamed tests module to klever_test; added _init and _INIT for dotenv initialization; changed assertions and simplified test function parameter.
.github/workflows/pull-develop.yaml Updated workflow command to use vars.NODES_ENV instead of secrets.NODES_ENV for restoring .env file.

Poem

Amidst the code in bytes and bits,
A rabbit hops with clever wits.
He tweaks and tunes the .env grace,
Ensuring each test finds its place.
Through TRX and BTC's thread,
Our bunny coder forges ahead.
In the garden of code, where changes sprout,
He celebrates each successful bout.
🌐✨


Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7313978 and 2adaa0c.

Files selected for processing (1)
  • packages/kos-sdk/src/chains/tron/mod.rs (2 hunks)

packages/kos-sdk/src/chains/tron/mod.rs Show resolved Hide resolved
packages/kos-sdk/src/chains/tron/mod.rs Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2adaa0c and 9946c19.

Files selected for processing (1)
  • packages/kos-sdk/src/chains/tron/mod.rs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/kos-sdk/src/chains/tron/mod.rs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9946c19 and 6da9d2e.

Files selected for processing (1)
  • packages/kos-sdk/src/chains/tron/mod.rs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/kos-sdk/src/chains/tron/mod.rs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Outside diff range and nitpick comments (1)
packages/kos-sdk/src/chains/ethereum/mod.rs (1)

480-480: Ensure proper environment variable management and test initialization.

Consider adding error handling for dotenv::from_filename(".env.nodes").ok(); to ensure that the environment file is loaded correctly and log any errors if the file is not found or has incorrect formatting.

Also applies to: 483-483, 491-497

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6da9d2e and 86fdbfb.

Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (6)
  • Cargo.toml (2 hunks)
  • packages/kos-sdk/Cargo.toml (1 hunks)
  • packages/kos-sdk/src/chains/bitcoin/mod.rs (3 hunks)
  • packages/kos-sdk/src/chains/bitcoin/requests.rs (2 hunks)
  • packages/kos-sdk/src/chains/ethereum/mod.rs (2 hunks)
  • packages/kos-sdk/src/chains/klever/klever_test.rs (8 hunks)
Files skipped from review due to trivial changes (2)
  • Cargo.toml
  • packages/kos-sdk/Cargo.toml
Additional comments not posted (3)
packages/kos-sdk/src/chains/bitcoin/requests.rs (1)

169-169: Repeated issue: Hardcoded URL should be dynamically retrieved.

packages/kos-sdk/src/chains/ethereum/mod.rs (2)

480-480: Initialization of environment variables is well-implemented using the Once pattern.

This ensures that environment settings are loaded exactly once, which is crucial for consistent test execution.

Also applies to: 483-483, 491-497


Line range hint 480-621: The test suite is comprehensive and well-structured.

Great job ensuring thorough coverage of Ethereum functionalities and proper initialization of environment settings for consistent test execution.

packages/kos-sdk/src/chains/ethereum/mod.rs Outdated Show resolved Hide resolved
packages/kos-sdk/src/chains/klever/klever_test.rs Outdated Show resolved Hide resolved
packages/kos-sdk/src/chains/bitcoin/mod.rs Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 86fdbfb and 89ed853.

Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (4)
  • packages/kos-sdk/Cargo.toml (1 hunks)
  • packages/kos-sdk/src/chains/bitcoin/mod.rs (3 hunks)
  • packages/kos-sdk/src/chains/ethereum/mod.rs (2 hunks)
  • packages/kos-sdk/src/chains/klever/klever_test.rs (8 hunks)
Files skipped from review as they are similar to previous changes (4)
  • packages/kos-sdk/Cargo.toml
  • packages/kos-sdk/src/chains/bitcoin/mod.rs
  • packages/kos-sdk/src/chains/ethereum/mod.rs
  • packages/kos-sdk/src/chains/klever/klever_test.rs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 89ed853 and e588ee4.

Files selected for processing (1)
  • .github/workflows/pull-develop.yaml (1 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/pull-develop.yaml

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e588ee4 and 489d4b9.

Files selected for processing (1)
  • .github/workflows/pull-develop.yaml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pull-develop.yaml

@brunocampos-ssa brunocampos-ssa merged commit f2f73bb into develop Jun 21, 2024
3 checks passed
@brunocampos-ssa brunocampos-ssa deleted the serialize-tx-into-raw-hex-trx branch June 21, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants