Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Commit 3f2a40d

Browse files
committed
Add IsTracing flag to ctx (#576)
## Describe your changes and provide context Add flag to ctx for execution to know whether it's for real processing or for simulation/tracers ## Testing performed to validate your change local sei
1 parent 20cdc9e commit 3f2a40d

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

types/context.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ type Context struct {
6767
txIndex int
6868

6969
traceSpanContext context.Context
70+
71+
isTracing bool
7072
}
7173

7274
// Proposed rename, not done to avoid API breakage
@@ -223,6 +225,10 @@ func (c Context) TraceSpanContext() context.Context {
223225
return c.traceSpanContext
224226
}
225227

228+
func (c Context) IsTracing() bool {
229+
return c.isTracing
230+
}
231+
226232
// WithEventManager returns a Context with an updated tx priority
227233
func (c Context) WithPriority(p int64) Context {
228234
c.priority = p
@@ -494,6 +500,11 @@ func (c Context) WithExpireTxHandler(expireTxHandler func()) Context {
494500
return c
495501
}
496502

503+
func (c Context) WithIsTracing(it bool) Context {
504+
c.isTracing = it
505+
return c
506+
}
507+
497508
// TODO: remove???
498509
func (c Context) IsZero() bool {
499510
return c.ms == nil

x/upgrade/keeper/keeper.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ func (k Keeper) GetUpgradePlan(ctx sdk.Context) (plan types.Plan, havePlan bool)
327327
return plan, true
328328
}
329329

330-
// setDone marks this upgrade name as being done so the name can't be reused accidentally
331-
func (k Keeper) setDone(ctx sdk.Context, name string) {
330+
// SetDone marks this upgrade name as being done so the name can't be reused accidentally
331+
func (k Keeper) SetDone(ctx sdk.Context, name string) {
332332
store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte{types.DoneByte})
333333
bz := make([]byte, 8)
334334
binary.BigEndian.PutUint64(bz, uint64(ctx.BlockHeight()))
@@ -367,7 +367,7 @@ func (k Keeper) ApplyUpgrade(ctx sdk.Context, plan types.Plan) {
367367
// This will prevent resubmission of upgrade msg after upgrade is already completed.
368368
k.ClearIBCState(ctx, plan.Height)
369369
k.ClearUpgradePlan(ctx)
370-
k.setDone(ctx, plan.Name)
370+
k.SetDone(ctx, plan.Name)
371371
}
372372

373373
// IsSkipHeight checks if the given height is part of skipUpgradeHeights

0 commit comments

Comments
 (0)