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

feat: add method to serialize tron tx to raw hex #40

Merged
merged 9 commits into from
Jun 4, 2024

Conversation

pedrxlz
Copy link
Contributor

@pedrxlz pedrxlz commented Apr 12, 2024

Description

add method to serialize tron tx to raw hex

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

  • Novos Recursos

    • Adicionada a função de serialização de transações Bitcoin para uma string hexadecimal.
    • Adicionada a função de serialização de transações TRX para representação hexadecimal.
  • Correções de Bugs

    • Atualização de versões de dependências para corrigir várias vulnerabilidades de segurança (CVEs).
  • Refatoração

    • Implementação de ToString para ResultAccount e TransferTXRequest usando std::fmt::Display para melhor controle de formatação.
  • Testes

    • Atualização de valores de hash e dados codificados em testes para Ethereum e Polygon.

Copy link

coderabbitai bot commented Jun 4, 2024

Walkthrough

As atualizações incluem melhorias de segurança, como a atualização do openssl-sys para corrigir várias CVEs, e a atualização da dependência reqwest no arquivo Cargo.toml. Novas funções de serialização foram adicionadas aos módulos Bitcoin e Tron, enquanto as implementações de ToString em Klever foram aprimoradas. Além disso, hashes criptográficos e dados codificados foram atualizados nos testes dos módulos Ethereum e Polygon.

Changes

Arquivo Resumo das Alterações
.pants-ignore Atualização das versões do openssl-sys para corrigir várias CVEs.
Cargo.toml Atualização da versão da dependência reqwest de 0.11 para 0.12.
.../bitcoin/mod.rs Adição da função pública serialize_tx para serializar transações Bitcoin em strings hexadecimais.
.../klever/models.rs Mudança na implementação de ToString para ResultAccount e TransferTXRequest para usar std::fmt::Display.
.../tron/mod.rs Adição da função pública serialize_tx_into_raw_hex para serializar transações Tron em strings hexadecimais.
deny.toml Atualização das versões das dependências sendo ignoradas.
.../ethereum/mod.rs Atualização dos valores de hash e dados codificados em testes.
.../polygon/mod.rs Atualização dos valores de hash e dados codificados em testes.

Poem

No código brilhou uma nova luz,
Com atualizações que afastam a cruz.
OpenSSL seguro, CVEs vencidos,
E novas funções, seus benefícios bem-vindos.
Reqwest renovado, mais forte e ágil,
Nosso código agora, mais robusto e frágil.
🌟🚀


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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5800202 and 7c29ae5.

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

299-307: A função serialize_tx está bem implementada, com tratamento adequado de erros e uso correto de correspondência de padrões.

packages/kos-sdk/src/chains/tron/mod.rs (1)

391-397: A função serialize_tx_into_raw_hex está corretamente implementada, com tratamento adequado de erros e uso eficiente da serialização e desserialização.

packages/kos-sdk/src/chains/klever/models.rs Outdated Show resolved Hide resolved
packages/kos-sdk/src/chains/klever/models.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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7c29ae5 and 0529fb3.

Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (1)
  • deny.toml (1 hunks)
Additional comments not posted (8)
deny.toml (8)

17-17: Verifique se a versão <=0.22 do pacote base64 está correta e se há uma justificativa clara para pular esta versão específica, considerando que está relacionada ao openssl.


18-18: Certifique-se de que a versão =0.4.0 do pacote idna está correta. Seria útil adicionar um comentário explicando por que esta versão específica está sendo ignorada.


19-19: Confirme se a versão <=0.52 do pacote winreg está correta e se há uma justificativa adequada para pular esta versão.


20-20: Verifique se a versão <=1.1 do pacote http está correta. Um comentário explicativo sobre a razão para pular esta versão seria benéfico.


21-21: Confirme se a versão <=1.0.0 do pacote http-body está correta e se há uma justificativa adequada para pular esta versão.


22-22: Verifique se a versão <=1.3.1 do pacote hyper está correta. Seria útil adicionar um comentário explicando por que esta versão específica está sendo ignorada.


23-23: Certifique-se de que a versão <=0.12.4 do pacote reqwest está correta. Um comentário explicativo sobre a razão para pular esta versão seria benéfico.


24-24: Confirme se a versão 1.0.4 do pacote rustls-pemfile está correta e se há uma justificativa adequada para pular esta versão.

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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0529fb3 and f81ee4a.

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

coderabbitai[bot]
coderabbitai bot previously approved these changes Jun 4, 2024
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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f81ee4a and 6cff74d.

Files selected for processing (2)
  • packages/kos-sdk/src/chains/ethereum/mod.rs (2 hunks)
  • packages/kos-sdk/src/chains/polygon/mod.rs (2 hunks)
Files skipped from review due to trivial changes (1)
  • packages/kos-sdk/src/chains/polygon/mod.rs
Additional comments not posted (3)
packages/kos-sdk/src/chains/ethereum/mod.rs (3)

590-590: Atualização de dados codificados em hexadecimal.


596-596: Atualização de hash de transação.


581-581: Correção de hash de transação.

- "fa2b84b45d28888c43c0bda80000e4a4d2040017f3b6e4a31e7d8a4ace27db29"
+ "fa2b84b45d28888c43c0bda80000e4a4d2040017f3b6e4a31e7d8a4ace27db29"

Likely invalid or redundant comment.

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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6cff74d and 4803267.

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

@brunocampos-ssa brunocampos-ssa merged commit d19d720 into develop Jun 4, 2024
3 checks passed
@brunocampos-ssa brunocampos-ssa deleted the serialize-tx-into-raw-hex-trx branch June 4, 2024 23:43
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.

3 participants