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

chore!: bump poa module to d321226 #87

Merged
merged 6 commits into from
Aug 6, 2024

Conversation

fmorency
Copy link
Collaborator

@fmorency fmorency commented Aug 5, 2024

  • POA params were removed in d321226
  • GetPoAAdmin() now returns the x/gov module address if POA_ADMIN_ADDRESS is not set
  • Fix tests, parameters, and documentation to reflect the update

Fixes #21

Summary by CodeRabbit

  • Documentation

    • Removed the "Update Parameters (update-params)" section from documentation, streamlining the content.
    • Updated the README.md to reflect the removal of references to PoA administrators in genesis file descriptions.
  • New Features

    • Improved flexibility in retrieving PoA admin addresses during application initialization.
    • Enhanced testing environment by dynamically setting the POA admin address.
  • Configuration Changes

    • Significant adjustments to economic parameters in genesis.json, including setting community tax and inflation to zero.
    • Removed specific PoA parameters and admin configurations from scripts and configuration files.
  • Bug Fixes

    • Improved robustness of the testing environment by ensuring valid admin addresses are set during tests.

- POA params were removed in `d321226`
- `GetPoAAdmin()` now panics if `POA_ADMIN_ADDRESS` is not set
- Fix tests, parameters and documentation to reflect the update
@fmorency fmorency marked this pull request as ready for review August 5, 2024 18:25
@fmorency fmorency requested a review from Reecepbcups August 5, 2024 18:25
Copy link

codecov bot commented Aug 5, 2024

Codecov Report

Attention: Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.

Project coverage is 76.74%. Comparing base (3cf0ed1) to head (55ce29c).

Files Patch % Lines
app/app.go 57.14% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #87      +/-   ##
==========================================
- Coverage   77.20%   76.74%   -0.46%     
==========================================
  Files          34       34              
  Lines        1794     1802       +8     
==========================================
- Hits         1385     1383       -2     
- Misses        320      327       +7     
- Partials       89       92       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

interchaintest/go.mod Outdated Show resolved Hide resolved
app/app.go Outdated Show resolved Hide resolved
app/app.go Show resolved Hide resolved
interchaintest/poa_group_test.go Show resolved Hide resolved
Copy link

coderabbitai bot commented Aug 6, 2024

Walkthrough

The recent changes streamline the blockchain application by removing hardcoded parameters for Proof of Authority (PoA) administrators, enhancing dynamic address retrieval, and updating module dependencies. The documentation is refined by eliminating outdated sections, while financial parameters in the genesis configuration are reset, indicating a shift towards a simpler governance model.

Changes

File Change Summary
MODULE.md, network/manifest-1/README.md Removed references to PoA administrators and simplified documentation.
app/app.go Updated GetPoAAdmin to retrieve the governance module address dynamically, removing hardcoding.
app/test_helpers.go, interchaintest/setup.go Enhanced setup to ensure valid PoA admin address is configured for tests.
chains/chain.json Removed the PoA administrators configuration from JSON, indicating a governance model shift.
go.mod, interchaintest/go.mod Updated and removed older dependencies, enhancing stability and compatibility.
network/manifest-1/genesis.json, network/manifest-1/set-genesis-params.sh Reset financial parameters to zero and removed PoA admin settings, indicating a new economic model.
interchaintest/poa_group_test.go Removed PoA-related test functions to simplify the test suite.

Assessment against linked issues

Objective Addressed Explanation
Remove the hardcoded PoA admin address (#21)
Initialize PoA admins from the genesis file (#21) The removal of PoA admin settings means they are not initialized from genesis.
Document the use of POA_ADMIN_ADDRESS (#21) The changes do not clarify this environment variable's role in the documentation.

🐇 Hop, skip, and jump through the code,
With each little change, our logic has flowed.
No more hardcoded paths, oh what a delight,
A dynamic dance, our future is bright!
So cheer for the changes, let’s twirl with glee,
In the world of PoA, we’re forever free! 🌟


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 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 Configuration 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.

@fmorency fmorency requested a review from Reecepbcups August 6, 2024 12:12
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 3cf0ed1 and 5809aea.

Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • interchaintest/go.sum is excluded by !**/*.sum
Files selected for processing (13)
  • MODULE.md (2 hunks)
  • app/app.go (2 hunks)
  • app/test_helpers.go (2 hunks)
  • chains/chain.json (1 hunks)
  • go.mod (4 hunks)
  • interchaintest/go.mod (4 hunks)
  • interchaintest/mainfest_test.go (1 hunks)
  • interchaintest/poa_group_test.go (8 hunks)
  • interchaintest/setup.go (4 hunks)
  • network/manifest-1/README.md (1 hunks)
  • network/manifest-1/genesis.json (2 hunks)
  • network/manifest-1/set-genesis-params.sh (1 hunks)
  • scripts/test_node.sh (2 hunks)
Files skipped from review due to trivial changes (3)
  • MODULE.md
  • interchaintest/mainfest_test.go
  • network/manifest-1/README.md
Additional comments not posted (30)
chains/chain.json (1)

Line range hint 1-1:
Verify the new governance model after the removal of the "admins" key.

The removal of the "app_state.poa.params.admins" key simplifies the configuration. Ensure that the new governance model is well-documented and tested.

interchaintest/setup.go (2)

4-5: Import fmt is necessary for formatted I/O operations.

The addition of the fmt package is necessary for using fmt.Sprintf.


60-62: Dynamic configuration of POA_ADMIN_ADDRESS improves flexibility.

The addition of fmt.Sprintf("POA_ADMIN_ADDRESS=%s", accAddr) to the Env slice allows for dynamic configuration of the PoA admin address, improving flexibility.

network/manifest-1/set-genesis-params.sh (1)

Line range hint 1-1:
Verify the new governance model after the removal of the "admins" parameter.

The removal of the "admins" parameter from the "poa" section simplifies the genesis configuration. Ensure that the new governance model is well-documented and tested.

network/manifest-1/genesis.json (8)

48-48: LGTM! Community tax set to zero.

The change aligns with the objective of simplifying the economic model.


192-192: LGTM! Inflation set to zero.

The change eliminates inflation in the token supply, aligning with the objective of removing inflationary mechanisms.


196-196: LGTM! Mint denomination set to "notused".

The change indicates that the previous denomination is no longer applicable.


197-197: LGTM! Inflation rate change set to zero.

The change aligns with the objective of removing inflationary mechanisms.


198-198: LGTM! Inflation max set to zero.

The change aligns with the objective of removing inflationary mechanisms.


199-199: LGTM! Inflation min set to zero.

The change aligns with the objective of removing inflationary mechanisms.


210-210: LGTM! Slash fraction for double sign set to zero.

The change removes penalties for double signing, aligning with the objective of simplifying the governance model.


211-211: LGTM! Slash fraction for downtime set to zero.

The change removes penalties for downtime, aligning with the objective of simplifying the governance model.

scripts/test_node.sh (2)

6-6: LGTM! Updated command-line arguments.

The change suggests a shift in the configuration for running the script, potentially indicating a different environment or setup for testing.


6-6: LGTM! Removed outdated POA configuration comment.

The removal of this comment implies that the POA configuration is no longer relevant or necessary in the current context of the script.

go.mod (8)

25-25: LGTM! Updated cosmossdk.io/depinject to stable version.

The change reflects a move away from alpha releases to a stable version.


50-50: LGTM! Updated github.com/strangelove-ventures/poa.

The change aligns with the PR objective of bumping the POA module to the specified commit.


55-55: LGTM! Updated google.golang.org/protobuf.

The change ensures compatibility and stability by updating to the latest version.


202-202: LGTM! Updated golang.org/x/crypto.

The change ensures compatibility and stability by updating to the latest version.


204-204: LGTM! Updated golang.org/x/net.

The change ensures compatibility and stability by updating to the latest version.


207-207: LGTM! Updated golang.org/x/sys.

The change ensures compatibility and stability by updating to the latest version.


208-208: LGTM! Updated golang.org/x/term.

The change ensures compatibility and stability by updating to the latest version.


209-209: LGTM! Updated golang.org/x/text.

The change ensures compatibility and stability by updating to the latest version.

app/test_helpers.go (2)

40-40: LGTM!

The new import statement for testdata from the Cosmos SDK test utilities is appropriate.


183-189: LGTM! But verify the environment variable setting.

The changes in the setup function ensure that a valid POA admin address is always available during tests, improving the robustness of the testing environment.

However, ensure that the environment variable POA_ADMIN_ADDRESS is correctly set and handled throughout the codebase.

Verification successful

Environment Variable Handling Verified

The POA_ADMIN_ADDRESS environment variable is correctly set and handled throughout the codebase. The variable is consistently set in test setups and configurations, and it is checked to return the admin address where needed.

  • interchaintest/setup.go: Set in local chain environment configuration.
  • interchaintest/poa_group_test.go: Set in test group environment configuration.
  • app/app.go: Checked in the GetPoAAdmin function.
  • app/test_helpers.go: Set if not already set during test setup.
  • app/sim_test.go: Set in the setPOAAdmin function for simulation tests.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `POA_ADMIN_ADDRESS` environment variable in the codebase.

# Test: Search for the usage of the `POA_ADMIN_ADDRESS` environment variable. Expect: Correct handling of the environment variable.
rg --type go 'POA_ADMIN_ADDRESS'

Length of output: 688


Script:

#!/bin/bash
# Description: Gather context around the usage of the `POA_ADMIN_ADDRESS` environment variable in the codebase.

# Get context for each file where `POA_ADMIN_ADDRESS` is used
files=(
  "interchaintest/setup.go"
  "interchaintest/poa_group_test.go"
  "app/app.go"
  "app/test_helpers.go"
  "app/sim_test.go"
)

for file in "${files[@]}"; do
  echo "File: $file"
  rg --type go --context 10 'POA_ADMIN_ADDRESS' "$file"
  echo "----------------------------------------"
done

Length of output: 4758

interchaintest/go.mod (3)

27-27: LGTM!

The update to the poa module version is appropriate and aligns with the PR objectives.


43-43: LGTM!

The update to the cosmossdk.io/depinject version from v1.0.0-alpha.4 to v1.0.0 is appropriate and aligns with the PR objectives.


241-255: LGTM!

The updates to the versions of golang.org/x/crypto, golang.org/x/net, golang.org/x/sys, golang.org/x/term, and google.golang.org/genproto/googleapis/rpc are appropriate and align with the PR objectives.

interchaintest/poa_group_test.go (1)

116-116: LGTM! But verify the core functionalities are still tested adequately.

The removal of functions and variables related to POA parameters simplifies the test suite.

However, ensure that the core functionalities are still tested adequately.

Verification successful

Core functionalities are still tested adequately.

The test functions present in interchaintest/poa_group_test.go cover a wide range of core functionalities, including software upgrades, stakeholder payouts, bank sends (both legal and illegal), and token operations. The removal of POA-specific parameters does not seem to have compromised the comprehensiveness of the tests.

  • testSoftwareUpgrade
  • testManifestStakeholdersPayout
  • testBankSend
  • testBankSendIllegal
  • testTokenCreate
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the core functionalities are still tested adequately.

# Test: Search for the remaining test functions. Expect: Adequate test coverage for core functionalities.
rg --type go 'func test' interchaintest/poa_group_test.go

Length of output: 709


Script:

#!/bin/bash
# Extract the bodies of the test functions to review their comprehensiveness
ast-grep --lang go --pattern 'func $_($_, $_, $_, $_, $_) { $$$ }' interchaintest/poa_group_test.go

Length of output: 13230

app/app.go (2)

143-150: Verify the function usage in the codebase.

Ensure that all function calls to GetPoAAdmin are consistent with the new implementation.

Verification successful

Verify the function usage in the codebase.

The function GetPoAAdmin is used multiple times in the app/app.go file, and each usage appears consistent with the new implementation. No issues were found with the function usage.

  • File: app/app.go
    • Lines: Multiple instances where GetPoAAdmin is called.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `GetPoAAdmin` are consistent with the new implementation.

# Test: Search for the function usage. Expect: Only occurrences of the new implementation.
rg --type go -A 5 $'GetPoAAdmin'

Length of output: 4755


441-441: Verify the function usage in the codebase.

Ensure that all function calls to GetPoAAdmin are consistent with the new implementation.

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 5809aea and 55ce29c.

Files selected for processing (1)
  • app/app.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/app.go

@fmorency
Copy link
Collaborator Author

fmorency commented Aug 6, 2024

ictest-manifest fails because of docker hub "too many request". I confirm it passes locally.

@fmorency fmorency merged commit 522bb0a into liftedinit:main Aug 6, 2024
14 of 16 checks passed
@fmorency fmorency deleted the poa-rm-params branch August 6, 2024 14:11
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.

Hardcoded PoA admin
2 participants