Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

chore(gov): Convert uint8[] to bytes for Message value bz #1211

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

calbera
Copy link
Contributor

@calbera calbera commented Oct 10, 2023

Summary by CodeRabbit

  • Refactor: Updated the CosmosCodecAny and CosmosCoin structs, replacing []uint8 with []byte for the Value field to align with functional usage in Cosmos SDK.
  • Refactor: Updated the ABI definition for the GovernanceModule contract, replacing uint8[] with bytes in the getProposal and getProposals functions.
  • Refactor: Updated the decodeProposalMessages function to handle different types using reflection.
  • Chore: Updated the code generation tool version from v2.35.2 to v2.35.3 across multiple files.
  • Chore: Added build constraints for the rlpgen tool in transaction.rlpgen.go.

@coderabbitai
Copy link

coderabbitai bot commented Oct 10, 2023

Walkthrough

The changes primarily involve the replacement of []uint8 with []byte in various structs and function signatures across the codebase. Additionally, there are updates to the ABI and bytecode of several contracts, and the code generation tool version has been updated in multiple files.

Changes

File(s) Summary
contracts/bindings/cosmos/.../cosmos_types.abigen.go, contracts/bindings/cosmos/.../i_governance_module.abigen.go, cosmos/lib/conversions.go, contracts/src/cosmos/CosmosTypes.sol Replaced []uint8 with []byte in various structs and function signatures.
contracts/bindings/testing/.../consume_gas.abigen.go, contracts/bindings/testing/.../distribution_testing_helper.abigen.go, contracts/bindings/testing/.../precompile_constructor.abigen.go, contracts/bindings/testing/.../solmate_erc20.abigen.go Updated the ABI and bytecode of several contracts.
cosmos/config/mocks/app_options.go, cosmos/txpool/mocks/..., eth/core/state/journal/mocks/..., eth/core/state/mocks/... Updated the code generation tool version from v2.35.2 to v2.35.3.
eth/core/types/transaction.rlpgen.go Added build constraints for the rlpgen tool.

🐇
"In the land of code, where the shadows lie,
A rabbit hopped, with a twinkle in its eye.
Byte arrays transformed, in a magical dance,
Contracts evolved, given a new chance.
Tools were updated, with a version so new,
Constraints were added, for the chosen few.
Celebrate these changes, for they're not in vain,
In the realm of code, there's no loss, only gain." 🎉


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • Mention @coderabbitai in any review comment for bot assistance.
  • Note: Review comments are made on code diffs or files, not on the PR overview.

Pause Incremental Reviews

  • Insert @coderabbitai: ignore in the PR description to halt the bot's ongoing reviews. Remove the line to resume.
  • Additionally, enter @coderabbitai pause to halt the bot's ongoing reviews as any issue or review comment. To
    resume reviews, enter @coderabbitai resume as any issue or review comment.

@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

Merging #1211 (3ea4566) into main (96e1b88) will not change coverage.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1211   +/-   ##
=======================================
  Coverage   51.32%   51.32%           
=======================================
  Files          82       82           
  Lines        4828     4828           
=======================================
  Hits         2478     2478           
  Misses       2177     2177           
  Partials      173      173           
Files Coverage Δ
cosmos/lib/conversions.go 0.00% <0.00%> (ø)

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

Commits Files that changed from the base of the PR and between 96e1b88 and 3ea4566.
Files selected for processing (28)
  • contracts/bindings/cosmos/lib/cosmos_types.abigen.go (4 hunks)
  • contracts/bindings/cosmos/precompile/governance/i_governance_module.abigen.go (7 hunks)
  • contracts/bindings/testing/consume_gas.abigen.go (1 hunks)
  • contracts/bindings/testing/distribution_testing_helper.abigen.go (1 hunks)
  • contracts/bindings/testing/governance/governance_wrapper.abigen.go (6 hunks)
  • contracts/bindings/testing/liquid_staking.abigen.go (1 hunks)
  • contracts/bindings/testing/precompile_constructor.abigen.go (1 hunks)
  • contracts/bindings/testing/solmate_erc20.abigen.go (1 hunks)
  • contracts/src/cosmos/CosmosTypes.sol (1 hunks)
  • cosmos/config/mocks/app_options.go (1 hunks)
  • cosmos/lib/conversions.go (1 hunks)
  • cosmos/txpool/mocks/geth_tx_pool.go (1 hunks)
  • cosmos/txpool/mocks/lifecycle.go (1 hunks)
  • cosmos/txpool/mocks/sdk_tx.go (1 hunks)
  • cosmos/txpool/mocks/subscription.go (1 hunks)
  • cosmos/txpool/mocks/tx_broadcaster.go (1 hunks)
  • cosmos/txpool/mocks/tx_serializer.go (1 hunks)
  • cosmos/txpool/mocks/tx_sub_provider.go (1 hunks)
  • eth/core/state/journal/mocks/accesslist.go (1 hunks)
  • eth/core/state/journal/mocks/log.go (1 hunks)
  • eth/core/state/journal/mocks/refund.go (1 hunks)
  • eth/core/state/journal/mocks/self_destruct_state_plugin.go (1 hunks)
  • eth/core/state/journal/mocks/self_destructs.go (1 hunks)
  • eth/core/state/journal/mocks/transient_storage.go (1 hunks)
  • eth/core/state/mocks/plugin.go (1 hunks)
  • eth/core/state/mocks/polar_state_db.go (1 hunks)
  • eth/core/state/mocks/precompile_plugin.go (1 hunks)
  • eth/core/types/transaction.rlpgen.go (1 hunks)
Files not summarized due to errors (2)
  • contracts/bindings/testing/governance/governance_wrapper.abigen.go: Error: Message exceeds token limit
  • contracts/bindings/testing/liquid_staking.abigen.go: Error: Message exceeds token limit
Files skipped from review due to trivial changes (24)
  • contracts/bindings/cosmos/precompile/governance/i_governance_module.abigen.go
  • contracts/bindings/testing/consume_gas.abigen.go
  • contracts/bindings/testing/precompile_constructor.abigen.go
  • contracts/bindings/testing/solmate_erc20.abigen.go
  • contracts/src/cosmos/CosmosTypes.sol
  • cosmos/config/mocks/app_options.go
  • cosmos/txpool/mocks/geth_tx_pool.go
  • cosmos/txpool/mocks/lifecycle.go
  • cosmos/txpool/mocks/sdk_tx.go
  • cosmos/txpool/mocks/subscription.go
  • cosmos/txpool/mocks/tx_broadcaster.go
  • cosmos/txpool/mocks/tx_serializer.go
  • cosmos/txpool/mocks/tx_sub_provider.go
  • eth/core/state/journal/mocks/accesslist.go
  • eth/core/state/journal/mocks/log.go
  • eth/core/state/journal/mocks/refund.go
  • eth/core/state/journal/mocks/self_destruct_state_plugin.go
  • eth/core/state/journal/mocks/self_destructs.go
  • eth/core/state/journal/mocks/transient_storage.go
  • eth/core/state/mocks/plugin.go
  • eth/core/state/mocks/polar_state_db.go
  • eth/core/state/mocks/precompile_plugin.go
  • eth/core/types/transaction.rlpgen.go
  • contracts/bindings/testing/liquid_staking.abigen.go (diff too large)
Additional comments (Suppressed): 7
contracts/bindings/testing/distribution_testing_helper.abigen.go (1)
  • 34-36: The ABI and bytecode of the DistributionWrapper contract have been updated. Ensure that these changes are compatible with the rest of the system and that all dependencies have been updated accordingly. Also, verify that the new ABI and bytecode have been thoroughly tested.
contracts/bindings/testing/governance/governance_wrapper.abigen.go (1)
  • 32-36: The type of Value field in CosmosCodecAny struct has been changed from []uint8 to []byte. Ensure that this change doesn't break any existing functionality where CosmosCodecAny is used. Also, verify that the new type []byte is handled correctly in all the places where this struct is used.
cosmos/lib/conversions.go (1)
  • 362-362: The Value field in the CosmosCodecAny struct has been changed from []uint8 to []byte. This change is reflected in the decodeProposalMessages function. Ensure that this change does not affect the rest of the codebase where this function is used or where the CosmosCodecAny struct is expected to have a Value field of type []uint8.
contracts/bindings/cosmos/lib/cosmos_types.abigen.go (4)
  • 35-35: The data type of the Value field in the CosmosCodecAny struct has been changed from []uint8 to []byte. Ensure that this change is compatible with the rest of your codebase and that all instances of CosmosCodecAny have been updated accordingly.

  • 61-63: The ABI and bytecode in the CosmosTypesMetaData have been updated. The internalType of the value field in the CodecAny function has been changed from uint8[] to bytes. Ensure that these changes are reflected in your smart contract on the Ethereum network.

  • 232-237: The CodecAny function has been updated to reflect the changes in the CosmosCodecAny struct and the CosmosTypesMetaData. Ensure that all calls to this function have been updated to match the new signature.

  • 247-259: The CodecAny function in the CosmosTypesSession and CosmosTypesCallerSession structs has been updated to reflect the changes in the CosmosCodecAny struct and the CosmosTypesMetaData. Ensure that all calls to this function have been updated to match the new signature.

cosmos/lib/conversions.go Show resolved Hide resolved
@calbera calbera merged commit 63876cd into main Oct 10, 2023
14 checks passed
@calbera calbera deleted the cal/gov-msg-bytes branch October 10, 2023 15:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants