Skip to content

Commit

Permalink
chore: add details to rights conservation assertion msg
Browse files Browse the repository at this point in the history
for help diagnosing #4407
  • Loading branch information
Chris-Hibbert committed Feb 11, 2022
1 parent 27271cd commit 10a5805
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/zoe/src/contractFacet/rightsConservation.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const assertEqualPerBrand = (leftSumsByBrand, rightSumsByBrand) => {
const { leftSum, rightSum } = getSums(brand);
assert(
AmountMath.isEqual(leftSum, rightSum),
X`rights were not conserved for brand ${brand}`,
X`rights were not conserved for brand ${brand} ${leftSum.value} != ${rightSum.value}`,
);
});
};
Expand Down
2 changes: 1 addition & 1 deletion packages/zoe/test/unitTests/contracts/test-otcDesk.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ const makeBob = (

await t.throwsAsync(() => E(seat).getOfferResult(), {
message:
'rights were not conserved for brand "[Alleged: simoleans brand]"',
'rights were not conserved for brand "[Alleged: simoleans brand]" "[15n]" != "[16n]"',
});

await assertPayoutAmount(
Expand Down
9 changes: 6 additions & 3 deletions packages/zoe/test/unitTests/zcf/test-zoeHelpersWZcf.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ test(`zoeHelper w/zcf - swapExact w/shortage`, async t => {
);

t.throws(() => swapExact(zcf, zcfSeatA, zcfSeatB), {
message: 'rights were not conserved for brand "[Alleged: moola brand]"',
message:
'rights were not conserved for brand "[Alleged: moola brand]" "[15n]" != "[20n]"',
});
t.truthy(zcfSeatA.hasExited(), 'fail right');
await assertPayoutAmount(
Expand Down Expand Up @@ -515,7 +516,8 @@ test(`zoeHelper w/zcf - swapExact w/excess`, async t => {
);

t.throws(() => swapExact(zcf, zcfSeatA, zcfSeatB), {
message: 'rights were not conserved for brand "[Alleged: moola brand]"',
message:
'rights were not conserved for brand "[Alleged: moola brand]" "[40n]" != "[20n]"',
});
t.truthy(zcfSeatA.hasExited(), 'fail right');
await assertPayoutAmount(
Expand Down Expand Up @@ -571,7 +573,8 @@ test(`zoeHelper w/zcf - swapExact w/extra payments`, async t => {
);

t.throws(() => swapExact(zcf, zcfSeatA, zcfSeatB), {
message: 'rights were not conserved for brand "[Alleged: moola brand]"',
message:
'rights were not conserved for brand "[Alleged: moola brand]" "[40n]" != "[0n]"',
});
t.truthy(zcfSeatA.hasExited(), 'fail right');
await assertPayoutAmount(
Expand Down

0 comments on commit 10a5805

Please sign in to comment.