agoric 0.21.2-other-dev-8f8782b.0 → 0.21.2-other-dev-3eb1a1d.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agoric",
3
- "version": "0.21.2-other-dev-8f8782b.0+8f8782b",
3
+ "version": "0.21.2-other-dev-3eb1a1d.0+3eb1a1d",
4
4
  "description": "Manage the Agoric Javascript smart contract platform",
5
5
  "type": "module",
6
6
  "main": "src/main.js",
@@ -8,60 +8,72 @@
8
8
  "agoric": "src/entrypoint.js",
9
9
  "agops": "src/bin-agops.js"
10
10
  },
11
+ "exports": {
12
+ "./src/entrypoint.js": "./src/entrypoint.js",
13
+ "./src/helpers.js": "./src/helpers.js"
14
+ },
11
15
  "files": [
12
16
  "src",
17
+ "tools",
13
18
  "exported.js"
14
19
  ],
15
20
  "scripts": {
16
21
  "build": "node ./scripts/get-sdk-package-names.js > src/sdk-package-names.js",
17
22
  "test": "ava",
18
- "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
23
+ "test:c8": "c8 --all $C8_OPTIONS ava",
19
24
  "test:xs": "exit 0",
20
25
  "integration-test": "ava --config .ava-integration-test.config.js",
21
26
  "lint-fix": "yarn lint:eslint --fix",
22
27
  "lint": "run-s --continue-on-error lint:*",
23
- "lint:types": "tsc -p jsconfig.json",
28
+ "lint:types": "tsc",
24
29
  "lint:eslint": "eslint ."
25
30
  },
26
31
  "devDependencies": {
27
- "@agoric/deploy-script-support": "0.10.4-other-dev-8f8782b.0+8f8782b",
28
- "ava": "^5.2.0",
29
- "c8": "^7.13.0",
30
- "dd-trace": "^3.3.0"
32
+ "@agoric/cosmic-swingset": "0.41.4-other-dev-3eb1a1d.0+3eb1a1d",
33
+ "@agoric/deploy-script-support": "0.10.4-other-dev-3eb1a1d.0+3eb1a1d",
34
+ "ava": "^5.3.0",
35
+ "c8": "^10.1.2",
36
+ "dd-trace": "^4.11.1"
31
37
  },
32
38
  "dependencies": {
33
- "@agoric/access-token": "0.4.22-other-dev-8f8782b.0+8f8782b",
34
- "@agoric/assert": "0.6.1-other-dev-8f8782b.0+8f8782b",
35
- "@agoric/cache": "0.3.3-other-dev-8f8782b.0+8f8782b",
36
- "@agoric/casting": "0.4.3-other-dev-8f8782b.0+8f8782b",
37
- "@agoric/cosmic-proto": "0.3.1-other-dev-8f8782b.0+8f8782b",
38
- "@agoric/ertp": "0.16.3-other-dev-8f8782b.0+8f8782b",
39
- "@agoric/inter-protocol": "0.16.2-other-dev-8f8782b.0+8f8782b",
40
- "@agoric/internal": "0.3.3-other-dev-8f8782b.0+8f8782b",
41
- "@agoric/smart-wallet": "0.5.4-other-dev-8f8782b.0+8f8782b",
42
- "@agoric/store": "0.9.3-other-dev-8f8782b.0+8f8782b",
43
- "@agoric/swingset-vat": "0.32.3-other-dev-8f8782b.0+8f8782b",
44
- "@agoric/vats": "0.15.2-other-dev-8f8782b.0+8f8782b",
45
- "@agoric/zoe": "0.26.3-other-dev-8f8782b.0+8f8782b",
46
- "@agoric/zone": "0.2.3-other-dev-8f8782b.0+8f8782b",
47
- "@confio/relayer": "^0.9.0",
48
- "@cosmjs/crypto": "^0.30.1",
49
- "@cosmjs/encoding": "^0.30.1",
50
- "@cosmjs/math": "^0.30.1",
51
- "@cosmjs/proto-signing": "^0.30.1",
52
- "@cosmjs/stargate": "^0.30.1",
53
- "@endo/bundle-source": "2.5.2-upstream-rollup",
54
- "@endo/captp": "3.1.1",
55
- "@endo/compartment-mapper": "0.8.4",
56
- "@endo/far": "0.2.18",
57
- "@endo/init": "0.5.56",
58
- "@endo/marshal": "0.8.5",
59
- "@endo/nat": "4.1.27",
60
- "@endo/promise-kit": "0.2.56",
39
+ "@agoric/access-token": "0.4.22-other-dev-3eb1a1d.0+3eb1a1d",
40
+ "@agoric/cache": "0.3.3-other-dev-3eb1a1d.0+3eb1a1d",
41
+ "@agoric/casting": "0.4.3-other-dev-3eb1a1d.0+3eb1a1d",
42
+ "@agoric/client-utils": "0.1.1-other-dev-3eb1a1d.0+3eb1a1d",
43
+ "@agoric/cosmic-proto": "0.4.1-other-dev-3eb1a1d.0+3eb1a1d",
44
+ "@agoric/ertp": "0.16.3-other-dev-3eb1a1d.0+3eb1a1d",
45
+ "@agoric/governance": "0.10.4-other-dev-3eb1a1d.0+3eb1a1d",
46
+ "@agoric/inter-protocol": "0.16.2-other-dev-3eb1a1d.0+3eb1a1d",
47
+ "@agoric/internal": "0.3.3-other-dev-3eb1a1d.0+3eb1a1d",
48
+ "@agoric/network": "0.1.1-other-dev-3eb1a1d.0+3eb1a1d",
49
+ "@agoric/smart-wallet": "0.5.4-other-dev-3eb1a1d.0+3eb1a1d",
50
+ "@agoric/store": "0.9.3-other-dev-3eb1a1d.0+3eb1a1d",
51
+ "@agoric/swingset-vat": "0.32.3-other-dev-3eb1a1d.0+3eb1a1d",
52
+ "@agoric/vats": "0.15.2-other-dev-3eb1a1d.0+3eb1a1d",
53
+ "@agoric/zoe": "0.26.3-other-dev-3eb1a1d.0+3eb1a1d",
54
+ "@agoric/zone": "0.2.3-other-dev-3eb1a1d.0+3eb1a1d",
55
+ "@confio/relayer": "^0.11.3",
56
+ "@cosmjs/crypto": "^0.32.3",
57
+ "@cosmjs/encoding": "^0.32.3",
58
+ "@cosmjs/math": "^0.32.3",
59
+ "@cosmjs/proto-signing": "^0.32.3",
60
+ "@cosmjs/stargate": "^0.32.3",
61
+ "@endo/bundle-source": "^3.5.0",
62
+ "@endo/captp": "^4.4.3",
63
+ "@endo/compartment-mapper": "^1.4.0",
64
+ "@endo/env-options": "^1.1.8",
65
+ "@endo/errors": "^1.2.8",
66
+ "@endo/far": "^1.1.9",
67
+ "@endo/init": "^1.1.7",
68
+ "@endo/marshal": "^1.6.2",
69
+ "@endo/nat": "^5.0.13",
70
+ "@endo/patterns": "^1.4.7",
71
+ "@endo/promise-kit": "^1.1.8",
72
+ "@endo/zip": "^1.0.9",
61
73
  "@iarna/toml": "^2.2.3",
62
74
  "anylogger": "^0.21.0",
63
75
  "chalk": "^5.2.0",
64
- "commander": "^10.0.0",
76
+ "commander": "^12.1.0",
65
77
  "deterministic-json": "^1.0.5",
66
78
  "esm": "agoric-labs/esm#Agoric-built",
67
79
  "inquirer": "^8.2.2",
@@ -82,10 +94,13 @@
82
94
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
83
95
  "ava": {
84
96
  "files": [
85
- "test/**/test-*.js"
97
+ "test/**/*.test.*"
86
98
  ],
87
99
  "timeout": "2m",
88
100
  "workerThreads": false
89
101
  },
90
- "gitHead": "8f8782bc52393e9d4fc82523ecf31cab429b11b3"
102
+ "typeCoverage": {
103
+ "atLeast": 77.54
104
+ },
105
+ "gitHead": "3eb1a1d2d75b2b4a94807cd3bf759bc9fc531f05"
91
106
  }
@@ -1,31 +1,46 @@
1
- /* global process */
1
+ /* eslint-env node */
2
+ import {
3
+ getEnvironmentOption,
4
+ getEnvironmentOptionsList,
5
+ } from '@endo/env-options';
2
6
  import anylogger from 'anylogger';
3
7
  import chalk from 'chalk';
4
8
 
5
- // Turn on debugging output with DEBUG=agoric
6
- const { DEBUG } = process.env;
7
- let selectedLevel = 'info';
8
- if (DEBUG === undefined) {
9
- selectedLevel = 'log';
10
- } else if (DEBUG.includes('agoric')) {
11
- selectedLevel = 'debug';
9
+ const DEBUG_LIST = getEnvironmentOptionsList('DEBUG');
10
+
11
+ // Turn on debugging output with DEBUG=agoric or DEBUG=agoric:${level}
12
+ let selectedLevel =
13
+ DEBUG_LIST.length || getEnvironmentOption('DEBUG', 'unset') === 'unset'
14
+ ? 'log'
15
+ : 'info';
16
+ for (const level of DEBUG_LIST) {
17
+ const parts = level.split(':');
18
+ if (parts[0] !== 'agoric') {
19
+ continue;
20
+ }
21
+ if (parts.length > 1) {
22
+ selectedLevel = parts[1];
23
+ } else {
24
+ selectedLevel = 'debug';
25
+ }
12
26
  }
13
- const defaultLevel = anylogger.levels[selectedLevel];
27
+ const selectedCode = anylogger.levels[selectedLevel];
28
+ const globalCode = selectedCode === undefined ? -Infinity : selectedCode;
14
29
 
15
30
  const oldExt = anylogger.ext;
16
- anylogger.ext = (l, o) => {
17
- l = oldExt(l, o);
18
- l.enabledFor = lvl => defaultLevel >= anylogger.levels[lvl];
31
+ anylogger.ext = (l, ...rest) => {
32
+ l = oldExt(l, ...rest);
33
+ l.enabledFor = lvl => globalCode >= anylogger.levels[lvl];
19
34
 
20
35
  const prefix = l.name.replace(/:/g, ': ');
21
36
  for (const [level, code] of Object.entries(anylogger.levels)) {
22
- if (code > defaultLevel) {
23
- // Disable printing.
24
- l[level] = () => {};
25
- } else {
37
+ if (globalCode >= code) {
26
38
  // Enable the printing with a prefix.
27
39
  const doLog = l[level] || (() => {});
28
40
  l[level] = (...args) => doLog(chalk.bold.blue(`${prefix}:`), ...args);
41
+ } else {
42
+ // Disable printing.
43
+ l[level] = () => {};
29
44
  }
30
45
  }
31
46
  return l;
package/src/bin-agops.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
+ /* eslint-env node */
2
3
  // @ts-check
3
4
  // @jessie-check
4
5
 
5
- /* eslint-disable @jessie.js/no-nested-await */
6
- /* global fetch, setTimeout */
6
+ import '@endo/init/pre.js';
7
7
 
8
- import '@agoric/casting/node-fetch-shim.js';
9
8
  import '@endo/init';
10
- import '@endo/init/pre.js';
9
+
10
+ import { E } from '@endo/far';
11
11
 
12
12
  import { execFileSync } from 'child_process';
13
13
  import path from 'path';
@@ -15,7 +15,7 @@ import process from 'process';
15
15
  import anylogger from 'anylogger';
16
16
  import { Command, CommanderError, createCommand } from 'commander';
17
17
  import { makeOracleCommand } from './commands/oracle.js';
18
- import { makeEconomicCommiteeCommand } from './commands/ec.js';
18
+ import { makeGovCommand } from './commands/gov.js';
19
19
  import { makePsmCommand } from './commands/psm.js';
20
20
  import { makeReserveCommand } from './commands/reserve.js';
21
21
  import { makeVaultsCommand } from './commands/vaults.js';
@@ -31,7 +31,7 @@ const program = new Command();
31
31
  program.name(progname).version('unversioned');
32
32
 
33
33
  program.addCommand(makeOracleCommand(logger));
34
- program.addCommand(makeEconomicCommiteeCommand(logger));
34
+ program.addCommand(makeGovCommand(logger));
35
35
  program.addCommand(makePerfCommand(logger));
36
36
  program.addCommand(makePsmCommand(logger));
37
37
  program.addCommand(makeVaultsCommand(logger));
@@ -74,13 +74,11 @@ program.addCommand(makeAuctionCommand(logger, { ...procIO, fetch }));
74
74
  program.addCommand(makeInterCommand(procIO, { fetch }));
75
75
  program.addCommand(makeTestCommand(procIO, { fetch }));
76
76
 
77
- try {
78
- await program.parseAsync(process.argv);
79
- } catch (err) {
77
+ void E.when(program.parseAsync(process.argv), undefined, err => {
80
78
  if (err instanceof CommanderError) {
81
79
  console.error(err.message);
82
80
  } else {
83
81
  console.error(err); // CRASH! show stack trace
84
82
  }
85
83
  process.exit(1);
86
- }
84
+ });
@@ -1,5 +1,6 @@
1
1
  import djson from 'deterministic-json';
2
2
  import TOML from '@iarna/toml';
3
+ import * as Tokens from '@agoric/internal/src/tokens.js';
3
4
 
4
5
  export const STAKING_MAX_VALIDATORS = 150;
5
6
  // Required for IBC connections not to time out.
@@ -13,38 +14,38 @@ export const ICA_HOST_ALLOW_MESSAGES = [
13
14
  ];
14
15
 
15
16
  const Stake = /** @type {const} */ ({
16
- name: 'Agoric Staking Token',
17
+ name: Tokens.Stake.proposedName,
17
18
  description: 'The token used by delegates to stake on the Agoric chain',
18
19
  denom_units: [
19
20
  {
20
- denom: 'ubld',
21
+ denom: Tokens.Stake.denom,
21
22
  exponent: 0,
22
23
  },
23
24
  {
24
25
  denom: 'bld',
25
- exponent: 6,
26
+ exponent: Tokens.Stake.displayInfo.decimalPlaces,
26
27
  },
27
28
  ],
28
- base: 'ubld',
29
+ base: Tokens.Stake.denom,
29
30
  display: 'bld',
30
- symbol: 'BLD',
31
+ symbol: Tokens.Stake.symbol,
31
32
  });
32
33
  const Stable = /** @type {const} */ ({
33
- name: 'Agoric stable token',
34
+ name: Tokens.Stable.proposedName,
34
35
  description: 'The stable token used by the Agoric chain',
35
36
  denom_units: [
36
37
  {
37
- denom: 'uist',
38
+ denom: Tokens.Stable.denom,
38
39
  exponent: 0,
39
40
  },
40
41
  {
41
42
  denom: 'ist',
42
- exponent: 6,
43
+ exponent: Tokens.Stable.displayInfo.decimalPlaces,
43
44
  },
44
45
  ],
45
- base: 'uist',
46
+ base: Tokens.Stable.denom,
46
47
  display: 'ist',
47
- symbol: 'IST',
48
+ symbol: Tokens.Stable.symbol,
48
49
  });
49
50
  export const DENOM_METADATA = /** @type {const} */ ([Stake, Stable]);
50
51
 
@@ -80,7 +81,12 @@ export const DEFAULT_RPC_PORT = 26657;
80
81
  export const DEFAULT_PROM_PORT = 26660;
81
82
  export const DEFAULT_API_PORT = 1317;
82
83
 
83
- // Rewrite the app.toml.
84
+ /**
85
+ * Rewrite the app.toml.
86
+ *
87
+ * @param {{ appToml: string, enableCors?: boolean, exportMetrics?: boolean, portNum?: string, chainId?: string, enableRosetta?: boolean, rosettaPort?: string }} input
88
+ * @returns {string} toml
89
+ */
84
90
  export function finishCosmosApp({
85
91
  appToml,
86
92
  enableCors,
@@ -91,6 +97,8 @@ export function finishCosmosApp({
91
97
  rosettaPort = `${DEFAULT_ROSETTA_PORT}`,
92
98
  }) {
93
99
  const rpcPort = Number(portNum);
100
+ // TODO: Use an accurate narrow type.
101
+ /** @type {Record<string, any>} */
94
102
  const app = TOML.parse(appToml);
95
103
 
96
104
  if (enableCors) {
@@ -137,7 +145,12 @@ export function finishCosmosApp({
137
145
  return TOML.stringify(app);
138
146
  }
139
147
 
140
- // Rewrite the config.toml.
148
+ /**
149
+ * Rewrite the config.toml.
150
+ *
151
+ * @param {{ configToml: string, enableCors?: boolean, exportMetrics?: boolean, portNum?: string, persistentPeers?: string, seeds?: string, unconditionalPeerIds?: string }} input
152
+ * @returns {string} toml
153
+ */
141
154
  export function finishTendermintConfig({
142
155
  configToml,
143
156
  enableCors,
@@ -150,6 +163,8 @@ export function finishTendermintConfig({
150
163
  const rpcPort = Number(portNum);
151
164
 
152
165
  // Adjust the config.toml.
166
+ // TODO: Use an accurate narrow type.
167
+ /** @type {Record<string, any>} */
153
168
  const config = TOML.parse(configToml);
154
169
 
155
170
  config.proxy_app = 'kvstore';
@@ -188,7 +203,12 @@ export function finishTendermintConfig({
188
203
  return TOML.stringify(config);
189
204
  }
190
205
 
191
- // Rewrite/import the genesis.json.
206
+ /**
207
+ * Rewrite/import the genesis.json.
208
+ *
209
+ * @param {{ genesisJson: string, exportedGenesisJson?: string }} input
210
+ * @returns {string} json
211
+ */
192
212
  export function finishCosmosGenesis({ genesisJson, exportedGenesisJson }) {
193
213
  const genesis = JSON.parse(genesisJson);
194
214
  const exported = exportedGenesisJson ? JSON.parse(exportedGenesisJson) : {};
@@ -235,7 +255,6 @@ export function finishCosmosGenesis({ genesisJson, exportedGenesisJson }) {
235
255
 
236
256
  // Set the denomination for different modules.
237
257
  genesis.app_state.mint.params.mint_denom = MINT_DENOM;
238
- genesis.app_state.crisis.constant_fee.denom = MINT_DENOM;
239
258
  genesis.app_state.gov.deposit_params.min_deposit = GOV_DEPOSIT_COINS;
240
259
  genesis.app_state.gov.voting_params.voting_period = GOV_VOTING_PERIOD;
241
260
 
@@ -1,14 +1,17 @@
1
- /* eslint-disable @jessie.js/no-nested-await */
2
1
  // @ts-check
3
- /* eslint-disable func-names */
2
+ /* eslint-env node */
4
3
  import { InvalidArgumentError } from 'commander';
5
- import { makeRpcUtils } from '../lib/rpc.js';
4
+ import { Fail } from '@endo/errors';
5
+ import { makeVstorageKit } from '@agoric/client-utils';
6
6
  import { outputActionAndHint } from '../lib/wallet.js';
7
+ import { getNetworkConfig } from '../lib/network-config.js';
7
8
 
8
- const { Fail } = assert;
9
+ /**
10
+ * @import {ParamTypesMap, ParamTypesMapFromRecord} from '@agoric/governance/src/contractGovernance/typedParamManager.js'
11
+ * @import {ParamValueForType} from '@agoric/governance/src/types.js'
12
+ */
9
13
 
10
- /** @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager.js').ParamTypesMap} ParamTypesMap */
11
- /** @template M @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager.js').ParamTypesMapFromRecord<M>} ParamTypesMapFromRecord */
14
+ const networkConfig = await getNetworkConfig({ env: process.env, fetch });
12
15
 
13
16
  /**
14
17
  * @template {ParamTypesMap} M
@@ -59,11 +62,6 @@ export const makeAuctionCommand = (
59
62
  'descending clock step size',
60
63
  BigInt,
61
64
  )
62
- .option(
63
- '--discount-step <integer>',
64
- 'proposed value (basis points)',
65
- BigInt,
66
- )
67
65
  .requiredOption(
68
66
  '--charterAcceptOfferId <string>',
69
67
  'offer that had continuing invitation result',
@@ -91,14 +89,13 @@ export const makeAuctionCommand = (
91
89
  * }} opts
92
90
  */
93
91
  async opts => {
94
- const { agoricNames, readLatestHead } = await makeRpcUtils({ fetch });
95
-
96
- /** @type {{ current: AuctionParamRecord }} */
97
- // @ts-expect-error XXX should runtime check?
98
- const { current } = await readLatestHead(
99
- `published.auction.governance`,
92
+ const { agoricNames, readPublished } = await makeVstorageKit(
93
+ { fetch },
94
+ networkConfig,
100
95
  );
101
96
 
97
+ const { current } = await readPublished(`auction.governance`);
98
+
102
99
  const {
103
100
  AuctionStartDelay: {
104
101
  value: { timerBrand },
@@ -111,7 +108,7 @@ export const makeAuctionCommand = (
111
108
  * but TimeMath.toRel prodocues a RelativeTime (which may be a bare bigint).
112
109
  *
113
110
  * @param {bigint} relValue
114
- * @returns {import('@agoric/time/src/types').RelativeTimeRecord}
111
+ * @returns {import('@agoric/time').RelativeTimeRecord}
115
112
  */
116
113
  const toRel = relValue => ({ timerBrand, relValue });
117
114
 
@@ -130,6 +127,8 @@ export const makeAuctionCommand = (
130
127
  };
131
128
 
132
129
  if (Object.keys(params).length === 0) {
130
+ // InvalidArgumentError is a class constructor, and so
131
+ // must be invoked with `new`.
133
132
  throw new InvalidArgumentError(`no parameters given`);
134
133
  }
135
134