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(errors): Restore support for SES 0.18.3 and prior #2093

Merged
merged 4 commits into from
Feb 21, 2024

Conversation

kriskowal
Copy link
Member

Description

Agoric’s chain bootstrap vat runs with a version of SES that predates the bare function. Consequently, any library including @endo/errors running in a contract bundle in that vat must be prepared to shim any features absent on the global assert.

Security Considerations

I do not believe this comes with direct security implications, but the situation emphasizes the need for extra scrutiny for programs admitted thru governance to run in the Agoric bootstrap vat given that it runs on a fixed version of SES.

Scaling Considerations

None.

Documentation Considerations

None.

Testing Considerations

This includes a test that fails before the fix and passes after the fix. To review this PR, rebase incrementally and run tests before and after the fix.

Compatibility Considerations

The bare method falls through to the behavior of quote. This is consistent with the behavior of programs were written before the addition of bare, so I expect them to converge if that is indeed important.

Upgrade Considerations

  • [ ] Includes *BREAKING*: in the commit message with migration instructions for any breaking change.
  • [ ] Updates NEWS.md for user-facing changes.

@kriskowal kriskowal requested a review from erights February 21, 2024 07:32
@kriskowal kriskowal force-pushed the kriskowal-fix-errors-bare-backward-compatibility branch 3 times, most recently from a7b4e0d to 74fb32e Compare February 21, 2024 08:12
Copy link
Contributor

@mhofman mhofman left a comment

Choose a reason for hiding this comment

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

LGTM but I'll let Mark decide if this is the best fallback to take.

packages/errors/test/test-ses0_18_3.js Show resolved Hide resolved
@kriskowal kriskowal force-pushed the kriskowal-fix-errors-bare-backward-compatibility branch from 74fb32e to 976286c Compare February 21, 2024 15:14
Copy link
Contributor

@erights erights left a comment

Choose a reason for hiding this comment

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

If this were a long lived anomaly, I might desire a more accurate bare emulation. By I don't buy the "in perpetuity". We cannot ever get stuck needing to support an infinite number of prior versions, because some of those will have fatal problems.

So this PR LGTM, thanks!

Comment on lines 63 to 65
// The Agoric chain's bootstrap vat runs with a version of SES that predates
// the addition of the 'bare' method, so we must fall back to quote behavior
// for that environment. (2024)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this 2024 a year reference?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, to indicate when we thought this because, as @erights points out, it cannot be permanent. But, as @michaelfig indicated, it’s true for the lifetime of Agoric’s current chain. My understanding is that we can only upgrade the chain bootstrap vat at genesis.

Copy link
Contributor

Choose a reason for hiding this comment

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

To clarify, we are planning on replacing the environment in which core evals run, and retire the bootstrap vat, at which point old agoric chains will be able to evaluate core evals without the need for this backwards compatibility. Technically replacement is not an upgrade (something something ship of Theseus)

packages/errors/index.js Show resolved Hide resolved
Comment on lines +72 to 81
bareOrQuote as bare,
makeError,
note,
quote,
redacted,
throwRedacted,
Copy link
Contributor

Choose a reason for hiding this comment

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

Alternative possibility:

Suggested change
bareOrQuote as bare,
makeError,
note,
quote,
redacted,
throwRedacted,
makeError,
note,
quote,
bare = quote,
redacted,
throwRedacted,

Copy link
Member Author

Choose a reason for hiding this comment

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

As noted with the failing test, our module transform does not support this pattern. Per the convergence of great minds, this was the shape of my first attempt!

@kriskowal kriskowal force-pushed the kriskowal-fix-errors-bare-backward-compatibility branch from c596adf to c86880f Compare February 21, 2024 16:34
@kriskowal
Copy link
Member Author

If this were a long lived anomaly, I might desire a more accurate bare emulation. By I don't buy the "in perpetuity". We cannot ever get stuck needing to support an infinite number of prior versions, because some of those will have fatal problems.

For sure. Hopefully, the unstoppable force can move the immovable object. I suspect the only way out of this situation is for the chain bootstrap vat to eval a final contract that bequeaths its authority to a replacement chain bootstrap vat. We would presumably prevent any further core evals to execute in the original chain bootstrap vat via governance.

@kriskowal kriskowal merged commit 8b289f0 into master Feb 21, 2024
14 checks passed
@kriskowal kriskowal deleted the kriskowal-fix-errors-bare-backward-compatibility branch February 21, 2024 17:02
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.

4 participants