-
Notifications
You must be signed in to change notification settings - Fork 72
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
failure in elementsIsSuperset({x, y, z}, {z}) #2588
Comments
@frazarshad writes: the issue is in the In cases where we have a set of invitations with duplicate descriptions, the function fails to mark it as a subset. we can verify by adding this test to test('test', t => {
const r1 = Remotable('Alleged: fooo');
const r0 = Remotable('Alleged: fooo');
const r2 = Remotable('Alleged: fooo');
const mainList = harden([
{
instance: r0,
description: 'fraz',
},
{
instance: r2,
description: 'fraz',
},
{
instance: r1,
description: 'alan',
},
]);
const withdraw = harden([mainList[2]]);
t.true(elementsIsSuperset(mainList, withdraw));
}); Longer explanationthis code is triggered through the purse's withdraw function when it tries to verify whether the item we are withdrawing is a subset of the items in the purse. the [
[elem1, 1n, 0n],
[elem2, 0n, 1n],
...
] in case the elements are invitations, which is a list of object with strings and remotables, it compares them by assigning tag numbers to the remotables. The problem arises when we pass invitations having the same description. while (j < length && rankCompare(value, elements[j]) === 0) {
{
instance: Object [Alleged: InstanceHandle] {},
installation: Object [Alleged: BundleIDInstallation] {},
handle: Object [Alleged: InvitationHandle] {},
description: 'oracle invitation'
}
{
instance: Object [Alleged: InstanceHandle] {},
installation: Object [Alleged: BundleIDInstallation] {},
handle: Object [Alleged: InvitationHandle] {},
description: 'oracle invitation'
} It will consider them equal, thus it will move to this line const resorted = sortByRank(similarRun, fullCompare); which performs a |
@gibson042 writes:
I'm inclined to assign this to him on that basis, but I'm not quite sure that I should. @gibson042 please assign yourself, unless there's some reason not to. cc @aj-agoric |
…irst remotable To be refinable into a total order that distinguishes remotables, `compareRank` must consider `[r1, 'x']` vs. `[r2, 'y']` as a tie rather than as equivalent to `[0, 'x']` vs. `[0, 'y']`, in case r1 vs. r2 ends up comparing differently than 'x' vs. 'y'. Fixes #2588
…irst remotable To be refinable into a total order that distinguishes remotables, `compareRank` must consider `[r1, 'x']` vs. `[r2, 'y']` as a tie rather than as equivalent to `[0, 'x']` vs. `[0, 'y']`, in case r1 vs. r2 ends up comparing differently than 'x' vs. 'y'. Fixes #2588
…irst remotable To be refinable into a total order that distinguishes remotables, `compareRank` must consider `[r1, 'x']` vs. `[r2, 'y']` as a tie rather than as equivalent to `[0, 'x']` vs. `[0, 'y']`, in case r1 vs. r2 ends up comparing differently than 'x' vs. 'y'. Fixes #2588
…irst remotable To be refinable into a total order that distinguishes remotables, `compareRank` must consider `[r1, 'x']` vs. `[r2, 'y']` as a tie rather than as equivalent to `[0, 'x']` vs. `[0, 'y']`, in case r1 vs. r2 ends up comparing differently than 'x' vs. 'y'. Fixes #2588
…irst remotable To be refinable into a total order that distinguishes remotables, `compareRank` must consider `[r1, 'x']` vs. `[r2, 'y']` as a tie rather than as equivalent to `[0, 'x']` vs. `[0, 'y']`, in case r1 vs. r2 ends up comparing differently than 'x' vs. 'y'. Fixes #2588
# `@endo/marshal` v1.6.0 - `compareRank` now short-circuits upon encountering remotables to compare, considering the inputs to be tied for the same rank regardless of what would otherwise be visited later in their respective data structures. This ensures that a `fullCompare` which does distinguish remotables will be a refinement of `compareRank`, rather than disagreeing about whether or not two values share a rank ([#2588](#2588)). This change is a bug fix for all purposes off-chain, but will frustrate deterministic replay. So, because of this change and probably many others, the supervisor bundle of vats on chain will need to be created from historical versions, not according to the semantic version of the library.
Describe the bug
An ERTP withdraw of
{z}
from a purse with a balance of{x, y, z}
failed.I'm abbreviating
makeCopySet(...items)
using traditional{...items}
set notation.Investigation led to a failure in
elementsIsSuperset({x, y, z}, {z})
.Steps to reproduce
Expected behavior
elementsIsSuperset({x, y, z}, {z})
always returns true for keysx
,y
, andz
.Platform environment
The original environment was a ci log of an a3p test.
It reproduces in 4406f5d
Additional context
some diagnosis to follow
The text was updated successfully, but these errors were encountered: