Skip to content

Latest commit

 

History

History
332 lines (267 loc) · 9.47 KB

TROUBLESHOOTING.md

File metadata and controls

332 lines (267 loc) · 9.47 KB

Trouble Shooting Issues & their Solutions

  1. SyntaxError#2: Unexpected token b in JSON at position 0 confusing bundle ids for bundles, need to prepend with "@"

  2. RangeError: Expected "[undefined]" is same as "Interface" endo/patterns issue

  3. get E$1: undefined variable using another E import, because it gets stripped by the rollup older versions of dapps use

import { E } from '@endo/far';

the rollup intends to strip that import:

* - import { E } from '@endo/far'
* We can strip this declaration during bundling
* since the core-eval scope includes exports of @endo/far

  1. SyntaxError: Possible HTML comment rejected at :
// ISSUE IMPORTING THIS, which promted yarn link: 
/*
    [!] (plugin configureBundleID) TypeError: Failed to load module "./src/orchdev.contract.js" in package "file:///Users/jovonni/Documents/projects/experiments/orca/contract/" (1 underlying failures: Cannot find external module "@agoric/orchestration/src/exos/stakingAccountKit.js" in package file:///Users/jovonni/Documents/projects/experiments/orca/contract/
src/orchdev.proposal.js
*/
  1. possible import rejection SES check for bn.js containing while (j-- > 0) {

we can check for this from outside the container:

kubectl exec -it agoriclocal-genesis-0 -- cat ./node_modules/bn.js/lib/bn.js | grep "j\-\-"

If the file is there, we can do make copy-bn-js

v38: Error#1: privateArgs: (an undefined) - Must be a copyRecord to match a copyRecord pattern: {"marshaller":"[match:remotable]","orchestration":"[match:remotable]","storageNode":"[match:remotable]","timer":"[match:remotable]"}

ensure privateArgs adheres to the format

privateArgs: timer: (an object) - Must be a remotable TimerService, not promise

ensure to pass the result of the promise, not the promise: timer: await chainTimerService

ensure to install

yarn add typescript --dev
npm install -g rollup
yarn add @agoric/vow@0.1.1-upgrade-16-fi-dev-8879538.0
yarn add @agoric/orchestration@0.1.1-upgrade-16-dev-d45b478.0
npm install rollup
AssertionError [ERR_ASSERTION] [ERR_ASSERTION]: The expression evaluated to a falsy value:

    assert(refs.runnerChain)
  AssertionError [ERR_ASSERTION] [ERR_ASSERTION]: The expression evaluated to a falsy value:

"@endo/patterns": "^1.4.0" throws this error when used in devdependencies, when running tests, just remove

Note: also remove all resolutions from root package.json, especially if you see this:

Uncaught exception in test/test-deploy-tools.js

  RangeError: Expected "[undefined]" is same as "Interface"

  ✘ test/test-deploy-tools.js exited with a non-zero exit code: 1

  Uncaught exception in test/test-orca-contract.js

  RangeError: Expected "[undefined]" is same as "Interface"

  Uncaught exception in test/test-bundle-source.js

  RangeError: Expected "[undefined]" is same as "Interface"

  ✘ No tests found in test/test-build-proposal.js
  ✘ test/test-orca-contract.js exited with a non-zero exit code: 1
  ✘ test/test-bundle-source.js exited with a non-zero exit code: 1
  ─
v43: Error#1: Cannot find file for internal module "./src/exos/cosmosOrchestrationAccount.js" (with candidates "./src/exos/cosmosOrchestrationAccount.js", "./src/exos/cosmosOrchestrationAccount.js.js", "./src/exos/cosmosOrchestrationAccount.js.json", "

inspect the container, and look at the module in question:

head node_modules/@agoric/orchestration/package.json

double check the package.json version, to ensure resolution isn't overrriding a package on yarn install etc.

xsnap: v52: Error: methodGuard: guard:methodGuard: (an object) - Must match one of [{"argGuards":"[match:arrayOf]","callKind":"sync","optionalArgGuards":"[match:or]","restArgGuard":"[match:or]","returnGuard":"[match:or]"},{"argGuards":"[match:arrayOf]","callKind":"async","optionalArgGuards":"[match:or]","restArgGuard":"[match:or]","returnGuard":"[Seen]"}]

Ensure

makeAcountInvitationMaker: M.call().returns(M.promise()),

updated syntax:

makeAccountInvitationMaker: M.callWhen().returns(InvitationShape)
Cannot find file for internal module "./vat.js"

the version of @agoric/vow should be kept updated to @dev for now to keep up.

ReferenceError#1: accountsStorageNode: get E: undefined variable

Make sure privateArgs adheres to the correct shape expected or else any subsequent call to something like this will fail:

E(storageNode).makeChildNode('accounts'),
export const meta = harden({
  privateArgsShape: {
    orchestration: M.remotable('orchestration'),
    storageNode: StorageNodeShape,
    marshaller: M.remotable('marshaller'),
    timer: TimerServiceShape,
  },
});
export const privateArgsShape = meta.privateArgsShape;
Error#1: redefinition of durable kind " Durable Publish Kit "
const { makeRecorderKit } = prepareRecorderKitMakers(baggage, marshaller);

it throwing this error. provideOrchestration also calls prepareRecorderKitMakers. Also ensure the remotePowers has the following keys:

orchestrationService: remotePowers.orchestration,
timerService: remotePowers.timer,

Because makeOrchestrationFacade expects the following remotePowers structure:

/**
 *
 * @param {{
 *   zone: Zone;
 *   timerService: Remote<TimerService> | null;
 *   zcf: ZCF;
 *   storageNode: Remote<StorageNode>;
 *   orchestrationService: Remote<OrchestrationService> | null;
 *   localchain: Remote<LocalChain>;
 * }} powers
TypeError: orchestrate: no function

If i log asyncFlowTools:

asyncFlowTools
2024-06-30T02:33:01.781Z SwingSet: vat: v38: { prepareAsyncFlowKit: [Function: prepareAsyncFlowKit], asyncFlow: [Function: asyncFlow], adminAsyncFlow: Object [Alleged: AdminAsyncFlow] {}, allWokenP: Promise [Promise] {} }
{
  "name": "@agoric/async-flow",
  "version": "0.1.1-upgrade-16-fi-dev-8879538.0+8879538",

this is the orchestrate function in @agoric/orchestration@0.1.1-upgrade-16-fi-dev-8879538.0+8879538

orchestrate(durableName, ctx, fn) {
    /** @type {Orchestrator} */
    const orc = {
    async getChain(name) {
        if (name === 'agoric') {
        return makeLocalChainFacade(localchain);
        }
        return makeRemoteChainFacade(name);
    },
    makeLocalAccount() {
        return E(localchain).makeAccount();
    },
    getBrandInfo: anyVal,
    asAmount: anyVal,
    };
    return async (...args) => fn(orc, ctx, ...args);
},

Here is the same orchestrate function in @agoric/orchestration@00.1.1-dev-6bc363b.0+6bc363b:

orchestrate(durableName, hostCtx, guestFn) {
    const subZone = zone.subZone(durableName);
    const hostOrc = makeOrchestrator();
    const [wrappedOrc, wrappedCtx] = prepareEndowment(subZone, 'endowments', [
    hostOrc,
    hostCtx,
    ]);
    const hostFn = asyncFlow(subZone, 'asyncFlow', guestFn);
    const orcFn = (...args) =>
    // TODO remove the `when` after fixing the return type
    // to `Vow<HostReturn>`
    when(hostFn(wrappedOrc, wrappedCtx, ...args));
    return harden(orcFn);
},

Hypothesis: prepareEndowment doesn't exist, so version issue

If you see x.js can't be resolved from an @agoric/... npm package, there may be a version mismatch where that version isn't exporting said file. Should be fixed with more stable versions eventually.

Error#1: In "makeAccountInvitation" method of (OrcaFacet): result: (an object) - Must be a remotable Invitation, not promise

ensure your public facet returns the result of a promise, not the promise:

const publicFacet = zone.exo(
  'OrcaFacet',
  M.interface('OrcaFacet', {
    makeAccountInvitation: M.call().returns(M.promise()),
  }),
  {
    async makeAccountInvitation() { // make sure NOT to use async here
      const invitation = await zcf.makeInvitation(
        createAccounts,
        'Create accounts',
        undefined,
        harden({
          give: {},
          want: {},
          exit: M.any(),
        }),
      );
      return invitation;
    },
  },
);
2024-07-01T19:16:10.669Z SwingSet: vat: v104: Warning for now: vow expected, not promise Promise [Promise] {} (Error#1)
2024-07-01T19:16:10.739Z SwingSet: xsnap: v104: Error#2: value for vow is not durable: slot 0 of { body: '#{"#tag":"Vow","payload":{"vowV0":"$0.Alleged: VowInternalsKit vowV0"}}', slots: [ 'o+40' ] }
2024-07-01T19:16:10.739Z SwingSet: xsnap: v104: Error: value for (a string) is not durable: slot 0 of (an object)

Make sure the offer handlers are in the top-level scope, so they don't inherit any "side effects"

await makeAccountInvitation() {

instead of:

makeAccountInvitation() {

also the function signature that works is:

/**
 * handler function for creating and managing accounts //* Xparam {object} offerArgs
 * @param {Orchestrator} orch
 * @param {undefined} _ctx
 * @param {ZCFSeat} seat
 * @param {{ chainName: string }} offerArgs
 */
const createAccountsFn = async (orch, _ctx, seat, {chainName}) => {```

some types were not correct

Then also, fron the client:

wallet?.makeOffer(
    {
      source: 'contract',
      instance, 
      publicInvitationMaker: 'makeOrchAccountInvitation',
      // publicInvitationMaker: 'makeAccountInvitation',
      // source: 'agoricContract',
      // instancePath: ['basicFlows'],
      // callPipe: [['makeOrchAccountInvitation']],
    },
    { give, want },
    { chainName: "osmosis"},

The offerArgs was empty