From 380c0683dbaffffe570ab52b59e1300bcb4a864e Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Fri, 26 Apr 2024 15:09:45 -0400 Subject: [PATCH 1/3] chore: Update README prerequisites Fixes #9294 --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a7f89750cea..1f3ee821d55 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,11 @@ to use. ## Prerequisites * Git -* Node.js LTS (version 16.13.0 or higher) +* Go ^1.20.2 +* Node.js ^18.12 or ^20.9 * we generally support the latest LTS release: use [nvm](https://github.com/nvm-sh/nvm) to keep your local system up-to-date * Yarn (`npm install -g yarn`) -* gcc-10 or newer, or a compiler with `__has_builtin()` +* gcc >=10, clang >=10, or another compiler with `__has_builtin()` Any version of Yarn will do: the `.yarnrc` file should ensure that all commands use the specific checked-in version of Yarn (stored in From c8a79e1fc6488162dba85e005880674bd6c3263e Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Fri, 26 Apr 2024 19:06:28 -0400 Subject: [PATCH 2/3] chore(golang/cosmos): Replace custom cutPrefix with stdlib bytes.CutPrefix --- golang/cosmos/x/vstorage/keeper/keeper.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/golang/cosmos/x/vstorage/keeper/keeper.go b/golang/cosmos/x/vstorage/keeper/keeper.go index ff408ee69ff..28c97646f9e 100644 --- a/golang/cosmos/x/vstorage/keeper/keeper.go +++ b/golang/cosmos/x/vstorage/keeper/keeper.go @@ -52,14 +52,6 @@ var _ ChangeManager = (*BatchingChangeManager)(nil) // 2 ** 256 - 1 var MaxSDKInt = sdk.NewIntFromBigInt(new(big.Int).Sub(new(big.Int).Exp(big.NewInt(2), big.NewInt(256), nil), big.NewInt(1))) -// TODO: Use bytes.CutPrefix once we can rely upon go >= 1.20. -func cutPrefix(s, prefix []byte) (after []byte, found bool) { - if !bytes.HasPrefix(s, prefix) { - return s, false - } - return s[len(prefix):], true -} - // Keeper maintains the link to data storage and exposes getter/setter methods // for the various parts of the state machine type Keeper struct { @@ -164,7 +156,7 @@ func (k Keeper) ExportStorageFromPrefix(ctx sdk.Context, pathPrefix string) []*t if !strings.HasPrefix(path, pathPrefix) { continue } - value, hasPrefix := cutPrefix(rawValue, types.EncodedDataPrefix) + value, hasPrefix := bytes.CutPrefix(rawValue, types.EncodedDataPrefix) if !hasPrefix { panic(fmt.Errorf("value at path %q starts with unexpected prefix", path)) } @@ -266,7 +258,7 @@ func (k Keeper) GetEntry(ctx sdk.Context, path string) agoric.KVEntry { if bytes.Equal(rawValue, types.EncodedNoDataValue) { return agoric.NewKVEntryWithNoValue(path) } - value, hasPrefix := cutPrefix(rawValue, types.EncodedDataPrefix) + value, hasPrefix := bytes.CutPrefix(rawValue, types.EncodedDataPrefix) if !hasPrefix { panic(fmt.Errorf("value at path %q starts with unexpected prefix", path)) } From 9f934bf8157e9751e6898bf912f1976d1ab73127 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Mon, 29 Apr 2024 12:07:07 -0400 Subject: [PATCH 3/3] chore: Require README updates when bumping Node.js version support --- docs/node-version.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/node-version.md b/docs/node-version.md index 33be5e6ab77..dbb274b0bc8 100644 --- a/docs/node-version.md +++ b/docs/node-version.md @@ -14,3 +14,4 @@ When a new version becomes Active LTS: - [ ] update the .node-version hint to use it - [ ] update Node.js test ranges to remove the EOLed version and add the new LTS - [ ] update package.json engines to allow the two LTS versions +- [ ] update README.md to document the new supported versions