anilhelvaci / agoric-3-proposals

Proposals run or planned for Mainnet (agoric-3)
Apache License 2.0
0 stars 0 forks source link

a3p integration for liquidation visibility #6

Open Jorge-Lopes opened 9 months ago

Jorge-Lopes commented 9 months ago

Current status:

Note: in order to run the eval.sh script it is necessary to first start the agd, ( @alexanderem49 that is the source of the time-out error you were facing ). For this purpose I end up have 2 open terminals and run the start_agd script in one and the eval in the other. I think the run_eval script would be able to run both processes but it was confusing to follow the log messages.

Task: confirm with @anilhelvaci if this is the correct flow to setup the env and execute the test

Jorge-Lopes commented 9 months ago

Error: RPC error -32600 - Invalid Request: error reading request body: http: request body too large

Context

After starting the container built using the ghcr.io/agoric/agoric-3-proposals image, we intent to test a proposal for updating the vaultFactory contract.

When installing the contract bundle (generated by executing agoric run <vaultFactory-proposal-builder>) the error Error: RPC error -32600 - Invalid Request: error reading request body: http: request body too large is triggered. The complete logs are provided bellow.

I have made sure that the bundle I provided in the assets directory is the one generated by the agoric run command, as it can be verified by the vaultFactory core-eval.

The same behaviour does not happens when I install the bundles on a local chain launched using the start-local-chain.sh script of the agoric-cli pkg, which I verified via the storage viewer.

This error message point me to the issue #28, but the proposed work around was not useful for me.

I am not sure if this issue can be related with the issue #17

Error message

Chain Logs: ``` agd --chain-id agoriclocal --keyring-backend test --from agoric1s8lmczw37rz7qendxa2pc88qrlmhn4gsda8vn4 tx swingset install-bundle @/usr/src/a3p/proposals/b:liquidation-visibility/assets/bundle-vaultFactory.json --gas auto --broadcast-mode block --yes --output json Error: RPC error -32600 - Invalid Request: error reading request body: http: request body too large Usage: agd tx swingset install-bundle /@/- [flags] Flags: -a, --account-number uint The account number of the signing account (offline mode only) -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync") --compress Compress the bundle in transit (default true) --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) --fee-account string Fee account pays fees for the transaction instead of deducting from the signer --fees string Fees to pay along with transaction; eg: 10uatom --from string Name or address of private key with which to sign --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically (default 200000) --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase is not accessible) -h, --help help for install-bundle --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) (default "os") --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used --ledger Use a connected Ledger device --node string : to tendermint rpc interface for this chain (default "tcp://localhost:26657") --note string Note to add a description to the transaction (previously --memo) --offline Offline mode (does not allow any online functionality -o, --output string Output format (text|json) (default "json") -s, --sequence uint The sequence number of the signing account (offline mode only) --sign-mode string Choose sign mode (direct|amino-json), this is an advanced feature --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height -y, --yes Skip tx broadcasting prompt confirmation Global Flags: --chain-id string The network chain ID --home string directory for config and data (default "/root/.agoric") --log_format string The logging format (json|plain) (default "plain") --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") --trace print out full stack trace on errors ```
Jorge-Lopes commented 9 months ago

Follow up on the issue described above

A lead to a possible solution was discussed on office hours, that pointed to a possible source of this error could be the bundle be larger than 1MB. See https://github.com/Agoric/dapp-offer-up/issues/28.

To test this case I used the test-build-proposal.js for the created vaultFactory proposal-builder.

Based on the test result, we can assume that this is not the issue

yarn test test/liquidationVisibility/test-proposal.js
yarn run v1.22.19
$ ava test/liquidationVisibility/test-proposal.js

agoric: run: running /Users/jorgelopes/Documents/GitHub/Agoric/sow6/liquidation-visibility/agoric-sdk-liquidation-visibility/packages/builders/scripts/inter-protocol/liquidationVisibility/proposal-builder.js
  ✔ proposal builder generates compressed bundles less than 1MB (5.5s)
    ℹ agoric run stdout: agoric: run: Deploy script will run with Node.js ESM
      bundle-source --cache-js /Users/jorgelopes/Documents/GitHub/Agoric/sow6/liquidation-visibility/agoric-sdk-liquidation-visibility/packages/builders/scripts/inter-protocol/liquidationVisibility/bundles /Users/jorgelopes/Documents/GitHub/Agoric/sow6/liquidation-visibility/agoric-sdk-liquidation-visibility/packages/inter-protocol/src/vaultFactory/vaultFactory.js vaultFactory
      creating vaultFactory-permit.json
      creating vaultFactory.js
      You can now run a governance submission command like:
        agd tx gov submit-proposal swingset-core-eval vaultFactory-permit.json vaultFactory.js \
          --title="Enable <something>" --description="Evaluate vaultFactory.js" --deposit=1000000ubld \
          --gas=auto --gas-adjustment=1.2
      Remember to install bundles before submitting the proposal:
        agd tx swingset install-bundle @/Users/jorgelopes/.agoric/cache/b1-5302546fafc63a2ef36142fb50c2333eb5e6775f6eebb725d1e3ce83aad7b27b3341992d9d83488383bfd19784b241fccc29a8cb9eeb9ebf33059b3976ff9b22.json
        agd tx swingset install-bundle @/Users/jorgelopes/.agoric/cache/b1-91a1a9da1dfa3bc6d3a8918cc6ff013869ebdf4b8df64ebd70e745289e32a382fc5850ce1b717b26b7707bdc861fb62aa2e840038d95f8082f8bb2656a01afce.json

      Object <[Object: null prototype] {}> { initial: 0, total: 1 }

    ℹ {
        bundleId: 'b1-5302546fafc63a2ef36142fb50c2333eb5e6775f6eebb725d1e3ce83aad7b27b3341992d9d83488383bfd19784b241fccc29a8cb9eeb9ebf33059b3976ff9b22',
        compressedSize: '0.50689697265625 MB',
      }
    ℹ {
        bundleId: 'b1-91a1a9da1dfa3bc6d3a8918cc6ff013869ebdf4b8df64ebd70e745289e32a382fc5850ce1b717b26b7707bdc861fb62aa2e840038d95f8082f8bb2656a01afce',
        compressedSize: '0.39804744720458984 MB',
      }
  ─

  1 test passed

As an experiment, I passed the --compress flag (which should be set as true by default) to the tx swingset install-bundle command. But the result was still the same.

agd --chain-id agoriclocal --keyring-backend test --from agoric1s8lmczw37rz7qendxa2pc88qrlmhn4gsda8vn4 tx swingset install-bundle @/usr/src/a3p/proposals/b:liquidation-visibility/assets/bundle-vaultFactory.json --compress --gas auto --broadcast-mode block --yes --output json
Error: RPC error -32600 - Invalid Request: error reading request body: http: request body too large
Usage:
  agd tx swingset install-bundle <JSON>/@<FILE>/- [flags]
Jorge-Lopes commented 9 months ago

The following commit seems to fix the issue faa07731190e0bc1cfe55203d2195816870c83d2

Although there was some inconsistent behaviours while I was testing with different approaches. If I can replicate those results I will share it here as well.

Nonetheless, @alexanderem49 the update above will be enough for you to continue extending the integration test coverage