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

Dummy PR #38

Open
wants to merge 87 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
8f1c7bd
refactor: exofy Orchestrator, RemoteChainFacade
erights Jun 17, 2024
37ec151
refactor: exofy Orchestrator, RemoteChainFacade (#9529)
mergify[bot] Jun 19, 2024
984fc9a
refactor: staking denom
turadg Jun 19, 2024
bcb1e89
chore: XXX -> FIXME for release blockers
turadg Jun 19, 2024
29649ad
refactor: kebab case exo filenames
turadg Jun 19, 2024
783f520
refactor: ChainAddress in localchain account
turadg Jun 19, 2024
5ce13fd
feat: OrchestrationAccountI for LCA holder
turadg Jun 19, 2024
1ca9a00
refactor: name LocalOrchestrationAccount
turadg Jun 19, 2024
772039c
refactor: makeLocalOrchestrationAccountKit name
turadg Jun 19, 2024
0636745
refactor: ChainFacadeI
turadg Jun 19, 2024
bec2253
feat: LocalChainFacade exo
turadg Jun 19, 2024
62bdb8a
feat: prepareOrchestrator durable returns
turadg Jun 19, 2024
c244e96
9281 durable orchestrator (#9532)
mergify[bot] Jun 19, 2024
989aa19
fix(swingset): log vat termination and upgrade better (#9535)
warner Jun 19, 2024
f4342f1
docs: ref issues
turadg Jun 19, 2024
724d1fb
feat: getConnectionInfo by obj or string
turadg Jun 12, 2024
28838b6
feat: getChainsAndConnection helper
turadg Jun 18, 2024
fc33238
chore(orchestation): include c8 coverage script
0xpatrickdev Jun 7, 2024
ed2317c
chore(types): VowTools in tools.js
turadg Jun 19, 2024
ad29545
test: provide vowTools
turadg Jun 19, 2024
bc3bc6b
feat(orchestration): icqConnectionKit returns unwrapped vows
0xpatrickdev Jun 4, 2024
778eb42
feat(orchestration): service.js returns unwrapped vows
0xpatrickdev Jun 4, 2024
7c99929
feat(orchestration): ChainAccountKit returns unwrapped vows
0xpatrickdev Jun 5, 2024
b9a18b0
fix: add TODOs for early synchronous returns
0xpatrickdev Jun 6, 2024
33085ff
feat(orchestration): localChainAccountKit returns unwrapped vows
0xpatrickdev Jun 18, 2024
c0fd411
feat(orchestration): cosmosOrchestrationAccount returns unwrapped vows
0xpatrickdev Jun 18, 2024
f3f87b1
feat(orchestration): return unwrapped vows (#9454)
mergify[bot] Jun 19, 2024
1f7d826
refactor: mv chain-hub to exos
turadg Jun 19, 2024
e382b66
feat: exofy chainHub
turadg Jun 19, 2024
9274bc7
9281 chainHub exo (#9538)
mergify[bot] Jun 19, 2024
426a3be
types(zoe): setTestJig param type optional
erights Jun 19, 2024
bf9f03b
types(zoe): setTestJig param type optional (#9533)
mergify[bot] Jun 19, 2024
62c73f5
feat(zoe): Make zcf singleton durable (#9531)
erights Jun 19, 2024
9550773
feat(facade): propagate vowTools
0xpatrickdev Jun 19, 2024
94d0c3c
feat(orchestrator): return unwrapped vows
0xpatrickdev Jun 19, 2024
56687b4
feat(orchestrator): return unwrapped vows (#9537)
mergify[bot] Jun 20, 2024
381b6a8
chore(deps): bump Typescript to 5.5 release
turadg Jun 9, 2024
0cfea88
adopt TypeScript 5.5 (#9476)
mergify[bot] Jun 20, 2024
608b882
lint: warn on non-resumable code
turadg Jun 20, 2024
f9bd118
lint: warn on non-resumable code (#9543)
mergify[bot] Jun 20, 2024
32d41ce
refactor: move registerChain helper to chain-info
turadg Jun 20, 2024
f928bdd
chore(facade): vow compat
turadg Jun 20, 2024
5e0643b
feat: chain-hub resumable
turadg Jun 20, 2024
944adea
9449 resumable chainHub (#9544)
mergify[bot] Jun 20, 2024
181acb8
chore(deps): bump yarn to 1.22.22
turadg Jun 20, 2024
2155263
chore(deps): rely on corepack for yarn
turadg Jun 20, 2024
52e0339
yarn by corepack (#9542)
mergify[bot] Jun 21, 2024
2a68510
ci: retry agoric-cli integration test
turadg Jun 21, 2024
c5c52ec
retry flaky agoric-cli integration test (#9550)
mergify[bot] Jun 21, 2024
527ac1a
test: quieter chain-info
turadg Jun 21, 2024
f9b6857
feat: chain facades return vows
turadg Jun 21, 2024
788647d
9449 chain facades return vows (#9547)
mergify[bot] Jun 21, 2024
b8b592c
refactor: extract writeChainInfo
turadg Jun 17, 2024
ad6e2e3
refactor: remove extra export
turadg Jun 17, 2024
ca97f1e
test: connection vstorage
turadg Jun 18, 2024
2f625b9
test: revise chain info
turadg Jun 21, 2024
01a1123
test of revising chain info (#9552)
mergify[bot] Jun 21, 2024
d3c4976
# This is a combination of 22 commits.
Jorge-Lopes Jan 12, 2024
e5b1813
chore(liquidationVisibility): update dependencies
anilhelvaci Feb 16, 2024
6cd0f48
chore(liquidationVisibility): fix test 'visibility-after-upgrade'
anilhelvaci Feb 16, 2024
4f51280
fix(liquidationVisibility): start using boot package
anilhelvaci Feb 19, 2024
15090c4
parent 1f641d9bcdf35161e0ca053742918c29a2f53090
anilhelvaci Feb 19, 2024
7546b72
chore(liquidationVisibility): prepare upgrade proposal
anilhelvaci Feb 20, 2024
eab6d87
chore(liquidationVisibility): copy old version of vaultFactory and up…
Jorge-Lopes Feb 22, 2024
2279a0b
feat(liquidationVisibility): add bootstrap tests for back compatibili…
Jorge-Lopes Feb 23, 2024
f309ec4
feat(liquidationVisibility): Store `liquidationsStorageNode` in ephem…
anilhelvaci Feb 23, 2024
a49bd17
fix(LiquidationVisibility): #21 #22 fix rebase changes, add utils pag…
Jorge-Lopes Feb 16, 2024
f4cecb0
fix(liquidationVisibility): minor updates to contract and bootstrap t…
Jorge-Lopes Feb 26, 2024
0033e16
fix(liquidationVisibility): rebase fixes
anilhelvaci Feb 26, 2024
59bd9b1
fix(liquidationVisibility): lint fixes
anilhelvaci Feb 26, 2024
a1d966e
chore(liquidationVisibility): add snapshot
anilhelvaci Feb 26, 2024
c4c746f
fixup(liquidationVisibility): remove the unused prefix
anilhelvaci Jun 10, 2024
00413dd
fixup(liquidationVisibility): destructure helper facet
anilhelvaci Jun 10, 2024
4ad2d72
fixup(liquidationVisibility): drop references to `LiquidationVisibili…
anilhelvaci Jun 10, 2024
81e8ee3
fixup(liquidationVisibility): add `startTime` field to `auctionResult…
anilhelvaci Jun 10, 2024
5a57427
fixup(liquidationVisibility): remove leftover comment and fix typo.
anilhelvaci Jun 10, 2024
d62235b
fixup(liquidationVisibility): implement `checkWritersPresent` and rem…
anilhelvaci Jun 12, 2024
fabf735
fixup(liquidationVisibility): Directly invoking methods on `liquidati…
anilhelvaci Jun 13, 2024
7f363a8
fixup(liquidationVisibility): Remove compatability tests and their re…
anilhelvaci Jun 13, 2024
a9ceca1
fixup(liquidationVisibility): Remove `allValuesSetteled()`
anilhelvaci Jun 17, 2024
040e87d
fixup(liquidationVisibility): Rebase fixes
anilhelvaci Jun 19, 2024
d5cfc92
fixup(liquidationVisibility): Rebase fixes - type and lint
anilhelvaci Jun 19, 2024
f2c878f
fixup(liquidationVisibility): Rebase fixes - type and lint
anilhelvaci Jun 20, 2024
5748fe3
chore(liquidationVisibility): Add new data fields
anilhelvaci Jun 20, 2024
fcd475a
test(liquidationVisibility): update expected auctionResult of checkVi…
Jorge-Lopes Jun 20, 2024
1b6e567
chore(liquidationVisibility): update LiquidationOutcome and expected …
Jorge-Lopes Jun 21, 2024
10d4171
chore(liquidationVisibility): Add a3p proposal
anilhelvaci Jun 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
refactor: exofy Orchestrator, RemoteChainFacade
  • Loading branch information
erights authored and turadg committed Jun 18, 2024

Verified

This commit was signed with the committer’s verified signature.
alexanderbez Aleksandr Bezobchuk
commit 8f1c7bdcaba96f5218ac4b4639c246773aac0aa9
3 changes: 2 additions & 1 deletion packages/orchestration/src/exos/local-chain-account-kit.js
Original file line number Diff line number Diff line change
@@ -278,4 +278,5 @@ export const prepareLocalChainAccountKit = (
);
return makeLocalChainAccountKit;
};
/** @typedef {ReturnType<ReturnType<typeof prepareLocalChainAccountKit>>} LocalChainAccountKit */
/** @typedef {ReturnType<typeof prepareLocalChainAccountKit>} MakeLocalChainAccountKit */
/** @typedef {ReturnType<MakeLocalChainAccountKit>} LocalChainAccountKit */
101 changes: 101 additions & 0 deletions packages/orchestration/src/exos/orchestrator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/** @file ChainAccount exo */
import { AmountShape } from '@agoric/ertp';
import { makeTracer } from '@agoric/internal';
import { V } from '@agoric/vow/vat.js';
import { M } from '@endo/patterns';
// eslint-disable-next-line import/no-cycle -- FIXME
import { makeLocalChainFacade } from '../facade.js';

/**
* @import {Zone} from '@agoric/base-zone';
* @import {ChainHub} from '../utils/chainHub.js';
* @import {Connection, Port} from '@agoric/network';
* @import {AnyJson} from '@agoric/cosmic-proto';
* @import {TxBody} from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
* @import {LocalIbcAddress, RemoteIbcAddress} from '@agoric/vats/tools/ibc-utils.js';
* @import {AsyncFlowTools} from '@agoric/async-flow';
* @import {Vow} from '@agoric/vow';
* @import {TimerService} from '@agoric/time';
* @import {IBCConnectionID} from '@agoric/vats';
* @import {LocalChain} from '@agoric/vats/src/localchain.js';
* @import {RecorderKit, MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js'.
* @import {Remote} from '@agoric/internal';
* @import {OrchestrationService} from '../service.js';
* @import {MakeLocalChainAccountKit} from './local-chain-account-kit.js';
* @import {Chain, ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount, Orchestrator} from '../types.js';
*/

const { Fail } = assert;
const trace = makeTracer('Orchestrator');

// TODO more validation
export const ChainInfoShape = M.any();
export const LocalChainAccountShape = M.remotable('LocalChainAccount');
export const DenomShape = M.string();
export const BrandInfoShape = M.any();

export const DenomAmountShape = { denom: DenomShape, value: M.bigint() };

/** @see {Orchestrator} */
export const OrchestratorI = M.interface('Orchestrator', {
getChain: M.callWhen(M.string()).returns(ChainInfoShape),
makeLocalAccount: M.callWhen().returns(LocalChainAccountShape),
getBrandInfo: M.call(DenomShape).returns(BrandInfoShape),
asAmount: M.call(DenomAmountShape).returns(AmountShape),
});

/**
* @param {Zone} zone
* @param {{
* asyncFlowTools: AsyncFlowTools;
* chainHub: ChainHub;
* localchain: Remote<LocalChain>;
* makeLocalChainAccountKit: MakeLocalChainAccountKit;
* makeRecorderKit: MakeRecorderKit;
* makeRemoteChainFacade: any;
* orchestrationService: Remote<OrchestrationService>;
* storageNode: Remote<StorageNode>;
* timerService: Remote<TimerService>;
* zcf: ZCF;
* }} powers
*/
export const prepareOrchestrator = (
zone,
{ chainHub, localchain, makeLocalChainAccountKit, makeRemoteChainFacade },
) =>
zone.exoClass(
'Orchestrator',
OrchestratorI,
() => {
trace('making an Orchestrator');
return {};
},
{
/** @type {Orchestrator['getChain']} */
getChain: async name => {
const agoricChainInfo = await chainHub.getChainInfo('agoric');

if (name === 'agoric') {
return makeLocalChainFacade(
localchain,
makeLocalChainAccountKit,
agoricChainInfo,
);
}

const remoteChainInfo = await chainHub.getChainInfo(name);
const connectionInfo = await chainHub.getConnectionInfo(
agoricChainInfo.chainId,
remoteChainInfo.chainId,
);

return makeRemoteChainFacade(remoteChainInfo, connectionInfo);
},
makeLocalAccount() {
return V(localchain).makeAccount();
},
getBrandInfo: () => Fail`not yet implemented`,
asAmount: () => Fail`not yet implemented`,
},
);
harden(prepareOrchestrator);
91 changes: 91 additions & 0 deletions packages/orchestration/src/exos/remote-chain-facade.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/** @file ChainAccount exo */
import { makeTracer } from '@agoric/internal';
import { V } from '@agoric/vow/vat.js';
import { M } from '@endo/patterns';

import { ChainInfoShape } from './orchestrator.js';

/**
* @import {Zone} from '@agoric/base-zone';
* @import {TimerService} from '@agoric/time';
* @import {Remote} from '@agoric/internal';
* @import {OrchestrationService} from '../service.js';
* @import {prepareCosmosOrchestrationAccount} from './cosmosOrchestrationAccount.js';
* @import {ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount} from '../types.js';
*/

const { Fail } = assert;
const trace = makeTracer('RemoteChainFacade');

/** @type {any} */
const anyVal = null;

/** @see {Chain} */
export const RemoteChainFacadeI = M.interface('RemoteChainFacade', {
getChainInfo: M.callWhen().returns(ChainInfoShape),
makeAccount: M.callWhen().returns(M.remotable('OrchestrationAccount')),
});

/**
* @param {Zone} zone
* @param {{
* makeCosmosOrchestrationAccount: ReturnType<
* typeof prepareCosmosOrchestrationAccount
* >;
* orchestration: Remote<OrchestrationService>;
* storageNode: Remote<StorageNode>;
* timer: Remote<TimerService>;
* }} powers
*/
export const prepareRemoteChainFacade = (
zone,
{ makeCosmosOrchestrationAccount, orchestration, storageNode, timer },
) =>
zone.exoClass(
'RemoteChainFacade',
RemoteChainFacadeI,
/**
* @param {CosmosChainInfo} remoteChainInfo
* @param {IBCConnectionInfo} connectionInfo
*/
(remoteChainInfo, connectionInfo) => {
trace('making an RemoteChainFacade');
return { remoteChainInfo, connectionInfo };
},
{
async getChainInfo() {
return this.state.remoteChainInfo;
},

// FIXME parameterize on the remoteChainInfo to make()
// That used to work but got lost in the migration to Exo
/** @returns {Promise<OrchestrationAccount<ChainInfo>>} */
async makeAccount() {
const { remoteChainInfo, connectionInfo } = this.state;

const icaAccount = await V(orchestration).makeAccount(
remoteChainInfo.chainId,
connectionInfo.id,
connectionInfo.counterparty.connection_id,
);

const address = await V(icaAccount).getAddress();

const [{ denom: bondDenom }] = remoteChainInfo.stakingTokens || [
{
denom: null,
},
];
if (!bondDenom) {
throw Fail`missing bondDenom`;
}
return makeCosmosOrchestrationAccount(address, bondDenom, {
account: icaAccount,
storageNode,
icqConnection: anyVal,
timer,
});
},
},
);
harden(prepareRemoteChainFacade);
122 changes: 28 additions & 94 deletions packages/orchestration/src/facade.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/** @file Orchestration service */

import { V as E } from '@agoric/vow/vat.js';
import { Fail } from '@agoric/assert';
import { prepareCosmosOrchestrationAccount } from './exos/cosmosOrchestrationAccount.js';
import { V as E } from '@agoric/vow/vat.js';
import { Far } from '@endo/far';
// eslint-disable-next-line import/no-cycle -- FIXME
import { prepareOrchestrator } from './exos/orchestrator.js';

/**
* @import {AsyncFlowTools} from '@agoric/async-flow';
* @import {Zone} from '@agoric/zone';
* @import {Vow} from '@agoric/vow';
* @import {TimerService} from '@agoric/time';
* @import {IBCConnectionID} from '@agoric/vats';
* @import {LocalChain} from '@agoric/vats/src/localchain.js';
@@ -16,9 +19,7 @@ import { prepareCosmosOrchestrationAccount } from './exos/cosmosOrchestrationAcc
* @import {Chain, ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount, Orchestrator} from './types.js';
*/

/** @type {any} */
const anyVal = null;

// FIXME turn this into an Exo
/**
* @param {Remote<LocalChain>} localchain
* @param {ReturnType<
@@ -27,12 +28,12 @@ const anyVal = null;
* @param {ChainInfo} localInfo
* @returns {Chain}
*/
const makeLocalChainFacade = (
export const makeLocalChainFacade = (
localchain,
makeLocalChainAccountKit,
localInfo,
) => {
return {
return Far('LocalChainFacade', {
/** @returns {Promise<ChainInfo>} */
async getChainInfo() {
return localInfo;
@@ -48,6 +49,7 @@ const makeLocalChainFacade = (
storageNode: null,
});

// FIXME turn this into an Exo LocalChainOrchestrationAccount or make that a facet of makeLocalChainAccountKit
return {
async deposit(payment) {
console.log('deposit got', payment);
@@ -89,60 +91,7 @@ const makeLocalChainFacade = (
},
};
},
};
};

/**
* @template {CosmosChainInfo} CCI
* @param {CCI} chainInfo
* @param {IBCConnectionInfo} connectionInfo
* @param {object} io
* @param {Remote<OrchestrationService>} io.orchestration
* @param {MakeRecorderKit} io.makeRecorderKit
* @param {Remote<StorageNode>} io.storageNode
* @param {Remote<TimerService>} io.timer
* @param {ZCF} io.zcf
* @param {Zone} io.zone
* @returns {Chain<CCI>}
*/
const makeRemoteChainFacade = (
chainInfo,
connectionInfo,
{ orchestration, makeRecorderKit, storageNode, timer, zcf, zone },
) => {
const makeCosmosOrchestrationAccount = prepareCosmosOrchestrationAccount(
zone.subZone(chainInfo.chainId),
makeRecorderKit,
zcf,
);

return {
getChainInfo: async () => chainInfo,
/** @returns {Promise<OrchestrationAccount<CCI>>} */
makeAccount: async () => {
const icaAccount = await E(orchestration).makeAccount(
chainInfo.chainId,
connectionInfo.id,
connectionInfo.counterparty.connection_id,
);

const address = await E(icaAccount).getAddress();

const [{ denom: bondDenom }] = chainInfo.stakingTokens || [
{
denom: null,
},
];
assert(bondDenom, 'missing bondDenom');
// @ts-expect-error XXX dynamic method availability
return makeCosmosOrchestrationAccount(address, bondDenom, {
account: icaAccount,
storageNode,
icqConnection: anyVal,
timer,
});
},
};
});
};

/**
@@ -158,6 +107,8 @@ const makeRemoteChainFacade = (
* typeof import('./exos/local-chain-account-kit.js').prepareLocalChainAccountKit
* >;
* makeRecorderKit: MakeRecorderKit;
* makeCosmosOrchestrationAccount: any;
* makeRemoteChainFacade: any;
* asyncFlowTools: AsyncFlowTools;
* }} powers
*/
@@ -171,6 +122,7 @@ export const makeOrchestrationFacade = ({
chainHub,
makeLocalChainAccountKit,
makeRecorderKit,
makeRemoteChainFacade,
asyncFlowTools,
}) => {
(zone &&
@@ -182,9 +134,23 @@ export const makeOrchestrationFacade = ({
makeLocalChainAccountKit &&
// @ts-expect-error type says defined but double check
makeRecorderKit &&
makeRemoteChainFacade &&
asyncFlowTools) ||
Fail`params missing`;

const makeOrchestrator = prepareOrchestrator(zone, {
asyncFlowTools,
chainHub,
localchain,
makeLocalChainAccountKit,
makeRecorderKit,
makeRemoteChainFacade,
orchestrationService,
storageNode,
timerService,
zcf,
});

return {
/**
* @template Context
@@ -196,40 +162,8 @@ export const makeOrchestrationFacade = ({
* @returns {(...args: Args) => Promise<unknown>}
*/
orchestrate(durableName, ctx, fn) {
/** @type {Orchestrator} */
const orc = {
async getChain(name) {
const agoricChainInfo = await chainHub.getChainInfo('agoric');

if (name === 'agoric') {
return makeLocalChainFacade(
localchain,
makeLocalChainAccountKit,
agoricChainInfo,
);
}

const remoteChainInfo = await chainHub.getChainInfo(name);
const connectionInfo = await chainHub.getConnectionInfo(
agoricChainInfo.chainId,
remoteChainInfo.chainId,
);
const orc = makeOrchestrator();

return makeRemoteChainFacade(remoteChainInfo, connectionInfo, {
orchestration: orchestrationService,
makeRecorderKit,
storageNode,
timer: timerService,
zcf,
zone,
});
},
makeLocalAccount() {
return E(localchain).makeAccount();
},
getBrandInfo: anyVal,
asAmount: anyVal,
};
return async (...args) => fn(orc, ctx, ...args);
},
};
Loading