Skip to content

Commit

Permalink
cleanup + fix tx processing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
adamewozniak committed Oct 2, 2024
1 parent 8530d29 commit 14e6e9f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 32 deletions.
38 changes: 18 additions & 20 deletions app/preblocker.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,26 @@ func (app *App) PreBlocker(ctx sdk.Context, req *cometabci.RequestFinalizeBlock)
}
voteExtensionsEnabled := abci.VoteExtensionsEnabled(ctx)
if voteExtensionsEnabled {
for _, tx := range req.Txs {
var injectedVoteExtTx types.InjectedVoteExtensionTx
if err := injectedVoteExtTx.Unmarshal(tx); err != nil {
app.Logger().Error("failed to decode injected vote extension tx", "err", err)
return nil, err
}
for _, exchangeRateVote := range injectedVoteExtTx.ExchangeRateVotes {
valAddr, err := sdk.ValAddressFromBech32(exchangeRateVote.Voter)
if err != nil {
app.Logger().Error("failed to get voter address", "err", err)
continue
}
app.OracleKeeper.SetAggregateExchangeRateVote(ctx, valAddr, exchangeRateVote)
}
for _, gasEstimate := range injectedVoteExtTx.GasEstimateMedians {
app.GasEstimateKeeper.SetGasEstimate(ctx, gasestimatetypes.GasEstimate{
Network: gasEstimate.Network,
GasEstimate: gasEstimate.GasEstimation,
})
var injectedVoteExtTx types.InjectedVoteExtensionTx
if err := injectedVoteExtTx.Unmarshal(req.Txs[0]); err != nil {
app.Logger().Error("failed to decode injected vote extension tx", "err", err)
return nil, err
}
for _, exchangeRateVote := range injectedVoteExtTx.ExchangeRateVotes {
valAddr, err := sdk.ValAddressFromBech32(exchangeRateVote.Voter)
if err != nil {
app.Logger().Error("failed to get voter address", "err", err)
continue
}
app.Logger().Info("gas estimates updated", "gasestimates", injectedVoteExtTx.GasEstimateMedians)
app.OracleKeeper.SetAggregateExchangeRateVote(ctx, valAddr, exchangeRateVote)
}
for _, gasEstimate := range injectedVoteExtTx.GasEstimateMedians {
app.GasEstimateKeeper.SetGasEstimate(ctx, gasestimatetypes.GasEstimate{
Network: gasEstimate.Network,
GasEstimate: gasEstimate.GasEstimation,
})
}
app.Logger().Info("gas estimates updated", "gasestimates", injectedVoteExtTx.GasEstimateMedians)
}

app.Logger().Info(
Expand Down
12 changes: 0 additions & 12 deletions x/gasestimate/abci.go

This file was deleted.

0 comments on commit 14e6e9f

Please sign in to comment.