Skip to content

Commit

Permalink
WIP gov testing
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Sep 26, 2023
1 parent 9959cef commit a7b7a07
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 15 deletions.
4 changes: 3 additions & 1 deletion packages/agoric-cli/src/bin-agops.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import anylogger from 'anylogger';
import { Command, CommanderError, createCommand } from 'commander';
import { makeOracleCommand } from './commands/oracle.js';
import { makeEconomicCommiteeCommand } from './commands/ec.js';
import { makeGovCommand } from './commands/gov.js';
import { makePsmCommand } from './commands/psm.js';
import { makeReserveCommand } from './commands/reserve.js';
import { makeVaultsCommand } from './commands/vaults.js';
Expand All @@ -31,10 +32,11 @@ const logger = anylogger('agops');
const progname = path.basename(process.argv[1]);

const program = new Command();
program.name(progname).version('unversioned');
program.name(progname).version('docker');

program.addCommand(makeOracleCommand(logger));
program.addCommand(makeEconomicCommiteeCommand(logger));
program.addCommand(makeGovCommand(logger));
program.addCommand(makePerfCommand(logger));
program.addCommand(makePsmCommand(logger));
program.addCommand(makeVaultsCommand(logger));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Related: https://github.com/agoric-labs/KREAd/releases/tag/gryo-rc0

It has to be built with these specific addresses, using this one really long command:
```
```sh
KREAD_COMMITTEE_ADDRESSES='{"krgov1": "agoric1890064p6j3xhzzdf8daknd6kpvhw766ds8flgw", "krgov2": "agoric1vqm5x5sj4lxmj2kem7x92tuhaum0k2yzyj6mgu"}' \
KREAD_COMMITTEE_NAME=kread-gov \
KREAD_ROYALTY_ADDRESS=agoric1yjc8llu3fugm7tgqye4rd5n92l9x2dhe30dazp \
Expand All @@ -18,40 +18,62 @@ make clean build-proposals
```

Build the images if you haven't lately,
```
```sh
make build
```


Then with MN2 set to the repo you build the above from:
```
```sh
TARGET=agoric-upgrade-11 MN2=/opt/agoric/KREAd/ make run
```

That will run:
```
```sh
docker run --rm -it -p 26656:26656 -p 26657:26657 -p 1317:1317 -v "${PWD}:/workspace" -v "${MN2}:/mn2" -e "DEBUG=SwingSet:ls,SwingSet:vat" -e "DEST=1" -e "TMUX_USE_CC=0" \
--entrypoint /usr/src/agoric-sdk/upgrade-test-scripts/start_to_to.sh \
agoric/upgrade-test:agoric-upgrade-11
```

Then in the shell that opens up, replace its `upgrade-test-scripts` with a symlink:
Then in a new shell do the following.
(TODO integrate these into the layers)
```sh
# Replace its `upgrade-test-scripts` with a symlink:
rm -rf upgrade-test-scripts
ln -s /workspace/upgrade-test-scripts
```

Then patch `/usr/src/agoric-sdk/bin/agd`:
- find `$BUILD_ONLY || exec 1>&2` (line 94?)
- put this in above it: `${NO_BUILD:-false} && exit 0`
TODO have the layer modify agd to never build itself
# Patch agoric-cli
cp upgrade-test-scripts/agoric-upgrade-11/gov-cmd packages/agoric-cli/src/commands/gov.js
cp upgrade-test-scripts/agoric-upgrade-11/agops-bin packages/agoric-cli/src/bin-agops.js
## this should be docker-u11
agops --version

Then use the `/mn2` that `make run` mounted:
```sh
# patch agd so it doesn't try to rebuild
#sed --in-place=.backup '93,$ d' /usr/src/agoric-sdk/bin/agd
#- find `$BUILD_ONLY || exec 1>&2` (line 94?)
#- put this in above it: `${NO_BUILD:-false} && exit 0`
vi /usr/src/agoric-sdk/bin/agd


# Run the test using the `/mn2` that `make run` mounted:
cd /usr/src/agoric-sdk/upgrade-test-scripts

NO_BUILD=true \
MN2_PROPOSAL_INFO=/mn2/agoric/dist/ \
MN2_INSTANCE=kread \
yarn ava /usr/src/agoric-sdk/upgrade-test-scripts/agoric-upgrade-11/mn2-start.test.js
```

Test governance
TODO put into JS
```sh
# should have two invitations in balances
agoric wallet show --keyring-backend=test --from krgov1

agops gov committee --name kreadCommittee --send-from krgov1
agops gov charter --name kreadCommitteeCharter --send-from krgov1

# now should have two used invitations
agoric wallet show --keyring-backend=test --from krgov1

```
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ export const makeAgd = ({ execFileSync }) => {
const out = await exec(['query', ...qArgs, ...nodeArgs, ...outJson], {
stdio: ['ignore', 'pipe', 'ignore'],
});
return JSON.parse(out);
try {
return JSON.parse(out);
} catch (e) {
console.error(e);
console.info('output:', out);
}
},
});
const nameHub = freeze({
Expand Down Expand Up @@ -86,7 +91,12 @@ export const makeAgd = ({ execFileSync }) => {
...outJson,
];
const out = exec(args);
return JSON.parse(out);
try {
return JSON.parse(out);
} catch (e) {
console.error(e);
console.info('output:', out);
}
},
...ro,
...nameHub,
Expand Down

0 comments on commit a7b7a07

Please sign in to comment.