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

5200 upgradable contractGovernor #7657

Merged
merged 3 commits into from
May 10, 2023
Merged

Conversation

turadg
Copy link
Member

@turadg turadg commented May 9, 2023

refs: #5200

Description

This makes the contractGovernor contract upgradable. It's not yet fully durable because some facets aren't durable and the open questions can't be validated after a contract restart/upgrade, so I'm leaving #5200 open.

It does satisfy the requirement that each governor contract vat be upgradable,

Security Considerations

Authority from baggage

Scaling Considerations

Should lower memory pressure slightly

Documentation Considerations

Little change to API. The voteOnApiInvocation is now async, so that it can lazily query the remote governed contract for its API methods.

Testing Considerations

Existing tests pass. Bootstrap test of vaults upgrade now upgrades the vaultFactory's governor.

@turadg turadg requested review from dckc and Chris-Hibbert May 9, 2023 21:48
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.

the Far change looks like a breaking contract api change. I'd like to know if I'm on target about that before approving.

It's probably worth waiting on a review by @Chris-Hibbert too

Comment on lines -40 to -41
zoe,
governedInstance,
Copy link
Member

Choose a reason for hiding this comment

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

these weren't used? how did that pass lint?

Copy link
Member Author

Choose a reason for hiding this comment

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

because the subsequent params were used, they had to stay there for backwards compatibility

createdFilterQuestion: b => voteCounters.has(b),
createdQuestion: b => voteCounters.has(b),
Copy link
Member

Choose a reason for hiding this comment

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

is this a breaking contract API change? Is it required?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

why is the object it's in Far?

Copy link
Member Author

Choose a reason for hiding this comment

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

good question. I don't really know. I do know that what is returned does not exposed outside the contractGovernorKit. But given the time pressure I'm content to strike the change.

If you approve contingent on that I'll omit it in the rebase I have to do.

Copy link
Member

Choose a reason for hiding this comment

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

I looked around and i don't see it escaping, so I agree it's internal.

Comment on lines 63 to 65
* @property {import('@agoric/time/src/types').TimerService} timer
* @property {import('@ agoric/time/src/types').TimerService} timer
Copy link
Member

Choose a reason for hiding this comment

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

accidental space?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeesh yes

electionManager: zcf.getInstance(),
});

trace('starting governedContractInstallation');
Copy link
Member

Choose a reason for hiding this comment

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

add governedContractLabel to this trace?

return invitationAmount.value[0].instance;
};
// trace('initiating start()');
// Awaiting this prevents vat restart
Copy link
Member

Choose a reason for hiding this comment

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

So this is not commenting out dead code but telling future maintainers "you may think to do it this way; don't." right?

Copy link
Member Author

Choose a reason for hiding this comment

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

correct. I can clarify

@@ -0,0 +1,233 @@
import { Fail } from '@agoric/assert';
Copy link
Member

Choose a reason for hiding this comment

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

I think the tests are better at judging whether the logic was preserved when moving this to a new file in exo form than I would be, so I'm just skimming.

Copy link
Contributor

Choose a reason for hiding this comment

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

I did more than skim. I don't see any errors or omissions. I think it's all here.

const upgradeResult = await EV(vfAdminFacet).restartContract(privateArgs);
t.deepEqual(upgradeResult, { incarnationNumber: 1 });
t.like(t.context.readCollateralMetrics(0), keyMetrics); // unchanged
});

test.serial('restart contractGovernor', async t => {
Copy link
Member

Choose a reason for hiding this comment

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

👏

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'd like to hear from @Chris-Hibbert on this, but I'm ok if we don't.

Copy link
Contributor

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

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

lgtm

import { ParamChangesQuestionDetailsShape } from './typeGuards.js';

const { Fail } = assert;

const trace = makeTracer('CGov', false);
const trace = makeTracer('CGov');
Copy link
Contributor

Choose a reason for hiding this comment

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

revert dropping false.

@@ -0,0 +1,233 @@
import { Fail } from '@agoric/assert';
Copy link
Contributor

Choose a reason for hiding this comment

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

I did more than skim. I don't see any errors or omissions. I think it's all here.

@turadg turadg force-pushed the 5200-upgradable-contractGovernor branch from 964504f to 6a6d751 Compare May 9, 2023 23:54
@turadg turadg enabled auto-merge May 9, 2023 23:54
@turadg turadg added this pull request to the merge queue May 10, 2023
Merged via the queue into master with commit d7c8ea4 May 10, 2023
@turadg turadg deleted the 5200-upgradable-contractGovernor branch May 10, 2023 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants