Skip to content

Commit

Permalink
telemetry and op sepolia
Browse files Browse the repository at this point in the history
  • Loading branch information
steel-feel committed Aug 1, 2024
1 parent 6cf58d0 commit c142995
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ func New(
time.Second,
map[string]string{
"421614": "https://rpc.ankr.com/arbitrum_sepolia",
"11155420" : "https://optimism-sepolia.blockpi.network/v1/rpc/public",
},
)

Expand Down
19 changes: 13 additions & 6 deletions x/xarchain/abci/vote_extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import (
"cosmossdk.io/log"
"golang.org/x/sync/errgroup"

abci "github.com/cometbft/cometbft/abci/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"time"
"xarchain/x/xarchain/keeper"

"xarchain/x/xarchain/types"

abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
)

type VoteExtHandler struct {
Expand Down Expand Up @@ -73,7 +75,7 @@ func (h *VoteExtHandler) ExtendVoteHandler() sdk.ExtendVoteHandler {
}
}
}

beforeFor := time.Now()
for chainId, provider := range h.providers {

// Launch a goroutine to fetch events from provider.
Expand Down Expand Up @@ -125,7 +127,12 @@ func (h *VoteExtHandler) ExtendVoteHandler() sdk.ExtendVoteHandler {
return nil
})
}

afterFor := time.Now()
telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), "xarchai" )
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), "xarchai2" )

h.logger.Error("failed to fetch events", "beforeFor", beforeFor, "afterFor", afterFor)

if err := g.Wait(); err != nil {
// We failed to get some or all event from providers. In the case that
// all events fail, we will throw error.
Expand Down Expand Up @@ -161,7 +168,7 @@ func (h *VoteExtHandler) VerifyVoteExtensionHandler() sdk.VerifyVoteExtensionHan
return nil, fmt.Errorf("vote extension height does not match request height; expected: %d, got: %d", req.Height, voteExt.Height)
}

//TODO: Perform checks on events
//TODO: Perform checks on events using go routines

return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_ACCEPT}, nil
}
Expand Down

0 comments on commit c142995

Please sign in to comment.