You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
makeContractGovernorKit is defined with ContractGovernorKitI, which requires that facet creator method getCreatorFacet returns a remotable, and likewise for methods getAdminFacet and getPublicFacet. But its initializer just accepts (startedInstanceKit, limitedCreatorFacet) and populates state like { ...startedInstanceKit, limitedCreatorFacet, … }, which means that the values those methods attempt to return might not actually be remotables. The interface guards will produce errors in that case, but there is no indication of a problem until that time, which is potentially far removed from the problem with initial creation.
To Reproduce
This problem already exists within our tests:
governedContract.js returns makeGovernorFacet({}, { governanceApi }) as its creatorFacet.
makeGovernorFacet(originalCreatorFacet, governedApis = {}) wraps makeFarGovernorFacet to return a "governorFacet" Far object whose getLimitedCreatorFacet method returns the input originalCreatorFacet, which for this test is an empty CopyRecord.
contractGovernor.js starts the governed contract (which for this test is governedContract.js) to get startedInstanceKit, calls getLimitedCreatorFacet() on startedInstanceKit.creatorFacet to get a limitedCreatorFacet (which for this test is that empty CopyRecord), and passes both on to makeContractGovernorKit(startedInstanceKit, limitedCreatorFacet).
The tests that start governed instances of governedContract.js don't call getCreatorFacet(), but any attempt to do so would result in an error.
Expected behavior
Because makeContractGovernorKit interface guards constrain methods that return values from original input, those values should be validated at creation time in the makeContractGovernorKit initializer.
The text was updated successfully, but these errors were encountered:
Describe the bug
makeContractGovernorKit
is defined withContractGovernorKitI
, which requires that facetcreator
methodgetCreatorFacet
returns a remotable, and likewise for methodsgetAdminFacet
andgetPublicFacet
. But its initializer just accepts(startedInstanceKit, limitedCreatorFacet)
and populates state like{ ...startedInstanceKit, limitedCreatorFacet, … }
, which means that the values those methods attempt to return might not actually be remotables. The interface guards will produce errors in that case, but there is no indication of a problem until that time, which is potentially far removed from the problem with initial creation.To Reproduce
This problem already exists within our tests:
makeGovernorFacet({}, { governanceApi })
as its creatorFacet.makeGovernorFacet(originalCreatorFacet, governedApis = {})
wrapsmakeFarGovernorFacet
to return a "governorFacet" Far object whosegetLimitedCreatorFacet
method returns the inputoriginalCreatorFacet
, which for this test is an empty CopyRecord.startedInstanceKit
, callsgetLimitedCreatorFacet()
onstartedInstanceKit.creatorFacet
to get alimitedCreatorFacet
(which for this test is that empty CopyRecord), and passes both on tomakeContractGovernorKit(startedInstanceKit, limitedCreatorFacet)
.getCreatorFacet()
, but any attempt to do so would result in an error.Expected behavior
Because
makeContractGovernorKit
interface guards constrain methods that return values from original input, those values should be validated at creation time in themakeContractGovernorKit
initializer.The text was updated successfully, but these errors were encountered: