-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs: #8896 ## Description Extracted from #9534 to focus that PR on multichain and lighten the review. Also it had merge conflicts with master that this resolves. ### Security Considerations nothing new ### Scaling Considerations no ### Documentation Considerations none ### Testing Considerations new coverage ### Upgrade Considerations none
- Loading branch information
Showing
10 changed files
with
324 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/// <reference types="ses" /> | ||
import { makeHelpers } from '@agoric/deploy-script-support'; | ||
|
||
/** @type {Record<string, import('@agoric/orchestration/src/chain-info.js').ChainInfo>} */ | ||
const chainInfo = { | ||
hot: { | ||
allegedName: 'Hot New Chain', | ||
chainId: 'hot-1', | ||
connections: { | ||
'cosmoshub-4': { | ||
id: 'connection-99', | ||
client_id: '07-tendermint-3', | ||
counterparty: { | ||
client_id: '07-tendermint-2', | ||
connection_id: 'connection-1', | ||
prefix: { | ||
key_prefix: '', | ||
}, | ||
}, | ||
state: 3 /* IBCConnectionState.STATE_OPEN */, | ||
transferChannel: { | ||
portId: 'transfer', | ||
channelId: 'channel-1', | ||
counterPartyChannelId: 'channel-1', | ||
counterPartyPortId: 'transfer', | ||
ordering: 1 /* Order.ORDER_UNORDERED */, | ||
state: 3 /* IBCConnectionState.STATE_OPEN */, | ||
version: 'ics20-1', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ | ||
export const defaultProposalBuilder = async () => | ||
harden({ | ||
sourceSpec: '@agoric/orchestration/src/proposals/revise-chain-info.js', | ||
getManifestCall: [ | ||
'getManifestForReviseChains', | ||
{ | ||
chainInfo, | ||
}, | ||
], | ||
}); | ||
|
||
export default async (homeP, endowments) => { | ||
const { writeCoreEval } = await makeHelpers(homeP, endowments); | ||
await writeCoreEval('revise-chain-info', defaultProposalBuilder); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/// <reference types="ses" /> | ||
import { makeHelpers } from '@agoric/deploy-script-support'; | ||
|
||
/** @type {Record<string, import('@agoric/orchestration/src/chain-info.js').ChainInfo>} */ | ||
const chainInfo = { | ||
agoric: { | ||
chainId: 'agoric-4', | ||
}, | ||
hot: { | ||
allegedName: 'Hot New Chain', | ||
chainId: 'hot-1', | ||
connections: { | ||
'cosmoshub-4': { | ||
id: 'connection-99', | ||
client_id: '07-tendermint-3', | ||
counterparty: { | ||
client_id: '07-tendermint-2', | ||
connection_id: 'connection-1', | ||
prefix: { | ||
key_prefix: '', | ||
}, | ||
}, | ||
state: 3 /* IBCConnectionState.STATE_OPEN */, | ||
transferChannel: { | ||
portId: 'transfer', | ||
channelId: 'channel-1', | ||
counterPartyChannelId: 'channel-1', | ||
counterPartyPortId: 'transfer', | ||
ordering: 1 /* Order.ORDER_UNORDERED */, | ||
state: 3 /* IBCConnectionState.STATE_OPEN */, | ||
version: 'ics20-1', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ | ||
export const defaultProposalBuilder = async () => | ||
harden({ | ||
sourceSpec: '@agoric/orchestration/src/proposals/revise-chain-info.js', | ||
getManifestCall: [ | ||
'getManifestForReviseChains', | ||
{ | ||
chainInfo, | ||
}, | ||
], | ||
}); | ||
|
||
export default async (homeP, endowments) => { | ||
const { writeCoreEval } = await makeHelpers(homeP, endowments); | ||
await writeCoreEval('revise-chain-info', defaultProposalBuilder); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { makeTracer } from '@agoric/internal'; | ||
import { registerChain } from '../chain-info.js'; | ||
|
||
const trace = makeTracer('ReviseChainInfo', true); | ||
|
||
/** @import {CosmosChainInfo} from '../types.js'; */ | ||
|
||
/** | ||
* This will add news values AND overwrite any existing values. Voters on a | ||
* proposal of core-eval must be careful not to overwrite any values operating | ||
* in production. | ||
* | ||
* @param {BootstrapPowers} powers | ||
* @param {{ options: { chainInfo: Record<string, CosmosChainInfo> } }} opt | ||
*/ | ||
export const reviseChainInfo = async ( | ||
{ consume: { agoricNamesAdmin } }, | ||
{ options: { chainInfo } }, | ||
) => { | ||
trace('init-chainInfo'); | ||
|
||
assert(chainInfo, 'chainInfo is required'); | ||
|
||
trace(chainInfo); | ||
|
||
// Now register the names | ||
for await (const [name, info] of Object.entries(chainInfo)) { | ||
await registerChain(agoricNamesAdmin, name, info, trace); | ||
} | ||
}; | ||
harden(reviseChainInfo); | ||
|
||
export const getManifestForReviseChains = (_powers, { chainInfo }) => ({ | ||
manifest: { | ||
[reviseChainInfo.name]: { | ||
consume: { | ||
agoricNamesAdmin: true, | ||
}, | ||
}, | ||
}, | ||
options: { | ||
chainInfo, | ||
}, | ||
}); |
Oops, something went wrong.