Skip to content

Commit

Permalink
feat(bundle-cost): lower cost by 100x as in mainnet 61
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc authored and turadg committed Mar 6, 2024
1 parent bc6dac6 commit 2691d42
Show file tree
Hide file tree
Showing 6 changed files with 1,337 additions and 1 deletion.
1 change: 1 addition & 0 deletions proposals/61:lo-bundle-cost/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
13 changes: 12 additions & 1 deletion proposals/61:lo-bundle-cost/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# reverse-engineer Proposal 61: Lower bundle cost

lower-bundle-cost.json:
# `agd tx gov submit-proposal param-change` seems
# to JSON.stringify the value in the proposal.
# So we need to `fromjson` it before feeding it back to `agd`.
lower-bundle-cost.json: tx-61.json
jq '.tx.body.messages[0].content | .changes[0].value |= fromjson' tx-61.json >$@

# To get the hash of the tx for proposal 61,
# we found the proposer (either using an explorer or
# `agd --node $ARCHIVE_NODE query gov proposer 61`)
# and looked at their transaction history.
hash=6EA7B46DFDD0973338BB50781B33D651FE0E8EE8ABF4D7BCB1BF8235334AAFE0
ARCHIVE_NODE="https://main-a.rpc.agoric.net:443"
tx-61.json:
agd --node $(ARCHIVE_NODE) query tx $(hash) -o json >$@

# clean up locally computed files
clean:
rm -f lower-bundle-cost.json

# clean up files cached from the network as well
realclean: clean
rm -f tx-61.json
17 changes: 17 additions & 0 deletions proposals/61:lo-bundle-cost/eval.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Exit when any command fails
set -e

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

GAS_ADJUSTMENT=1.2
SIGN_BROADCAST_OPTS="--keyring-backend=test --chain-id=$CHAINID \
--gas=auto --gas-adjustment=$GAS_ADJUSTMENT \
--yes -b block"

agd tx gov submit-proposal param-change lower-bundle-cost.json \
$SIGN_BROADCAST_OPTS --from validator

voteLatestProposalAndWait

17 changes: 17 additions & 0 deletions proposals/61:lo-bundle-cost/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"agoricProposal": {
"type": "/cosmos.params.v1beta1.ParameterChangeProposal"
},
"type": "module",
"license": "Apache-2.0",
"dependencies": {
"@agoric/synthetic-chain": "0.0.7"
},
"scripts": {
"agops": "yarn --cwd /usr/src/agoric-sdk/ --silent agops"
},
"ava": {
"timeout": "30s"
},
"packageManager": "[email protected]"
}
16 changes: 16 additions & 0 deletions proposals/61:lo-bundle-cost/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e

expected=20000000

params="$(agd query swingset params -o json)"
cost="$(echo $params | jq -r ".beans_per_unit | .[] | select(.key == \"storageByte\") | .beans" )"

# fail if cost is not expected
if [ "$cost" != "$expected" ]; then
echo "Expected cost $expected, got $cost"
exit 1
else
echo "Cost is $cost"
fi

Loading

0 comments on commit 2691d42

Please sign in to comment.