Skip to content

Commit ac1780c

Browse files
authored
Merge pull request #472 from oasisprotocol/matevz/feature/rofl-remove-cleanup
cmd: Also remove the deployment from rofl.yaml when removing app
2 parents 49bf4eb + 6a6302b commit ac1780c

4 files changed

Lines changed: 34 additions & 4 deletions

File tree

cmd/rofl/mgmt.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,15 @@ var (
326326
npa := common.GetNPASelection(cfg)
327327
txCfg := common.GetTransactionConfig()
328328

329-
var rawAppID string
329+
var (
330+
rawAppID string
331+
manifest *buildRofl.Manifest
332+
deployment *buildRofl.Deployment
333+
)
330334
if len(args) > 0 {
331335
rawAppID = args[0]
332336
} else {
333-
_, deployment := roflCommon.LoadManifestAndSetNPA(cfg, npa, deploymentName, &roflCommon.ManifestOptions{
337+
manifest, deployment = roflCommon.LoadManifestAndSetNPA(cfg, npa, deploymentName, &roflCommon.ManifestOptions{
334338
NeedAppID: true,
335339
NeedAdmin: true,
336340
})
@@ -353,6 +357,12 @@ var (
353357
cobra.CheckErr(err)
354358
}
355359

360+
fmt.Printf("WARNING: Removing this ROFL app will DEREGISTER it, ERASE any on-chain secrets and local configuration!\n")
361+
fmt.Printf("WARNING: THIS ACTION IS IRREVERSIBLE!\n")
362+
if !common.GetAnswerYes() {
363+
common.Confirm(fmt.Sprintf("Remove ROFL app '%s' deployed on network '%s'", appID, npa.NetworkName), "not removing")
364+
}
365+
356366
// Prepare transaction.
357367
tx := rofl.NewRemoveTx(nil, &rofl.Remove{
358368
ID: appID,
@@ -363,6 +373,14 @@ var (
363373
cobra.CheckErr(err)
364374

365375
common.BroadcastOrExportTransaction(ctx, npa, conn, sigTx, meta, nil)
376+
377+
// Update manifest to clear the corresponding deployment section.
378+
if manifest != nil {
379+
delete(manifest.Deployments, deploymentName)
380+
if err = manifest.Save(); err != nil {
381+
cobra.CheckErr(fmt.Errorf("failed to update manifest: %w", err))
382+
}
383+
}
366384
},
367385
}
368386

docs/rofl.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ Run `rofl remove` to deregister your ROFL app:
118118
The deposit required to register the ROFL app will be returned to the current
119119
administrator account.
120120

121+
:::danger Secrets will be permanently lost
122+
123+
All secrets stored on-chain will be permanently lost when the ROFL app will be
124+
deregistered.
125+
126+
:::
127+
121128
## Show ROFL information {#show}
122129

123130
Run `rofl show` to obtain the information from the network on the ROFL admin

docs/setup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
## Download and Run
44

5-
Download the latest release [here][cli-releases] and extract it to your
6-
favorite application folder.
5+
Download the latest release from our [GitHub repository][cli-releases] and
6+
extract it to your favorite application folder.
77

88
:::info
99

examples/rofl/remove.out.static

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
WARNING: Removing this ROFL app will DEREGISTER it, ERASE any on-chain secrets and local configuration!
2+
WARNING: THIS ACTION IS IRREVERSIBLE!
3+
? Remove ROFL app 'rofl1qzd82n99vtwesvcqjfyur4tcm45varz2due7s635' deployed on network 'testnet' Yes
4+
Unlock your account.
5+
? Passphrase:
16
You are about to sign the following transaction:
27
Format: plain
38
Method: rofl.Remove

0 commit comments

Comments
 (0)