From 7673e86a71967bdb56f8facddf3159925b43224c Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Sat, 23 Sep 2023 10:09:40 -0700 Subject: [PATCH 1/3] fixup! fix: durable creatorFacet --- agoric/contract/src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/agoric/contract/src/index.js b/agoric/contract/src/index.js index f964bb0aa..195808ee7 100644 --- a/agoric/contract/src/index.js +++ b/agoric/contract/src/index.js @@ -164,8 +164,9 @@ export const start = async (zcf, privateArgs, baggage) => { ), ); + const { governorFacet } = makeDurableGovernorFacet(baggage, kreadKit.creator); return harden({ - creatorFacet: makeDurableGovernorFacet(baggage, kreadKit.creator), + creatorFacet: governorFacet, // no governed parameters, so no need to augment. publicFacet: kreadKit.public, }); From 35a5a8f7ed9bd0fe0a31857468e579170a60ca3e Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Sat, 23 Sep 2023 10:40:21 -0700 Subject: [PATCH 2/3] docs: update README for Makefile --- README.md | 21 -------------- agoric/Makefile | 3 +- agoric/README.md | 71 +++++++++++++++--------------------------------- 3 files changed, 24 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index 1a2e674d6..76e3b468a 100644 --- a/README.md +++ b/README.md @@ -88,24 +88,3 @@ To run the application for more than one user follow these steps: 4. Navigate to `localhost:3000` on each session and approve the app in both wallets 10. Enjoy! - - -## to start up the backend on a local chain - -1. Start the chain - 1. make local-testnet -2. Update KEPLR_ADDRESS in Makefile.paths - 1. try to make the committee below, but it'll give you an aswer that some account doesn't exist - 2. copy that address into Makefile.paths.local -3. fund the account - 1. make fund-account -4. make the committee - 1. make kread-committee -5. provision the fee collector wallet - 1. make provision-fee-collector -6. start the KREAd contract - 1. make clean start-kread - -To confirm it started, -- in chain log you should see "CONTRACT INIT SUCCESS" -- after that `agd query vstorage children published` should include "kread" diff --git a/agoric/Makefile b/agoric/Makefile index d25f90212..9cef95ba4 100644 --- a/agoric/Makefile +++ b/agoric/Makefile @@ -124,7 +124,8 @@ provision-account: provision-fee-collector: cd $(COSMIC_SWINGSET_PATH); \ - make fund-provision-pool provision-acct ACCT_ADDR=$(FEE_ADDRESS) \ + make fund-provision-pool provision-acct ACCT_ADDR=$(ROYALTY_ADDRESS) \ + make fund-provision-pool provision-acct ACCT_ADDR=$(PLATFORM_ADDRESS) \ fund-account: cd $(COSMIC_SWINGSET_PATH); \ diff --git a/agoric/README.md b/agoric/README.md index ae015c3a3..e8330018e 100644 --- a/agoric/README.md +++ b/agoric/README.md @@ -1,55 +1,28 @@ -# KREAd deploy steps +# Contract deploy steps To succesfully run the below steps making use of the makefile, it is important to have a local file `Makefile.paths.local` filled in with the required paths and addresses, an example can be found in `Makefile.paths`. Steps to run: ensure you are in the agoric folder otherwise cd to agoric folder -```sh -cd agoric -``` - -get the dependencies for current Mainnet: - -```sh -agoric install agoric-upgrade-11 -``` - -run chain from: - -```sh -make local-testnet -``` - -run client for chain: - -```sh -make client-local-testnet -``` - -create kread-bundle and publish it to chain (this step requires the `client-local-testnet` otherwise it has no address to bundle and publish from): - -```sh -make kread-bundle -``` - -provision the account that is in the core eval proposal - -```sh -make provision-fee-collector -``` - -create and vote on proposal - -```sh -make proposal -``` - -The proposal logs some board_id information to chain-logs which can be used to verify it ran correctly. - -Vstorage should contain the following after startup: - -- kread bundle in bundles -- kread instance in agoricNames/instances -- KREAdCHARACTER and KREAdITEM brands in agoricNames/brands -- kread storage path with kread-info populated with boardIds +1. Start the chain + 1. make local-testnet +2. Update KEPLR_ADDRESS in Makefile.paths + 1. try to `make kread-committee` + 2. it will fail but look for `"sender","value":"agoric1` to find the address + 3. copy that address into Makefile.paths.local for KEPLR_ADDRESS +3. fund the account + 1. make fund-account +4. make the committee + 1. make kread-committee +5. provision the fee collector wallet + 1. make provision-fee-collector +6. start the KREAd contract + 1. make clean start-kread + +To confirm it started, + +- in chain log you should see "CONTRACT INIT SUCCESS" +- after that `agd query vstorage children published` should include "kread" + +If you encounter `Request would exceed mint limit` try `make fund-account` From 3209723013a2c32b163316199ce63d9f26a52066 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Sat, 23 Sep 2023 10:54:33 -0700 Subject: [PATCH 3/3] feat: tracing in start-kread-proposal --- .../src/proposal/start-kread-proposal.js | 18 ++++++++++++++++-- agoric/package.json | 3 ++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/agoric/contract/src/proposal/start-kread-proposal.js b/agoric/contract/src/proposal/start-kread-proposal.js index 075ca2548..b51dd568e 100644 --- a/agoric/contract/src/proposal/start-kread-proposal.js +++ b/agoric/contract/src/proposal/start-kread-proposal.js @@ -2,14 +2,19 @@ /** @file This is a module for use with swingset.CoreEval. */ +// XXX this is unsupported, but it's already included in the bundle (statically linked) +import { makeTracer } from '@agoric/internal'; import { E } from '@endo/far'; +import { deeplyFulfilled } from '@endo/marshal'; + import { baseCharacters, baseItems } from './base-inventory.js'; import '@agoric/governance/src/types-ambient.js'; -import { deeplyFulfilled } from '@endo/marshal'; const KREAD_LABEL = 'KREAd'; +const trace = makeTracer(KREAD_LABEL); + const contractInfo = { storagePath: 'kread', instanceName: 'kread', @@ -91,6 +96,7 @@ const startGovernedInstance = async ( E(E(zoe).getInvitationIssuer()).getAmountOf(poserInvitationP), ]); + trace('awaiting governorTerms'); const governorTerms = await deeplyFulfilled( harden({ timer, @@ -111,6 +117,8 @@ const startGovernedInstance = async ( }, }), ); + + trace('awaiting startInstance'); const governorFacets = await E(zoe).startInstance( contractGovernor, {}, @@ -124,6 +132,8 @@ const startGovernedInstance = async ( }), `${label}-governor`, ); + + trace('awaiting facets'); const [instance, publicFacet, creatorFacet, adminFacet] = await Promise.all([ E(governorFacets.creatorFacet).getInstance(), E(governorFacets.creatorFacet).getPublicFacet(), @@ -195,10 +205,12 @@ export const startKread = async (powers, config) => { const { royaltyAddr, platformFeeAddr } = config.options; + trace('awaiting royaltyDepositFacet'); const [royaltyDepositFacet] = await reserveThenGetNamePaths( namesByAddressAdmin, [[royaltyAddr, 'depositFacet']], ); + trace('awaiting platformFeeDepositFacet'); const [platformFeeDepositFacet] = await reserveThenGetNamePaths( namesByAddressAdmin, [[platformFeeAddr, 'depositFacet']], @@ -253,6 +265,7 @@ export const startKread = async (powers, config) => { const privateArgs = harden({ powers: kreadPowers, ...kreadConfig }); + trace('awaiting startGovernedInstance'); const facets = await startGovernedInstance( { zoe, @@ -285,6 +298,7 @@ export const startKread = async (powers, config) => { brands: { KREAdCHARACTER: characterBrand, KREAdITEM: itemBrand }, } = await E(zoe).getTerms(instance); + trace('awaiting KREAd initialization'); await Promise.all([ E(creatorFacet).initializeBaseAssets(baseCharacters, baseItems), E(creatorFacet).initializeMetrics(), @@ -300,7 +314,7 @@ export const startKread = async (powers, config) => { produceItemIssuer.resolve(itemIssuer); produceItemBrand.resolve(itemBrand); - console.log('CONTRACT INIT SUCCESS!'); + trace('CONTRACT INIT SUCCESS!'); }; harden(startKread); diff --git a/agoric/package.json b/agoric/package.json index 98ac175b9..a109d8a2b 100644 --- a/agoric/package.json +++ b/agoric/package.json @@ -28,7 +28,8 @@ "@agoric/cosmic-swingset": "agoric-upgrade-11" }, "dependencies": { - "agoric": "agoric-upgrade-11" + "agoric": "agoric-upgrade-11", + "@agoric/internal": "agoric-upgrade-11" }, "scripts": { "preinstall": "node -e \"process.env.AGORIC_INSTALL && process.exit(0); console.warn('please use: agoric install . For details, see https://agoric.com/documentation/'); process.exit(1)\"",