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

feat: save the outgoing EC Charter instance and kit #10749

Merged
merged 2 commits into from
Dec 20, 2024
Merged

Conversation

Chris-Hibbert
Copy link
Contributor

refs: #10680

Description

Add the EconomicCommittee Charter to the instances and kits being saved.

Security Considerations

Don't throw away stuff you might need.

Scaling Considerations

Negligible

Documentation Considerations

None

Testing Considerations

Added a test to see that the charterID was saved.

Upgrade Considerations

If U18 and U19 get combined, this will impact the contracts being updated in U18. If we only pull some changes from U19 into U18, this should be inclduded.

@Chris-Hibbert Chris-Hibbert added code-style defensive correctness patterns; readability thru consistency Governance Governance contract-upgrade force:integration Force integration tests to run on PR labels Dec 19, 2024
@Chris-Hibbert Chris-Hibbert self-assigned this Dec 19, 2024
@Chris-Hibbert Chris-Hibbert requested a review from a team as a code owner December 19, 2024 21:54
Copy link

cloudflare-workers-and-pages bot commented Dec 19, 2024

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 355a2e1
Status: ✅  Deploy successful!
Preview URL: https://8b81bc41.agoric-sdk.pages.dev
Branch Preview URL: https://cth-retain-charter.agoric-sdk.pages.dev

View logs

Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

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

I'm not positive I understand the motivation / context; you may want more eyes.

a few suggestions to consider...

});

const label = 'econCommitteeCharter';
const previousCharterKit = { label, ...econCharterKit };
Copy link
Member

Choose a reason for hiding this comment

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

This reads as if any label in econCharterKit overrides the one on line 335.

Suggested change
const previousCharterKit = { label, ...econCharterKit };
const previousCharterKit = { ...econCharterKit, label };

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In some ways I prefer the other order. We need to add this because the label wasn't added initially, not because we want to change it. If this proposal is re-used, there's no reason to change an existing label.

But I'll change it.

Comment on lines +293 to +294
* PromiseSpaceOf<{ retiredContractInstances: MapStore<string, Instance> }>} powers
* - The resources and capabilities required to start the committee.
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if/when retiredContractInstances should be added in vats/src
/core/types-ambient.d.ts


trace('Starting new EC Charter Instance');

const terms = await harden({
Copy link
Member

Choose a reason for hiding this comment

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

Spurious await?

Suggested change
const terms = await harden({
const terms = harden({

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dropped

const previousCharterKit = { label, ...econCharterKit };

const boardID = await E(board).getId(previousCharterKit.instance);
const identifier = `${label}-${boardID}`;
Copy link
Member

Choose a reason for hiding this comment

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

are we relying on this identifier syntax somewhere? It seems like there should be helper functions to construct and parse it. perhaps near provideRetiredInstances?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So far there's no plan for code to rely on it. People may construct scripts to make use of it (like Richard's vat killer), but the boardID has to be looked up manually at this point to know what name to make.

const charterIDs = Array.from(retiredContractInstances.keys()).filter(k =>
k.startsWith('econCommitteeCharter'),
);
assert(charterIDs);
Copy link
Member

Choose a reason for hiding this comment

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

log it/them? I'd feel better seeing positive evidence in a ci log.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -36,6 +36,12 @@ export const testRecordedRetiredInstances = async ({
const committeeInstance = retiredContractInstances.get(committeeIDs[0]);
assert(await E(contractKits).get(committeeInstance));

const charterIDs = Array.from(retiredContractInstances.keys()).filter(k =>
Copy link
Member

Choose a reason for hiding this comment

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

I'm used to seeing...

Suggested change
const charterIDs = Array.from(retiredContractInstances.keys()).filter(k =>
const charterIDs = [...retiredContractInstances.keys()].filter(k =>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@warner warner left a comment

Choose a reason for hiding this comment

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

yeah, looks good to me

previousInstanceP,
contractKitsP,
econCharterKitP,
provideRetiredInstances(retiredContractInstancesP, produceRetiredInstances),
Copy link
Member

Choose a reason for hiding this comment

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

still slightly weirded out by our approach for this, but it looks sound

Copy link
Member

Choose a reason for hiding this comment

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

in case it makes you feel any better, the approach goes back to the vaults release.

// Initialize the periodic collectors list if we don't have one.
periodicFeeCollectorsP.resolve(
makeScalarBigMapStore('periodicCollectors', { durable: true }),
);
const periodicCollectors = await periodicFeeCollectors;

or even further (mid 2022) using []:

// Initialize the periodic collectors list if we don't have one.
periodicFeeCollectorsP.resolve([]);
const periodicCollectors = await periodicFeeCollectors;

@Chris-Hibbert Chris-Hibbert added the automerge:rebase Automatically rebase updates, then merge label Dec 20, 2024
@mergify mergify bot merged commit e5813b9 into master Dec 20, 2024
81 checks passed
@mergify mergify bot deleted the cth-retain-charter branch December 20, 2024 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge code-style defensive correctness patterns; readability thru consistency contract-upgrade force:integration Force integration tests to run on PR Governance Governance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants