Skip to content

fix(gravity): clamp batch timeout projection height#1284

Open
jamilahmadzai wants to merge 1 commit into
openmetaearth:mainfrom
jamilahmadzai:fix/gravity-batch-timeout-genesis-945
Open

fix(gravity): clamp batch timeout projection height#1284
jamilahmadzai wants to merge 1 commit into
openmetaearth:mainfrom
jamilahmadzai:fix/gravity-batch-timeout-genesis-945

Conversation

@jamilahmadzai

Copy link
Copy Markdown
Contributor

Summary

Fixes #945.

This clamps the local ME height used by GetBatchTimeoutHeight when the stored LastObservedBlockHeight.BlockHeight is ahead of the current context height, which can happen after genesis import or migration. Instead of subtracting a larger imported local height from a fresh height-1 context and underflowing uint64, the projection now treats elapsed local time as zero until the chain catches up.

The external observed height is preserved, and the normal timeout window is still added on top of that height.

Validation

  • go test ./x/gravity/keeper -run 'TestGravityKeeperTestSuite/TestBatchTimeoutHeightDoesNotUnderflowWhenObservedLocalHeightAhead' -count=1 -v
  • go test ./x/gravity/keeper -count=1
  • go test ./x/gravity/... -count=1
  • go test ./... -count=1
  • git diff --check

Payout

Meta Earth bug bounty payout in $MEC via ME Pass wallet:

me1ya82w6cjflk9r2qeyfeu64sm7gxtfr7mu62w9j

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.

[BUG BOUNTY] [High] [Gravity/AppHash] Genesis import can underflow batch timeout projection and create near-never-expiring batches

1 participant