Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(inter-protocol): write liquidation auction results to Vstorage #8994

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b353c13
# This is a combination of 22 commits.
Jorge-Lopes Jan 12, 2024
09120bf
chore(liquidationVisibility): update dependencies
anilhelvaci Feb 16, 2024
0e63755
chore(liquidationVisibility): fix test 'visibility-after-upgrade'
anilhelvaci Feb 16, 2024
04662fe
fix(liquidationVisibility): start using boot package
anilhelvaci Feb 19, 2024
87a3089
parent 1f641d9bcdf35161e0ca053742918c29a2f53090
anilhelvaci Feb 19, 2024
239e6e6
chore(liquidationVisibility): prepare upgrade proposal
anilhelvaci Feb 20, 2024
02de8a6
chore(liquidationVisibility): copy old version of vaultFactory and up…
Jorge-Lopes Feb 22, 2024
1ec3b7d
feat(liquidationVisibility): add bootstrap tests for back compatibili…
Jorge-Lopes Feb 23, 2024
ddf980b
feat(liquidationVisibility): Store `liquidationsStorageNode` in ephem…
anilhelvaci Feb 23, 2024
6d9fa50
fix(LiquidationVisibility): #21 #22 fix rebase changes, add utils pag…
Jorge-Lopes Feb 16, 2024
1144114
fix(liquidationVisibility): minor updates to contract and bootstrap t…
Jorge-Lopes Feb 26, 2024
00ee30b
fix(liquidationVisibility): rebase fixes
anilhelvaci Feb 26, 2024
6aeaef8
fix(liquidationVisibility): lint fixes
anilhelvaci Feb 26, 2024
e20f0da
chore(liquidationVisibility): add snapshot
anilhelvaci Feb 26, 2024
4508c86
fixup(liquidationVisibility): remove the unused prefix
anilhelvaci Jun 10, 2024
c45b568
fixup(liquidationVisibility): destructure helper facet
anilhelvaci Jun 10, 2024
b5bd27a
fixup(liquidationVisibility): drop references to `LiquidationVisibili…
anilhelvaci Jun 10, 2024
298aa06
fixup(liquidationVisibility): add `startTime` field to `auctionResult…
anilhelvaci Jun 10, 2024
3ae097a
fixup(liquidationVisibility): remove leftover comment and fix typo.
anilhelvaci Jun 10, 2024
d835bd8
fixup(liquidationVisibility): implement `checkWritersPresent` and rem…
anilhelvaci Jun 12, 2024
6188fc8
fixup(liquidationVisibility): Directly invoking methods on `liquidati…
anilhelvaci Jun 13, 2024
7c9d989
fixup(liquidationVisibility): Remove compatability tests and their re…
anilhelvaci Jun 13, 2024
3699de9
fixup(liquidationVisibility): Remove `allValuesSetteled()`
anilhelvaci Jun 17, 2024
95f8c8e
fixup(liquidationVisibility): Rebase fixes
anilhelvaci Jun 19, 2024
e42c203
fixup(liquidationVisibility): Rebase fixes - type and lint
anilhelvaci Jun 19, 2024
2093f0a
fixup(liquidationVisibility): Rebase fixes - type and lint
anilhelvaci Jun 20, 2024
0fa050f
chore(liquidationVisibility): Add new data fields
anilhelvaci Jun 20, 2024
541a6d5
test(liquidationVisibility): update expected auctionResult of checkVi…
Jorge-Lopes Jun 20, 2024
c013902
chore(liquidationVisibility): update LiquidationOutcome and expected …
Jorge-Lopes Jun 21, 2024
38687dc
chore(liquidationVisibility): Add a3p proposal
anilhelvaci Jun 21, 2024
6931290
chore(liquidationVisibility): Remove unnecessary change from liquidat…
anilhelvaci Jun 21, 2024
09f3452
chore(liquidationVisibility): `builders` lint fix
anilhelvaci Jun 25, 2024
84c896c
fix(liquidationVisibility): rebase fix
anilhelvaci Jul 15, 2024
f3a508c
fix(liquidationVisibility): lint fixes
anilhelvaci Jul 15, 2024
a31107d
fix(liquidationVisibility): lint fixes
anilhelvaci Jul 15, 2024
66108ca
fix(liquidationVisibility): remove `Work Backlog`
anilhelvaci Jul 15, 2024
8483c67
fix(liquidationVisibility): rename `test-liquidation-visibility.js` t…
anilhelvaci Jul 16, 2024
bd8a071
fix(liquidationVisibility): start using `submission` for builds
anilhelvaci Jul 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.yarn
artifacts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
83 changes: 83 additions & 0 deletions a3p-integration/proposals/d:liquidation-visibility/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Liquidation Visibility
This proposal aims to perform a `core-eval` upgrade to `vaultFactory`. The purpose of the upgrade is to
improve the visibility of liquidating vaults. For the full spec please see [this issue](https://github.com/Jorge-Lopes/liquidation-visibility/issues/2)
and for minor additional specs see [this one](https://github.com/Jorge-Lopes/agoric-sdk/issues/36).

## Test Structure
We follow the usual `a3p` flow where we first perform our upgrade at `EVAL` phase then run our tests in `TEST`
phase. Notice that we don't run anything under `USE` phase as we don't want the changes we make to create the
appropriate test circumstances to effect future builds.

To execute our core-eval we use;
* [eval-liquidation-visibility.js](./eval-liquidation-visibility.js)

Our main challenge in testing the visibility of liquidations is to trigger an actual liquidation in our post
eval tests. Below files are used to set up that environment;
* [post.liquidation.js](./post.liquidation.js)
* [post.test.js](./post.test.js)

And test our desired behavior we use;
* [post.scenario.js](./post.scenario.js)

## How to trigger liquidation?
In the below diagram, we describe the steps we go thorough to trigger a fake liquidation.
The reason why it is problematic subject is;
1. We need to be able to control the time and `chainTimerService` does not allow that
2. Auctioneer at this version is not upgradable so we have to deploy a new one
3. We have to make sure `vaultFactory` does use our fake auctioneer and the timer we want
* The problem with this one is with making sure while we adjust the code base to serve
our needs to create a suitable liquidation environment, we also have to make sure our tests
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).
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`
* Bundle `inter-protocol` again
* Make sure the vaultFactory bundle hash matches the one we use to perform our core-eval
* At this stage we're sure that the version we have in `/usr/src/agoric-sdk` is the same
as the one we deployed
* Adjust VF code programmatically in [post.liquidation.js](./post.liquidation.js) to
make sure it uses the fake auctioneer and manual timer so that we can trigger the liquidation

### The whole proposal flow

```mermaid
sequenceDiagram
participant image as ghcr.io/agoric/agoric-3-proposals
participant web as release
Note over image,image: vaultFactory: inc 0 code
Note over testFlow,agd: PHASE: EVAL
testFlow ->>+ agd: eval-liquidation-visibility.js
agd -->>- testFlow: upgrade successful
Note over agd,agd: vaultFactory: inc 1
Note over testFlow,agd: PHASE: TEST
Note over testFlow,testFlow: post.liquidation.js running
testFlow ->>+ web: fetch vaultFactory inc 1 code
web -->>- testFlow: incarnation 1 code
testFlow ->> testFlow: make sure inc 1 code matches the local one
testFlow ->> testFlow: unarchive local inc 1 code
testFlow ->> image: copy vaultFactory inc 1 code
Note over image,image: vaultFactory: inc 1 code
testFlow ->> image: bundle vaultFactory
testFlow ->> testFlow: check bundle hash from the image matches inc 1's bundle hash
Note over testFlow, testFlow: we must use a manual timer to trigger liquidation
testFlow ->> testFlow: update vaultFactory.js, vaultDirector.js, vaultManager.js
Note over testFlow, testFlow: we must deploy a new auctioneer as well that uses the same timer as VF
testFlow ->> testFlow: build proposal to deploy changes required to trigger liquidation
testFlow ->> agd: Execute built proposal
Note over agd,agd: vaultFactory: inc 2
Note over testFlow,testFlow: post.test.js running
testFlow ->> agd: deploy a new vaultManager for the asset STARS
Note over testFlow, agd: we use addSTARS.js from. the sdk
testFlow ->> testFlow: accept oracle invitations
testFlow ->> testFlow: push STARS/IST price
Note over testFlow,testFlow: post.scenario.js running
testFlow ->> testFlow: open STARS vaults
testFlow ->> testFlow: place bids to fake auctioneer
testFlow ->> testFlow: make sure aution is run and bids are settled
testFlow ->> testFlow: assert the visibility of the liquidation
```
Loading
Loading