Skip to content

Commit

Permalink
Merge branch 'main' into fix-vault-stake-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaroms authored Feb 11, 2025
2 parents d2d9467 + 2c37ea3 commit be6ea1c
Show file tree
Hide file tree
Showing 10 changed files with 1,153 additions and 54 deletions.
5 changes: 5 additions & 0 deletions protocol/chainlib/jsonRPC.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ func (apip *JsonRPCChainParser) ParseMsg(url string, data []byte, connectionType

parsedBlock := parsedInput.GetBlock()

if msg.Method == "eth_call" && uint64(parsedBlock) < extensionInfo.LatestBlock-126 {
// change to archive
extensionInfo.AdditionalExtensions = append(extensionInfo.AdditionalExtensions, extensionslib.ArchiveExtension)
}

if idx == 0 {
// on the first entry store them
api = apiCont.api
Expand Down
7 changes: 4 additions & 3 deletions protocol/statetracker/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import (
"sync"
"time"

coretypes "github.com/cometbft/cometbft/rpc/core/types"
"github.com/goccy/go-json"

"github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/version"
hybrid_client "github.com/lavanet/lava/v5/protocol/statetracker/hybridclient"

"github.com/lavanet/lava/v5/app"
"github.com/lavanet/lava/v5/protocol/chainlib"
"github.com/lavanet/lava/v5/protocol/chaintracker"
Expand Down Expand Up @@ -273,10 +274,10 @@ func paymentsLookup(ctx context.Context, clientCtx client.Context, blockStart, b
}
utils.LavaFormatInfo("fetching block", utils.LogAttr("block", block))
queryInst := updaters.NewStateQueryAccessInst(clientCtx)
var blockResults *coretypes.ResultBlockResults
var blockResults *hybrid_client.ResultBlockResults
for retry := 0; retry < 3; retry++ {
ctxWithTimeout, cancelContextWithTimeout := context.WithTimeout(ctx, time.Second*30)
blockResults, err = queryInst.BlockResults(ctxWithTimeout, &block)
blockResults, err = queryInst.GetBlockResults(ctxWithTimeout, &block)
cancelContextWithTimeout()
if err != nil {
utils.LavaFormatWarning("@@@@ failed fetching block results will retry", err, utils.LogAttr("block_number", block))
Expand Down
16 changes: 16 additions & 0 deletions protocol/statetracker/hybridclient/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Hybrid Client

This package provides a hybrid client implementation that maintains compatibility between Cosmos SDK v47 and v50 event handling.

## Background

In Cosmos SDK v50, there were significant changes to block event handling:
- `BeginBlockEvents` and `EndBlockEvents` were deprecated
- A new event type `FinalizeBlockEvents` was introduced to replace them

This hybrid client seamlessly handles both versions by:
- Supporting the legacy `BeginBlockEvents` and `EndBlockEvents` for v47 compatibility
- Supporting the new `FinalizeBlockEvents` for v50 compatibility
- Aggregating all events into `FinalizeBlockEvents` for consistent downstream handling

This allows applications to work with both v47 and v50 chains without needing version-specific event handling logic.
Loading

0 comments on commit be6ea1c

Please sign in to comment.