Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/extend_vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
type OracleKeeper interface {
GetTimestampBefore(ctx context.Context, queryId []byte, timestamp time.Time) (time.Time, error)
GetTimestampAfter(ctx context.Context, queryId []byte, timestamp time.Time) (time.Time, error)
GetAggregatedReportsByHeight(ctx context.Context, height uint64) []oracletypes.Aggregate
GetAggregatedReportsByHeight(ctx context.Context, height uint64) ([]oracletypes.Aggregate, error)
}

type BridgeKeeper interface {
Expand Down
14 changes: 12 additions & 2 deletions app/mocks/OracleKeeper.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions app/proposal_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ func (h *ProposalHandler) PrepareProposalHandler(ctx sdk.Context, req *abci.Requ

func (h *ProposalHandler) ProcessProposalHandler(ctx sdk.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) {
if req.Height > ctx.ConsensusParams().Abci.VoteExtensionsEnableHeight {
// in case proposer says 0 tx in a block after vote extensions enabled
if len(req.Txs) == 0 {
h.logger.Error("ProcessProposalHandler: rejecting proposal, empty transactions after vote extensions enabled")
return &abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}, nil
}
var injectedVoteExtTx VoteExtTx
if err := json.Unmarshal(req.Txs[0], &injectedVoteExtTx); err != nil {
h.logger.Error("ProcessProposalHandler: failed to decode injected vote extension tx", "err", err)
Expand Down
19 changes: 19 additions & 0 deletions app/proposal_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,25 @@ func (s *ProposalHandlerTestSuite) TestProcessProposalHandler() {
require.NotNil(res)
}

func (s *ProposalHandlerTestSuite) TestProcessProposalHandler_EmptyTxs() {
require := s.Require()
p := s.proposalHandler
ctx := s.ctx

ctx = ctx.WithBlockHeight(3)

// Empty Txs after vote extensions enabled should reject, not panic
req := abcitypes.RequestProcessProposal{
Txs: [][]byte{},
Height: 3,
}

res, err := p.ProcessProposalHandler(ctx, &req)
require.NoError(err)
require.NotNil(res)
require.Equal(abcitypes.ResponseProcessProposal_REJECT, res.Status)
}

func (s *ProposalHandlerTestSuite) TestPreBlocker() {
require := s.Require()
p := s.proposalHandler
Expand Down
12 changes: 6 additions & 6 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

"github.com/tellor-io/layer/app/upgrades"
v_6_1_1 "github.com/tellor-io/layer/app/upgrades/v6.1.1"
v_6_1_2 "github.com/tellor-io/layer/app/upgrades/v6.1.2"

upgradetypes "cosmossdk.io/x/upgrade/types"
)
Expand All @@ -13,20 +13,20 @@ var (
// `Upgrades` defines the upgrade handlers and store loaders for the application.
// New upgrades should be added to this slice after they are implemented.
Upgrades = []*upgrades.Upgrade{
&v_6_1_1.Upgrade,
&v_6_1_2.Upgrade,
}
Forks = []upgrades.Fork{}
)

// setupUpgradeHandlers registers the upgrade handlers to perform custom upgrade
// logic and state migrations for software upgrades.
func (app *App) setupUpgradeHandlers() {
if app.UpgradeKeeper.HasHandler(v_6_1_1.UpgradeName) {
panic(fmt.Sprintf("Cannot register duplicate upgrade handler '%s'", v_6_1_1.UpgradeName))
if app.UpgradeKeeper.HasHandler(v_6_1_2.UpgradeName) {
panic(fmt.Sprintf("Cannot register duplicate upgrade handler '%s'", v_6_1_2.UpgradeName))
}
app.UpgradeKeeper.SetUpgradeHandler(
v_6_1_1.UpgradeName,
v_6_1_1.CreateUpgradeHandler(
v_6_1_2.UpgradeName,
v_6_1_2.CreateUpgradeHandler(
app.ModuleManager(),
app.configurator,
),
Expand Down
16 changes: 16 additions & 0 deletions app/upgrades/v6.1.2/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package v6_1_2

import (
"github.com/tellor-io/layer/app/upgrades"

store "cosmossdk.io/store/types"
)

const (
UpgradeName = "v6.1.2"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
StoreUpgrades: store.StoreUpgrades{},
}
32 changes: 32 additions & 0 deletions app/upgrades/v6.1.2/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package v6_1_2

import (
"context"
"fmt"

upgradetypes "cosmossdk.io/x/upgrade/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
)

/*
Upgrade to v6.1.2 includes:
- Reporter stake caching: skip full recalculation when delegation state hasn't changed
- New reporter collections: LastValSetUpdateHeight, StakeRecalcFlag, RecalcAtTime
- Staking hooks now flag reporters for recalculation on validator set changes and delegation modifications
- Microreport pruning: oracle EndBlocker removes reports older than 30 days (batched, max 100/block)
- Simplified reporter PruneOldReports using oracle block-height lookup
*/

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)
sdkCtx.Logger().Info(fmt.Sprintf("Running %s Upgrade...", UpgradeName))

return mm.RunMigrations(ctx, configurator, vm)
}
}
2 changes: 2 additions & 0 deletions cmd/layerd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"io"
"os"
"time"

tmcfg "github.com/cometbft/cometbft/config"
tmcli "github.com/cometbft/cometbft/libs/cli"
Expand Down Expand Up @@ -122,6 +123,7 @@ func NewRootCmd(
// return tmcfg.DefaultConfig if no custom configuration is required for the application.
func initTendermintConfig() *tmcfg.Config {
cfg := tmcfg.DefaultConfig()
cfg.Consensus.TimeoutCommit = 3 * time.Second
return cfg
}

Expand Down
Loading