Skip to content

Commit

Permalink
fix: resync with agoric-sdk 6260
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Nov 12, 2022
1 parent 1c9204b commit cef2a1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/marshal/src/encodePassable.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export const makeEncodePassable = ({
encodeError = (err, _) => assert.fail(X`error unexpected: ${err}`),
} = {}) => {
const encodePassable = passable => {
if (ErrorHelper.canBeValid(passable, x => x)) {
if (ErrorHelper.canBeValid(passable)) {
return encodeError(passable, encodePassable);
}
const passStyle = passStyleOf(passable);
Expand Down Expand Up @@ -486,7 +486,7 @@ harden(isEncodedRemotable);
* individually is a valid bigint prefix. `n` for "negative" and `p` for
* "positive". The ordering of these prefixes is the same as the
* rankOrdering of their respective PassStyles. This table is imported by
* randOrder.js for this purpose.
* rankOrder.js for this purpose.
*
* In addition, `|` is the remotable->ordinal mapping prefix:
* This is not used in covers but it is
Expand Down
6 changes: 4 additions & 2 deletions packages/marshal/src/rankOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ const passStyleRanks = /** @type {PassStyleRanksRecord} */ (fromEntries(
return trivialComparator(leftPrefixes, rightPrefixes);
})
.map(([passStyle, prefixes], index) => {
// Cover all strings that start with any character in `prefixes`.
// `prefixes` is already sorted, so that's
// Cover all strings that start with any character in `prefixes`,
// verifying that it is sorted so that is
// all s such that prefixes.at(0) ≤ s < successor(prefixes.at(-1)).
prefixes === [...prefixes].sort().join('') ||
Fail`unsorted prefixes for passStyle ${q(passStyle)}: ${q(prefixes)}`;
const cover = [
prefixes.charAt(0),
String.fromCharCode(prefixes.charCodeAt(prefixes.length - 1) + 1),
Expand Down

0 comments on commit cef2a1f

Please sign in to comment.