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

fix(types): board values #9332

Merged
merged 1 commit into from
May 10, 2024
Merged

fix(types): board values #9332

merged 1 commit into from
May 10, 2024

Conversation

turadg
Copy link
Member

@turadg turadg commented May 7, 2024

Description

Follow up to #8774

Fix the Board types

Security Considerations

Scaling Considerations

Documentation Considerations

Testing Considerations

Upgrade Considerations

The one behavior change is to omit non-remotables from the board, but nothing should have been doing that and if it was this error will help.

Of course that doesn't need to go out in any particular chain upgrade, but it could to minimize divergence from master until,

@turadg turadg requested a review from dckc May 7, 2024 18:36
Copy link

cloudflare-workers-and-pages bot commented May 7, 2024

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4196da3
Status: ✅  Deploy successful!
Preview URL: https://b9b7bda7.agoric-sdk.pages.dev
Branch Preview URL: https://1488-scalarkey.agoric-sdk.pages.dev

View logs

* @param {PassableCap} value
* @throws if `value` is not a Key in the @agoric/store sense
* @param {RemotableObject} value
* @throws if `value` is not a ScalarKey in the @agoric/store sense
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 not sure @agoric/store has a ScalarKey sense. maybe "in the @endo/patterns sense"

Copy link
Member Author

Choose a reason for hiding this comment

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

agreed. though this is one place ScalarKey ought to be mentioned, because this code only throws at runtime if it's it's not a ScalarKey. (it doesn't check that it's a remotable)

Copy link
Member Author

Choose a reason for hiding this comment

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

I made it check with isRemotable()

@turadg turadg changed the base branch from 1488-Endo-Passable to master May 8, 2024 22:04
@@ -267,8 +270,7 @@ export const prepareBoardKit = baggage => {
* `value` for its entire lifetime. For a well-known board, this is
* essentially forever.
*
* @param {PassableCap} value
* @throws if `value` is not a Key in the @agoric/store sense
Copy link
Member Author

Choose a reason for hiding this comment

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

removed this because it shouldn't come as a surprise to get an error when the argument doesn't satisfy the param type

@@ -101,7 +101,9 @@ const makeInvitation = async (
board,
zoe,
) => {
const instance = E(board).getValue(instanceHandleBoardId);
const instance = /** @type {Promise<Instance>} */ (
Copy link
Member Author

Choose a reason for hiding this comment

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

getPublicFacet won't take any old Remotable

@turadg turadg marked this pull request as ready for review May 8, 2024 22:06
@turadg turadg requested a review from dckc May 8, 2024 22:07
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.

an Upgrade Consideration: like many/most recent changes, I expect upgrade to happen by way of

* @param {PassableCap} val
* @param {RemotableObject} val
Copy link
Member

Choose a reason for hiding this comment

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

👍

@@ -26,7 +26,6 @@ const makeOnChainWallet = board => {
getCurrentAmount: () => harden({ brand, value: 100 }),
});
// only for private brands
// context.initBrandId(boardId, brand);
Copy link
Member

Choose a reason for hiding this comment

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

weird

Comment on lines +138 to +140
if (!isRemotable(value)) {
Fail`Board cannot create id for non-remotable`;
}
Copy link
Member

Choose a reason for hiding this comment

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

one could look at that as a breaking change... I think I'll look at it as a (non-breaking) fix: the fact that you used to be able store primitives is a bug.

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 point and I agree

@turadg turadg added the automerge:rebase Automatically rebase updates, then merge label May 8, 2024
@mergify mergify bot merged commit 9b5b61a into master May 10, 2024
63 checks passed
@mergify mergify bot deleted the 1488-ScalarKey branch May 10, 2024 17:41
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants