Skip to content

Disable SEI cosmos chain - #883

Open
0xh3rman wants to merge 5 commits into
mainfrom
disable-sei
Open

Disable SEI cosmos chain#883
0xh3rman wants to merge 5 commits into
mainfrom
disable-sei

Conversation

@0xh3rman

@0xh3rman 0xh3rman commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Disables Sei Cosmos while preserving its Rust enum and database compatibility.

  • Marks Sei variants with #[typeshare(skip)], so generated iOS and Android enums no longer expose the discontinued chain while Core can still decode existing values.
  • Adds one-time Android 85→86 and iOS database migrations using the raw "sei" identifier to transactionally remove chain references.
  • Deletes wallets left without accounts through the normal wallet deletion flows, including private keys, preferences, and avatars. Multi-chain wallets remain.
  • Keeps Sei EVM assets intact under the explicit seievm name.

The migration helpers accept a set of raw chain identifiers, providing a generic method to disable future chains without adding client enum cases or permanent runtime filtering.

Validated with the Android Store migration test and assembly, plus the iOS Store test suite.

@DRadmir DRadmir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@0xh3rman

Sei is only filtered in two places (allChains on iOS and available() on Android), but many places still use Chain.allCases / Chain.entries directly for example token search, transactions filter, contact chain select. So Sei can still appear there.

I suggest a different approach: add a "discontinued" flag to the chain config in core, and write a generic cleanup on each platform that runs on app start: for every discontinued chain it deletes accounts/addresses/nodes and disables assets. This cleanup is data-only, the schema does not change, so we don't need DB migrations at all.

We write this logic once, and next time we disable a chain it is only one flag in core no new migrations

Also, deleting accounts can leave a wallet with zero accounts

@gemcoder21 gemcoder21 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it should be generic solution, for any chain

@0xh3rman

Copy link
Copy Markdown
Collaborator Author

@DRadmir we still need to have a place to filter discontinued flag and most chains are false, now we have a disabled chain config and replaces all the Chain.allCases with Chain.enabled

@0xh3rman
0xh3rman requested a review from DRadmir August 14, 2026 06:01

@DRadmir DRadmir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We delete wallets with raw SQL, but this skips the normal wallet delete flow (WalletService.delete on iOS, DeleteWalletImpl on Android). So for Sei-only wallets we leave data: private keys, wallet preferences, and the avatar too. Maybe we should delete these wallets through the normal wallet delete path?

Small thing: Chain::all() in Rust is not filtered, so core/backend still see Sei as enabled. Is that intended?

@0xh3rman

Copy link
Copy Markdown
Collaborator Author

@DRadmir good suggestion, let me apply

@0xh3rman
0xh3rman force-pushed the disable-sei branch 2 times, most recently from bfb333a to 4ee8593 Compare August 14, 2026 11:25
@0xh3rman 0xh3rman self-assigned this Aug 14, 2026

@gemcoder21 gemcoder21 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should handle removal of chain case on the clients, sei should be marked as skip generation for typeshare. Once user launches the app it removed any references of that chain once, and never checks inside the app

@gemcoder21

Copy link
Copy Markdown
Contributor

once that change is made, there is many others that does not need renaming or adjustments, less code and much more reliable and long term solution to remove any unused stuff.

override fun toString(): String = "$sql | ${arguments.joinToString()}"
}

internal fun chainRemovalStatements(chain: String): List<MigrationStatement> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

chainRemovalStatements move this to reusable function somewhere? so could be used in the future

try? db.execute(sql: "DELETE FROM \(AssetRecord.databaseTableName) WHERE chain = ?", arguments: [chain])
}

static func removeChains(_ db: Database, chains: Set<String>) throws {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

there is clearChainData - can you consolidate that? should we check if table exist first?

#[test]
fn test_deployment_addresses_are_checksummed() {
for chain in Chain::all() {
for chain in Chain::all_with_disabled() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we remove all_with_disabled? just exclude sei in all()

@gemcoder21 gemcoder21 assigned gemcoder21 and unassigned 0xh3rman Aug 15, 2026
Remove the empty-wallet deletion flow and simplify chain handling. Deleted/streamlined DeleteWallet API (no boolean return, no deleteEmptyWallets), removed avatar file deletion and moved LocalStore into the wallet-details feature, and updated DI to match. WalletsRepository/DAO no longer expose getEmptyWallets; tests adapted. iOS OnstartService/WalletService no longer call deleteEmptyWallets. Core chain logic: mark Sei as deprecated, remove is_disabled/all_with_disabled, and make Chain::all exclude Sei; callers updated to use Chain::all. Small related test updates and cleanup across Kotlin/Swift/Rust modules.
Remove legacy 'sei' references and preserve SeiEVM (seievm) across platforms. Key changes: refactor DB migration to remove 'sei' (Migration_85_86), add Android instrumentation test for migration, update iOS migration/tests and rename seievm assets to sei.svg, map Chain.SeiEvm icon to sei.svg, switch many call sites to Chain.available() and safer Chain lookups (entries.firstOrNull), update various repository and test logic, and add small core/rust test ensuring legacy Sei is excluded. Misc. formatting and minor API cleanups.
Rename the 'sei' chain assets and references to 'seievm', update icon mappings, and centralize chain removal logic.

Key changes:
- Added SupportSQLiteDatabase.removeChain helper to delete all DB refs for a chain using GLOB JSON-safe patterns.
- Migration_85_86 now calls db.removeChain("sei").
- Updated Android IconUrlGeneration and tests to use seievm asset name.
- Renamed Android/iOS chain icon assets and updated Images/ChainImage mapping.
- Adjusted migration tests to assert new wallets_connections/in_app_notifications ids.

This ensures consistent handling of the Sei EVM chain and safer JSON matching during removals.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants