Skip to content

Commit

Permalink
revision
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryfan01234 committed Jul 26, 2024
1 parent fe97218 commit d866fa7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 0 additions & 8 deletions protocol/app/ante/sigverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ante

import (
"fmt"
"time"

errorsmod "cosmossdk.io/errors"
txsigning "cosmossdk.io/x/tx/signing"
Expand All @@ -14,7 +13,6 @@ import (
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/dydxprotocol/v4-chain/protocol/lib/metrics"
accountpluskeeper "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/keeper"
accountplustypes "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"
gometrics "github.com/hashicorp/go-metrics"
"google.golang.org/protobuf/types/known/anypb"
)
Expand Down Expand Up @@ -99,12 +97,6 @@ func (svd SigVerificationDecorator) AnteHandle(
// `GoodTilBlock` for replay protection.
if !skipSequenceValidation {
if accountpluskeeper.IsTimestampNonce(sig.Sequence) {
defer telemetry.ModuleMeasureSince(
accountplustypes.ModuleName,
time.Now(),
metrics.TimestampNonce,
metrics.Latency,
)
err = svd.akp.ProcessTimestampNonce(ctx, acc, sig.Sequence)

if err == nil {
Expand Down
10 changes: 10 additions & 0 deletions protocol/x/accountplus/keeper/timestampnonce.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ package keeper

import (
"fmt"
"time"

"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/dydxprotocol/v4-chain/protocol/lib/metrics"
"github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"
)

Expand All @@ -21,6 +24,13 @@ func IsValidTimestampNonce(tsNonce uint64, referenceTs uint64) bool {
}

func (k Keeper) ProcessTimestampNonce(ctx sdk.Context, acc sdk.AccountI, tsNonce uint64) error {
defer telemetry.ModuleMeasureSince(
types.ModuleName,
time.Now(),
metrics.TimestampNonce,
metrics.Latency,
)

blockTs := uint64(ctx.BlockTime().UnixMilli())
address := acc.GetAddress()

Expand Down

0 comments on commit d866fa7

Please sign in to comment.