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

fixes to Economic Governance abilities #6422

Merged
merged 5 commits into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion packages/agoric-cli/src/lib/rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const fromAgoricNet = str => {
export const networkConfig =
'AGORIC_NET' in process.env && process.env.AGORIC_NET !== 'local'
? await fromAgoricNet(NonNullish(process.env.AGORIC_NET))
: { rpcAddrs: ['http://0.0.0.0:26657'], chainName: 'agoric' };
: { rpcAddrs: ['http://0.0.0.0:26657'], chainName: 'agoriclocal' };
// console.warn('networkConfig', networkConfig);

/**
Expand Down
Binary file modified packages/governance/docs/contractGovernance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/governance/docs/contractGovernance.puml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package "GovernedContract Vat" <<Rectangle>> {
+terms: { electionManager, governedParams }
+getState()
+getContractGovernor()
-getParamManagerRetriever()
-getParamMgrRetriever()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you make a change to this file, please run .../governance/docs/gen.sh, and checkin the changes to the .png.

}
note left : calls buildParamManager(paramDesc);\nmakes paramMgr state public\nreturns paramMgr in creatorFacet
}
Expand Down
1 change: 0 additions & 1 deletion packages/governance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
},
"devDependencies": {
"@agoric/deploy-script-support": "^0.9.2",
"@agoric/swingset-vat": "^0.28.0",
"@endo/bundle-source": "^2.3.1",
"@endo/init": "^0.5.49",
"ava": "^4.3.1",
Expand Down
18 changes: 18 additions & 0 deletions packages/governance/src/contractGovernor.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,23 @@ const start = async (zcf, privateArgs) => {
governedCF,
);

/**
* @param {Invitation} poserInvitation
* @returns {Promise<void>}
*/
const replaceElectorate = poserInvitation => {
/** @type {Promise<import('./contractGovernance/typedParamManager.js').TypedParamManager<{'Electorate': 'invitation'}>>} */
// @ts-expect-error cast
const paramMgr = E(E(governedCF).getParamMgrRetriever()).get({
key: 'governedParams',
});

// TODO use updateElectorate
return E(paramMgr).updateParams({
Electorate: poserInvitation,
});
};

// this conditional was extracted so both sides are equally asynchronous
/** @type {() => Promise<ApiGovernor>} */
const initApiGovernance = async () => {
Expand Down Expand Up @@ -278,6 +295,7 @@ const start = async (zcf, privateArgs) => {
};

const creatorFacet = Far('governor creatorFacet', {
replaceElectorate,
voteOnParamChanges,
voteOnApiInvocation,
voteOnOfferFilter: voteOnFilter,
Expand Down
6 changes: 4 additions & 2 deletions packages/governance/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* T extends 'brand' ? Brand :
* T extends 'installation' ? Installation:
* T extends 'instance' ? Instance :
* T extends 'invitation' ? Amount :
* T extends 'invitation' ? Amount : // XXX this is the getter value but not the setter
* T extends 'nat' ? bigint :
* T extends 'ratio' ? Ratio :
* T extends 'string' ? string :
Expand Down Expand Up @@ -392,7 +392,7 @@
* @property {(name: string) => Brand} getBrand
* @property {(name: string) => Instance} getInstance
* @property {(name: string) => Installation} getInstallation
* @property {(name: string) => Amount} getInvitationAmount
* @property {(name: string) => Amount<'set'>} getInvitationAmount
* @property {(name: string) => bigint} getNat
* @property {(name: string) => Ratio} getRatio
* @property {(name: string) => string} getString
Expand Down Expand Up @@ -540,6 +540,8 @@
* @property {() => Promise<LimitedCreatorFacet<CF>>} getCreatorFacet - creator
* facet of the governed contract, without the tightly held ability to change
* param values.
* @property {(poserInvitation: Invitation) => Promise<void>} replaceElectorate
* @property {() => Promise<AdminFacet>} getAdminFacet
* @property {() => GovernedPublicFacet<PF>} getPublicFacet - public facet of the governed contract
* @property {() => Instance} getInstance - instance of the governed
* contract
Expand Down
55 changes: 35 additions & 20 deletions packages/inter-protocol/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
TITLE = Inter Protocol Preview: Interchain Asset Vaults

EVAL_DEPOSIT = 1000000ubld
GAS_ADJUSTMENT = 1.2

# USAGE
# set KEY= on command to your key or modify this file
# edit the EVALS paths to your script
# see what open questions there are
#
# submit proposal
# make submit-proposal
# see what its question number is
# make gov-q
# go over to cosmic-swingset and vote for that number
# make scenario2-vote VOTE_PROPOSAL=2
# poll until the vote concludes to see how it turned out
# make gov-q


# stage
AG_SOLO_BASEDIR = /tmp/agoricdev10
NETWORK_CONFIG = https://devnet.agoric.net/network-config
CHAIN_ID = $(shell curl -Ss "$(NETWORK_CONFIG)" | jq -r .chainName)
RPC_IP = $(shell curl -Ss "$(NETWORK_CONFIG)" | jq -r .rpcAddrs[0] | cut -d":" -f1)
CHAIN_OPTS = --node=http://$(RPC_IP):26657 --chain-id=$(CHAIN_ID)
# NETWORK_CONFIG = https://ollinet.agoric.net/network-config
# CHAIN_ID = $(shell curl -Ss "$(NETWORK_CONFIG)" | jq -r .chainName)
#RPC_IP = $(shell curl -Ss "$(NETWORK_CONFIG)" | jq -r .rpcAddrs[0] | cut -d":" -f1)
NODE = $(shell curl -Ss "$(NETWORK_CONFIG)" | jq -r .rpcAddrs[0])

# running local
CHAIN_ID = agoriclocal
CHAIN_OPTS = --chain-id=$(CHAIN_ID)

# local-chain
# AG_SOLO_BASEDIR=../cosmic-swingset/t1/8000
Expand All @@ -20,29 +36,28 @@ CHAIN_OPTS = --node=http://$(RPC_IP):26657 --chain-id=$(CHAIN_ID)
# gov-amm-vaults-etc-permit.json gov-amm-vaults-etc.js \
# ./scripts/gov-startPSM-permit.json ./scripts/gov-startPSM.js

EVALS = gov-add-collateral-permit.json gov-add-collateral.js \
gov-invite-committee-permit.json gov-invite-committee.js \
gov-price-feed-permit.json gov-price-feed.js
# TODO parameterize
EVALS = test/psm/wildcard-permit.json test/psm/gov-replace-committee.js
DESCRIPTION = test/psm/gov-replace-committee.md
TITLE = $$(head -1 $(DESCRIPTION))

submit-proposal: $(EVALS)
git describe --tags --always
git diff --stat
cat $(AG_SOLO_BASEDIR)/ag-cosmos-helper-address
KEY=k1
# ADDR=agoric1z8vavxgfjztlhay5kftgp4kp5l4znkh4gf8lg4
ADDR=$$(agd keys show $(KEY) --output json |jq --raw-output .address)

submit-proposal: $(EVALS) $(DESCRIPTION)
agd keys show $(KEY)
agd $(CHAIN_OPTS) \
--home=$(AG_SOLO_BASEDIR)/ag-cosmos-helper-statedir --keyring-backend=test \
tx gov submit-proposal swingset-core-eval \
$(EVALS) \
--title="$(TITLE) on $(CHAIN_ID)" --description="$$(cat ./docs/run-preview-vault-asset.md)" \
--title="$(TITLE) on $(CHAIN_ID)" --description="$$(cat $(DESCRIPTION))" \
--deposit=$(EVAL_DEPOSIT) \
--gas=auto --gas-adjustment=$(GAS_ADJUSTMENT) \
--yes --from=ag-solo -b block

--yes --from=$(KEY) -b sync

gov-q:
agd $(CHAIN_OPTS) query gov proposals --output json | \
jq -c '.proposals[] | [.proposal_id,.voting_end_time,.status]';

ADDR=agoric1z8vavxgfjztlhay5kftgp4kp5l4znkh4gf8lg4

bank-q:
agd $(CHAIN_OPTS) query bank balances $(ADDR)
Loading