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

in testing: zoe throws on un-hardened offer result from governParam.js #9074

Open
dckc opened this issue Mar 12, 2024 · 1 comment
Open

in testing: zoe throws on un-hardened offer result from governParam.js #9074

dckc opened this issue Mar 12, 2024 · 1 comment

Comments

@dckc
Copy link
Member

dckc commented Mar 12, 2024

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @agoric/[email protected] for the project I'm working on.

Zoe threw Cannot pass non-frozen objects because an offer result from governParam.js isn't hardened. This is normally not a problem, since the offer result is marshaled across vats. But I'm testing with everything in one ava realm.

Here is the diff that solved my problem:

diff --git a/node_modules/@agoric/governance/src/contractGovernance/governParam.js b/node_modules/@agoric/governance/src/contractGovernance/governParam.js
index c27c6d8..95af1b5 100644
--- a/node_modules/@agoric/governance/src/contractGovernance/governParam.js
+++ b/node_modules/@agoric/governance/src/contractGovernance/governParam.js
@@ -133,11 +133,11 @@ const setupParamGovernance = (
         return negative;
       });
 
-    return {
+    return harden({
       outcomeOfUpdate,
       instance: voteCounter,
       details: E(counterPublicFacet).getDetails(),
-    };
+    });
   };
 
   return Far('paramGovernor', {

This issue body was partially generated by patch-package.

context:

my stack trace:

  Unhandled rejection in test/test-vote-by-committee.js

  Error: Cannot pass non-frozen objects like {"outcomeOfUpdate":"[Promise]","instance":"[Alleged: InstanceHandle]","details":"[Promise]"}. Use harden()
    at makeError (file:///home/connolly/projects/dapp-agoric-basics/node_modules/ses/src/error/assert.js:243:17)
    at Function.fail (file:///home/connolly/projects/dapp-agoric-basics/node_modules/ses/src/error/assert.js:357:20)
    at passStyleOfInternal (file:///home/connolly/projects/dapp-agoric-basics/node_modules/@endo/pass-style/src/passStyleOf.js:140:20)
    at passStyleOfRecur (file:///home/connolly/projects/dapp-agoric-basics/node_modules/@endo/pass-style/src/passStyleOf.js:110:25)
    at passStyleOf (file:///home/connolly/projects/dapp-agoric-basics/node_modules/@endo/pass-style/src/passStyleOf.js:186:12)
    at deeplyFulfilled (file:///home/connolly/projects/dapp-agoric-basics/node_modules/@endo/marshal/src/deeplyFulfilled.js:51:21)
    at file:///home/connolly/projects/dapp-agoric-basics/node_modules/@agoric/zoe/src/zoeService/zoeSeat.js:221:17
    at file:///home/connolly/projects/dapp-agoric-basics/node_modules/@endo/eventual-send/src/track-turns.js:62:18

cc @Chris-Hibbert

@dckc
Copy link
Member Author

dckc commented Mar 13, 2024

puppet governance doesn't supply electionManager

more patching...

diff --git a/node_modules/@agoric/governance/src/contractGovernance/governParam.js b/node_modules/@agoric/governance/src/contractGovernance/governParam.js
index c27c6d8..95af1b5 100644
--- a/node_modules/@agoric/governance/src/contractGovernance/governParam.js
+++ b/node_modules/@agoric/governance/src/contractGovernance/governParam.js
@@ -133,11 +133,11 @@ const setupParamGovernance = (
         return negative;
       });
 
-    return {
+    return harden({
       outcomeOfUpdate,
       instance: voteCounter,
       details: E(counterPublicFacet).getDetails(),
-    };
+    });
   };
 
   return Far('paramGovernor', {
diff --git a/node_modules/@agoric/governance/tools/puppetContractGovernor.js b/node_modules/@agoric/governance/tools/puppetContractGovernor.js
index 65fdda0..650f702 100644
--- a/node_modules/@agoric/governance/tools/puppetContractGovernor.js
+++ b/node_modules/@agoric/governance/tools/puppetContractGovernor.js
@@ -38,8 +38,10 @@ export const start = async (zcf, privateArgs) => {
     },
   } = zcf.getTerms();
 
-  // in the fake there's no electionManager to augment the terms
-  const augmentedTerms = contractTerms;
+  const augmentedTerms = {
+    ...contractTerms,
+    electionManager: zcf.getInstance(),
+  };
 
   const {
     creatorFacet: governedCF,

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

No branches or pull requests

1 participant