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

feat(sequencer): conditional unbonding + kick for liveness #1343

Merged
merged 289 commits into from
Nov 5, 2024

Conversation

danwt
Copy link
Contributor

@danwt danwt commented Oct 23, 2024

Description

features:

changes needed:

  • x/rollapp
    • unbond cond rollapp state infos
      • prune
      • bookkeeping
      • condition
      • test prune
      • test bookkeeping
      • test condition
      • wiring to app
    • liveness
      • logic
      • test
      • params
      • params validation
      • params validation test
    • kick hook
      • logic
      • test
    • proposer change hook
      • logic
      • test
  • x/sequencer
    • kick proposer
      • msg
      • validations
      • logic
      • test
      • cli
      • hook to rollapp keeper
      • hook wiring
      • param
      • param test
      • flow test
      • event
    • update opt in status
      • msg
      • validations
      • logic
      • test
      • cli
      • event
    • genesis import export
      • logic
      • test
    • proposer change hook
      • logic
      • test
    • events
      • rotation complete
      • rotation start
      • notice start
      • unbonded
      • bond increase
      • create seq
      • proposer change
      • slash
    • audit
      • unsafe coins usage
      • correct address type usage
    • invariants
      • new ones added
    • bond change flow
      • logic
      • test happy
      • test ugly
    • rotation flow
      • logic
      • test happy
      • test ugly
    • slash flow
      • logic
      • test happy
      • test ugly
      • extra test cases for in conjunction with rotation
    • params
      • params validation
      • params validation test
  • x/lightclient
    • unbond cond light client states
      • bookkeeping
      • prune
      • condition
      • test prune
      • test bookkeeping
      • test condition
      • wiring to app
      • delete old bookkeeping code
    • unbonding period removal
    • enabled/disable flag
    • genesis import export
      • logic
      • test

tech debts and todos:

remarks:

  • Have avoided changing events and TX/Query where possible to avoid changing frontends, which leaves things less pretty
  • Should really have more tests
  • Added an ugly test enable/disable for lightclient to not break ibctesting/

Closes #1328

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.

PR review checkboxes:

I have...

  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Targeted PR against the correct branch
  • included the correct type prefix in the PR title
  • Linked to the GitHub issue with discussion and accepted design
  • Targets only one GitHub issue
  • Wrote unit and integration tests
  • Wrote relevant migration scripts if necessary
  • All CI checks have passed
  • Added relevant godoc comments
  • Updated the scripts for local run, e.g genesis_config_commands.sh if the PR changes parameters
  • Add an issue in the e2e-tests repo if necessary

SDK Checklist

  • Import/Export Genesis
  • Registered Invariants
  • Registered Events
  • Updated openapi.yaml
  • No usage of go map
  • No usage of time.Now()
  • Used fixed point arithmetic and not float arithmetic
  • Avoid panicking in Begin/End block as much as possible
  • No unexpected math Overflow
  • Used sendCoin and not SendCoins
  • Out-of-block compute is bounded
  • No serialized ID at the end of store keys
  • UInt to byte conversion should use BigEndian

Full security checklist here


For Reviewer:

  • Confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • Confirmed all author checklist items have been addressed

After reviewer approval:

  • In case the PR targets the main branch, PR should not be squash merge in order to keep meaningful git history.
  • In case the PR targets a release branch, PR must be rebased.

Copy link
Contributor

@omritoptix omritoptix left a comment

Choose a reason for hiding this comment

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

great job!

x/lightclient/types/params.go Outdated Show resolved Hide resolved
x/rollapp/keeper/liveness.go Outdated Show resolved Hide resolved
x/rollapp/keeper/hooks_listeners.go Show resolved Hide resolved
x/sequencer/keeper/msg_server_bond.go Outdated Show resolved Hide resolved
x/sequencer/keeper/proposer.go Fixed Show resolved Hide resolved
x/sequencer/keeper/msg_server_bond.go Outdated Show resolved Hide resolved
x/sequencer/keeper/proposer.go Show resolved Hide resolved
@danwt danwt requested a review from omritoptix November 4, 2024 11:15
omritoptix
omritoptix previously approved these changes Nov 4, 2024
ibctesting/light_client_test.go Outdated Show resolved Hide resolved
x/lightclient/ante/ibc_msg_update_client.go Show resolved Hide resolved
x/lightclient/keeper/keeper.go Show resolved Hide resolved
}
if errorsmod.IsOf(err, gerrc.ErrNotFound) {
if !canonical {
// not from sequencer, and not canonical - it's not interesting
Copy link
Contributor

Choose a reason for hiding this comment

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

why to exclude this scenario? why u can't enforce it for every msg, regardless of canonical or not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's your suggestion, concretely? the check is saying it's not from sequencer AND it's not canonical

Copy link
Contributor

Choose a reason for hiding this comment

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

my q is why AND it's not canonical required? why not return an error if it's not from a sequencer

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 it's not from sequencer then we would reject ibc updates for non rollapps

x/lightclient/ante/ibc_msg_update_client.go Show resolved Hide resolved
x/lightclient/ante/ibc_msg_update_client.go Outdated Show resolved Hide resolved
x/lightclient/ante/ibc_msg_update_client.go Show resolved Hide resolved
x/lightclient/ante/ibc_msg_update_client.go Outdated Show resolved Hide resolved
// if containingHPlus1 is not nil then containingH also guaranteed to not be nil
type stateInfos struct {
containingH *rollapptypes.StateInfo
containingHPlus1 *rollapptypes.StateInfo
Copy link
Contributor

Choose a reason for hiding this comment

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

containingHPlus1 used to get next sequencer
can we take the NextSequencer field from the containingH state info instead? (after the HF PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

x/lightclient/types/state.go Outdated Show resolved Hide resolved
x/lightclient/keeper/hook_listener.go Outdated Show resolved Hide resolved
x/lightclient/keeper/hook_listener.go Outdated Show resolved Hide resolved
x/sequencer/keeper/get_and_set.go Outdated Show resolved Hide resolved
store := ctx.KVStore(k.storeKey)
bz := store.Get(types.SuccessorByRollappKey(rollapp))
if bz == nil {
return k.GetSequencer(ctx, types.SentinelSeqAddr)
Copy link
Contributor

Choose a reason for hiding this comment

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

how u distinguish between No successer set (no rotation in progress), and sentinal successor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do you need to do that?
If you need to do that, awaitingLastProposerBlock
Can expose in a query if need be

Comment on lines +69 to 70
return proposer.NoticeElapsed(ctx.BlockTime())
}
Copy link
Contributor

Choose a reason for hiding this comment

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

we discussed in the past that this is not reliable enough.
awaitingLastProposerBlock should be true only after chooseSuccessor is called

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, good spot, I forgot to move ChooseSuccessorForFinishedNotices to begin block!

@mtsitrin mtsitrin merged commit 76aa1e1 into main Nov 5, 2024
5 checks passed
@mtsitrin mtsitrin deleted the danwt/1328-seq-bond-management-and-slashing branch November 5, 2024 11:37
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.

Sequencer bond management + slashing - Impl
3 participants