Skip to content

chore: revert temporary base hacks#10876

Merged
0xApotheosis merged 1 commit intodevelopfrom
remove-base-hacks
Oct 23, 2025
Merged

chore: revert temporary base hacks#10876
0xApotheosis merged 1 commit intodevelopfrom
remove-base-hacks

Conversation

@kaladinlight
Copy link
Contributor

@kaladinlight kaladinlight commented Oct 21, 2025

Description

Does what the title says. Remove the temporary logic added to handle base chain in a degraded state now that we have cut over to Moralis. Also increase page size for base so we can leverage Moralis to it's fullest and improve tx history load times.

Issue (if applicable)

N/A

Risk

High Risk PRs Require 2 approvals

Medium - new service providing data, but can't be any worse than not having support or out of date/degraded support right?

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

Testing

  • Spot check base functionality (portfolio data, tx history, send/receive, websocket updates)

Engineering

☝️

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

☝️

Screenshots (if applicable)

Summary by CodeRabbit

  • Refactor
    • Removed temporary base portfolio management workarounds.
    • Simplified internal transaction handling across multiple transaction subscribers.
    • Optimized transaction history pagination for improved performance on base chain.

@kaladinlight kaladinlight requested a review from a team as a code owner October 21, 2025 17:27
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 21, 2025

📝 Walkthrough

Walkthrough

This PR removes the useBasePortfolioManagement hook and eliminates base-chain-specific portfolio synchronization logic across multiple action subscriber hooks, while adjusting tx history pagination for the base chain.

Changes

Cohort / File(s) Summary
Hook removal
src/hooks/useActionCenterSubscribers/useFetchBasePortfolio.ts
Removed entire useBasePortfolioManagement export and all associated side-effect-driven logic for manually upserting base portfolio balances via viem client and Redux dispatch.
Action subscriber cleanup
src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx, useLimitOrderActionSubscriber.tsx, useSendActionSubscriber.tsx, useSwapActionSubscriber.tsx, useThorchainLpActionSubscriber.tsx
Removed baseChainId import from caip, eliminated useBasePortfolioManagement hook usage, and deleted base-chain-specific conditional logic that triggered portfolio fetches and upserts. Converted async callbacks to sync, removed chainId destructuring from metadata, and simplified transaction confirmation checks.
Pagination adjustment
src/state/slices/txHistorySlice/txHistorySlice.ts
Added baseChainId import and adjusted tx history pagination logic: pageSize becomes 100 when chainId equals baseChainId, otherwise 10.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Multiple files affected across distinct action subscribers with varying contexts. Changes involve removing conditional logic, async-to-sync conversions, and dependency array updates. While changes follow a consistent removal pattern, the distributed nature and logic simplifications across different hook implementations require careful contextual review.

Possibly related PRs

Suggested labels

high risk

Suggested reviewers

  • premiumjibles
  • gomesalexandre

Poem

🐰 The base chain hack bids farewell today,
No more portfolios fetched the temporary way,
Action subscribers now flow so clean,
Simpler logic, no base-chain scene,
One less hook to burden the fray! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "chore: revert temporary base hacks" is directly aligned with the primary objective of the changeset, which is to remove temporary logic and workarounds that handled the Base chain in a degraded state. The PR removes the useBasePortfolioManagement hook, eliminates base-chain-specific conditional logic across multiple subscriber hooks (including 10-second delays and fetch/upsert operations), and simplifies the overall transaction handling flow. While the PR also includes a complementary optimization that increases pagination page size for Base chain in txHistorySlice.ts, the main narrative of the changeset is indeed reverting these temporary hacks. The title is concise, clear, and specific enough that a teammate reviewing git history would immediately understand the primary change involves removing temporary base chain workarounds.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove-base-hacks

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cb59e8c and 3951673.

📒 Files selected for processing (7)
  • src/hooks/useActionCenterSubscribers/useFetchBasePortfolio.ts (0 hunks)
  • src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx (4 hunks)
  • src/hooks/useActionCenterSubscribers/useLimitOrderActionSubscriber.tsx (0 hunks)
  • src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx (3 hunks)
  • src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx (1 hunks)
  • src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx (2 hunks)
  • src/state/slices/txHistorySlice/txHistorySlice.ts (2 hunks)
💤 Files with no reviewable changes (2)
  • src/hooks/useActionCenterSubscribers/useLimitOrderActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useFetchBasePortfolio.ts
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)

**/*.{ts,tsx}: ALWAYS use Result<T, E> pattern for error handling in swappers and APIs
ALWAYS use Ok() and Err() from @sniptt/monads for monadic error handling
ALWAYS use custom error classes from @shapeshiftoss/errors
ALWAYS provide meaningful error codes for internationalization
ALWAYS include relevant details in error objects
ALWAYS wrap async operations in try-catch blocks
ALWAYS use AsyncResultOf utility for converting promises to Results
ALWAYS provide fallback error handling
ALWAYS use timeoutMonadic for API calls
ALWAYS provide appropriate timeout values for API calls
ALWAYS handle timeout errors gracefully
ALWAYS validate inputs before processing
ALWAYS provide clear validation error messages
ALWAYS use early returns for validation failures
ALWAYS log errors for debugging
ALWAYS use structured logging for errors
ALWAYS include relevant context in error logs
Throwing errors instead of using monadic patterns is an anti-pattern
Missing try-catch blocks for async operations is an anti-pattern
Generic error messages without context are an anti-pattern
Not handling specific error types is an anti-pattern
Missing timeout handling is an anti-pattern
No input validation is an anti-pattern
Poor error logging is an anti-pattern
Using any for error types is an anti-pattern
Missing error codes for internationalization is an anti-pattern
No fallback error handling is an anti-pattern
Console.error without structured logging is an anti-pattern

**/*.{ts,tsx}: ALWAYS use camelCase for variables, functions, and methods
ALWAYS use descriptive names that explain the purpose for variables and functions
ALWAYS use verb prefixes for functions that perform actions
ALWAYS use PascalCase for types, interfaces, and enums
ALWAYS use descriptive names that indicate the structure for types, interfaces, and enums
ALWAYS use suffixes like Props, State, Config, Type when appropriate for types and interfaces
ALWAYS use UPPER_SNAKE_CASE for constants and configuration values
ALWAYS use d...

Files:

  • src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx
  • src/state/slices/txHistorySlice/txHistorySlice.ts
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)

**/*.tsx: ALWAYS wrap components in error boundaries
ALWAYS provide user-friendly fallback components in error boundaries
ALWAYS log errors for debugging in error boundaries
ALWAYS use useErrorToast hook for displaying errors
ALWAYS provide translated error messages in error toasts
ALWAYS handle different error types appropriately in error toasts
Missing error boundaries in React components is an anti-pattern

**/*.tsx: ALWAYS use PascalCase for React component names
ALWAYS use descriptive names that indicate the component's purpose
ALWAYS match the component name to the file name
Flag components without PascalCase
Flag default exports for components

Files:

  • src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx
**/*

📄 CodeRabbit inference engine (.cursor/rules/naming-conventions.mdc)

**/*: ALWAYS use appropriate file extensions
Flag files without kebab-case

Files:

  • src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx
  • src/state/slices/txHistorySlice/txHistorySlice.ts
**/use*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/naming-conventions.mdc)

**/use*.{ts,tsx}: ALWAYS use use prefix for custom hooks
ALWAYS use descriptive names that indicate the hook's purpose
ALWAYS use camelCase after the use prefix for custom hooks

Files:

  • src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/react-best-practices.mdc)

**/*.{tsx,jsx}: ALWAYS use useMemo for expensive computations, object/array creations, and filtered data
ALWAYS use useMemo for derived values and computed properties
ALWAYS use useMemo for conditional values and simple transformations
ALWAYS use useCallback for event handlers and functions passed as props
ALWAYS use useCallback for any function that could be passed as a prop or dependency
ALWAYS include all dependencies in useEffect, useMemo, useCallback dependency arrays
NEVER use // eslint-disable-next-line react-hooks/exhaustive-deps unless absolutely necessary
ALWAYS explain why dependencies are excluded if using eslint disable
ALWAYS use named exports for components
NEVER use default exports for components
KEEP component files under 200 lines when possible
BREAK DOWN large components into smaller, reusable pieces
EXTRACT complex logic into custom hooks
USE local state for component-level state
LIFT state up when needed across multiple components
USE Context for avoiding prop drilling
ALWAYS wrap components in error boundaries for production
ALWAYS handle async errors properly
ALWAYS provide user-friendly error messages
ALWAYS use virtualization for lists with 100+ items
ALWAYS implement proper key props for list items
ALWAYS lazy load heavy components
ALWAYS use React.lazy for code splitting
Components receiving props are wrapped with memo

Files:

  • src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/react-best-practices.mdc)

USE Redux only for global state shared across multiple places

Files:

  • src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx
  • src/state/slices/txHistorySlice/txHistorySlice.ts
🧠 Learnings (5)
📓 Common learnings
Learnt from: kaladinlight
PR: shapeshift/web#10326
File: src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx:37-41
Timestamp: 2025-08-22T15:07:18.021Z
Learning: In src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx, kaladinlight prefers not to await the upsertBasePortfolio call in the Base chain handling block, indicating intentional fire-and-forget behavior for Base portfolio upserts in the THORChain LP completion flow.
📚 Learning: 2025-08-22T15:07:18.021Z
Learnt from: kaladinlight
PR: shapeshift/web#10326
File: src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx:37-41
Timestamp: 2025-08-22T15:07:18.021Z
Learning: In src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx, kaladinlight prefers not to await the upsertBasePortfolio call in the Base chain handling block, indicating intentional fire-and-forget behavior for Base portfolio upserts in the THORChain LP completion flow.

Applied to files:

  • src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx
📚 Learning: 2025-08-22T14:59:04.889Z
Learnt from: kaladinlight
PR: shapeshift/web#10326
File: src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx:105-111
Timestamp: 2025-08-22T14:59:04.889Z
Learning: In the ShapeShift web Base chain handling, the await pattern inside forEach in useGenericTransactionSubscriber is intentional to delay the entire action completion flow (not just fetchBasePortfolio) for Base chain transactions. The user kaladinlight wants everything below the Base portfolio refresh - including dispatch, query invalidation, and toast notifications - to also be delayed by ~10 seconds to accommodate Base's degraded node state.

Applied to files:

  • src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
  • src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
PR: shapeshift/web#0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.

Applied to files:

  • src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx
📚 Learning: 2025-08-21T22:14:39.915Z
Learnt from: kaladinlight
PR: shapeshift/web#10326
File: src/hooks/useActionCenterSubscribers/useFetchBasePortfolio.ts:18-29
Timestamp: 2025-08-21T22:14:39.915Z
Learning: In the ShapeShift web codebase, temporary Base portfolio management hacks (marked with "TEMP HACK FOR BASE" comments) may use burst patterns like calling portfolioApi.getAccount with forceRefetch in tight loops, which are acceptable given they're temporary solutions and already used elsewhere in the app.

Applied to files:

  • src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
🧬 Code graph analysis (2)
src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx (1)
src/state/slices/txHistorySlice/utils.ts (1)
  • serializeTxIndex (43-59)
src/state/slices/txHistorySlice/txHistorySlice.ts (1)
packages/caip/src/constants.ts (1)
  • baseChainId (68-68)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install and Cache
🔇 Additional comments (5)
src/state/slices/txHistorySlice/txHistorySlice.ts (1)

4-4: LGTM! Base chain page size optimization.

The conditional page size increase (10 → 100) for Base chain will reduce the number of API requests needed to fetch transaction history, leveraging Moralis's improved capabilities.

Also applies to: 204-204

src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx (1)

2-2: LGTM! Clean removal of Base chain handling.

The removal of baseChainId import and associated base portfolio management logic aligns with the PR objective to revert temporary hacks for Base chain handling.

src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx (1)

79-79: LGTM! Simplified chain-agnostic processing.

The removal of Base chain-specific handling simplifies the action completion flow. All chains now follow the same path: check tx exists and is confirmed, then complete the action.

Based on learnings

Also applies to: 85-85, 99-100

src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx (1)

2-2: LGTM! Removed Base chain delay workaround.

The conversion from async to sync processing removes the artificial delay that was previously needed to accommodate Base chain's degraded node state. All chains now process uniformly without chain-specific delays.

Based on learnings

Also applies to: 28-36, 77-77

src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx (1)

1-1: LGTM! Unified transaction processing.

The removal of Base chain-specific delays and portfolio synchronization side-effects streamlines the action completion flow. All transaction types now process uniformly based on on-chain confirmation status.

Based on learnings

Also applies to: 65-65, 81-81, 91-92


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Member

@0xApotheosis 0xApotheosis left a comment

Choose a reason for hiding this comment

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

✅ Spot check base functionality (portfolio data, tx history, send/receive, websocket updates)

All looking ok, ser!

@0xApotheosis 0xApotheosis merged commit e57492f into develop Oct 23, 2025
4 checks passed
@0xApotheosis 0xApotheosis deleted the remove-base-hacks branch October 23, 2025 03:10
@coderabbitai coderabbitai bot mentioned this pull request Nov 7, 2025
1 task
@coderabbitai coderabbitai bot mentioned this pull request Nov 27, 2025
1 task
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.

2 participants