Skip to content

Commit

Permalink
fix: lower bundle storage cost to 0.02 IST / Kb like mainnet (#24)
Browse files Browse the repository at this point in the history
* fix: lower bundle storage cost to 0.02 IST / Kb like mainnet

Minting IST can't be skipped altogether; we still need _some_.
But we can mint just 100 and only 1 time, rather than 4k several
times.

* refactor: compute bundle cost param-change dynamically
  • Loading branch information
dckc authored Jan 10, 2024
1 parent 8da2191 commit 853c415
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
42 changes: 42 additions & 0 deletions contract/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,48 @@ SIGN_BROADCAST_OPTS=--keyring-backend=test --chain-id=$(CHAINID) \
--gas=auto --gas-adjustment=$(GAS_ADJUSTMENT) \
--yes -b block

mint100:
make FUNDS=1000$(ATOM) fund-acct
cd /usr/src/agoric-sdk && \
yarn --silent agops vaults open --wantMinted 100 --giveCollateral 100 >/tmp/want-ist.json && \
yarn --silent agops perf satisfaction --executeOffer /tmp/want-ist.json --from user1 --keyring-backend=test

# https://agoric.explorers.guru/proposal/61
lower-bundle-cost: bundles/lower-bundle-cost.json ./scripts/voteLatestProposalAndWait.sh
agd tx gov submit-proposal param-change bundles/lower-bundle-cost.json \
$(SIGN_BROADCAST_OPTS) \
--from user1
./scripts/voteLatestProposalAndWait.sh
# agd query swingset params


bundles/swingset-params.json:
mkdir -p bundles/
agd query swingset params -o json >$@

.ONESHELL:
bundles/lower-bundle-cost.json: bundles/swingset-params.json
@read PARAMS < bundles/swingset-params.json; export PARAMS
node - <<- EOF >$@
const storageByte = '20000000';
const paramChange = {
title: 'Lower Bundle Cost to 0.02 IST/Kb (a la mainnet 61)',
description: '0.02 IST/Kb',
deposit: '10000000ubld',
changes: [{
subspace: 'swingset',
key: 'beans_per_unit',
value: '...',
}],
};
const params = JSON.parse(process.env.PARAMS);
const ix = params.beans_per_unit.findIndex(({key}) => key === 'storageByte');
params.beans_per_unit[ix].beans = storageByte;
paramChange.changes[0].value = params.beans_per_unit;
console.log(JSON.stringify(paramChange, null, 2));
EOF

# Keep mint4k around a while for compatibility
mint4k:
make FUNDS=1000$(ATOM) fund-acct
cd /usr/src/agoric-sdk && \
Expand Down
4 changes: 0 additions & 4 deletions contract/scripts/install-bundles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ install_bundle() {
# exit fail if bundle-list is emtpy
[ -s bundles/bundle-list ] || exit 1

# TODO: avoid needing so much IST
# https://github.com/agoric-labs/dapp-game-places/issues/3
make mint4k
make mint4k
make balance-q # do we have enough IST?

for b in $(cat bundles/bundle-list); do
Expand Down
3 changes: 2 additions & 1 deletion contract/scripts/run-chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ waitForBlock 2
# Approve any proposals forever in the background.
approveProposals &

make -C /workspace/contract mint4k
make -C /workspace/contract mint100
make -C /workspace/contract lower-bundle-cost

# bring back chain process to foreground
wait
5 changes: 5 additions & 0 deletions contract/scripts/voteLatestProposalAndWait.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -ueo pipefail

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

0 comments on commit 853c415

Please sign in to comment.