Skip to content

Commit

Permalink
chore(swingset): 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 11, 2020
1 parent d74e970 commit 32d119b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
22 changes: 22 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,27 @@ 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'];
test('a73');

return harden({
setA,
setB,
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/test/test-message-patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export async function runVatsInComms(t, enablePipelining, name) {
config.vats.leftvattp = { sourcePath: vatTPSourcePath };
config.vats.rightvattp = { sourcePath: vatTPSourcePath };
const { passOneMessage, loopboxSrcPath, loopboxEndowments } = buildLoopbox(
'immediate',
'queued',
);
config.devices = [['loopbox', loopboxSrcPath, loopboxEndowments]];
const c = await buildVatController(config, [name]);
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 32d119b

Please sign in to comment.