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

InstAgoric network for Econ Stress Test (xnet) #5375

Closed
16 of 17 tasks
Tartuffo opened this issue May 16, 2022 · 25 comments
Closed
16 of 17 tasks

InstAgoric network for Econ Stress Test (xnet) #5375

Tartuffo opened this issue May 16, 2022 · 25 comments
Assignees
Labels
Inter-protocol Overarching Inter Protocol

Comments

@Tartuffo
Copy link
Contributor

Tartuffo commented May 16, 2022

This must include the installation of the code-complete Inter Protocol contracts, as well as the Oracles and required collaterals wired through.

@Tartuffo Tartuffo added the Inter-protocol Overarching Inter Protocol label May 16, 2022
@Tartuffo Tartuffo changed the title Launch InstaAgoric that will support Econ Stress Test, on May 25 New InstAgoric launched and ready for Econ Stress Test, on May 25 May 16, 2022
@dckc
Copy link
Member

dckc commented May 25, 2022

@michaelfig You and were talking about how we work the permissionless interchain AMM pool stuff into bootstrap... but now that it has come up tangibly, I don't recall how we were going to do it. The relevant test code is https://github.com/Agoric/agoric-sdk/blob/master/packages/run-protocol/test/test-gov-collateral.js#L321-L352 . Making that into a deploy script looks straightforward, but that doesn't fit in the genesis "core proposals" mechanism.

The tangible bit, as reported by @arirubinstein :

2022/05/24 23:55:12 Running SwingSet until bootstrap is ready
Loading makeSlogSender fromlaunch-chain: buildSwingset
portHandler threw (Error#1)
Error#1: INTERCHAIN_ISSUER_BOARD_ID is required

  at Module.defaultProposalBuilder
Cannot initialize Controller Error: INTERCHAIN_ISSUER_BOARD_ID is required
+ '[' -f /state/hang ']'

@Tartuffo Tartuffo changed the title New InstAgoric launched and ready for Econ Stress Test, on May 25 New InstAgoric launched and ready for Econ Stress Test, on May 27 May 26, 2022
@dckc
Copy link
Member

dckc commented May 26, 2022

xnet is up, though without telemetry due to #5445:

https://xnet.agoric.net/
https://xnet.explorer.agoric.net/agoric/blocks/2 2022-05-26T20:33:18.296276163Z
C1D4A989907944500D97CCA9B5E3A047CFAECEB91648C48195A408DBD0042DDA

p.s. but not yet viable due to complications with provisioning clients.

@dckc
Copy link
Member

dckc commented May 27, 2022

xnet is up now and supporting provisioning of clients.

https://xnet.explorer.agoric.net/agoric/blocks/2 2022-05-26T23:04:34.062691692Z
AC925E387609D61A7A141967C58E88A19E9380B869B7D6A5A368AEE0A9FBA2A1
Chain_id: agoricxnet-6

command[5] E(home.myAddressNameAdmin).getMyAddress()
history[5] "agoric1qs0fuk6u5jnwrmlurhf29gwezv4f3jy4gdl8jf"

AMM: no liquidity

https://amm.agoric.app/ can't quote prices (it just spins) because there is no liquidity:

command[3] E(amm.pub).getAllPoolBrands()
history[3] [[Object Alleged: IbcATOM brand]{}]
command[4] E(amm.pub).getPoolAllocation(history[3][0])
history[4] {"Central":{"brand":[Object Alleged: RUN brand]{},"value":0n},"Liquidity":{"brand":[Object Alleged: IbcATOMLiquidity brand]{},"value":0n},"Secondary":{"brand":[Object Alleged: IbcATOM brand]{},"value":0n}}

@michaelfig can you send me a bunch of tokens (IbcATOM, RUN) so I can add some?

Vaults: no collaterals? no Oracles?

There are no vault collaterals... or at least: none with functioning oracles.

command[8] E(vf.pub).getCollaterals()
history[8] unresolved Promise

@dckc
Copy link
Member

dckc commented May 27, 2022

AMM has liquidity

Using the xnet shared agsolo that has lots of tokens:

command[34] E(amm.pub).getPoolAllocation(IbcATOM.brand)
history[34] {"Central":{"brand":[Object Alleged: RUN brand]{},"value":200000000000n},"Liquidity":{"brand":[Object Alleged: IbcATOMLiquidity brand]{},"value":0n},"Secondary":{"brand":[Object Alleged: IbcATOM brand]{},"value":100000000n}}

image

@dckc
Copy link
Member

dckc commented May 27, 2022

Vault has IbcATOM collateral with manual Oracle price

command[48] E(oa).pushResult('12.34')

image

oracleAdmin: rescued offerResult

scripts/manual-price-feed.js started to work (using the remote ag-solo) but then:

=== Extracting oracleAdmins from price feed offers...
=== Control-C to cancel
agoric: (TypeError#1)
TypeError#1: Cannot read properties of undefined (reading 'instance')

  at packages/run-protocol/scripts/manual-price-feed.js:104:27

fortunately, I was able to rescue it:

command[38] E(home.wallet).getAdminFacet().then(f => wa=f)
history[38] [Object Alleged: adminFacet]{}
command[39] E(wa).getOffersNotifier()
history[39] [Object Alleged: notifier]{}
command[40] E(h[39]).getUpdateSince()
...
command[45] E(home.wallet).lookup('offerResult', h[40].value[2].id)
history[45] [Object Alleged: OracleAdmin]{}
command[46] oa=h[45]

ref:

Voted to raise the debt limit

I used vote-raise-debt-limit.js . It was straightforward except

  • I had to use the xnet shared remote ag-solo
  • I had to up the voting period from 30 to 45 seconds

So I'm able to create a vault:

image

@Tartuffo
Copy link
Contributor Author

@dckc @mfig can this be closed, or do we still need to "re-spin xnet to include reserve shortfall stuff below" (in the description)?

@dckc
Copy link
Member

dckc commented May 30, 2022

I still think we should re-spin xnet with the reserve shortfall stuff tomorrow.

@dckc
Copy link
Member

dckc commented May 31, 2022

updating xnet to agoricdev-13

Chain: agoricxnet-7
https://xnet.explorer.agoric.net/agoric/blocks/2 2022-05-30T20:13:09.484183052Z
AA560DD129B3FBAA9A50D4D9660596B6CD294068A3655442D6B5F297BC177A77

econ committee not available to start vaults

@michaelfig help?

I'm trying to do the vote to raise the debt limit, but the shared agsolo that has the voting invitation is stuck:

command[0] E(home.myAddressNameAdmin).getMyAddress()
history[0] Promise.reject("TypeError: Cannot deliver \"getMyAddress\" to target; typeof target is \"undefined\"")

command[1] home.LOADING
history[1] ["agoric","wallet"]

@dckc
Copy link
Member

dckc commented Jun 1, 2022

agoricxnet-8 all set

Due to trouble with econ committee voter facet, we respun xnet today.
https://xnet.explorer.agoric.net/agoric/blocks/2 2022-05-31T21:27:16.816920939Z
AAB6C28982E99E0F8B0A829DEC9CEEE810671090BE6E10F92A0321CA49497AC7

Then, I...

  • created a vault, which required
    • raising debt limit
    • posting an oracle price
  • made an AMM swap, which required
    • adding AMM liquidity add-initial-liquidity.js
      • I meant to set the price of ATOM to 20 RUN but somehow goofed and set it to 0.20 RUN.

@dckc dckc closed this as completed Jun 1, 2022
@dckc
Copy link
Member

dckc commented Jun 4, 2022

p.s. I fixed the xnet AMM price, finally:

image

ack: wolfram alpha: solve xy=203662439646,x/y=12,x>0,y>0

pool Central Secondary XY price
IbcATOM 2,898,437 70,266 203662439646 41.24933
  -1,335,124 60,010    
  1,563,314 130,276 203662439646 12.00000

@dckc
Copy link
Member

dckc commented Jun 9, 2022

p.s. we restarted: agoricxnet-9

2022-06-08T20:26:45.03466185Z
F13A96ECE9725392D310FF9E99AA5A957213027442C16871185A9DB6CA1DC6B2
https://xnet.explorer.agoric.net/agoric/blocks/2

@dckc
Copy link
Member

dckc commented Jun 16, 2022

@michaelfig once #5614 lands, please re-spin.

@dckc dckc reopened this Jun 16, 2022
@dckc
Copy link
Member

dckc commented Jun 16, 2022

All systems go on agoricxnet-11

vault liquidation confirmed.

2022-06-16T21:19:50.071425508Z
18EB49E452F073F95105D6D88FBD9A5C6AF8D5432841EC9A9D90EB555DEDDAFD
https://xnet.explorer.agoric.net/agoric/blocks/2

@dckc dckc closed this as completed Jun 16, 2022
@dckc
Copy link
Member

dckc commented Jun 30, 2022

respun xnet with RPC: problem with vaults

 A problem occured while loading the collaterals — make sure you have RUN in your Zoe fees purse.

image

I can get collaterals from the REPL:

command[12] E(vf.pub).getCollaterals()
history[12] [{"brand":[Object Alleged: IbcATOM brand]{},"interestRate":{"denominator":{"brand":[Object Alleged: RUN brand]{},"value":100n},"numerator":{"brand":[Object Alleged: RUN brand]{},"value":1n}},"liquidationMargin":{"denominator":{"brand":[Object Alleged: RUN brand]{},"value":100n},"numerator":{"brand":[Object Alleged: RUN brand]{},"value":200n}},"marketPrice":{"denominator":{"brand":[Object Alleged: IbcATOM brand]{},"value":10000n},"numerator":{"brand":[Object Alleged: RUN brand]{},"value":20000000n}},"stabilityFee":{"denominator":{"brand":[Object Alleged: RUN brand]{},"value":100n},"numerator":{"brand":[Object Alleged: RUN brand]{},"value":1n}}}]

In the console, I see CTP_RETURN with that same data, followed by Couldnt load collaterals (TypeError#1) with no stack trace to speak of.

https://xnet.explorer.agoric.net/agoric/blocks/2
2022-06-30T16:07:04.745273165Z
0D6749B0103D582F65BA33D606E6A7263D88CE8E8640AE097B0689C76E6115F3

@dckc dckc reopened this Jun 30, 2022
@dckc
Copy link
Member

dckc commented Jun 30, 2022

@samsiegart you asked for the whole console log... I'm not really sure how to get it; the closest I got is https://gist.github.com/dckc/f3c441d27ddc2986106f388c0f46ddc5

@samsiegart
Copy link
Contributor

I see this when I run locally:

Couldnt load collaterals TypeError: Cannot read properties of undefined (reading 'DebtLimit')
  at setupTreasury (Application.jsx:227:1)

I tried reverting 52e9b10 which worked. Can we get the DebtLimit some other way, or should we add it back in? @turadg

@turadg
Copy link
Member

turadg commented Jul 1, 2022

Can we get the DebtLimit some other way

Yeah, DebtLimit is a parameter of the vaultManager (specified in the call to addVaultType). I don't know why it used to be provided as a term of the contract.

@samsiegart here's how to get it from the public facet of the vault factory:

const params = await E(vaultsAPI).getGovernedParams({
collateralBrand: brand,
});
t.deepEqual(params.DebtLimit, {
type: 'amount',
value: { brand: runBrand, value: 0n },
});
});

@dckc dckc changed the title New InstAgoric launched and ready for Econ Stress Test, on May 27 InstAgoric network for Econ Stress Test Jul 5, 2022
@dckc dckc assigned samsiegart and unassigned arirubinstein and michaelfig Jul 5, 2022
@dckc
Copy link
Member

dckc commented Jul 5, 2022

@samsiegart can you confirm that vaults are working in xnet (including liquidation)?
If not, point to an issue that's blocking it?

@samsiegart
Copy link
Contributor

@samsiegart can you confirm that vaults are working in xnet (including liquidation)? If not, point to an issue that's blocking it?

I'm not sure how to simulate liquidation, but I was able to get a vault opened on xnet with these steps https://gist.github.com/samsiegart/4015af98add766be5eb688bb0e97d0f4

Screen Shot 2022-07-05 at 2 44 12 PM

@dckc
Copy link
Member

dckc commented Jul 6, 2022

Thanks, @samsiegart ; I confirmed that vaults are working.

@dckc dckc closed this as completed Jul 6, 2022
@dckc
Copy link
Member

dckc commented Aug 16, 2022

Nalin reports not being able to get the "whale" account to load. @samsiegart found at least a partial diagnosis:

command[66] E(home.wallet).foo()
history[66] Promise.reject("Error: vat terminated")

So xnet is hosed.

@dckc dckc reopened this Aug 16, 2022
@dckc dckc changed the title InstAgoric network for Econ Stress Test InstAgoric network for Econ Stress Test (xnet) Aug 16, 2022
@dckc
Copy link
Member

dckc commented Aug 17, 2022

xnet is up with 13 contracts listed in RPC query (though without #5929)

thanks, @arirubinstein !

published.agoricNames.instance
$ ~/go/bin/agd --node=https://xnet.rpc.agoric.net:443 query vstorage data published.agoricNames.instance -o json | jq '.value | fromjson | {body: .body | fromjson, slots}'
{
  "body": [
    [
      "economicCommittee",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 0
      }
    ],
    [
      "amm",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 1
      }
    ],
    [
      "ammGovernor",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 2
      }
    ],
    [
      "VaultFactory",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 3
      }
    ],
    [
      "feeDistributor",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 4
      }
    ],
    [
      "Treasury",
      {
        "@qclass": "slot",
        "index": 3
      }
    ],
    [
      "VaultFactoryGovernor",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 5
      }
    ],
    [
      "stakeFactory",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 6
      }
    ],
    [
      "Pegasus",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 7
      }
    ],
    [
      "reserve",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 8
      }
    ],
    [
      "reserveGovernor",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 9
      }
    ],
    [
      "psm",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 10
      }
    ],
    [
      "psmGovernor",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 11
      }
    ],
    [
      "interchainPool",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 12
      }
    ],
    [
      "ATOM-USD price feed",
      {
        "@qclass": "slot",
        "iface": "Alleged: InstanceHandle",
        "index": 13
      }
    ]
  ],
  "slots": [
    "board00613",
    "board03040",
    "board01029",
    "board00848",
    "board04719",
    "board04149",
    "board01034",
    "board00917",
    "board05736",
    "board03138",
    "board00530",
    "board04431",
    "board05141",
    "board02021"
  ]
}

@dckc
Copy link
Member

dckc commented Aug 17, 2022

AMM has 10,000 IbcATOM to 200,000 IST liquidity

published.amm.pool0
$ ~/go/bin/agd --node=https://xnet.rpc.agoric.net:443 query vstorage data published.amm.pool0 -o json | jq '.value | fromjson | {body: .body | fromjson, slots}'
{
  "body": {
    "central": {
      "brand": {
        "@qclass": "slot",
        "iface": "Alleged: IST brand",
        "index": 0
      },
      "value": {
        "@qclass": "bigint",
        "digits": "200000000000"
      }
    },
    "secondary": {
      "brand": {
        "@qclass": "slot",
        "iface": "Alleged: IbcATOM brand",
        "index": 1
      },
      "value": {
        "@qclass": "bigint",
        "digits": "100000000"
      }
    }
  },
  "slots": [
    "board0074",
    "board03446"
  ]
}

Vault Factory has IbcATOM collateral with 10,000,000 IST debt limit

published.vaultFactory.manager0
$ ~/go/bin/agd --node=https://xnet.rpc.agoric.net:443 query vstorage data published.vaultFactory.metrics -o json | jq '.value | fromjson | {body: .body | fromjson, slots}'
{
  "body": {
    "collaterals": [
      {
        "@qclass": "slot",
        "iface": "Alleged: IbcATOM brand",
        "index": 0
      }
    ],
    "rewardPoolAllocation": {}
  },
  "slots": [
    "board03446"
  ]
}
$ ~/go/bin/agd --node=https://xnet.rpc.agoric.net:443 query vstorage data published.vaultFactory.manager0.governance -o json | jq '.value | fromjson | {body: .body | fromjson, slots}'
{
  "body": {
    "current": {
      "DebtLimit": {
        "type": "amount",
        "value": {
          "brand": {
            "@qclass": "slot",
            "iface": "Alleged: IST brand",
            "index": 0
          },
          "value": {
            "@qclass": "bigint",
            "digits": "10000000000000"
          }
        }
      },
      "InterestRate": {
        "type": "ratio",
        "value": {
          "denominator": {
            "brand": {
              "@qclass": "slot",
              "index": 0
            },
            "value": {
              "@qclass": "bigint",
              "digits": "100"
            }
          },
          "numerator": {
            "brand": {
              "@qclass": "slot",
              "index": 0
            },
            "value": {
              "@qclass": "bigint",
              "digits": "1"
            }
          }
        }
      },
      "LiquidationMargin": {
        "type": "ratio",
        "value": {
          "denominator": {
            "brand": {
              "@qclass": "slot",
              "index": 0
            },
            "value": {
              "@qclass": "bigint",
              "digits": "100"
            }
          },
          "numerator": {
            "brand": {
              "@qclass": "slot",
              "index": 0
            },
            "value": {
              "@qclass": "bigint",
              "digits": "200"
            }
          }
        }
      },
      "LiquidationPenalty": {
        "type": "ratio",
        "value": {
          "denominator": {
            "brand": {
              "@qclass": "slot",
              "index": 0
            },
            "value": {
              "@qclass": "bigint",
              "digits": "100"
            }
          },
          "numerator": {
            "brand": {
              "@qclass": "slot",
              "index": 0
            },
            "value": {
              "@qclass": "bigint",
              "digits": "1"
            }
          }
        }
      },
      "LoanFee": {
        "type": "ratio",
        "value": {
          "denominator": {
            "brand": {
              "@qclass": "slot",
              "index": 0
            },
            "value": {
              "@qclass": "bigint",
              "digits": "100"
            }
          },
          "numerator": {
            "brand": {
              "@qclass": "slot",
              "index": 0
            },
            "value": {
              "@qclass": "bigint",
              "digits": "1"
            }
          }
        }
      }
    }
  },
  "slots": [
    "board0074"
  ]
}```

```console
$ ~/go/bin/agd --node=https://xnet.rpc.agoric.net:443 query vstorage data published.vaultFactory.manager0.metrics -o json | jq '.value | fromjson | {body: .body | fromjson, slots}'
{
  "body": {
    "numActiveVaults": 0,
    "numLiquidatingVaults": 0,
    "numLiquidationsCompleted": 0,
    "retainedCollateral": {
      "brand": {
        "@qclass": "slot",
        "iface": "Alleged: IbcATOM brand",
        "index": 0
      },
      "value": {
        "@qclass": "bigint",
        "digits": "0"
      }
    },
    "totalCollateral": {
      "brand": {
        "@qclass": "slot",
        "index": 0
      },
      "value": {
        "@qclass": "bigint",
        "digits": "0"
      }
    },
    "totalCollateralSold": {
      "brand": {
        "@qclass": "slot",
        "index": 0
      },
      "value": {
        "@qclass": "bigint",
        "digits": "0"
      }
    },
    "totalDebt": {
      "brand": {
        "@qclass": "slot",
        "iface": "Alleged: IST brand",
        "index": 1
      },
      "value": {
        "@qclass": "bigint",
        "digits": "0"
      }
    },
    "totalOverageReceived": {
      "brand": {
        "@qclass": "slot",
        "index": 1
      },
      "value": {
        "@qclass": "bigint",
        "digits": "0"
      }
    },
    "totalProceedsReceived": {
      "brand": {
        "@qclass": "slot",
        "index": 1
      },
      "value": {
        "@qclass": "bigint",
        "digits": "0"
      }
    },
    "totalShortfallReceived": {
      "brand": {
        "@qclass": "slot",
        "index": 1
      },
      "value": {
        "@qclass": "bigint",
        "digits": "0"
      }
    }
  },
  "slots": [
    "board03446",
    "board0074"
  ]
}```

```console
agoric-sdk/packages/cosmic-swingset$ ~/go/bin/agd --node=https://xnet.rpc.agoric.net:443 query vstorage data published.vaultFactory.manager0 -o json | jq '.value | fromjson | {body: .body | fromjson, slots}'
{
  "body": {
    "compoundedInterest": {
      "denominator": {
        "brand": {
          "@qclass": "slot",
          "iface": "Alleged: IST brand",
          "index": 0
        },
        "value": {
          "@qclass": "bigint",
          "digits": "100"
        }
      },
      "numerator": {
        "brand": {
          "@qclass": "slot",
          "index": 0
        },
        "value": {
          "@qclass": "bigint",
          "digits": "100"
        }
      }
    },
    "interestRate": {
      "denominator": {
        "brand": {
          "@qclass": "slot",
          "index": 0
        },
        "value": {
          "@qclass": "bigint",
          "digits": "100"
        }
      },
      "numerator": {
        "brand": {
          "@qclass": "slot",
          "index": 0
        },
        "value": {
          "@qclass": "bigint",
          "digits": "1"
        }
      }
    },
    "latestInterestUpdate": {
      "@qclass": "bigint",
      "digits": "1660694400"
    },
    "liquidatorInstance": {
      "@qclass": "slot",
      "iface": "Alleged: InstanceHandle",
      "index": 1
    }
  },
  "slots": [
    "board0074",
    null
  ]
}

@dckc
Copy link
Member

dckc commented Aug 17, 2022

Price Feed: 19 USD / ATOM (vs 19.37)

The price was set using E(history[0]).pushResult('19.37') but the ratio we get via RPC is 19 USD to 1 ATOM. Is it using a unit price of 10^-6 ATOM rather than 1 ATOM?

published.priceFeed.ATOM_USD_price_feed
$ ~/go/bin/agd --node=https://xnet.rpc.agoric.net:443 query vstorage data published.priceFeed.ATOM_USD_price_feed -o json | jq '.value | fromjson | {body: .body | fromjson, slots}'
{
  "body": {
    "quoteAmount": {
      "brand": {
        "@qclass": "slot",
        "iface": "Alleged: quote brand",
        "index": 0
      },
      "value": [
        {
          "amountIn": {
            "brand": {
              "@qclass": "slot",
              "iface": "Alleged: ATOM brand",
              "index": 1
            },
            "value": {
              "@qclass": "bigint",
              "digits": "1"
            }
          },
          "amountOut": {
            "brand": {
              "@qclass": "slot",
              "iface": "Alleged: USD brand",
              "index": 2
            },
            "value": {
              "@qclass": "bigint",
              "digits": "19"
            }
          },
          "timer": {
            "@qclass": "slot",
            "iface": "Alleged: timerService",
            "index": 3
          },
          "timestamp": {
            "@qclass": "bigint",
            "digits": "1660695302"
          }
        }
      ]
    },
    "quotePayment": {
      "@qclass": "slot",
      "iface": "Alleged: quote payment",
      "index": 4
    }
  },
  "slots": [
    null,
    "board02810",
    "board0639",
    null,
    null
  ]
}

@dckc
Copy link
Member

dckc commented Aug 18, 2022

wallet.agoric.app, amm.agoric.app are up-to-date (thanks, @samsiegart ).

xnet is current at 2022-08-18T16:27:06 5098751

@dckc dckc closed this as completed Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Inter-protocol Overarching Inter Protocol
Projects
None yet
Development

No branches or pull requests

6 participants