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!: SlashAcks api change #1163

Closed
wants to merge 10 commits into from
Closed

Fix!: SlashAcks api change #1163

wants to merge 10 commits into from

Conversation

yaruwangway
Copy link
Contributor

Description

Closes: #728

Remove invalid todos.


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
  • Targeted the correct branch (see PR Targeting)
  • Provided a link to the relevant issue 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 all author checklist items have been addressed
  • Confirmed that this PR does not change production code

@yaruwangway yaruwangway requested a review from a team as a code owner July 20, 2023 10:18
@yaruwangway
Copy link
Contributor Author

Hi @smarshall-spitzbart, if you can have a look if this is correct ? Thank you!

x/ccv/provider/keeper/keeper.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/keeper.go Outdated Show resolved Hide resolved
@yaruwangway yaruwangway marked this pull request as draft July 21, 2023 15:32
@yaruwangway yaruwangway changed the title chore: remove invalid todos Fix!: remove invalid todos Jul 21, 2023
@yaruwangway yaruwangway changed the title Fix!: remove invalid todos Fix!: SlashAcks api change Jul 21, 2023
@yaruwangway
Copy link
Contributor Author

the api change will convert will deal with the covertion consumerConsAddr <-> consumerConsAddr.String()

k.AppendSlashAck(ctx, chainID, consumerConsAddr.String())

consAddresses := []types.ConsumerConsAddress{}
for _, address := range addresses {
// reverse of ConsumerConsAddress.String()
consAddr, err := sdk.ConsAddressFromBech32(address)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if someone can help confirmsdk.ConsAddressFromBech32() is the reverse of ConsumerConsAddress.String() ?

Copy link
Contributor

Choose a reason for hiding this comment

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

see how consumer handles this

for _, addr := range newChanges.GetSlashAcks() {
. Although I'm not sure that we need to add the complexity of converting these types back and forth so much


acks, err := StrToConsumerConsAddresses(addresses)
if err != nil {
// todo
Copy link
Contributor Author

Choose a reason for hiding this comment

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

shall return err ? if yes, where to deal with the err ? @smarshall-spitzbart

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say pattern match other places in the repo that panic or return upon error. See above on how consumer does this

Copy link
Contributor

@shaspitz shaspitz left a comment

Choose a reason for hiding this comment

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

I'd say we should do one of the two following solutions:

  • Only change API of the append function and keep everything else as strings. This is most simple, avoids state migration, but doesn't add much type safety. This solution is just fine if you wanna take this route.
  • Store slash acks as the cons addr type, adjust APIs accordingly, only convert to strings one time when the slash acks are about to be sent over wire. This would require migration as it's state breaking

We should avoid converting slash acks back and forth in-mem as that adds unneeded complexity

@shaspitz
Copy link
Contributor

shaspitz commented Aug 9, 2023

Hey these changes have started to look like more work than we thought, lets just close the issue and call it good

@shaspitz shaspitz closed this Aug 9, 2023
@shaspitz shaspitz deleted the chore-remove-todo branch August 9, 2023 18:08
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.

SlashAcks should not be persisted as string
2 participants