Skip to content

Conversation

@aarmoa
Copy link
Collaborator

@aarmoa aarmoa commented Apr 2, 2025

  • Fixed the manual TX generation and signing to receive the gas price

Summary by CodeRabbit

  • New Features

    • Enabled configurable gas pricing for more flexible fee management.
    • Enhanced transaction broadcasting with selectable modes and structured JSON responses.
    • Streamlined offline signing, including updated network settings to testnet.
    • Introduced a new automated linting workflow to maintain code quality.
  • Refactor

    • Improved error handling and overall transaction processing reliability.
    • Transitioned configuration files to YAML format for better readability and management.
    • Removed outdated pre-commit hooks for improved workflow efficiency.
    • Added new linting targets in the Makefile for enhanced development checks.

@coderabbitai
Copy link

coderabbitai bot commented Apr 2, 2025

Walkthrough

The changes update the transaction handling logic in the chain client. The code now replaces client.Context with sdkclient.Context in multiple method signatures. The BuildSignedTx function has been modified to accept a new gasPrice parameter, and the transaction broadcasting flow has been refactored to use a new BroadcastSignedTx method with updated error handling. Corresponding changes have been applied to the test support file. Additionally, the example file now uses the os package for file operations, updates network parameters, and formats broadcast responses in JSON.

Changes

File(s) Change Summary
client/chain/chain.go
client/chain/chain_test_support.go
Replaced client.Context with sdkclient.Context in method signatures; updated BuildSignedTx to include a new gasPrice parameter; introduced/refactored broadcasting via the new BroadcastSignedTx method; updated error handling to use sdkclient.CheckCometError.
examples/chain/.../example.go Replaced ioutil with os for file operations; modified network parameters (from "devnet" to "testnet" with an extra parameter and updated marketId); updated transaction building to pass client.DefaultGasPrice; removed file-based tx broadcast in favor of direct broadcasting with JSON formatting.
.github/workflows/golangci-lint.yml Introduced a new workflow file to automate linting for Go projects, defining a job that runs golangci-lint on pull requests and pushes.
.github/workflows/pre-commit.yml Removed steps for installing goimports and golangci-lint from the pre-commit job.
.golangci.yml Converted configuration from JSON to YAML format, updated the skip directories, and added gofmt and goimports to the enabled linters.
.pre-commit-config.yaml Removed repository configuration for Go-related pre-commit hooks, including go-fmt, go-imports, and golangci-lint.
Makefile Added new targets for linting: lint, lint-last-commit, and lint-master, each configured to run golangci-lint with specific parameters. Updated .PHONY to include these new targets.

Possibly related PRs

Suggested reviewers

  • PavelInjective

Poem

I'm a happy rabbit, hopping through code,
With gasPrice in place, my transactions explode.
I watch as BroadcastSignedTx takes flight,
And errors are checked in a cleaner light.
In fields of SDK, I leap with delight!
🐰💻


🪧 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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: 0

🧹 Nitpick comments (1)
.github/workflows/golangci-lint.yml (1)

16-16: Consider Upgrading the Checkout Action Version

Static analysis indicates that actions/checkout@v3 may be outdated. Upgrading to a newer version (e.g., actions/checkout@v4) can improve performance and compatibility with GitHub Actions.

Apply this diff to update the version:

-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
🧰 Tools
🪛 actionlint (1.7.4)

16-16: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 402e99b and 6ef3116.

📒 Files selected for processing (4)
  • .github/workflows/golangci-lint.yml (1 hunks)
  • .github/workflows/pre-commit.yml (0 hunks)
  • .golangci.yml (1 hunks)
  • .pre-commit-config.yaml (0 hunks)
💤 Files with no reviewable changes (2)
  • .github/workflows/pre-commit.yml
  • .pre-commit-config.yaml
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/golangci-lint.yml

16-16: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (9)
.github/workflows/golangci-lint.yml (6)

1-5: Workflow Trigger Configuration Looks Good

The workflow is set to trigger on both pull requests and pushes (to the master and dev branches). This setup aligns well with standard CI practices.


6-10: Permissions Configuration is Appropriate

The permissions for repository contents and pull-requests are correctly set to read. This ensures that the workflow can access the necessary repository information without overprivileging.


11-15: Job and Environment Setup is Well Defined

The job configuration—including setting the runner to ubuntu-latest and listing the key steps for setting up Go—is clear and effective for the intended linting process.


17-21: Go Setup Action is Configured Correctly

The configuration for actions/setup-go@v5, including usage of the go-version-file and checking for the latest version, is correctly implemented.


22-32: Linting Action Configuration is Comprehensive

The use of golangci/golangci-lint-action@v6 with the provided options (version set to latest, timeout, and verbose logging) ensures a robust linting process.


33-45: Optional Cache and Working Directory Settings are Well Documented

The commented-out options for working directory and build-cache configurations provide useful guidelines for future adjustments.

.golangci.yml (3)

1-9: Lint Run Configuration is Clear and Effective

The run section specifies that tests are disabled and properly lists directories to skip—including the newly added injective_data. This looks well aligned with your project’s structure and objectives.


10-32: Linters List is Comprehensive

The enabled linters list covers a broad spectrum of code quality checks, and disabling the unused linter appears intentional. The list is well-organized and should help maintain code quality effectively.


33-50: Linters Settings are Well Tuned

The configuration for linters settings—specifically for revive (with all rules enabled and customized for variable naming) and for gocritic (with clearly defined enabled tags and disabled checks)—is clear and effective for enforcing quality standards.

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

🧹 Nitpick comments (2)
.github/workflows/golangci-lint.yml (1)

16-16: Update the Checkout Action Version

The static analysis hint indicates that the runner for actions/checkout@v3 may be outdated. Please consider upgrading this action (for example, to a later v3 release or v4 if available) to ensure compatibility and stability in the workflow.

🧰 Tools
🪛 actionlint (1.7.4)

16-16: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Makefile (1)

154-165: New Lint Targets Integration

The newly added lint targets (lint, lint-last-commit, and lint-master) are well integrated, exporting GOPROXY=direct and invoking golangci-lint with a 15-minute timeout and the appropriate reference (dev, HEAD~, or master). As a minor improvement, consider centralizing the export of GOPROXY=direct at the top level of the Makefile to adhere to the DRY principle if this variable is intended to be used across multiple targets.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 6ef3116 and b7ef16c.

📒 Files selected for processing (4)
  • .github/workflows/golangci-lint.yml (1 hunks)
  • .github/workflows/pre-commit.yml (0 hunks)
  • .golangci.yml (1 hunks)
  • Makefile (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/pre-commit.yml
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/golangci-lint.yml

16-16: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: lint
🔇 Additional comments (3)
.github/workflows/golangci-lint.yml (1)

1-15: Overall Workflow Configuration Looks Solid

The workflow is well-structured with clear steps for setting up Go and running golangci-lint with appropriate arguments (e.g., timeout, verbosity, and new issues filtering). Ensure that the versions for actions (like actions/setup-go@v5 and golangci/golangci-lint-action@v6) continue to align with our CI requirements across the project.

Also applies to: 17-39

.golangci.yml (1)

1-63: Comprehensive GolangCI Configuration

The YAML configuration for GolangCI is detailed and covers a wide array of linters with custom settings for both revive and gocritic. The update from a JSON to YAML format—with changes such as replacing skip-dirs with exclude-dirs—appears well thought out. Just verify that the selected linters and their respective settings (for example, disabling certain checks in gocritic) continue to align with our project’s coding guidelines.

Makefile (1)

166-167: Updated .PHONY Declaration

The .PHONY declaration now includes the new linting targets, ensuring they are always executed as commands rather than file references. This update is correct and improves command clarity in the Makefile.

@aarmoa aarmoa merged commit 836fa87 into master Apr 2, 2025
6 checks passed
@aarmoa aarmoa deleted the fix/fix_manual_tx_generation branch April 2, 2025 16:25
aarmoa added a commit that referenced this pull request Apr 2, 2025
* (fix) Applied the fixes for EIP712 JSON unmarshalling to the master branch

* fix: update pre-commit/action from v2.0.2 to v3.0.1 to ry to solve the pre-commit validation workflow error

* fix: Added configuration in .golangci.yml file to exclude some dirs

* fix: updated the oracle stream prices script to send the oracle type always in lowercase

* fix: updated the oracle stream prices script to send the oracle type always in lowercase

* fix: Added quantization in the functions that convert notional values to chain format

* fix/fix_manual_tx_generation (#296)

* fix: fixed the manual TX generation and signing to receive the gas price

* fix: solve issues in pre-commit workflow caused by using deprecated components

* fix: solve issues in pre-commit workflow caused by using deprecated components
aarmoa added a commit that referenced this pull request Apr 16, 2025
* feat: removed the deprecated pre-commit repo pre-commit-golang. Added new CI step to run golangci-lint using the github action

* fix: added skip directories into the golanci lint config

* fix: fixed lint errors

* fix: fixed lint errors

* feat: updated proto definitions for the chain upgrade v1.15

* fix: synced go.mod dependecnies with Injective core

* fix: fixed lint errors

* fix: fixed lint errors

* feat: updated all proto definitions for v1.15 chain upgrade. Added an example for the new GetEipBaseFee request in txfees module

* feat: updated all examples to query gas price from the chain instead of using the default value

* Feat/sync with master v1.56.2 (#298)

* (fix) Applied the fixes for EIP712 JSON unmarshalling to the master branch

* fix: update pre-commit/action from v2.0.2 to v3.0.1 to ry to solve the pre-commit validation workflow error

* fix: Added configuration in .golangci.yml file to exclude some dirs

* fix: updated the oracle stream prices script to send the oracle type always in lowercase

* fix: updated the oracle stream prices script to send the oracle type always in lowercase

* fix: Added quantization in the functions that convert notional values to chain format

* fix/fix_manual_tx_generation (#296)

* fix: fixed the manual TX generation and signing to receive the gas price

* fix: solve issues in pre-commit workflow caused by using deprecated components

* fix: solve issues in pre-commit workflow caused by using deprecated components

* feat: updated proto definitions for the chain upgrade v1.15

* (fix) Applied the fixes for EIP712 JSON unmarshalling to the master branch

* fix: updated the oracle stream prices script to send the oracle type always in lowercase

* fix: updated the oracle stream prices script to send the oracle type always in lowercase

* fix: synced go.mod dependecnies with Injective core

* fix: fixed lint errors

* fix: fixed lint errors

* feat: updated all proto definitions for v1.15 chain upgrade. Added an example for the new GetEipBaseFee request in txfees module

* feat: updated all examples to query gas price from the chain instead of using the default value

* fix: fix function parameter type

* feat: updated proto definition to v1.15.0-beta.2 and v1.14.48 for Indexer

* fix: update ofac.json file

* Improve error messaging and enhance documentation in eip712_cosmos.go (#240)

This PR improves error handling and enhances documentation in the
eip712_cosmos.go file to provide clearer messages and more detailed
explanations.

Signed-off-by: Hwangjae Lee <meetrick@gmail.com>
Co-authored-by: Abel Armoa <30988000+aarmoa@users.noreply.github.com>

* fix: fixed array creatin in a unit test (#299)

* fix: updated chain version to v1.15 and indexer version to v1.15.6

* fix: removed explicit inclusion of txfees response in the context initialization (not required)

---------

Signed-off-by: Hwangjae Lee <meetrick@gmail.com>
Co-authored-by: Hwangjae Lee <meetrick@gmail.com>
aarmoa added a commit that referenced this pull request Apr 16, 2025
* feat: removed the deprecated pre-commit repo pre-commit-golang. Added new CI step to run golangci-lint using the github action

* fix: added skip directories into the golanci lint config

* fix: fixed lint errors

* fix: fixed lint errors

* feat: updated proto definitions for the chain upgrade v1.15

* fix: synced go.mod dependecnies with Injective core

* fix: fixed lint errors

* fix: fixed lint errors

* feat: updated all proto definitions for v1.15 chain upgrade. Added an example for the new GetEipBaseFee request in txfees module

* feat: updated all examples to query gas price from the chain instead of using the default value

* Feat/sync with master v1.56.2 (#298)

* (fix) Applied the fixes for EIP712 JSON unmarshalling to the master branch

* fix: update pre-commit/action from v2.0.2 to v3.0.1 to ry to solve the pre-commit validation workflow error

* fix: Added configuration in .golangci.yml file to exclude some dirs

* fix: updated the oracle stream prices script to send the oracle type always in lowercase

* fix: updated the oracle stream prices script to send the oracle type always in lowercase

* fix: Added quantization in the functions that convert notional values to chain format

* fix/fix_manual_tx_generation (#296)

* fix: fixed the manual TX generation and signing to receive the gas price

* fix: solve issues in pre-commit workflow caused by using deprecated components

* fix: solve issues in pre-commit workflow caused by using deprecated components

* feat: updated proto definitions for the chain upgrade v1.15

* (fix) Applied the fixes for EIP712 JSON unmarshalling to the master branch

* fix: updated the oracle stream prices script to send the oracle type always in lowercase

* fix: updated the oracle stream prices script to send the oracle type always in lowercase

* fix: synced go.mod dependecnies with Injective core

* fix: fixed lint errors

* fix: fixed lint errors

* feat: updated all proto definitions for v1.15 chain upgrade. Added an example for the new GetEipBaseFee request in txfees module

* feat: updated all examples to query gas price from the chain instead of using the default value

* fix: fix function parameter type

* feat: updated proto definition to v1.15.0-beta.2 and v1.14.48 for Indexer

* fix: update ofac.json file

* Improve error messaging and enhance documentation in eip712_cosmos.go (#240)

This PR improves error handling and enhances documentation in the
eip712_cosmos.go file to provide clearer messages and more detailed
explanations.




* fix: fixed array creatin in a unit test (#299)

* fix: updated chain version to v1.15 and indexer version to v1.15.6

* fix: removed explicit inclusion of txfees response in the context initialization (not required)

---------

Signed-off-by: Hwangjae Lee <meetrick@gmail.com>
Co-authored-by: Hwangjae Lee <meetrick@gmail.com>
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.

2 participants