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: tooling for ICAs with "DAO ISM"s #4773

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

feat: tooling for ICAs with "DAO ISM"s #4773

wants to merge 22 commits into from

Conversation

tkporter
Copy link
Collaborator

@tkporter tkporter commented Oct 28, 2024

Description

  • Creates ICAs using ISMs that have the "DAO ISM" structure, albeit still owned by the Ethereum safe, and including the AW validator / deployer key. Migrating to a true "DAO ISM" will involve different ICAs than this.
  • Moves to JSON for our ICA artifact management.
  • Keeps around old ICAs for now so we're capable of submitting txs to transfer ownership
  • I haven't created all the ICAs yet to save on gas prior to review and to let reviewers play around with it for themselves. This is the command I've ran so far to generate the existing ones:
$ yarn tsx ./scripts/get-owner-ica.ts -e mainnet3 --ownerChain ethereum --chains celo gnosis viction inevm xlayer cheesechain worldchain cyber --deploy

Governance owner on ethereum: 0x3965AC3D295641E452E0ea896a086A9cD7C6C5b6
Attempting ICA recovery on chain celo with existing artifact {
  ica: '0x259f1f514397448DE885c0E3aAC67C88Ab45B5A7',
  ism: '0x25dd0b5ea63Bb87Ae01B8E3c2c1F5f8021a650F2'
}
Attempting ICA recovery on chain gnosis with existing artifact {
  ica: '0x56cFF84148421699d6EDd4a76AC46cC2DCD976A6',
  ism: '0x58399173cEE6CabbCBf53093b8410b1c510A3B56'
}
Attempting ICA recovery on chain viction with existing artifact {
  ica: '0x1Aa0f7d5C7B56719997308775ABaEc4c2f1F1f7D',
  ism: '0xa19bb63d0850c2E1633DBbD7Be0CCc98b81DA094'
}
Attempting ICA recovery on chain inevm with existing artifact {
  ica: '0xc93De68e6d8D324D80204e9bFa5f063482d722db',
  ism: '0xBb2719c78C0fEfB8C48b33dd7FCBbAc23E105c3c'
}
Attempting ICA recovery on chain xlayer with existing artifact {
  ica: '0x1B0b80C31fBBCd7760aD356C7e7b27e2dC5920B1',
  ism: '0x9b685398483BD64496EF09FF9AdFE4422E14Ff16'
}
Attempting ICA recovery on chain cheesechain with existing artifact {
  ica: '0xbf3d4f17d699b89E052927f34482CdfF0307007a',
  ism: '0x9A1aF14b301eC2eDA1EE4DbdD1f3260Cf427f24f'
}
Attempting ICA recovery on chain worldchain with existing artifact {
  ica: '0x99780E4bdDC555f705CB9C03f1D21C1d0B088798',
  ism: '0xe702EB772C8bCdbd987b7dF8949548f16eEB56Ff'
}
Attempting ICA recovery on chain cyber with existing artifact {
  ica: '0x0b40037e9560Bd93247C85A9fa728FEbFc2DEDCe',
  ism: '0xe702EB772C8bCdbd987b7dF8949548f16eEB56Ff'
}
Recovered ICA on chain cyber
Recovered ICA on chain worldchain
Recovered ICA on chain cheesechain
Recovered ICA on chain inevm
Recovered ICA on chain celo
Recovered ICA on chain gnosis
{"level":50,"time":1730730682035,"pid":55553,"module":"SmartProvider:88","msg":"Unhandled error case in combined provider error handler"}
{"level":50,"time":1730730683234,"pid":55553,"module":"SmartProvider:88","msg":"Unhandled error case in combined provider error handler"}
{"level":50,"time":1730730684901,"pid":55553,"module":"SmartProvider:88","msg":"Unhandled error case in combined provider error handler"}
Recovered ICA on chain viction
Recovered ICA on chain xlayer
┌─────────────┬──────────┬───────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────┐
│   (index)   │ deployed │ recovered │                     ica                      │                     ism                      │
├─────────────┼──────────┼───────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────┤
│    celo     │   '✅'   │   '✅'    │ '0x259f1f514397448DE885c0E3aAC67C88Ab45B5A7' │ '0x25dd0b5ea63Bb87Ae01B8E3c2c1F5f8021a650F2' │
│   gnosis    │   '✅'   │   '✅'    │ '0x56cFF84148421699d6EDd4a76AC46cC2DCD976A6' │ '0x58399173cEE6CabbCBf53093b8410b1c510A3B56' │
│   viction   │   '✅'   │   '✅'    │ '0x1Aa0f7d5C7B56719997308775ABaEc4c2f1F1f7D' │ '0xa19bb63d0850c2E1633DBbD7Be0CCc98b81DA094' │
│    inevm    │   '✅'   │   '✅'    │ '0xc93De68e6d8D324D80204e9bFa5f063482d722db' │ '0xBb2719c78C0fEfB8C48b33dd7FCBbAc23E105c3c' │
│   xlayer    │   '✅'   │   '✅'    │ '0x1B0b80C31fBBCd7760aD356C7e7b27e2dC5920B1' │ '0x9b685398483BD64496EF09FF9AdFE4422E14Ff16' │
│ cheesechain │   '✅'   │   '✅'    │ '0xbf3d4f17d699b89E052927f34482CdfF0307007a' │ '0x9A1aF14b301eC2eDA1EE4DbdD1f3260Cf427f24f' │
│ worldchain  │   '✅'   │   '✅'    │ '0x99780E4bdDC555f705CB9C03f1D21C1d0B088798' │ '0xe702EB772C8bCdbd987b7dF8949548f16eEB56Ff' │
│    cyber    │   '✅'   │   '✅'    │ '0x0b40037e9560Bd93247C85A9fa728FEbFc2DEDCe' │ '0xe702EB772C8bCdbd987b7dF8949548f16eEB56Ff' │
└─────────────┴──────────┴───────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────┘

Drive-by changes

Related issues

Backward compatibility

Testing

Copy link

changeset-bot bot commented Oct 28, 2024

⚠️ No Changeset found

Latest commit: 088aa9e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.27%. Comparing base (6dd7fc6) to head (088aa9e).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4773   +/-   ##
=======================================
  Coverage   74.27%   74.27%           
=======================================
  Files         101      101           
  Lines        1481     1481           
  Branches      192      192           
=======================================
  Hits         1100     1100           
  Misses        360      360           
  Partials       21       21           
Components Coverage Δ
core 84.61% <ø> (ø)
hooks 77.77% <ø> (ø)
isms 77.77% <ø> (ø)
token 89.01% <ø> (ø)
middlewares 77.58% <ø> (ø)

@tkporter tkporter changed the title WIP DAO ISM feat: DAO ISM tooling Nov 4, 2024
@tkporter tkporter marked this pull request as ready for review November 4, 2024 14:35
@tkporter tkporter requested a review from ltyu as a code owner November 4, 2024 14:35
@tkporter tkporter changed the title feat: DAO ISM tooling feat: tooling for ICAs with "DAO ISM"s Nov 4, 2024
// Found by running:
// yarn tsx ./scripts/get-owner-ica.ts -e mainnet3 --ownerChain ethereum --destinationChains <chain1> <chain2> ...
export const icas: Partial<
export const oldIcas: Partial<
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe move these to a legacy-aw-icas.json with zero address for ism, so we have a consistent way of reading/writing/persisting ica information

Comment on lines +60 to +65
const actualAccount = await ica.getAccount(chain, {
...ownerConfig,
ismOverride: expected.ism,
routerOverride: ownerChainInterchainAccountRouter,
});
if (!eqAddress(expected.ica, actualAccount)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

wonder if there's anything we can do to dedupe between here + get-owner-ica, so we don't accidentally check one thing and deploy another

Comment on lines +67 to +71
Expected: expected,
Actual: {
ica: actualAccount,
ism: expected.ism,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah moving old icas to a legacy-aw-ica could help us double check those like this too

should we also include the router address in here for reproducible checks?

}
}

// -- ISM config generation --
Copy link
Contributor

Choose a reason for hiding this comment

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

all of this config generation should live at infra/config/ not infra/scripts

probably could split out the owners.ts a little so we have the "aw-ica" stuff there

Comment on lines +382 to +403
// Ensure that we can derive the ICA using the ISM we're aware of.
const ismOverride =
this.checker.configMap[chain].ownerOverrides?._icaIsmAddress;
const recoveredAccount = await this.interchainAccount.getAccount(chain, {
owner: accountConfig.owner,
origin: accountConfig.origin,
ismOverride,
});
if (!eqAddress(recoveredAccount, account.address)) {
console.error(
chalk.red(
`Failed to recover the target owner ICA: (chain: ${chain}, remote owner: ${accountConfig.owner}, origin: ${accountConfig}).
Used ISM override: ${ismOverride}, recovered account: ${recoveredAccount}. Is the ICA's ISM override correct?
Defaulting to manual submission.`,
),
);
return {
type: SubmissionType.MANUAL,
chain,
call,
};
}
Copy link
Contributor

Choose a reason for hiding this comment

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

so once we have deployed the new icas and uncomment out the relevant code for them in the config, i'm not sure I see how we still submit to the old icas to transfer ownership to the new ones

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe I'm misunderstanding but I thought transferring would involve:

  • changing the owner to the new ICA
  • we keep _icaAddress as the old ICA, so we're capable of sending a tx via the old ICA to transfer to the new owner

And then after that's executed, we:

  • update _icaAddress to be the new ICA and _icaIsmAddress as needed, so we can submit new txs via this new ICA

Copy link
Contributor

Choose a reason for hiding this comment

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

ahhh yes - because we update the owner to be artifact ?? safe ?? deployer but don't change the actual ica that things get submitted through the first time

thanks for reminding me

Comment on lines +187 to +188
// ...(icaArtifact && { _icaAddress: icaArtifact.ica }),
// ...(icaArtifact?.ism && { _icaIsmAddress: icaArtifact.ism }),
Copy link
Contributor

Choose a reason for hiding this comment

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

should we throw if icaArtifact.ism isn't set?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

3 participants