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: Use fixed length hex for pointer at FwdCapabilityKey #11737

Merged
merged 2 commits into from
Apr 25, 2022
Merged

fix: Use fixed length hex for pointer at FwdCapabilityKey #11737

merged 2 commits into from
Apr 25, 2022

Conversation

facundomedica
Copy link
Member

Description

Use %#016p instead of %p to standardize across architectures. This will pad pointer addresses up to 16 chars (enough to do MaxUint64) and will remove the leading 0x in an effort to reduce the gas usage impact (so in the end we are only adding 3 bytes instead of 5).

0x14000cf4330 <- 13 bytes (old)
0000014000cf4330 <- 16 bytes (new)
0x0000014000cf4330 <- 18 bytes (what new would look like without #)

Closes: #11726


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change <- This IS a breaking change right?
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

cc @marbar3778 @alexanderbez @ValarDragon

Copy link
Contributor

@ValarDragon ValarDragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! We have discussion in the issue for better longer term solutions (one of which seems like it may be simple if we understand correctly), but I see no reason to block this which is clearly correct and solves the immediate bug

@codecov
Copy link

codecov bot commented Apr 24, 2022

Codecov Report

Merging #11737 (798c67e) into main (a8b3602) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #11737      +/-   ##
==========================================
+ Coverage   66.00%   66.02%   +0.02%     
==========================================
  Files         668      668              
  Lines       70695    70695              
==========================================
+ Hits        46659    46676      +17     
+ Misses      21345    21328      -17     
  Partials     2691     2691              
Impacted Files Coverage Δ
x/capability/types/keys.go 100.00% <100.00%> (ø)
x/group/keeper/keeper.go 53.36% <0.00%> (-0.43%) ⬇️
x/distribution/simulation/operations.go 90.27% <0.00%> (+9.72%) ⬆️

@julienrbrt julienrbrt merged commit dc98d7b into cosmos:main Apr 25, 2022
@alexanderbez
Copy link
Contributor

@AdityaSripal should this be backported to current releases (0.44.x, 0.45.x, 0.46.x)? This isn't state breaking AFAIk, as nodes can just restart safely.

@facundomedica
Copy link
Member Author

@alexanderbez given that this changes the amount of gas used, and that gets used to calculate a hash that gets stored, maybe it is state breaking?

@alexanderbez
Copy link
Contributor

Right...I forgot that happened, which is unfortunate. Why we charge gas for memory-based operations is questionable.

facundomedica added a commit that referenced this pull request May 4, 2022
yihuang added a commit to yihuang/cosmos-sdk that referenced this pull request Aug 4, 2022
alexanderbez pushed a commit that referenced this pull request Aug 9, 2022
…11737) (#12818)

* fix: Use fixed length hex for pointer at FwdCapabilityKey (backport #11737)

* Update CHANGELOG.md

* add comments and unit tests
JeancarloBarrios pushed a commit to agoric-labs/cosmos-sdk that referenced this pull request Sep 28, 2024
…osmos#11737) (cosmos#12818)

* fix: Use fixed length hex for pointer at FwdCapabilityKey (backport cosmos#11737)

* Update CHANGELOG.md

* add comments and unit tests
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.

bug: Can't sync darwin-arm64 after creating IBC channel (different gas used / pointer addresses are different)
5 participants