Skip to content

Commit

Permalink
fix: change ordering of events when submitting a bundle (backport #42) (
Browse files Browse the repository at this point in the history
#43)

Co-authored-by: Maximilian Breithecker <72022235+mbreithecker@users.noreply.github.com>
  • Loading branch information
mergify[bot] and mbreithecker authored May 8, 2023
1 parent 1a89f0d commit cfd2745
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

## [Unreleased]

### API Breaking

- (`x/bundles`) [#42](https://github.com/KYVENetwork/chain/pull/42) Emit `VoteEvent` after `BundleProposedEvent` when submitting a bundle.

## [v1.1.1](https://github.com/KYVENetwork/chain/releases/tag/v1.1.1) - 2023-05-08

### Improvements
Expand Down
16 changes: 8 additions & 8 deletions x/bundles/keeper/logic_bundles.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,6 @@ func (k Keeper) registerBundleProposalFromUploader(ctx sdk.Context, msg *types.M
CompressionId: pool.CurrentCompressionId,
}

// Emit a vote event.
_ = ctx.EventManager().EmitTypedEvent(&types.EventBundleVote{
PoolId: msg.PoolId,
Staker: msg.Staker,
StorageId: msg.StorageId,
Vote: types.VOTE_TYPE_VALID,
})

k.SetBundleProposal(ctx, bundleProposal)

_ = ctx.EventManager().EmitTypedEvent(&types.EventBundleProposed{
Expand All @@ -306,6 +298,14 @@ func (k Keeper) registerBundleProposalFromUploader(ctx sdk.Context, msg *types.M
StorageProviderId: bundleProposal.StorageProviderId,
CompressionId: bundleProposal.CompressionId,
})

// Emit a vote event. Uploader automatically votes valid on their bundle.
_ = ctx.EventManager().EmitTypedEvent(&types.EventBundleVote{
PoolId: msg.PoolId,
Staker: msg.Staker,
StorageId: msg.StorageId,
Vote: types.VOTE_TYPE_VALID,
})
}

// finalizeCurrentBundleProposal takes the data of the current evaluated proposal
Expand Down

0 comments on commit cfd2745

Please sign in to comment.