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

fix(gov): Add value decoder for attribute key "sender" #1397

Merged
merged 10 commits into from
Jan 9, 2024
Merged

Conversation

calbera
Copy link
Contributor

@calbera calbera commented Jan 8, 2024

Summary by CodeRabbit

  • New Features

    • Improved governance contract with enhanced address conversion capabilities.
    • Enhanced telemetry and metrics collection within the application for better performance monitoring.
    • Expanded Ethereum execution layer functionality with new backend integration.
  • Refactor

    • Streamlined configuration initialization for improved application setup.

Copy link

coderabbitai bot commented Jan 8, 2024

Walkthrough

The changes suggest an enhancement in the governance and monitoring capabilities of a blockchain system. A method for converting account addresses from strings has been added to the governance precompile logic. Additionally, the configuration for the end-to-end test application now enables Prometheus metrics and telemetry with a memory sink for metrics. On the Ethereum integration side, new methods have been introduced to access the backend and networking stack of the execution layer, indicating an increased focus on interfacing with Ethereum-like blockchain components.

Changes

File Path Change Summary
cosmos/precompile/governance/... Added ConvertAccAddressFromString method; updated CustomValueDecoders
e2e/testapp/polard/cmd/... Enabled Prometheus and telemetry in configuration
eth/eth.go Added Backend() and Stack() methods to ExecutionLayer
eth/polar/backend.go Added APIBackend method to Polaris
cosmos/precompile/governance/governance_test.go Increased expected length of custom value decoders

Poem

🐰✨
In the cosmos, a rabbit hopped, code in tow,
Telemetry awakes, metrics in a row.
Governance refined, Ethereum's embrace,
A blockchain dance, in cyberspace. 🚀🌌

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0ec98f5 and 871b630.
Files selected for processing (4)
  • cosmos/precompile/governance/governance.go (2 hunks)
  • e2e/testapp/polard/cmd/commands.go (3 hunks)
  • eth/eth.go (1 hunks)
  • eth/polar/backend.go (1 hunks)
Additional comments: 7
eth/eth.go (2)
  • 186-188: The addition of the Backend() method to the ExecutionLayer struct is straightforward and provides access to the underlying Polaris object. This seems to be a utility function for internal use and does not appear to introduce any immediate issues.

  • 190-192: Similarly, the Stack() method provides access to the NetworkingStack object. This method is also straightforward and does not introduce any issues. It's important to ensure that the NetworkingStack object is intended to be exposed in this manner.

eth/polar/backend.go (1)
  • 224-226: The APIBackend() method has been added to the Polaris struct to expose the apiBackend field. This change is consistent with the pattern of providing accessor methods for internal fields and does not seem to introduce any issues. However, it's important to ensure that exposing this field is safe and intended, as it could potentially be used in a way that affects the system's behavior.
e2e/testapp/polard/cmd/commands.go (2)
  • 65-65: Enabling Prometheus in the initCometBFTConfig function is a common practice for monitoring and observability purposes. This change aligns with the PR objectives to enhance monitoring capabilities.

  • 103-105: The changes in the initAppConfig function to enable telemetry and set the metrics sink to "mem" are also in line with the PR's objectives to improve observability. It's important to ensure that these settings are appropriate for the test application's environment and that the "mem" sink is a suitable choice for the intended use case.

cosmos/precompile/governance/governance.go (2)
  • 569-574: The new method ConvertAccAddressFromString correctly uses the cosmlib.EthAddressFromString function to convert a Cosmos account address from a string to an Ethereum common.Address. This is consistent with the PR's objective to decode the "sender" attribute key.

Ensure that the attributeValue passed to this method is always a valid Cosmos account address string to prevent potential errors during the conversion process.

  • 85-85: The integration of ConvertAccAddressFromString into the CustomValueDecoders method is done correctly. It is mapped to the sdk.AttributeKeySender, which aligns with the PR's objective to handle the conversion of the "sender" attribute key.

Ensure that the rest of the codebase is updated to use this new decoder where necessary, and that it is tested thoroughly to handle all expected input formats.

@calbera
Copy link
Contributor Author

calbera commented Jan 8, 2024

Closing in favor of #1396

@calbera calbera closed this Jan 8, 2024
@calbera calbera reopened this Jan 9, 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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 871b630 and e520aeb.
Files selected for processing (1)
  • cosmos/precompile/governance/governance_test.go (1 hunks)
Additional comments: 1
cosmos/precompile/governance/governance_test.go (1)
  • 110-110: The change in the expected length of custom value decoders from 2 to 3 is noted. This is likely due to the addition of a new decoder for the "sender" attribute key as mentioned in the PR objectives. Ensure that the new decoder is correctly implemented and tested.

Copy link

codecov bot commented Jan 9, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (44fbc24) 48.25% compared to head (e520aeb) 48.23%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1397      +/-   ##
==========================================
- Coverage   48.25%   48.23%   -0.02%     
==========================================
  Files          84       84              
  Lines        4965     4969       +4     
==========================================
+ Hits         2396     2397       +1     
- Misses       2392     2395       +3     
  Partials      177      177              
Files Coverage Δ
cosmos/precompile/governance/governance.go 72.57% <25.00%> (-0.55%) ⬇️

@calbera calbera merged commit 0855077 into main Jan 9, 2024
11 of 14 checks passed
@calbera calbera deleted the gov-value-decoder branch January 9, 2024 16:01
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.

None yet

3 participants