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: changes to sdk for interchain security #15917

Closed
wants to merge 3 commits into from

Conversation

faddat
Copy link
Contributor

@faddat faddat commented Apr 24, 2023

Description

This is a review PR that I will leave as draft, and the sdk team is free to close. It has been made to create a record that these are the changes that we are requesting that informal systems review, to provide feedback on the best way to handle or not.

If the SDK team wishes to share their opinion on the matter, here's the relevant PR to interchain security:

Reviews of this work are greatly appreciated. We have been requesting feedback from informal on the matter of weather or not ICS is sdk47 compatible since March 23, 2023. So far, we have gotten the responses NO and YES. We'd like to establish a clear answer, so that work on 47 can proceed smoothly, and we are able to advise would-be consumer chains as to the correct path forward.


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
  • 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)

effectiveFraction = math.LegacyOneDec()
}
// call the before-slashed hook
k.hooks.BeforeValidatorSlashed(ctx, operatorAddress, effectiveFraction)

Check warning

Code scanning / gosec

Errors unhandled.

Errors unhandled.
operatorAddress := validator.GetOperator()

// call the before-modification hook
k.hooks.BeforeValidatorModified(ctx, operatorAddress)

Check warning

Code scanning / gosec

Errors unhandled.

Errors unhandled.
@faddat faddat changed the title fix: changes to ics for interchain security fix: changes to sdk for interchain security Apr 24, 2023
@julienrbrt
Copy link
Member

Thanks for this PR. Due to your previous one, Informal opened a PR with the changes needed for ICS: #15908.
We are currently reviewing them.

@@ -61,7 +61,7 @@ type ValidatorSet interface {
StakingTokenSupply(sdk.Context) math.Int // total staking token supply

// slash the validator and delegators of the validator, specifying offence height, offence power, and slash fraction
Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec) math.Int
Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec, Infraction)
SlashWithInfractionReason(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec, Infraction) math.Int
Copy link
Member

Choose a reason for hiding this comment

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

So, v0.45.x-ics did have a breaking change in Slash, but in v0.47 we decided not to break the API for users, hence the SlashWithInfractionReason.

Copy link
Member

Choose a reason for hiding this comment

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

@vuong177 hey can you check this out, can we move the slash func for consumer keeper to SlashWithInfractionReason

@@ -16,9 +15,6 @@ func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr cryptotypes.Addre

// fetch the validator public key
consAddr := sdk.ConsAddress(addr)
if _, err := k.GetPubkey(ctx, addr); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

See #15908

@@ -367,11 +367,6 @@ func (m *Manager) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, genesisData
}
}

// a chain must initialize with a non-empty validator set
Copy link
Member

Choose a reason for hiding this comment

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

This was added in v0.46 (so it is normal it isn't on v0.45.x and v0.45.x-ics). Could you please tell us which issues you are facing with it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I cannot, but @vuong177 can. He is the person who identified this stuff.

Copy link
Member

Choose a reason for hiding this comment

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

so the consumer app doesn't have a valset because it operate on the provider chain valset, so any time consumer app init genesis the valset check will always return an error

Copy link
Member

@julienrbrt julienrbrt Apr 24, 2023

Choose a reason for hiding this comment

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

I am not that familiar with ICS codebase, but this makes sense.
Have you investigated if the consumer app could recover the panic? I know this isn't ideal, but this is a UX improvement for all but consumer chains.

@faddat

This comment was marked as off-topic.

@julienrbrt

This comment was marked as off-topic.

@faddat

This comment was marked as off-topic.

@faddat faddat mentioned this pull request Apr 24, 2023
9 tasks
@jtremback

This comment was marked as off-topic.

@faddat

This comment was marked as off-topic.

@faddat faddat marked this pull request as ready for review April 25, 2023 02:48
@faddat faddat requested a review from a team as a code owner April 25, 2023 02:48
@faddat

This comment was marked as off-topic.

@faddat

This comment was marked as off-topic.

Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

As you've just opened the PR, the target branch will need to be main. Could you change that?

@julienrbrt

This comment was marked as off-topic.

@faddat
Copy link
Contributor Author

faddat commented Apr 25, 2023

@julienrbrt yep absoutely. I'm finishing up with that right now.

It is... sir this all makes me sad sir.

@julienrbrt julienrbrt mentioned this pull request Apr 25, 2023
19 tasks
@julienrbrt
Copy link
Member

Thank you for opening a PR targeting main (#15944).
I am going to close this one, so we can continue the review in the other one.

@julienrbrt julienrbrt closed this Apr 25, 2023
@faddat
Copy link
Contributor Author

faddat commented Apr 25, 2023

Absolutely. Sorry I actually thought that I had closed. No worries.

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.

5 participants