From 4743a7ad0d62aadb2eeafe4359b398e771620b0e Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Sun, 10 Apr 2022 19:37:54 -0700 Subject: [PATCH] confix: clean up and document transformations (#8301) Right now the confix tool works up to v0.35. This change is preparation for extending the tool to handle additional changes in v0.36. Mostly this is adding documentation. The one functional change is to fix the name of the moved "fast-sync" parameter, which was renamed "enable". - Document the origin of each transformation step. - Update fast-sync target name. --- go.mod | 3 +-- go.sum | 4 ++-- scripts/confix/confix.go | 12 +++++++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 91895c36e..0b05266bd 100644 --- a/go.mod +++ b/go.mod @@ -73,8 +73,7 @@ require ( github.com/charithe/durationcheck v0.0.9 // indirect github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af // indirect github.com/containerd/continuity v0.2.1 // indirect - github.com/creachadair/taskgroup v0.3.2 - github.com/creachadair/tomledit v0.0.5 + github.com/creachadair/tomledit v0.0.11 github.com/daixiang0/gci v0.3.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect diff --git a/go.sum b/go.sum index 2351806cf..ea3befa2f 100644 --- a/go.sum +++ b/go.sum @@ -225,8 +225,8 @@ github.com/creachadair/atomicfile v0.2.4 h1:GRjpQLmz/78I4+nBQpGMFrRa9yrL157AUTrA github.com/creachadair/atomicfile v0.2.4/go.mod h1:BRq8Une6ckFneYXZQ+kO7p1ZZP3I2fzVzf28JxrIkBc= github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM= github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= -github.com/creachadair/tomledit v0.0.5 h1:ILJt2EO93fr8w2UAUA5FPNThk1Pq5m4KX2qUZ1Xz4Xs= -github.com/creachadair/tomledit v0.0.5/go.mod h1:gvtfnSZLa+YNQD28vaPq0Nk12bRxEhmUdBzAWn+EGF4= +github.com/creachadair/tomledit v0.0.11 h1:6fHNLdCa5pNudF+5Sb+3M+hPHz/q1fMoAm+MI6TWIR4= +github.com/creachadair/tomledit v0.0.11/go.mod h1:gvtfnSZLa+YNQD28vaPq0Nk12bRxEhmUdBzAWn+EGF4= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= diff --git a/scripts/confix/confix.go b/scripts/confix/confix.go index aa73897a5..b958060fe 100644 --- a/scripts/confix/confix.go +++ b/scripts/confix/confix.go @@ -80,24 +80,28 @@ func main() { var plan = transform.Plan{ { + // Since https://github.com/tendermint/tendermint/pull/5777. Desc: "Rename everything from snake_case to kebab-case", T: transform.SnakeToKebab(), }, { + // Since https://github.com/tendermint/tendermint/pull/6896. Desc: "Rename [fastsync] to [blocksync]", T: transform.Rename(parser.Key{"fastsync"}, parser.Key{"blocksync"}), ErrorOK: true, }, { - Desc: "Move top-level fast_sync key under [blocksync]", + // Since https://github.com/tendermint/tendermint/pull/7159. + Desc: "Move top-level fast_sync key to blocksync.enable", T: transform.MoveKey( parser.Key{"fast-sync"}, parser.Key{"blocksync"}, - parser.Key{"fast-sync"}, + parser.Key{"enable"}, ), ErrorOK: true, }, { + // Since https://github.com/tendermint/tendermint/pull/6462. Desc: "Move priv-validator settings under [priv-validator]", T: transform.Func(func(_ context.Context, doc *tomledit.Document) error { const pvPrefix = "priv-validator-" @@ -144,6 +148,8 @@ var plan = transform.Plan{ }), }, { + // v1 removed: https://github.com/tendermint/tendermint/pull/5728 + // v2 deprecated: https://github.com/tendermint/tendermint/pull/6730 Desc: `Set blocksync.version to "v0"`, T: transform.Func(func(_ context.Context, doc *tomledit.Document) error { v := doc.First("blocksync", "version") @@ -166,7 +172,7 @@ func ApplyFixes(ctx context.Context, doc *tomledit.Document) error { tmVersion := GuessConfigVersion(doc) if tmVersion == vUnknown { return errors.New("cannot tell what Tendermint version created this config") - } else if tmVersion < v34 { + } else if tmVersion < v34 || tmVersion > v36 { // TODO(creachadair): Add in rewrites for older versions. This will // require some digging to discover what the changes were. The upgrade // instructions do not give specifics.