-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 (backport #11737) #12818
fix: Use fixed length hex for pointer at FwdCapabilityKey (backport #11737) #12818
Conversation
x/capability/types/keys.go
Outdated
// truncate the key to fixed length, keep backward compatible on common architectures. | ||
key := fmt.Sprintf("%#010p", cap) | ||
if len(key) > 10 { | ||
key = key[len(key)-10:] | ||
} | ||
return []byte(fmt.Sprintf("%s/fwd/0x%s", module, key)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this different from what we, recently, updated on main
which is
return []byte(fmt.Sprintf("%s/fwd/%#016p", module, cap))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is not breaking for common architectures, by using the same length as before, but for mac m1, it truncate the high byte, to avoid hash mismatch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But these keys are not in merkle state, so no change would be breaking AFAIK. As long as gas consumption is the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly, the gas would be different if the encoded pointer has different length, the issue is here: #11726, it seems you have participated in it too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ethermint feemarket will save the block gas used to merkle state ;D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it works, but it's a breaking one, so can't backport to old versions directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its breaking because it charges a different gas compared to what it was before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems ok given the circumstances, but it'd be nice to indicate in the code this is a temporary patch and should not be replicated. Also, I think the tests should use the two pointer values in the referenced issue
Nice work and thanks for opening up a non-breaking fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added comments and backward compatibility test.
this is related to #11726 correct? |
yes, a non-breaking backport to make mac m1 able to sync legacy chains. |
This will be included in the next 0.45 point release :) cc @marbar3778 |
…osmos#11737) (cosmos#12818) * fix: Use fixed length hex for pointer at FwdCapabilityKey (backport cosmos#11737) * Update CHANGELOG.md * add comments and unit tests
Description
ref: #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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...
!
in the type prefix if API or client breaking change