Skip to content

Commit 689f21a

Browse files
committed
refactor(apps): rollback cmd updates
1 parent 2c85e06 commit 689f21a

6 files changed

Lines changed: 20 additions & 36 deletions

File tree

apps/evm/single/cmd/rollback.go

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ import (
1818
// NewRollbackCmd creates a command to rollback ev-node state by one height.
1919
func NewRollbackCmd() *cobra.Command {
2020
var (
21-
height uint64
22-
skipP2PStores bool
23-
syncNode bool
21+
height uint64
22+
syncNode bool
2423
)
2524

2625
cmd := &cobra.Command{
@@ -69,10 +68,6 @@ func NewRollbackCmd() *cobra.Command {
6968
return fmt.Errorf("failed to rollback ev-node state: %w", err)
7069
}
7170

72-
if skipP2PStores {
73-
return printSuccess(height)
74-
}
75-
7671
// rollback ev-node goheader state
7772
headerStore, err := goheaderstore.NewStore[*types.SignedHeader](
7873
evolveDB,
@@ -110,19 +105,16 @@ func NewRollbackCmd() *cobra.Command {
110105
return fmt.Errorf("failed to rollback data sync service state: %w", err)
111106
}
112107

113-
return printSuccess(height)
108+
fmt.Printf("Rolled back ev-node state to height %d\n", height)
109+
if syncNode {
110+
fmt.Println("Restart the node with the `--clear-cache` flag")
111+
}
112+
return nil
114113
},
115114
}
116115

117116
cmd.Flags().Uint64Var(&height, "height", 0, "rollback to a specific height")
118117
cmd.Flags().BoolVar(&syncNode, "sync-node", false, "sync node (no aggregator)")
119-
cmd.Flags().BoolVar(&skipP2PStores, "skip-p2p-stores", false, "skip rollback p2p stores (goheaderstore)")
120118

121119
return cmd
122120
}
123-
124-
func printSuccess(height uint64) error {
125-
fmt.Printf("Rolled back ev-node state to height %d\n", height)
126-
fmt.Println("Restart the node with the `--clear-cache` flag")
127-
return nil
128-
}

apps/evm/single/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/evstack/ev-node/apps/evm/single
22

33
go 1.24.6
44

5-
replace github.com/celestiaorg/go-header => github.com/julienrbrt/go-header v0.0.0-20250909151551-cb11b091bf58 // TODO: to remove after https://github.com/celestiaorg/go-header/pull/347
5+
replace github.com/celestiaorg/go-header => github.com/julienrbrt/go-header v0.0.0-20251008134330-747c8c192fa8 // TODO: to remove after https://github.com/celestiaorg/go-header/pull/347
66

77
replace (
88
github.com/evstack/ev-node => ../../../

apps/evm/single/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
242242
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
243243
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
244244
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
245-
github.com/julienrbrt/go-header v0.0.0-20250909151551-cb11b091bf58 h1:FBGLvgA4hfRjjYHUiiya7KkGxcHQWSpdn2dRKUEDa5k=
246-
github.com/julienrbrt/go-header v0.0.0-20250909151551-cb11b091bf58/go.mod h1:eX9iTSPthVEAlEDLux40ZT/olXPGhpxHd+mEzJeDhd0=
245+
github.com/julienrbrt/go-header v0.0.0-20251008134330-747c8c192fa8 h1:F+gOiipBxG43s+Ho+ri9T8IwumjWjp1XUon4DLWjxfQ=
246+
github.com/julienrbrt/go-header v0.0.0-20251008134330-747c8c192fa8/go.mod h1:eX9iTSPthVEAlEDLux40ZT/olXPGhpxHd+mEzJeDhd0=
247247
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
248248
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
249249
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=

apps/testapp/cmd/rollback.go

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ import (
1919
// NewRollbackCmd creates a command to rollback ev-node state by one height.
2020
func NewRollbackCmd() *cobra.Command {
2121
var (
22-
height uint64
23-
skipP2PStores bool
24-
syncNode bool
22+
height uint64
23+
syncNode bool
2524
)
2625

2726
cmd := &cobra.Command{
@@ -75,10 +74,6 @@ func NewRollbackCmd() *cobra.Command {
7574
return fmt.Errorf("failed to rollback ev-node state: %w", err)
7675
}
7776

78-
if skipP2PStores {
79-
return printSuccess(height)
80-
}
81-
8277
// rollback ev-node goheader state
8378
headerStore, err := goheaderstore.NewStore[*types.SignedHeader](
8479
evolveDB,
@@ -121,18 +116,15 @@ func NewRollbackCmd() *cobra.Command {
121116
return fmt.Errorf("rollback failed: %w", err)
122117
}
123118

124-
return printSuccess(height)
119+
fmt.Printf("Rolled back ev-node state to height %d\n", height)
120+
if syncNode {
121+
fmt.Println("Restart the node with the `--clear-cache` flag")
122+
}
123+
return nil
125124
},
126125
}
127126

128127
cmd.Flags().Uint64Var(&height, "height", 0, "rollback to a specific height")
129128
cmd.Flags().BoolVar(&syncNode, "sync-node", false, "sync node (no aggregator)")
130-
cmd.Flags().BoolVar(&skipP2PStores, "skip-p2p-stores", false, "skip rollback p2p stores (goheaderstore)")
131129
return cmd
132130
}
133-
134-
func printSuccess(height uint64) error {
135-
fmt.Printf("Rolled back ev-node state to height %d\n", height)
136-
fmt.Println("Restart the node with the `--clear-cache` flag")
137-
return nil
138-
}

apps/testapp/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/evstack/ev-node/apps/testapp
22

33
go 1.24.6
44

5-
replace github.com/celestiaorg/go-header => github.com/julienrbrt/go-header v0.0.0-20250909151551-cb11b091bf58 // TODO: to remove after https://github.com/celestiaorg/go-header/pull/347
5+
replace github.com/celestiaorg/go-header => github.com/julienrbrt/go-header v0.0.0-20251008134330-747c8c192fa8 // TODO: to remove after https://github.com/celestiaorg/go-header/pull/347
66

77
replace (
88
github.com/evstack/ev-node => ../../.

apps/testapp/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
176176
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
177177
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
178178
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
179-
github.com/julienrbrt/go-header v0.0.0-20250909151551-cb11b091bf58 h1:FBGLvgA4hfRjjYHUiiya7KkGxcHQWSpdn2dRKUEDa5k=
180-
github.com/julienrbrt/go-header v0.0.0-20250909151551-cb11b091bf58/go.mod h1:eX9iTSPthVEAlEDLux40ZT/olXPGhpxHd+mEzJeDhd0=
179+
github.com/julienrbrt/go-header v0.0.0-20251008134330-747c8c192fa8 h1:F+gOiipBxG43s+Ho+ri9T8IwumjWjp1XUon4DLWjxfQ=
180+
github.com/julienrbrt/go-header v0.0.0-20251008134330-747c8c192fa8/go.mod h1:eX9iTSPthVEAlEDLux40ZT/olXPGhpxHd+mEzJeDhd0=
181181
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
182182
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
183183
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=

0 commit comments

Comments
 (0)