Skip to content

Commit

Permalink
message-patterns: add a73 to exercise bug #1400
Browse files Browse the repository at this point in the history
  • Loading branch information
warner committed Aug 10, 2020
1 parent 2944d76 commit 0904e3d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/SwingSet/test/message-patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import { E } from '@agoric/eventual-send';
import { makePromiseKit } from '@agoric/promise-kit';
import { ignore } from './util';

// Exercise a set of increasingly complex object-capability message patterns,
// for testing.
Expand Down Expand Up @@ -516,6 +517,28 @@ export function buildPatterns(log) {
];
test('a72');

// Exercise bug #1400. We set up two messages:
// pipe1 = bob~.one()
// pipe1~.two()
// but their handling must meet two ordering constraints:
// 1: left-comms transmits two() before learning about pipe1 resolving
// 2: right-comms receives two() *after* learning about pipe1 resolving
// to achieve this, we changed loopbox() to deliver one message at a time
{
objA.a73 = async () => {
const pipe1 = E(b.bob).b73_one();
const p2 = E(pipe1).two();
ignore(p2);
};
objB.b73_one = () =>
harden({
two: () => log('two'),
});
}
out.a73 = ['two'];
outPipelined.a73 = ['two'];
test('a73');

return harden({
setA,
setB,
Expand Down
7 changes: 7 additions & 0 deletions packages/SwingSet/test/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,10 @@ export function buildDispatch(onDispatchCallback = undefined) {

return { log, dispatch };
}

export function ignore(p) {
p.then(
() => 0,
() => 0,
);
}

0 comments on commit 0904e3d

Please sign in to comment.