Skip to content

Commit

Permalink
chore(liquidationVisibility): liquidation visibility for `agoric-upgr…
Browse files Browse the repository at this point in the history
…ade-15`

Refs: #6
  • Loading branch information
anilhelvaci committed Jun 21, 2024
1 parent f9a2885 commit 754bfd6
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 58 deletions.
31 changes: 0 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,6 @@ The `-p` is short for [publish](https://docs.docker.com/network/#published-ports

## Design

## Notes to BytePitch Boys
### Check out the repo
```shell
git checkout https://github.com/anilhelvaci/agoric-3-proposals.git
cd agoric-3-proposals
git checkout liq-visibility
cd packages/synthetic-chain
yarn install
```

### Create your own proposal
```shell
cd agoric-3-proposals
## Proposal not made it to the Mainnet yet must start with a letter. For instance; b:liquidation-visibility
mkdir proposals/b:liquidation-visibility
cp -r proposals/64:crabble-start/* proposals/b:liquidation-visibility
## Remove crabble related stuff
rm -rf proposals/b:liquidation-visibility/assets proposals/b:liquidation-visibility/test-crabble-start.js
## Create your own test file
touch proposals/b:liquidation-visibility/test-liquidation-visibility.js
```

### Test your proposal
```shell
cd agoric-3-proposals
docker run -it --entrypoint bash --mount type=bind,src=.,dst=/usr/src/a3p ghcr.io/agoric/agoric-3-proposals
### Below here is the container's shell ###
cd /usr/src/upgrade-test-scripts
./install_deps.sh
```

## Stages

The build is [multi-stage](https://docs.docker.com/build/building/multi-stage/) with several kinds of stages:
Expand Down
2 changes: 1 addition & 1 deletion proposals/b:liquidation-visibility/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ are actually reliable(we test what we will be deploying to the mainnet).

### Addressing problem #3
In order to get around this problem we've created a tarball file ([visibilityFeaturesProof.tar](./visibilityFeaturesProof.tar))
that has what we've developed and put the same file in both the [relase](https://github.com/Jorge-Lopes/agoric-sdk/releases/tag/liq-visibility-a3p-v0.2.tar).
that has what we've developed and put the same file in both the [relase](https://github.com/Jorge-Lopes/agoric-sdk/releases/tag/liq-visibility-a3p-v0.2).
Basically what we do with that file is;
* Check the local and remote versions match using `cksum`
* Move the incarnation 1 code to `/usr/src/agoric-sdk`
Expand Down

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"bundles": [
{
"entrypoint": "../src/vaultFactory/vaultFactory.js",
"bundleID": "b1-c5b68b69afc30ac95f4e40f79dab5bc45006000e9cb6bdeae037fb8f7ba711a8b147766a3691366c812ff748ffc90342d7d8d46aa0a8cb3bd21b323f9bb01c3e",
"fileName": "/Users/anil/.agoric/cache/b1-c5b68b69afc30ac95f4e40f79dab5bc45006000e9cb6bdeae037fb8f7ba711a8b147766a3691366c812ff748ffc90342d7d8d46aa0a8cb3bd21b323f9bb01c3e.json"
"bundleID": "b1-0daeb28abf2bb95cd27bebe80cdcd53ecd670244cb4ca6fe07784697fa8b40bcbc8f3ab1fd92a6d7ce8197efa0d2a28716737f77c68ab2eba88b3c72179f15e0",
"fileName": "/Users/anil/.agoric/cache/b1-0daeb28abf2bb95cd27bebe80cdcd53ecd670244cb4ca6fe07784697fa8b40bcbc8f3ab1fd92a6d7ce8197efa0d2a28716737f77c68ab2eba88b3c72179f15e0.json"
},
{
"entrypoint": "../src/proposals/vaultsUpgrade.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const getManifestCall = harden([
"getManifestVaultsUpgrade",
{
vaultFactoryRef: {
bundleID: "b1-c5b68b69afc30ac95f4e40f79dab5bc45006000e9cb6bdeae037fb8f7ba711a8b147766a3691366c812ff748ffc90342d7d8d46aa0a8cb3bd21b323f9bb01c3e",
bundleID: "b1-0daeb28abf2bb95cd27bebe80cdcd53ecd670244cb4ca6fe07784697fa8b40bcbc8f3ab1fd92a6d7ce8197efa0d2a28716737f77c68ab2eba88b3c72179f15e0",
},
},
]);
Expand Down
9 changes: 7 additions & 2 deletions proposals/b:liquidation-visibility/core-eval-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,13 @@ export const assertVisibility = async (t, managerIndex, base = 0, { nominalStart
scale6(Liquidation.setup.auction.start.collateral) -
scale6(Liquidation.setup.auction.end.collateral),
},
collateralRemaining: { value: 0n },
// endTime: { absValue: endTime.absValue }, Figure out how to read the
// schedule
collateralRemaining: { value: scale6(Liquidation.outcome.remaining.collateral) },
debtToBurn: { value: scale6(Liquidation.setup.auction.start.debt) },
mintedForReserve: { value: scale6(Liquidation.outcome.reserve.minted) },
totalPenalty: { value: scale6(Liquidation.outcome.penalty) },
// startTime: { absValue: startTime.absValue },
// endTime: { absValue: endTime.absValue },
});
};
};
5 changes: 1 addition & 4 deletions proposals/b:liquidation-visibility/eval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@ source /usr/src/upgrade-test-scripts/env_setup.sh

ls -al

# XXX using Ava serial to script the core-eval
# XXX move the eval to TEST phase for now
# XXX because an upgrade breaks the ATOM VM's debt limit
#yarn ava test-liquidation-visibility.js
yarn test:eval

2 changes: 1 addition & 1 deletion proposals/b:liquidation-visibility/helper.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sdkRoot=/usr/src/agoric-sdk
proposalRoot=/usr/src/a3p/proposals/b:liquidation-visibility
proposalRoot=/usr/src/proposals/b:liquidation-visibility

echo "SDK Root" $sdkRoot
echo "Proposal Root" $proposalRoot
Expand Down
2 changes: 1 addition & 1 deletion proposals/b:liquidation-visibility/post.liquidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const config = {
featuresSrc: 'visibilityFeaturesProof.tar',
release:
'https://github.com/Jorge-Lopes/agoric-sdk/releases/tag/liq-visibility-a3p-v0.2',
originalBundle: 'b1-c5b68b69afc30ac95f4e40f79dab5bc45006000e9cb6bdeae037fb8f7ba711a8b147766a3691366c812ff748ffc90342d7d8d46aa0a8cb3bd21b323f9bb01c3e.json'
originalBundle: 'b1-0daeb28abf2bb95cd27bebe80cdcd53ecd670244cb4ca6fe07784697fa8b40bcbc8f3ab1fd92a6d7ce8197efa0d2a28716737f77c68ab2eba88b3c72179f15e0.json'
};

test.before(async t => {
Expand Down
2 changes: 1 addition & 1 deletion proposals/b:liquidation-visibility/post.scenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ test.serial('finish the current auction', async t => {

test.serial('assert visibility', async t => {
await assertVisibility(t, 2, 0, config.currentAuction);
});
});
6 changes: 3 additions & 3 deletions proposals/b:liquidation-visibility/post.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ test.serial('make sure user1 will be funded with STARS', async t => {
});

test.serial('add STARS asset', async t => {
const propDir = '/usr/src/a3p/proposals/b:liquidation-visibility/testAssets/addStarsAsset';
const propDir = '/usr/src/proposals/b:liquidation-visibility/testAssets/addStarsAsset';
const bundleInfos = await readBundles(propDir);
await passCoreEvalProposal(
bundleInfos,
Expand All @@ -121,7 +121,7 @@ test.serial('add STARS asset', async t => {
});

test.serial('fund user1 with STARS', async t => {
const propDir = '/usr/src/a3p/proposals/b:liquidation-visibility/testAssets/fundStars';
const propDir = '/usr/src/proposals/b:liquidation-visibility/testAssets/fundStars';
const bundleInfos = await readBundles(propDir);
await passCoreEvalProposal(
bundleInfos,
Expand All @@ -132,7 +132,7 @@ test.serial('fund user1 with STARS', async t => {
});

test.serial('add STARS collateral', async t => {
const propDir = '/usr/src/a3p/proposals/b:liquidation-visibility/testAssets/addStarsCollateral';
const propDir = '/usr/src/proposals/b:liquidation-visibility/testAssets/addStarsCollateral';
const bundleInfos = await readBundles(propDir);
await passCoreEvalProposal(
bundleInfos,
Expand Down
7 changes: 6 additions & 1 deletion proposals/b:liquidation-visibility/spec.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const Liquidation = {
STARS: 0.309852,
},
shortfall: 0,
minted: 0,
},
// The order in the setup preserved
vaults: [
Expand All @@ -67,5 +68,9 @@ export const Liquidation = {
locked: 3.425146,
},
],
remaining: {
collateral: 0,
},
penalty: 0.30985,
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const assetInfo = {
{ permit: 'upgrade-vaults-liq-visibility-permit.json', script: 'upgrade-vaults-liq-visibility.js' },
],
bundles: [
'b1-7a5b067832fe1e968aca362ad713126737c3f0289dba7b527e0d23648b9419395c16399eed9358d5c555d29d2724561c12902dc2c960eca1bc4f0deee373a5c8.json',
'b1-ccaf7d7db13a60ab9bcdc085240a4be8ee590486a763fb2e94dbc042000af7d5fdeb54edb8bc26febde291c2f777f8c39c47bbbad2b90bcc9da570b09cafec54.json'
'b1-0daeb28abf2bb95cd27bebe80cdcd53ecd670244cb4ca6fe07784697fa8b40bcbc8f3ab1fd92a6d7ce8197efa0d2a28716737f77c68ab2eba88b3c72179f15e0.json',
'b1-88b8532be656b66ebc0298f916802fae523a263bd1935160ee0042cf0cb4136bdba57165a7ca70b78b37402404aaafc02400019383c6d6b076a7236a352a6ba3.json'
],
},
},
Expand Down Expand Up @@ -67,7 +67,7 @@ test.serial('fund user1 before the upgrade', async t => {

test.serial('test', async t => {

const dir = '/usr/src/a3p/proposals/b:liquidation-visibility/assets';
const dir = '/usr/src/proposals/b:liquidation-visibility/assets';
const bundleInfos = await readBundles(dir);

await passCoreEvalProposal(bundleInfos, { title: `Core eval of ${dir}`, ...staticConfig });
Expand Down
1 change: 0 additions & 1 deletion proposals/b:liquidation-visibility/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -e

source /usr/src/upgrade-test-scripts/env_setup.sh

yarn test:eval
yarn test:post-liq
yarn test:post
yarn test:scenario
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const manifestBundleRef = {bundleID:"b1-beec8763eb9738cbd6a4c47f3948bf40a17269ae
const getManifestCall = harden([
"getFundStarsManifest",
{
fundAccounts: ["agoric1p2aqakv3ulz4qfy2nut86j9gx0dx0yw09h96md"],
fundAccounts: ["agoric1rwwley550k9mmk6uq6mm6z4udrg8kyuyvfszjk"],
},
]);
const overrideManifest = {
Expand Down
Binary file modified proposals/b:liquidation-visibility/visibilityFeaturesProof.tar
Binary file not shown.

0 comments on commit 754bfd6

Please sign in to comment.