@agoric/cosmos 0.34.2-dev-b8140f3.0 → 0.34.2-dev-de2008a.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/git-revision.txt CHANGED
@@ -1 +1 @@
1
- b8140f3
1
+ de2008a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/cosmos",
3
- "version": "0.34.2-dev-b8140f3.0+b8140f3",
3
+ "version": "0.34.2-dev-de2008a.0+de2008a",
4
4
  "description": "Connect JS to the Cosmos blockchain SDK",
5
5
  "parsers": {
6
6
  "js": "mjs"
@@ -39,5 +39,5 @@
39
39
  "typeCoverage": {
40
40
  "atLeast": 0
41
41
  },
42
- "gitHead": "b8140f3af9d8f4c76eef2a7d2311b9dbdec860d5"
42
+ "gitHead": "de2008a11a0347ac9e920d79f56324d20a789ec0"
43
43
  }
@@ -52,14 +52,6 @@ var _ ChangeManager = (*BatchingChangeManager)(nil)
52
52
  // 2 ** 256 - 1
53
53
  var MaxSDKInt = sdk.NewIntFromBigInt(new(big.Int).Sub(new(big.Int).Exp(big.NewInt(2), big.NewInt(256), nil), big.NewInt(1)))
54
54
 
55
- // TODO: Use bytes.CutPrefix once we can rely upon go >= 1.20.
56
- func cutPrefix(s, prefix []byte) (after []byte, found bool) {
57
- if !bytes.HasPrefix(s, prefix) {
58
- return s, false
59
- }
60
- return s[len(prefix):], true
61
- }
62
-
63
55
  // Keeper maintains the link to data storage and exposes getter/setter methods
64
56
  // for the various parts of the state machine
65
57
  type Keeper struct {
@@ -164,7 +156,7 @@ func (k Keeper) ExportStorageFromPrefix(ctx sdk.Context, pathPrefix string) []*t
164
156
  if !strings.HasPrefix(path, pathPrefix) {
165
157
  continue
166
158
  }
167
- value, hasPrefix := cutPrefix(rawValue, types.EncodedDataPrefix)
159
+ value, hasPrefix := bytes.CutPrefix(rawValue, types.EncodedDataPrefix)
168
160
  if !hasPrefix {
169
161
  panic(fmt.Errorf("value at path %q starts with unexpected prefix", path))
170
162
  }
@@ -266,7 +258,7 @@ func (k Keeper) GetEntry(ctx sdk.Context, path string) agoric.KVEntry {
266
258
  if bytes.Equal(rawValue, types.EncodedNoDataValue) {
267
259
  return agoric.NewKVEntryWithNoValue(path)
268
260
  }
269
- value, hasPrefix := cutPrefix(rawValue, types.EncodedDataPrefix)
261
+ value, hasPrefix := bytes.CutPrefix(rawValue, types.EncodedDataPrefix)
270
262
  if !hasPrefix {
271
263
  panic(fmt.Errorf("value at path %q starts with unexpected prefix", path))
272
264
  }