async function enqueueMessagesAndUpdateHome(
  chainDetails,
  homeDomain,
  messages,
) {
  const home = getHome(chainDetails, homeDomain);
  const updater = getUpdaterObject(chainDetails, homeDomain);

  const startRoot = await home.current();

  // enqueue each message to Home and get the intermediate root
  const enqueuedRoots = [];
  for (let message of messages) {
    const newRoot = await enqueueMessageToHome(
      chainDetails,
      homeDomain,
      message,
    );

    enqueuedRoots.push(newRoot);
  }

  // ensure that Home queue contains
  // all of the roots we just enqueued
  for (let root of enqueuedRoots) {
    expect(await home.queueContains(root)).to.be.true;
  }

  // sign & submit an update from startRoot to finalRoot
  const finalRoot = enqueuedRoots[enqueuedRoots.length - 1];

  const { signature } = await updater.signUpdate(startRoot, finalRoot);

  await expect(home.update(startRoot, finalRoot, signature))
    .to.emit(home, 'Update')
    .withArgs(homeDomain, startRoot, finalRoot, signature);

  // ensure that Home root is now finalRoot
  expect(await home.current()).to.equal(finalRoot);

  // ensure that Home queue no longer contains
  // any of the roots we just enqueued -
  // they should be removed from queue when update is submitted
  for (let root of enqueuedRoots) {
    expect(await home.queueContains(root)).to.be.false;
  }

  const update = {
    startRoot,
    finalRoot,
    signature,
  };

  return update;
}
/*
 * Enqueue a set of messages to the specified Home contract,
 * then sign and submit an update to the Home contract
 *
 * @param chainDetails - ChainDetails type containing every deployed domain
 * @param homeDomain - domain of the Home contract to which we will enqueue all of messages / submit the update
 * @param messages - Message[]
 *
 * @return update - Update type
 */
Enqueue a set of messages to the specified Home contract,
then sign and submit an update to the Home contract

@param chainDetails - ChainDetails type containing every deployed domain
@param homeDomain - domain of the Home contract to which we will enqueue all of messages / submit the update
@param messages - Message[]

@return update - Update type
Enqueue a set of messages to the specified Home contract then sign and submit an update to the Home contract @param chainDetails - ChainDetails type containing every deployed domain @param homeDomain - domain of the Home contract to which we will enqueue all of messages / submit the update @param messages - Message [] @return update - Update type
async function enqueueMessagesAndUpdateHome(
  chainDetails,
  homeDomain,
  messages,
) {
  const home = getHome(chainDetails, homeDomain);
  const updater = getUpdaterObject(chainDetails, homeDomain);
  const startRoot = await home.current();
  const enqueuedRoots = [];
  for (let message of messages) {
    const newRoot = await enqueueMessageToHome(
      chainDetails,
      homeDomain,
      message,
    );
    enqueuedRoots.push(newRoot);
  }
  for (let root of enqueuedRoots) {
    expect(await home.queueContains(root)).to.be.true;
  }
  const finalRoot = enqueuedRoots[enqueuedRoots.length - 1];
  const { signature } = await updater.signUpdate(startRoot, finalRoot);
  await expect(home.update(startRoot, finalRoot, signature))
    .to.emit(home, 'Update')
    .withArgs(homeDomain, startRoot, finalRoot, signature);
  expect(await home.current()).to.equal(finalRoot);
  for (let root of enqueuedRoots) {
    expect(await home.queueContains(root)).to.be.false;
  }
  const update = {
    startRoot,
    finalRoot,
    signature,
  };
  return update;
}
async function enqueueMessagesAndUpdateHome ( chainDetails , homeDomain , messages , ) { const home = getHome ( chainDetails , homeDomain ) ; const updater = getUpdaterObject ( chainDetails , homeDomain ) ; const startRoot = await home . current ( ) ; const enqueuedRoots = [ ] ; for ( let message of messages ) { const newRoot = await enqueueMessageToHome ( chainDetails , homeDomain , message , ) ; enqueuedRoots . push ( newRoot ) ; } for ( let root of enqueuedRoots ) { expect ( await home . queueContains ( root ) ) . to . be . true ; } const finalRoot = enqueuedRoots [ enqueuedRoots . length - 1 ] ; const { signature } = await updater . signUpdate ( startRoot , finalRoot ) ; await expect ( home . update ( startRoot , finalRoot , signature ) ) . to . emit ( home , 'Update' ) . withArgs ( homeDomain , startRoot , finalRoot , signature ) ; expect ( await home . current ( ) ) . to . equal ( finalRoot ) ; for ( let root of enqueuedRoots ) { expect ( await home . queueContains ( root ) ) . to . be . false ; } const update = { startRoot , finalRoot , signature , } ; return update ; }
Enqueue a set of messages to the specified Home contract,
 then sign and submit an update to the Home contract
Enqueue a set of messages to the specified Home contract then sign and submit an update to the Home contract
// enqueue each message to Home and get the intermediate root // ensure that Home queue contains // all of the roots we just enqueued // sign & submit an update from startRoot to finalRoot // ensure that Home root is now finalRoot // ensure that Home queue no longer contains // any of the roots we just enqueued - // they should be removed from queue when update is submitted