-
Notifications
You must be signed in to change notification settings - Fork 231
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): add more chain infos for fusdc #10845
Conversation
1802ebd
to
111a842
Compare
Deploying agoric-sdk with
|
Latest commit: |
bcc450c
|
Status: | ✅ Deploy successful! |
Preview URL: | https://2f334f36.agoric-sdk.pages.dev |
Branch Preview URL: | https://fu-chain-info.agoric-sdk.pages.dev |
24c3c4e
to
513d5ba
Compare
Problem: When adding all the chain infos, it causes an It works on my computer, just not in CI. So, I wonder:
Edit: |
766a6ba
to
8057723
Compare
Finally got test passing. Had to make some decisions (see description) so please take a look @0xpatrickdev @turadg |
@@ -331,7 +331,15 @@ test.serial('basic-flows', async t => { | |||
'@agoric/builders/scripts/orchestration/init-basic-flows.js', | |||
[ | |||
'--chainInfo', | |||
JSON.stringify(withChainCapabilities(fetchedChainInfo)), | |||
JSON.stringify( | |||
withChainCapabilities({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is repeated below. It would help legibility and maintainability if this value were named like fetchedChainInfo
is. please extract to const like minimalSubsetChainInfo
or what have you.
I see it's used in multiple modules so consider making a new one for named chain info subsets which tests and contracts could import from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just put this in tools
for reuse
// XXX for some reason the code after this when run under XS fails with: | ||
// message: 'unsettled value for "kp2526"', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have an issue now which suffices and has the advantage of an easy query for cleanup.
// XXX for some reason the code after this when run under XS fails with: | |
// message: 'unsettled value for "kp2526"', | |
// UNTIL https://github.com/Agoric/agoric-sdk/issues/10847 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just removed all this code because of cab3fbe
}); | ||
|
||
// chain info, assets and ibc data will be downloaded dynamically by invoking fetchUrls method | ||
await client.fetchUrls(); | ||
|
||
const chainInfo = await convertChainInfo(client); | ||
const icaChainSet = new Set(icaChainNames); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider icaChainNames
itself being a Set. there really is no ordering to them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
* {@link CHAIN_ID_SEPARATOR} in the chain ID to make it clear that it's part of | ||
* the chain ID rather than a separator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not just making it clear. it's making it a reversible encoding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the wording to be more precise
chainId.replaceAll( | ||
CHAIN_ID_SEPARATOR, | ||
`${CHAIN_ID_SEPARATOR}${CHAIN_ID_SEPARATOR}`, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on the fence about this suggestion, but since this expression is so close to the const I think it could be clearer:
chainId.replaceAll( | |
CHAIN_ID_SEPARATOR, | |
`${CHAIN_ID_SEPARATOR}${CHAIN_ID_SEPARATOR}`, | |
); | |
chainId.replaceAll('_', '__'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean but I prefer keeping the variable here
* @see {@link https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-2.md} | ||
*/ | ||
const CHAIN_ID_SEPARATOR = '_'; | ||
export const sanitizeChainId = chainId => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not sanitizing it. it's encoding it so it can appear in the tuple
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the wording
@@ -95,6 +96,7 @@ export const convertChainInfo = async registry => { | |||
stakingTokens: chain.staking?.staking_tokens, | |||
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9326 | |||
icqEnabled: chain.chain_name === 'osmosis', | |||
icaEnabled: icaEnabled(chain.chain_name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same name is being used for a property and a query function. please rename the query function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed
chains, | ||
ibcData: ibc.data, | ||
}, | ||
() => true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this happens to be true but should it be assumed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well not assume. Just changed this to use the imported list of icaEnabled chains
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test to FUSDC that ensures there's a channel between noble and all of the chains in the ticket? This would ensure chain-registry
has all of the information we're after.
NB: in registry.js
, the script prints "multiple preferred transfer channels" as a console.warn. It be worth auditing more closely at this time and raising if we find multiple valid channels for noble -> another remote chain.
@@ -12,7 +12,7 @@ const outputFile = 'src/fetched-chain-info.js'; | |||
/** | |||
* Names for which to fetch info | |||
*/ | |||
const chainNames = [ | |||
export const icaChainNames = new Set([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for including this distinction.
I would suggest keeping a single list here and moving icaChains
to chain-capabilities.js
as IcaEnabled
.
It's a bit of duplication, but in #10329 it was agreed it was best to keep non-chain registry info out of fetch-chain-info / fetched-chain-info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot about that. Thanks for catching it @0xpatrickdev .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
}); | ||
|
||
// chain info, assets and ibc data will be downloaded dynamically by invoking fetchUrls method | ||
await client.fetchUrls(); | ||
|
||
const chainInfo = await convertChainInfo(client); | ||
const chainInfo = await convertChainInfo(client, name => | ||
icaChainNames.has(name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave this part out for now? We should add icaEnabled
via withChainCapabilities
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test to FUSDC that ensures there's a channel between noble and all of the chains in the ticket? This would ensure chain-registry has all of the information we're after.
Added a test, however not every connection seems to exists. I documented which ones in the test. We'll need to follow up on those.
NB: in registry.js, the script prints "multiple preferred transfer channels" as a console.warn. It be worth auditing more closely at this time and raising if we find multiple valid channels for noble -> another remote chain.
I manually reviewed and couldn't find any such warnings involving noble. However, there's some missing preferred channels as I mentioned above.
}); | ||
|
||
// chain info, assets and ibc data will be downloaded dynamically by invoking fetchUrls method | ||
await client.fetchUrls(); | ||
|
||
const chainInfo = await convertChainInfo(client); | ||
const chainInfo = await convertChainInfo(client, name => | ||
icaChainNames.has(name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -12,7 +12,7 @@ const outputFile = 'src/fetched-chain-info.js'; | |||
/** | |||
* Names for which to fetch info | |||
*/ | |||
const chainNames = [ | |||
export const icaChainNames = new Set([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
I'll need to update test snapshots but if you could, please take another look @0xpatrickdev thanks! |
@@ -38,23 +38,43 @@ const PfmEnabled = /** @type {const} */ ({ | |||
}); | |||
harden(PfmEnabled); | |||
|
|||
const IcaEnabled = /** @type {const} */ ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from where is this info derived? what's the process to update it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually derived. To update automatically we might be able to get a public RPC endpoint for each chain from the chain registry, then query the endpoints for the ICA info. However, the RPC endpoints in chain registry are often unreliable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's cool. I should have been more clear… these are questions I think the source code should answer. Please document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
// List of chains to test to ensure an IBC connection exists from noble to them | ||
// XXX: Some missing connections. | ||
const fastUsdcDestinationChains = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be available outside the test? e.g. for the contract to handle differently a destination that isn't in this list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. Possibly something to ensure we have a testing plan for... if we get a destination that's not supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the contract is presented with an unknown destination, we should get ADVANCE_FAILED
and something like no connection info found for...
in the swingset logs.
That's to say, i don't think we need to do anything here: "for the contract to handle differently a destination that isn't in this list"
However, this is something FEs might find useful. It's not in our current design, but I could imagine some version of this info going into vstorage.
@@ -5,6 +5,7 @@ import fsp from 'node:fs/promises'; | |||
import prettier from 'prettier'; | |||
|
|||
import { convertChainInfo } from '@agoric/orchestration/src/utils/registry.js'; | |||
import { icaChainNames } from '@agoric/orchestration/scripts/fetch-chain-info.ts'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just chainNames
now? And does convertChainInfo
still take a 2nd arg? force-integration
should be a cheapish way to verify this change is correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yea this is all unnecessary now, and the test was in fact failing because this import doesn't exist anymore.
|
||
// List of chains to test to ensure an IBC connection exists from noble to them | ||
// XXX: Some missing connections. | ||
const fastUsdcDestinationChains = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the contract is presented with an unknown destination, we should get ADVANCE_FAILED
and something like no connection info found for...
in the swingset logs.
That's to say, i don't think we need to do anything here: "for the contract to handle differently a destination that isn't in this list"
However, this is something FEs might find useful. It's not in our current design, but I could imagine some version of this info going into vstorage.
const testNobleConnection = test.macro({ | ||
exec(t, input) { | ||
const info = fetchedChainInfo[input]; | ||
const { chainId } = info; | ||
const connection = fetchedChainInfo.noble.connections[chainId]; | ||
t.truthy(connection); | ||
}, | ||
title(_, input) { | ||
return `Connection from noble to ${input}`; | ||
}, | ||
}); | ||
|
||
for (const chain of fastUsdcDestinationChains) { | ||
test(testNobleConnection, chain); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you 🙏
@@ -38,23 +38,43 @@ const PfmEnabled = /** @type {const} */ ({ | |||
}); | |||
harden(PfmEnabled); | |||
|
|||
const IcaEnabled = /** @type {const} */ ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e2d535a
to
a5066f0
Compare
a5066f0
to
bcc450c
Compare
closes #10736
refs #10629
Description
icaEnabled
property toCosmosChainInfo
_
). Since we use underscores as a separator in the vstorage key, we sanitize the chain IDs by doubling the underscores (similar to double-quote in csv)Security Considerations
We're adding non-ica-enabled chains now, so #10629 is relevant.
Scaling Considerations
packages/orchestration/src/fetched-chain-info.js
is quite large, hopefully not too large?Documentation Considerations
Not sure if these chains need to be documented somewhere.
Testing Considerations
Just did
yarn codegen
. Not sure how to test this for real.Upgrade Considerations
Updating the chain infos will presumably require a core-eval