Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orchestration-basics v1 release #10

Closed
wants to merge 21 commits into from
Closed

Orchestration-basics v1 release #10

wants to merge 21 commits into from

Conversation

Jovonni
Copy link
Collaborator

@Jovonni Jovonni commented Jul 29, 2024

  • clean from larger dev branch
  • e2e workflow works
  • tests pass
    cleaned branch with all modern changes/updates

Tests Pass

Details

make test-orca
yarn workspace dapp-agoric-orca-contract test

  ✘ No tests found in test/test-build-proposal.js
  ✘ No tests found in test/build-proposal.test.js
  ✔ deploy-tools › local copy of ParamTypes matches @agoric/governance
  ✔ deploy-tools › local copy of ELECTORATE matches @agoric/governance
  ✔ deploy-tools › local copy of INVITATION_MAKERS_DESC matches @agoric/iner-protocol
  ✔ deploy-tools › boardAux marshal short-cut matches @endo/marshal
  ✔ deploy-tools › AmountMath.make work-alike matches @agoric/ertp
----- OrCE.2  2 start proposal module evaluating
bundles/ bundle-orca.js valid: 374 files bundled at 2024-07-29T19:11:09.828Z with size 3268397
chain registered: agoric {
  chainId: 'agoriclocal',
  denom: 'ubld',
  expectedAddressPrefix: 'agoric'
}
chain registered: osmosis {
  chainId: 'osmosislocal',
  denom: 'uosmo',
  expectedAddressPrefix: 'osmo'
}
    orca-contract › before hook
    ℹ bootstrap
    ℹ brand timer: new Promise
    ℹ brand BLD: new Promise
    ℹ brand IST: new Promise
    ℹ brand Invitation: new Promise
    ℹ issuer BLD: new Promise
    ℹ issuer IST: new Promise
    ℹ issuer Invitation: new Promise
    ℹ brand timer settled; remaining: [
        'BLD',
        'IST',
        'Invitation',
      ]
    ℹ brand BLD settled; remaining: [
        'IST',
        'Invitation',
      ]
    ℹ brand IST settled; remaining: [
        'Invitation',
      ]
    ℹ brand Invitation settled; remaining: []
    ℹ issuer BLD settled; remaining: [
        'IST',
        'Invitation',
      ]
    ℹ issuer IST settled; remaining: [
        'Invitation',
      ]
    ℹ issuer Invitation settled; remaining: []
    ℹ issuer MNY: new Promise
    ℹ brand MNY: new Promise
    ℹ issuer Item: new Promise
    ℹ brand Item: new Promise
    ℹ issuer ATOM: new Promise
    ℹ brand ATOM: new Promise
    ℹ issuer MNY settled; remaining: [
        'ATOM',
        'Item',
      ]
    ℹ brand MNY settled; remaining: [
        'ATOM',
        'Item',
      ]
    ℹ issuer Item settled; remaining: [
        'ATOM',
      ]
    ℹ brand Item settled; remaining: [
        'ATOM',
      ]
    ℹ issuer ATOM settled; remaining: []
    ℹ brand ATOM settled; remaining: []
----- startOrch.3  2 startOrchCoreEval
----- startOrch.3  3 startOrchCoreEval done
publish bundle orca b1-48ff9
----- OrCE.2  3 startOrcaContract()... 0.0.93
{
  produce: {},
  consume: {},
  installation: { produce: {}, consume: {} },
  instance: { produce: {}, consume: {} },
  issuer: { produce: {}, consume: {} },
  brand: { produce: {}, consume: {} },
  zone: Object [Alleged: durableZone] {
    exo: [Function: wrapper],
    exoClass: [Function: wrapper],
    exoClassKit: [Function: wrapper],
    subZone: [Function: subZone],
    makeOnce: [Function: makeOnce],
    watchPromise: [Function: watchPromise],
    detached: [Function: detached],
    isStorable: [Function: isStorable],
    mapStore: [Function: wrapper],
    setStore: [Function: wrapper],
    weakMapStore: [Function: wrapper],
    weakSetStore: [Function: wrapper]
  }
}
----- OrCE.2  4 config {
  options: {
    orca: {
      bundleID: 'b1-48ff962c12e337568582749dfe7f4752c7c69a6f722499a7538c8db4b0fb42eb46f8f0e71aa44fd7b217f37e04de4aab86a0d0429dedc5cdb1a6840116c26d84'
    }
  }
}
----- OrCE.2  5 permittedPowers {
  produce: {},
  consume: {},
  installation: { produce: {}, consume: {} },
  instance: { produce: {}, consume: {} },
  issuer: { produce: {}, consume: {} },
  brand: { produce: {}, consume: {} },
  zone: Object [Alleged: durableZone] {
    exo: [Function: wrapper],
    exoClass: [Function: wrapper],
    exoClassKit: [Function: wrapper],
    subZone: [Function: subZone],
    makeOnce: [Function: makeOnce],
    watchPromise: [Function: watchPromise],
    detached: [Function: detached],
    isStorable: [Function: isStorable],
    mapStore: [Function: wrapper],
    setStore: [Function: wrapper],
    weakMapStore: [Function: wrapper],
    weakSetStore: [Function: wrapper]
  }
}
  ✔ orca-contract › Install the contract
    ℹ installed: Object @Alleged: BundleInstallation {}
orca (re-)installed as b1-48ff9
permittedPowers
{
  produce: {},
  consume: {},
  installation: { produce: {}, consume: {} },
  instance: { produce: {}, consume: {} },
  issuer: { produce: {}, consume: {} },
  brand: { produce: {}, consume: {} },
  zone: Object [Alleged: durableZone] {
    exo: [Function: wrapper],
    exoClass: [Function: wrapper],
    exoClassKit: [Function: wrapper],
    subZone: [Function: subZone],
    makeOnce: [Function: makeOnce],
    watchPromise: [Function: watchPromise],
    detached: [Function: detached],
    isStorable: [Function: isStorable],
    mapStore: [Function: wrapper],
    setStore: [Function: wrapper],
    weakMapStore: [Function: wrapper],
    weakSetStore: [Function: wrapper]
  }
}
from inside startOrcaContract: Object [Alleged: BundleIDInstallation] {}
Promise { Object [Alleged: DummyOrchestration] {} }
Promise { Object [Alleged: NameHubKit nameHub] {} }
chainStorage
Promise {
  Object [Alleged: mockChainStorage] {
    __getInterfaceGuard__: [Function: value],
    __getMethodNames__: [Function: value],
    getPath: [Function: value],
    getStoreKey: [Function: value],
    makeChildNode: [Function: value],
    setValue: [Function: value],
    getBody: [Function: getBody],
    keys: [Function: keys]
  }
}
Object [Alleged: ChainStorageNode] {}
DONE MAKING NODES v0.3
Object [Alleged: Board publishingMarshaller] {}
  ✔ orca-contract › Verify chain registration
----- OrCE.2  6 startOpts {
  label: 'orca',
  installation: Object [Alleged: BundleIDInstallation] {},
  terms: undefined,
  privateArgs: {
    storageNode: Object [Alleged: ChainStorageNode] {},
    marshaller: Object [Alleged: Board publishingMarshaller] {},
    orchestrationService: Object [Alleged: DummyOrchestration] {},
    timerService: Object [Alleged: ManualTimer] {
      __getInterfaceGuard__: [Function: value],
      __getMethodNames__: [Function: value],
      advanceBy: [Function: value],
      advanceTo: [Function: value],
      cancel: [Function: value],
      delay: [Function: value],
      getClock: [Function: value],
      getCurrentTimestamp: [Function: value],
      getTimerBrand: [Function: value],
      makeNotifier: [Function: value],
      makeRepeater: [Function: value],
      repeatAfter: [Function: value],
      setWakeup: [Function: value],
      wakeAt: [Function: value],
      tick: [Function: tick],
      tickN: [AsyncFunction: tickN]
    },
    localchain: Object [Alleged: DummyLocalchain] {},
    agoricNames: Object [Alleged: NameHubKit nameHub] {}
  }
}
----- OrchDev1.2  2 inside start function: v1.0.85
----- OrchDev1.2  3 privateArgs {
  cosmosInterchainService: Object [Alleged: DummyCosmosInterchainService] {
    getChainHub: [AsyncFunction: getChainHub],
    makeAccount: [AsyncFunction: makeAccount],
    getChainInfo: [AsyncFunction: getChainInfo]
  },
  orchestrationService: Object [Alleged: DummyCosmosInterchainService] {
    getChainHub: [AsyncFunction: getChainHub],
    makeAccount: [AsyncFunction: makeAccount],
    getChainInfo: [AsyncFunction: getChainInfo]
  },
  storageNode: Object [Alleged: DummyStorageNode] {
    makeChildNode: [AsyncFunction: makeChildNode],
    getPath: [Function: getPath],
    toCapData: [Function: toCapData],
    setValue: [Function: setValue]
  },
  marshaller: Object [Alleged: DummyMarshaller] {
    toCapData: [Function: toCapData],
    fromCapData: [Function: fromCapData]
  },
  timer: Object [Alleged: DummyTimer] {},
  timerService: Object [Alleged: DummyTimer] {},
  localchain: Object [Alleged: Dumm] {},
  agoricNames: Object [Alleged: DummyAgoricNames] {
    lookup: [AsyncFunction: lookup]
  }
}
----- OrchDev1.2  4 orchestration:  Object [Alleged: DummyCosmosInterchainService] {
  getChainHub: [AsyncFunction: getChainHub],
  makeAccount: [AsyncFunction: makeAccount],
  getChainInfo: [AsyncFunction: getChainInfo]
}
----- OrchDev1.2  5 marshaller:  Object [Alleged: DummyMarshaller] {
  toCapData: [Function: toCapData],
  fromCapData: [Function: fromCapData]
}
----- OrchDev1.2  6 storageNode:  Object [Alleged: DummyStorageNode] {
  makeChildNode: [AsyncFunction: makeChildNode],
  getPath: [Function: getPath],
  toCapData: [Function: toCapData],
  setValue: [Function: setValue]
}
----- OrchDev1.2  7 timer:  Object [Alleged: DummyTimer] {}
----- OrchDev1.2  8 localchain:  Object [Alleged: Dumm] {}
----- OrchDev1.2  9 agoricNames:  Object [Alleged: DummyAgoricNames] { lookup: [AsyncFunction: lookup] }
----- Orchestrator.4  2 making an Orchestrator
----- OrchDev1.2  2 inside start function: v1.0.85
----- OrchDev1.2  3 privateArgs {
  cosmosInterchainService: Object [Alleged: DummyCosmosInterchainService] {
    getChainHub: [AsyncFunction: getChainHub],
    makeAccount: [AsyncFunction: makeAccount],
    getChainInfo: [AsyncFunction: getChainInfo]
  },
  orchestrationService: Object [Alleged: DummyCosmosInterchainService] {
    getChainHub: [AsyncFunction: getChainHub],
    makeAccount: [AsyncFunction: makeAccount],
    getChainInfo: [AsyncFunction: getChainInfo]
  },
  storageNode: Object [Alleged: DummyStorageNode] {
    makeChildNode: [AsyncFunction: makeChildNode],
    getPath: [Function: getPath],
    toCapData: [Function: toCapData],
    setValue: [Function: setValue]
  },
  marshaller: Object [Alleged: DummyMarshaller] {
    toCapData: [Function: toCapData],
    fromCapData: [Function: fromCapData]
  },
  timer: Object [Alleged: DummyTimer] {},
  timerService: Object [Alleged: DummyTimer] {},
  localchain: Object [Alleged: DummyLocalchain] {},
  agoricNames: Object [Alleged: DummyAgoricNames] {
    lookup: [AsyncFunction: lookup]
  }
}
----- OrchDev1.2  4 orchestration:  Object [Alleged: DummyCosmosInterchainService] {
  getChainHub: [AsyncFunction: getChainHub],
  makeAccount: [AsyncFunction: makeAccount],
  getChainInfo: [AsyncFunction: getChainInfo]
}
----- OrchDev1.2  5 marshaller:  Object [Alleged: DummyMarshaller] {
  toCapData: [Function: toCapData],
  fromCapData: [Function: fromCapData]
}
----- OrchDev1.2  6 storageNode:  Object [Alleged: DummyStorageNode] {
  makeChildNode: [AsyncFunction: makeChildNode],
  getPath: [Function: getPath],
  toCapData: [Function: toCapData],
  setValue: [Function: setValue]
}
----- OrchDev1.2  7 timer:  Object [Alleged: DummyTimer] {}
----- OrchDev1.2  8 localchain:  Object [Alleged: DummyLocalchain] {}
----- OrchDev1.2  9 agoricNames:  Object [Alleged: DummyAgoricNames] { lookup: [AsyncFunction: lookup] }
----- Orchestrator.4  2 making an Orchestrator
  ✔ orca-contract › Start Orca contract (1.5s)
    ℹ started: Object @Alleged: InstanceHandle {}
----- OrchDev1.2  2 inside start function: v1.0.85
----- OrchDev1.2  3 privateArgs {
  storageNode: Object [Alleged: ChainStorageNode] {},
  marshaller: Object [Alleged: Board publishingMarshaller] {},
  orchestrationService: Object [Alleged: DummyOrchestration] {},
  timerService: Object [Alleged: ManualTimer] {
    __getInterfaceGuard__: [Function: value],
    __getMethodNames__: [Function: value],
    advanceBy: [Function: value],
    advanceTo: [Function: value],
    cancel: [Function: value],
    delay: [Function: value],
    getClock: [Function: value],
    getCurrentTimestamp: [Function: value],
    getTimerBrand: [Function: value],
    makeNotifier: [Function: value],
    makeRepeater: [Function: value],
    repeatAfter: [Function: value],
    setWakeup: [Function: value],
    wakeAt: [Function: value],
    tick: [Function: tick],
    tickN: [AsyncFunction: tickN]
  },
  localchain: Object [Alleged: DummyLocalchain] {},
  agoricNames: Object [Alleged: NameHubKit nameHub] {}
}
----- OrchDev1.2  4 orchestration:  Object [Alleged: DummyOrchestration] {}
----- OrchDev1.2  5 marshaller:  Object [Alleged: Board publishingMarshaller] {}
----- OrchDev1.2  6 storageNode:  Object [Alleged: ChainStorageNode] {}
----- OrchDev1.2  7 timer:  undefined
----- OrchDev1.2  8 localchain:  Object [Alleged: DummyLocalchain] {}
----- OrchDev1.2  9 agoricNames:  Object [Alleged: NameHubKit nameHub] {}
----- Orchestrator.4  2 making an Orchestrator
----- OrCE.2  7 orca (re)started WITH RESET
PROPOSAL_STATUS_PASSED
  ✔ orca-contract › Start Orca contract using core-eval (1.5s)
    ℹ run core-eval to start (dummy) orchestration
    ℹ before core eval
    ℹ before install
    ℹ run orca core-eval
    ℹ [object Object]
    ℹ bundleID
    ℹ b1-48ff962c12e337568582749dfe7f4752c7c69a6f722499a7538c8db4b0fb42eb46f8f0e71aa44fd7b217f37e04de4aab86a0d0429dedc5cdb1a6840116c26d84
    ℹ Object @Alleged: InstanceHandle {}
----- OrchDev1.2  10 version 0.1.36
----- OrchDev1.2  11 give
----- OrchDev1.2  12 {}
----- OrchDev1.2  13 inside createAccounts
----- OrchDev1.2  14 orch
----- OrchDev1.2  15 Object [Alleged: Orchestrator orchestrator guest wrapper] {
  __getInterfaceGuard__: [Function: In "__getInterfaceGuard__" method of (Orchestrator orchestrator)],
  __getMethodNames__: [Function: __getMethodNames__],
  asAmount: [Function: In "asAmount" method of (Orchestrator orchestrator)],
  getBrandInfo: [Function: In "getBrandInfo" method of (Orchestrator orchestrator)],
  getChain: [Function: In "getChain" method of (Orchestrator orchestrator)],
  makeLocalAccount: [Function: In "makeLocalAccount" method of (Orchestrator orchestrator)]
}
----- OrchDev1.2  16 seat
----- OrchDev1.2  17 Object [Alleged: zcfSeat guest wrapper] {
  __getInterfaceGuard__: [Function: In "__getInterfaceGuard__" method of (zcfSeat)],
  __getMethodNames__: [Function: __getMethodNames__],
  clear: [Function: In "clear" method of (zcfSeat)],
  decrementBy: [Function: In "decrementBy" method of (zcfSeat)],
  exit: [Function: In "exit" method of (zcfSeat)],
  fail: [Function: In "fail" method of (zcfSeat)],
  getAmountAllocated: [Function: In "getAmountAllocated" method of (zcfSeat)],
  getCurrentAllocation: [Function: In "getCurrentAllocation" method of (zcfSeat)],
  getProposal: [Function: In "getProposal" method of (zcfSeat)],
  getStagedAllocation: [Function: In "getStagedAllocation" method of (zcfSeat)],
  getSubscriber: [Function: In "getSubscriber" method of (zcfSeat)],
  hasExited: [Function: In "hasExited" method of (zcfSeat)],
  hasStagedAllocation: [Function: In "hasStagedAllocation" method of (zcfSeat)],
  incrementBy: [Function: In "incrementBy" method of (zcfSeat)],
  isOfferSafe: [Function: In "isOfferSafe" method of (zcfSeat)]
}
Querying data at path: published.agoricNames
Querying data at path: published.wallet.test-wallet.current
----- OrchDev1.2  18 version 0.1.36
----- OrchDev1.2  19 give
----- OrchDev1.2  20 {}
----- OrchDev1.2  21 inside createAccounts
----- OrchDev1.2  22 orch
----- OrchDev1.2  23 Object [Alleged: Orchestrator orchestrator guest wrapper] {
  __getInterfaceGuard__: [Function: In "__getInterfaceGuard__" method of (Orchestrator orchestrator)],
  __getMethodNames__: [Function: __getMethodNames__],
  asAmount: [Function: In "asAmount" method of (Orchestrator orchestrator)],
  getBrandInfo: [Function: In "getBrandInfo" method of (Orchestrator orchestrator)],
  getChain: [Function: In "getChain" method of (Orchestrator orchestrator)],
  makeLocalAccount: [Function: In "makeLocalAccount" method of (Orchestrator orchestrator)]
}
----- OrchDev1.2  24 seat
----- OrchDev1.2  25 Object [Alleged: zcfSeat guest wrapper] {
  __getInterfaceGuard__: [Function: In "__getInterfaceGuard__" method of (zcfSeat)],
  __getMethodNames__: [Function: __getMethodNames__],
  clear: [Function: In "clear" method of (zcfSeat)],
  decrementBy: [Function: In "decrementBy" method of (zcfSeat)],
  exit: [Function: In "exit" method of (zcfSeat)],
  fail: [Function: In "fail" method of (zcfSeat)],
  getAmountAllocated: [Function: In "getAmountAllocated" method of (zcfSeat)],
  getCurrentAllocation: [Function: In "getCurrentAllocation" method of (zcfSeat)],
  getProposal: [Function: In "getProposal" method of (zcfSeat)],
  getStagedAllocation: [Function: In "getStagedAllocation" method of (zcfSeat)],
  getSubscriber: [Function: In "getSubscriber" method of (zcfSeat)],
  hasExited: [Function: In "hasExited" method of (zcfSeat)],
  hasStagedAllocation: [Function: In "hasStagedAllocation" method of (zcfSeat)],
  incrementBy: [Function: In "incrementBy" method of (zcfSeat)],
  isOfferSafe: [Function: In "isOfferSafe" method of (zcfSeat)]
}
  ✔ orca-contract › orchestrate - osmosis makeAccount returns a ContinuingOfferResult (1.5s)
    ℹ installing the contract...
    ℹ starting the instance...
    ℹ instance started: Object @Alleged: InstanceHandle {}
    ℹ getting public facet...
    ℹ public facet obtained: Object @Alleged: Orca Public Facet {}
    ℹ creating account invitation...
    ℹ invitation created: Object @Alleged: Zoe Invitation payment {}
    ℹ making offer...
    ℹ initial user seat: Object @Alleged: ZoeUserSeat userSeat {}
    ℹ getting offer result...
    ℹ offer result: Object @Vow {
        payload: {
          vowV0: Object @Alleged: VowInternalsKit vowV0 {},
        },
      }
    ℹ vstorage data at published.agoricNames: {}
    ℹ querying vstorage for wallet: test-wallet, offerId: offerId
    ℹ current wallet record: {
        offerToPublicSubscriberPaths: [
          [
            'offerId',
            Object { … },
          ],
        ],
        status: {
          error: undefined,
          id: 'offerId',
          numWantsSatisfied: 1,
          result: 'UNPUBLISHED',
        },
      }
    ℹ offer to public subscriber map: {
        offerId: {
          account: 'osmo1abc',
        },
      }
    ℹ extracted address: osmo1abc
    ℹ got address: osmo1abc
    ℹ current wallet record {
        offerToPublicSubscriberPaths: [
          [
            'offerId',
            Object { … },
          ],
        ],
        status: {
          error: undefined,
          id: 'offerId',
          numWantsSatisfied: 1,
          result: 'UNPUBLISHED',
        },
      }
    ℹ continuing offer result Object @Vow {
        payload: {
          vowV0: Object @Alleged: VowInternalsKit vowV0 {},
        },
      }
  ✔ bundle-source › bundleSource() bundles the contract for use with zoe (4.6s)
    ℹ 48ff962c12e337568582749dfe7f4752c7c69a6f722499a7538c8db4b0fb42eb46f8f0e71aa44fd7b217f37e04de4aab86a0d0429dedc5cdb1a6840116c26d84
    ℹ Object @Alleged: BundleInstallation {}
  ✔ bundle-source › bundleSource() bundles the contract for use with zoe (4.6s)
    ℹ a61c0b9d3c7b4ba1dd1c4bb85dbeae47fbeaa368d42d197c4fd57b17168b0191333eb1fe191525982d02ac6bf619ad35f38efb804161e77585aeddf0b5d780a6
    ℹ Object @Alleged: BundleInstallation {}


  12 tests passed

Contract deployment works as expected, and ui user flow works as expected.

@Jovonni Jovonni added the enhancement New feature or request label Jul 29, 2024
@Jovonni Jovonni self-assigned this Jul 29, 2024
Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please get yarn lint working.

I only looked at the 1st commit (ui stuff) so far. I'd like to have the lint stuff cleaned up before I look at more stuff. I could perhaps be persuaded to leave it until later, but I'd rather not.

>
{loadingCreateAccount ? (
<svg aria-hidden="true" role="status" className="inline w-4 h-4 me-3 text-gray-200 animate-spin dark:text-gray-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where do these path numbers come from? how do we maintain this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just a raw svg path for a common spinner. I was going to sub it out for a lib component, prob from daisy since its a dep

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's often OK to copy from an open source package, but we need to acknowledge the source. And we need to check that the license isn't copyleft; it has to be compatible with ours (Apache 2).

Comment on lines +1 to +4
const RpcEndpoints = {
osmosis: 'http://127.0.0.1:26655',
agoric: 'http://127.0.0.1:26657',
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't look like it's indented in the conventional style. do we have yarn lint set up in this repo?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you say you got yarn lint working? I'm struggling to get it to work:

10:13 connolly@bldbox$ yarn lint
Unknown Syntax Error: Command not found; did you mean one of:

version I have checked out is:

  • 2024-08-13 15:31 919cf28 create buttons are now a group for both handleCreateAccount and handleCreateAndFund

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, that commit should work for you. what directory are you running the yarn lint from? @dckc

You can run this from TLD:

yarn workspace dapp-agoric-orca-contract lint
or simply 
make lint

or from /contract, you can just run yarn lint

result

ontract % yarn workspace dapp-agoric-orca-contract lint

/Users/jovonni/Documents/projects/devtes/dapp-orchestration-basics/contract/src/orca.contract.js
  160:33  warning  The first `await` appearing in an async function must not be nested  @jessie.js/safe-await-separator

/Users/jovonni/Documents/projects/devtes/dapp-orchestration-basics/contract/src/orca.proposal.js
  35:1  warning  Missing JSDoc @param "config" type  jsdoc/require-param-type

/Users/jovonni/Documents/projects/devtes/dapp-orchestration-basics/contract/src/platform-goals/start-contract.js
  39:1  warning  Missing JSDoc @param "privateArgs" type  jsdoc/require-param-type

✖ 3 problems (0 errors, 3 warnings)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re lint, see #14

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yarn lint from tld throws:

dapp-orchestration-basics % yarn lint
Unknown Syntax Error: Command not found; did you mean one of:

  0. yarn workspaces list [--since] [-R,--recursive] [--no-private] [-v,--verbose] [--json]
  1. yarn workspaces focus [--json] [--production] [-A,--all] ...
  2. yarn workspaces foreach [--from #0] [-A,--all] [-R,--recursive] [-W,--worktree] [-v,--verbose] [-p,--parallel] [-i,--interlaced] [-j,--jobs #0] [-t,--topological] [--topological-dev] [--include #0] [--exclude #0] [--no-private] [--since] [-n,--dry-run] <commandName> ...

While running workspaces run lint
jovonni@jovonnis-MBP dapp-orchestration-basics % 

return;
}

const { instances } = useContractStore.getState();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name instances is a little surprising... it's instance in agoricNames (that's orthogonal to this PR, so IOU an issue)

Comment on lines 56 to 57
}
if (update.status === 'accepted') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no else? can update.status change in the if above?

does it make sense to use switch(update.status)?

Comment on lines +15 to +16
default:
return '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a silent failure. is that by design?


const rpcEndpoint = rpcEndpoints[chain];
try {
const balance = await fetchBalanceFromRpc(address, rpcEndpoint);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this trigger a "used before defined" eslint error?

};

const fetchBalanceFromRpc = async (address, rpcEndpoint) => {
const client = await StargateClient.connect(rpcEndpoint);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope we can avoid this sort of ambient authority.

see:

@@ -0,0 +1,44 @@
export const initializeKeplr = async () => {
await window.keplr.experimentalSuggestChain({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about passing in window.keplr explicitly rather than using ambient authority?

modules should not export powerful objects (for example, objects that close over fs or process.env)
-- OCap Discipline

window and window.keplr are in the same class as fs and process and process.env.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another possibility is to export the data and call window.keplr.experimentalSuggestChain elsewhere.

agoric: 'http://127.0.0.1:26657',
};

export default RpcEndpoints;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newline at end of file... again, do we have yarn lint set up here?

@@ -1,9 +1,8 @@
import { create } from 'zustand';

interface ContractState {
instance?: unknown;
instances?: Record<string, unknown>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh... so it's not orthogonal to this PR. elsewhere this is called instance; i.e. agoricNames.instance.orca. (likewise brand, issuer, ...)

OTOH, in the Zoe API, getTerms() returns something with issuers and brands... so... go figure.

Comment on lines +38 to +44
"bn.js@npm:^5.2.0": "patch:bn.js@npm%3A4.12.0#~/.yarn/patches/bn.js-npm-4.12.0-3ec6c884f6.patch",
"bn.js@npm:^4.11.9": "patch:bn.js@npm%3A4.12.0#~/.yarn/patches/bn.js-npm-4.12.0-3ec6c884f6.patch",
"bn.js@npm:^5.2.1": "patch:bn.js@npm%3A4.12.0#~/.yarn/patches/bn.js-npm-4.12.0-3ec6c884f6.patch",
"bn.js@npm:^4.11.8": "patch:bn.js@npm%3A4.12.0#~/.yarn/patches/bn.js-npm-4.12.0-3ec6c884f6.patch",
"bn.js@npm:^4.1.0": "patch:bn.js@npm%3A4.12.0#~/.yarn/patches/bn.js-npm-4.12.0-3ec6c884f6.patch",
"bn.js@npm:^4.0.0": "patch:bn.js@npm%3A4.12.0#~/.yarn/patches/bn.js-npm-4.12.0-3ec6c884f6.patch",
"bn.js@npm:^5.0.0": "patch:bn.js@npm%3A4.12.0#~/.yarn/patches/bn.js-npm-4.12.0-3ec6c884f6.patch",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When doing yarn from the host machine(not sure if I should have done it from the container), this is the error message I get. I'm not familiar with how patching works but I get the feeling that maybe locally generated patch files was not pushed to github from your machine. Please let me know if I need to do anything different to get this PR up and running in my machine. @Jovonni

anil@Anils-MacBook-Pro dapp-orchestration-basics % yarn                           
➤ YN0000: · Yarn 4.3.1
➤ YN0000: ┌ Project validation
➤ YN0057: │ dapp-agoric-orca-contract: Resolutions field will be ignored
➤ YN0000: └ Completed
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: bn.js@patch:bn.js@npm%3A4.12.0#~/.yarn/patches/bn.js-npm-4.12.0-3ec6c884f6.patch: ENOENT: no such file or directory, open '/Users/anil/WebstormProjects/agoric-samples/dapp-orchestration-basics/.yarn/patches/bn.js-npm-4.12.0-3ec6c884f6.patch'
➤ YN0000: └ Completed in 0s 266ms
➤ YN0000: · Failed with errors in 0s 273ms

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jovonni let's find a way to drop these resolutions. As of Agoric/agoric-sdk#9691 there's no need to patch bn.js.

The change hasn't made it to a number release so you'll have to use dev build of @agoric/cosmic-proto@dev. I see your package.json does that already. If it's not working you may have to just bump which dev build is in the yarn.lock

Copy link
Collaborator Author

@Jovonni Jovonni Jul 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed the patch files , @amessbee should fix it for now:
https://github.com/Agoric/dapp-orchestration-basics/tree/dev/orca-v1/.yarn/patches

also, @turadg I can now try it without the patch files 🚀

@@ -10,3 +10,5 @@ fund:
yarn workspace dapp-agoric-orca-contract fund
add-address:
yarn workspace dapp-agoric-orca-contract add:address
lint:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is there a large yarn.lock diff in this commit?

…to the localaccount using the watcher pattern, and then transfers to remoteaccount upon successful deposit. Contract test also works with a deposit. also created transfer watcher
@Jovonni
Copy link
Collaborator Author

Jovonni commented Aug 10, 2024

6ace05f updates:

  • contract successfully accepts a deposit from an offer
  • created both localaccount and remoteaccount
  • deposits it into the localaccount using the watcher pattern
  • the contract transfers to remoteaccount upon successful deposit
  • Contract test also works with a deposit
  • created transfer watcher
  • ui changes to support submitting the new offer, etc

The following balances are reached after submitting one offer with a makeCreateAndFundInvitation invitation:

Temporarily the address shows 1 ubld, until the deposit, then the payment is removed as expected.
Screenshot 2024-08-10 at 12 57 00 PM

Screenshot 2024-08-10 at 12 51 39 PM

Comment on lines 194 to 227
const watcher = zone.exo(
`watcher-transfer-${localAddress.value}-to-${remoteAddress.value}`, // Error: key (a string) has already been used in this zone and incarnation -- perhaps use timestamp or offerid as well?
M.interface('watcher for transfer', {
onFulfilled: M.call(M.any()).optional(M.any()).returns(VowShape),
}
),
{
/**
* @param {any} _result
* @param {bigint} value
*/
onFulfilled(
_result,
value
) {
trace("inside onFulfilled:", value)
return watch(localAccount.transfer(
{
denom: "ubld",
value: value/2n,
},
remoteAddress
))
},
},
);

trace("about to watch transfer, watcher v0.16")
trace("watcher", watcher)
watch(
E(localAccount).deposit(pmt),
watcher,
BigInt(amt.value),
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const watcher = zone.exo(
`watcher-transfer-${localAddress.value}-to-${remoteAddress.value}`, // Error: key (a string) has already been used in this zone and incarnation -- perhaps use timestamp or offerid as well?
M.interface('watcher for transfer', {
onFulfilled: M.call(M.any()).optional(M.any()).returns(VowShape),
}
),
{
/**
* @param {any} _result
* @param {bigint} value
*/
onFulfilled(
_result,
value
) {
trace("inside onFulfilled:", value)
return watch(localAccount.transfer(
{
denom: "ubld",
value: value/2n,
},
remoteAddress
))
},
},
);
trace("about to watch transfer, watcher v0.16")
trace("watcher", watcher)
watch(
E(localAccount).deposit(pmt),
watcher,
BigInt(amt.value),
);
await E(localAccount).deposit(pmt);
await localAccount.transfer(
{
denom: "ubld",
value: amt.value / 2n,
},
remoteAddress,
);

Since we're inside an async-flow, we don't need to use a vows / a promise watcher.

Also - curious - why divide by 2?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay that makes sense. I'm just dividing by two as a demo/debug to show two accounts being funded, because if we transfer the entire amount in the end, sometimes it's not easily seen that localaccount ever had funds on the frontend. Just a debug thing for now

Copy link
Collaborator Author

@Jovonni Jovonni Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember trying this first actually, and I kept getting this error here:
#11 (comment)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see what you mean here, its inside of vowTools.retriable, not just the handler! good point

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still encountering this when trying to do that, opened this ticket to track it @0xpatrickdev :
https://github.com/Agoric/dapp-orchestration-basics/issues/13#issue-2464084230

@dckc dckc mentioned this pull request Aug 14, 2024
3 tasks
This was referenced Aug 14, 2024
@Jovonni Jovonni closed this Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants