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

feat(orchestration): chain NameHub #9323

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
304 changes: 304 additions & 0 deletions packages/orchestration/test/mocks/chain-info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,304 @@
/**
* Generated using gRPC queries to local simulated chains
* See {@link https://github.com/Agoric/agoric-sdk/blob/43e0249502171e82460be7cf4bad8baf5db5aafd/packages/cosmic-proto/test/snapshots/test-chain-info.js.md | snapshots} and
* their {@link https://github.com/Agoric/agoric-sdk/blob/43e0249502171e82460be7cf4bad8baf5db5aafd/packages/cosmic-proto/test/snapshots/test-chain-info.js.md | source test}.
0xpatrickdev marked this conversation as resolved.
Show resolved Hide resolved
* // TODO check in some portion of above code
*/
export const mockChainInfo = {
agoric: {
icaParams: {
allowMessages: [
'/agoric.*',
'/ibc.*',
'/cosmos.[a-rt-z]*',
'/cosmos.s[a-su-z]*',
],
hostEnabled: true,
},
icqParams: {
hostEnabled: false,
},
chainId: 'agoriclocal',
bondDenom: 'ubld',
denoms: [
{
denom: 'ubld',
native: true,
},
{
denom: 'uist',
native: true,
},
{
baseDenom: 'uion',
denom:
'ibc/F7E92EE59B5428793F3EF5C1A4CB2494F61A9D0C9A69469D02390714A1372E16',
path: 'transfer/channel-0',
},
{
baseDenom: 'uosmo',
denom:
'ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518',
path: 'transfer/channel-0',
Copy link
Member

Choose a reason for hiding this comment

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

channel 0 goes to the cosmos hub, according to https://mapofzones.com/zones/agoric-3/peers?columnKey=ibcVolumeIn&period=24h

or is this about emerynet or something?

},
{
baseDenom: 'uatom',
denom:
'ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9',
path: 'transfer/channel-1',
},
],
connections: [
{
chainId: 'osmosis-test',
connectionInfo: {
clientId: '07-tendermint-2',
counterparty: {
clientId: '07-tendermint-2',
connectionId: 'connection-1',
},
id: 'connection-0',
state: 'STATE_OPEN',
},
lastUpdated: {
revisionHeight: 831n,
Comment on lines +64 to +65
Copy link
Member

Choose a reason for hiding this comment

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

how often do you expect this to get updated?

Copy link
Member Author

Choose a reason for hiding this comment

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

Pretty frequently, I believe with every block (of the chain with the shorter avg block time).

I recognize this likely makes it a poor candidate to put into state, given our anticipated update frequency/governance, but some messages seem like they rely on it for preventing an unbound timeout:

  1. MsgTransfer has timeoutHeight and timeoutTimestamp fields (the generated TS types say both are required, but i think it's actually one or the other)
  2. RequestQuery has a height field used for timing out a packet
  3. TxBody has a timeoutHeight field used for timing out a packet

More on Height:

/**
 * Height is a monotonically increasing data type
 * that can be compared against another Height for the purposes of updating and
 * freezing clients
 *
 * Normally the RevisionHeight is incremented at each height while keeping
 * RevisionNumber the same. However some consensus algorithms may choose to
 * reset the height in certain conditions e.g. hard forks, state-machine
 * breaking changes In these cases, the RevisionNumber is incremented so that
 * height continues to be monitonically increasing even as the RevisionHeight
 * gets reset
 */
export interface Height {
    /** the revision that the client is currently on */
    revisionNumber: bigint;
    /** the height within the given revision */
    revisionHeight: bigint;
}

For MsgTransfer, it seems that we should use timeoutTimestamp (absolute) to set the timeout, leaning on TimerService.

For RequestQuery and TxBody, maybe the correct abstraction for now is to ensure timeoutHeight/height is always an (invitation|offer)Arg, and rely on clients for this information.

A clever approach might be to approximate timeout height based on a target block duration (of the chain with the shorter avg block times), using using a historical revisionHeight and the timestamp is was saved at. This is likely too clever, and doesn't account for things like chain halting upgrades or target block time drift.

P.S. created #9324 to capture this work, as TxBody's revisionHeight and RequestQuery's height default to 0n on master

revisionNumber: 0n,
},
transferChannels: [
{
counterpartyChannelId: 'channel-1',
counterpartyPortId: 'transfer',
ordering: 'ORDER_UNORDERED',
sourceChannelId: 'channel-0',
sourcePortId: 'transfer',
state: 'STATE_OPEN',
version: 'ics20-1',
},
],
},
{
chainId: 'gaia-test',
connectionInfo: {
clientId: '07-tendermint-3',
counterparty: {
clientId: '07-tendermint-2',
connectionId: 'connection-1',
},
id: 'connection-1',
state: 'STATE_OPEN',
},
lastUpdated: {
revisionHeight: 854n,
revisionNumber: 0n,
},
transferChannels: [
{
counterpartyChannelId: 'channel-1',
counterpartyPortId: 'transfer',
ordering: 'ORDER_UNORDERED',
sourceChannelId: 'channel-1',
sourcePortId: 'transfer',
state: 'STATE_OPEN',
version: 'ics20-1',
},
],
},
],
},
cosmos: {
icaParams: {
allowMessages: [],
hostEnabled: true,
},
icqParams: {
hostEnabled: false,
},
chainId: 'gaia-test',
bondDenom: 'uatom',
denoms: [
{
denom: 'uatom',
native: true,
},
{
baseDenom: 'uion',
denom:
'ibc/F7E92EE59B5428793F3EF5C1A4CB2494F61A9D0C9A69469D02390714A1372E16',
path: 'transfer/channel-0',
},
{
baseDenom: 'uosmo',
denom:
'ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518',
path: 'transfer/channel-0',
},
{
baseDenom: 'ubld',
denom:
'ibc/E7827844CB818EE9C4DB2C159F1543FF62B26213B44CE8029D5CEFE52F0EE596',
path: 'transfer/channel-1',
},
{
baseDenom: 'uist',
denom:
'ibc/16CD81E12F05F5397CA2D580B4BA786A12A8F48B6FB3823D82EBE95D80B5287B',
path: 'transfer/channel-1',
},
],
connections: [
{
chainId: 'osmosis-test',
connectionInfo: {
clientId: '07-tendermint-0',
counterparty: {
clientId: '07-tendermint-0',
connectionId: 'connection-0',
},
id: 'connection-0',
state: 'STATE_OPEN',
},
lastUpdated: {
revisionHeight: 12056n,
revisionNumber: 0n,
},
transferChannels: [
{
counterpartyChannelId: 'channel-0',
counterpartyPortId: 'transfer',
ordering: 'ORDER_UNORDERED',
sourceChannelId: 'channel-0',
sourcePortId: 'transfer',
state: 'STATE_OPEN',
version: 'ics20-1',
},
],
},
{
chainId: 'agoriclocal',
connectionInfo: {
clientId: '07-tendermint-2',
counterparty: {
clientId: '07-tendermint-3',
connectionId: 'connection-1',
},
id: 'connection-1',
state: 'STATE_OPEN',
},
lastUpdated: {
revisionHeight: 113n,
revisionNumber: 0n,
},
transferChannels: [
{
counterpartyChannelId: 'channel-1',
counterpartyPortId: 'transfer',
ordering: 'ORDER_UNORDERED',
sourceChannelId: 'channel-1',
sourcePortId: 'transfer',
state: 'STATE_OPEN',
version: 'ics20-1',
},
],
},
],
},
osmosis: {
icaParams: {
allowMessages: ['*'],
hostEnabled: true,
},
icqParams: {
allowQueries: [
'/cosmos.bank.v1beta1.Query/Balance',
'/cosmos.staking.v1beta1.Query/Delegation',
],
hostEnabled: true,
},
chainId: 'osmosis-test',
bondDenom: 'uosmo',
denoms: [
{
denom: 'uion',
native: true,
},
{
denom: 'uosmo',
native: true,
},
{
baseDenom: 'uatom',
denom:
'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2',
path: 'transfer/channel-0',
},
{
baseDenom: 'ubld',
denom:
'ibc/E7827844CB818EE9C4DB2C159F1543FF62B26213B44CE8029D5CEFE52F0EE596',
path: 'transfer/channel-1',
},
{
baseDenom: 'uist',
denom:
'ibc/16CD81E12F05F5397CA2D580B4BA786A12A8F48B6FB3823D82EBE95D80B5287B',
path: 'transfer/channel-1',
},
],
connections: [
{
chainId: 'gaia-test',
connectionInfo: {
clientId: '07-tendermint-0',
counterparty: {
clientId: '07-tendermint-0',
connectionId: 'connection-0',
},
id: 'connection-0',
state: 'STATE_OPEN',
},
lastUpdated: {
revisionHeight: 7836n,
revisionNumber: 0n,
},
transferChannels: [
{
counterpartyChannelId: 'channel-0',
counterpartyPortId: 'transfer',
ordering: 'ORDER_UNORDERED',
sourceChannelId: 'channel-0',
sourcePortId: 'transfer',
state: 'STATE_OPEN',
version: 'ics20-1',
},
],
},
{
chainId: 'agoriclocal',
connectionInfo: {
clientId: '07-tendermint-2',
counterparty: {
clientId: '07-tendermint-2',
connectionId: 'connection-0',
},
id: 'connection-1',
state: 'STATE_OPEN',
},
lastUpdated: {
revisionHeight: 110n,
revisionNumber: 0n,
},
transferChannels: [
{
counterpartyChannelId: 'channel-0',
counterpartyPortId: 'transfer',
ordering: 'ORDER_UNORDERED',
sourceChannelId: 'channel-1',
sourcePortId: 'transfer',
state: 'STATE_OPEN',
version: 'ics20-1',
},
],
},
],
},
};
Loading
Loading