Skip to content

Commit

Permalink
chore: moving voting power update to BeginBlock (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianElvis authored Oct 19, 2023
1 parent 41bc320 commit 8f9d049
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions test/e2e/btc_staking_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ func (s *BTCStakingTestSuite) Test2SubmitJurySignature() {
activeDel := activeDels.Dels[0]
s.NotNil(activeDel.JurySig)

// wait for a block so that above txs take effect and the voting power table
// is updated in the next block's BeginBlock
nonValidatorNode.WaitForNextBlock()

// ensure BTC staking is activated
activatedHeight := nonValidatorNode.QueryActivatedHeight()
s.Positive(activatedHeight)
Expand Down
9 changes: 5 additions & 4 deletions x/btcstaking/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import (

func BeginBlocker(ctx sdk.Context, k keeper.Keeper, req abci.RequestBeginBlock) {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker)
}

func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker)

// index BTC height at the current height
k.IndexBTCHeight(ctx)
Expand All @@ -28,5 +24,10 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate {
k.RecordRewardDistCache(ctx)
}

}

func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker)

return []abci.ValidatorUpdate{}
}

0 comments on commit 8f9d049

Please sign in to comment.