Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions configs/app/features/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const title = 'Rollup (L2) chain';
const config: Feature<{
type: RollupType;
stageIndex: string | undefined;
layerNumber: number;
homepage: { showLatestBlocks: boolean };
outputRootsEnabled: boolean;
interopEnabled: boolean;
Expand All @@ -50,6 +51,7 @@ const config: Feature<{
isEnabled: true,
type,
stageIndex: getEnvValue('NEXT_PUBLIC_ROLLUP_STAGE_INDEX'),
layerNumber: Number(getEnvValue('NEXT_PUBLIC_ROLLUP_LAYER_NUMBER') || 2),
L2WithdrawalUrl: type === 'optimistic' ? L2WithdrawalUrl : undefined,
outputRootsEnabled: type === 'optimistic' && getEnvValue('NEXT_PUBLIC_ROLLUP_OUTPUT_ROOTS_ENABLED') === 'true',
interopEnabled: type === 'optimistic' && getEnvValue('NEXT_PUBLIC_INTEROP_ENABLED') === 'true',
Expand Down
13 changes: 13 additions & 0 deletions deploy/tools/envs-validator/schemas/features/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,17 @@ export const rollupSchema = yup
value => value === undefined,
),
}),
NEXT_PUBLIC_ROLLUP_LAYER_NUMBER: yup.number()
.positive()
.integer()
.min(2)
.when('NEXT_PUBLIC_ROLLUP_TYPE', {
is: (value: string) => Boolean(value),
then: (schema) => schema,
otherwise: (schema) => schema.test(
'not-exist',
'NEXT_PUBLIC_ROLLUP_LAYER_NUMBER can only be used with NEXT_PUBLIC_ROLLUP_TYPE',
value => value === undefined,
),
}),
});
3 changes: 2 additions & 1 deletion deploy/tools/envs-validator/test/.env.optimism
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ NEXT_PUBLIC_ROLLUP_HOMEPAGE_SHOW_LATEST_BLOCKS=true
NEXT_PUBLIC_ROLLUP_OUTPUT_ROOTS_ENABLED=false
NEXT_PUBLIC_ROLLUP_PARENT_CHAIN={'baseUrl':'https://explorer.duckchain.io'}
NEXT_PUBLIC_INTEROP_ENABLED=true
NEXT_PUBLIC_ROLLUP_STAGE_INDEX=1
NEXT_PUBLIC_ROLLUP_STAGE_INDEX=1
NEXT_PUBLIC_ROLLUP_LAYER_NUMBER=5
21 changes: 12 additions & 9 deletions deploy/tools/llms-txt-generator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { writeFileSync } from 'node:fs';
import { dirname, resolve as resolvePath } from 'node:path';
import { fileURLToPath } from 'node:url';
import dedent from 'dedent';
import { layerLabels } from 'lib/rollups/utils';

const currentFilePath = fileURLToPath(import.meta.url);
const currentDir = dirname(currentFilePath);
Expand All @@ -25,6 +26,8 @@ function run() {

const rollupFeature = config.features.rollup;
const parentChainUrl = rollupFeature.isEnabled ? rollupFeature.parentChain.baseUrl : undefined;
const currentToParentLayerLabel = layerLabels.current + '→' + layerLabels.parent;
const parentToCurrentLayerLabel = layerLabels.parent + '→' + layerLabels.current;

const validatorsFeature = config.features.validators;

Expand Down Expand Up @@ -111,19 +114,19 @@ function run() {
curl --request GET --url '${ generalApiUrl }/api/v2/blocks/arbitrum-batch/{batch_number}'
\`\`\`

### Get L1→L2 messages
### Get ${ parentToCurrentLayerLabel } messages

\`\`\`bash
curl --request GET --url '${ generalApiUrl }/api/v2/arbitrum/messages/to-rollup'
\`\`\`

### Get L2→L1 messages
### Get ${ currentToParentLayerLabel } messages

\`\`\`bash
curl --request GET --url '${ generalApiUrl }/api/v2/arbitrum/messages/from-rollup'
\`\`\`

### L2→L1 messages by transaction:
### ${ currentToParentLayerLabel } messages by transaction:

\`\`\`bash
curl --request GET --url '${ generalApiUrl }/api/v2/arbitrum/messages/withdrawals/{transactions_hash}'
Expand Down Expand Up @@ -155,13 +158,13 @@ function run() {
curl --request GET --url '${ generalApiUrl }/api/v2/optimism/games'
\`\`\`

### Get L1→L2 messages
### Get ${ parentToCurrentLayerLabel } messages

\`\`\`bash
curl --request GET --url '${ generalApiUrl }/api/v2/optimism/deposits'
\`\`\`

### Get L2→L1 messages
### Get ${ currentToParentLayerLabel } messages

\`\`\`bash
curl --request GET --url '${ generalApiUrl }/api/v2/optimism/withdrawals'
Expand Down Expand Up @@ -299,27 +302,27 @@ function run() {
curl --request GET --url '${ generalApiUrl }/api/v2/blocks/scroll-batch/{batch_number}'
\`\`\`

### Deposits (L1→L2)
### Deposits (${ parentToCurrentLayerLabel })

\`\`\`bash
curl --request GET --url '${ generalApiUrl }/api/v2/scroll/deposits'
\`\`\`

### Withdrawals (L2→L1)
### Withdrawals (${ currentToParentLayerLabel })

\`\`\`bash
curl --request GET --url '${ generalApiUrl }/api/v2/scroll/withdrawals'
\`\`\`
` : undefined;

const SHIBARIUM_CHAIN_TEMPLATE = rollupFeature.isEnabled && rollupFeature.type === 'shibarium' ? `
### Deposits (L1→L2)
### Deposits (${ parentToCurrentLayerLabel })

\`\`\`bash
curl --request GET --url '${ generalApiUrl }/api/v2/shibarium/deposits'
\`\`\`

### Withdrawals (L2→L1)
### Withdrawals (${ currentToParentLayerLabel })

\`\`\`bash
curl --request GET --url '${ generalApiUrl }/api/v2/shibarium/withdrawals'
Expand Down
7 changes: 4 additions & 3 deletions docs/ENVS.md
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,9 @@ Ads are enabled by default on all self-hosted instances. If you would like to di
| Variable | Type| Description | Compulsoriness | Default value | Example value | Version |
| --- | --- | --- | --- | --- | --- | --- |
| NEXT_PUBLIC_ROLLUP_TYPE | `'optimistic' \| 'arbitrum' \| 'shibarium' \| 'zkEvm' \| 'zkSync' \| 'scroll'` | Rollup chain type | Required | - | `'optimistic'` | v1.24.0+ |
| NEXT_PUBLIC_ROLLUP_L1_BASE_URL | `string` | Blockscout base URL for L1 network. **DEPRECATED** _Use `NEXT_PUBLIC_ROLLUP_PARENT_CHAIN` instead_ | Required | - | `'http://eth-goerli.blockscout.com'` | v1.24.0+ |
| NEXT_PUBLIC_ROLLUP_L2_WITHDRAWAL_URL | `string` | URL for L2 -> L1 withdrawals (Optimistic stack only) | - | - | `https://app.optimism.io/bridge/withdraw` | v1.24.0+ |
| NEXT_PUBLIC_ROLLUP_L1_BASE_URL | `string` | Blockscout base URL for parent network. **DEPRECATED** _Use `NEXT_PUBLIC_ROLLUP_PARENT_CHAIN` instead_ | Required | - | `'http://eth-goerli.blockscout.com'` | v1.24.0+ |
| NEXT_PUBLIC_ROLLUP_L2_WITHDRAWAL_URL | `string` | URL for rollup to parent chain withdrawals (Optimistic stack only) | - | - | `https://app.optimism.io/bridge/withdraw` | v1.24.0+ |
| NEXT_PUBLIC_ROLLUP_LAYER_NUMBER | `number` | Layer number of the rollup | - | `2` | `3` | upcoming |
| NEXT_PUBLIC_ROLLUP_STAGE_INDEX | `1 \| 2` | Reflects the maturity and decentralization level of the chain based on [L2BEAT's framework](https://medium.com/l2beat/introducing-stages-a-framework-to-evaluate-rollups-maturity-d290bb22befe). The label will be added to the sidebar according to the provided stage index. Not applicable for testnets. | - | - | `1` | v2.1.0+ |
| NEXT_PUBLIC_FAULT_PROOF_ENABLED | `boolean` | Set to `true` for chains with fault proof system enabled (Optimistic stack only) | - | - | `true` | v1.31.0+ |
| NEXT_PUBLIC_HAS_MUD_FRAMEWORK | `boolean` | Set to `true` for instances that use MUD framework (Optimistic stack only) | - | - | `true` | v1.33.0+ |
Expand All @@ -546,7 +547,7 @@ Ads are enabled by default on all self-hosted instances. If you would like to di
| Variable | Type| Description | Compulsoriness | Default value | Example value |
| --- | --- | --- | --- | --- | --- |
| id | `number` | Chain id, see [https://chainlist.org](https://chainlist.org) for the reference. | - | - | `42` |
| name | `string` | Displayed name of the chain. Set to customize L1 transaction status labels in the UI (e.g., "Sent to <chain-name>"). Currently, this setting is applicable only for Arbitrum-based chains. | - | - | `DuckChain` |
| name | `string` | Displayed name of the chain. Set to customize parent chain transaction status labels in the UI (e.g., "Sent to <chain-name>"). Currently, this setting is applicable only for Arbitrum-based chains. | - | - | `DuckChain` |
| baseUrl | `string` | Base url of the chain explorer. | Required | - | `https://explorer.duckchain.io` |
| rpcUrls | `Array<string>` | Chain public RPC server urls, see [https://chainlist.org](https://chainlist.org) for the reference. | - | - | `['https://rpc.duckchain.io']` |
| currency | `{ name: string; symbol: string; decimals: number; }` | Chain currency config. | - | - | `{ name: Quack, symbol: QUA, decimals: 18 }` |
Expand Down
2 changes: 1 addition & 1 deletion icons/navigation/ecosystems.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions lib/hooks/useNavItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React from 'react';
import type { NavItemInternal, NavItem, NavGroupItem } from 'types/client/navigation';

import config from 'configs/app';
import { layerLabels } from 'lib/rollups/utils';
import { rightLineArrow } from 'toolkit/utils/htmlEntities';

const marketplaceFeature = config.features.marketplace;
Expand Down Expand Up @@ -98,13 +99,13 @@ export default function useNavItems(): ReturnType {
isActive: pathname === '/validators' || pathname === '/validators/[id]',
} : null;
const rollupDeposits = {
text: `Deposits (L1${ rightLineArrow }L2)`,
text: `Deposits (${ layerLabels.parent }${ rightLineArrow }${ layerLabels.current })`,
nextRoute: { pathname: '/deposits' as const },
icon: 'navigation/deposits',
isActive: pathname === '/deposits',
};
const rollupWithdrawals = {
text: `Withdrawals (L2${ rightLineArrow }L1)`,
text: `Withdrawals (${ layerLabels.current }${ rightLineArrow }${ layerLabels.parent })`,
nextRoute: { pathname: '/withdrawals' as const },
icon: 'navigation/withdrawals',
isActive: pathname === '/withdrawals',
Expand Down
7 changes: 4 additions & 3 deletions lib/metadata/templates/title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getFeaturePayload } from 'configs/app/features/types';
import type { Route } from 'nextjs-routes';

import config from 'configs/app';
import { layerLabels } from 'lib/rollups/utils';

const dappEntityName = (getFeaturePayload(config.features.marketplace)?.titles.entity_name ?? '').toLowerCase();

Expand Down Expand Up @@ -43,15 +44,15 @@ const TEMPLATE_MAP: Record<Route['pathname'], string> = {
'/account/verified-addresses': '%network_name% - my verified addresses',
'/public-tags/submit': '%network_name% - public tag requests',
'/withdrawals': '%network_name% withdrawals - track on %network_name% explorer',
'/txn-withdrawals': '%network_name% L2 to L1 message relayer',
'/txn-withdrawals': `${ layerLabels.current } to ${ layerLabels.parent } message relayer`,
'/visualize/sol2uml': '%network_name% Solidity UML diagram',
'/csv-export': '%network_name% export data to CSV',
'/deposits': '%network_name% deposits - track on %network_name% explorer',
'/output-roots': '%network_name% output roots',
'/dispute-games': '%network_name% dispute games',
'/batches': '%network_name% txn batches',
'/batches/[number]': '%network_name% L2 txn batch %number%',
'/batches/celestia/[height]/[commitment]': '%network_name% L2 txn batch %height% %commitment%',
'/batches/[number]': `%network_name% ${ layerLabels.current } txn batch %number%`,
'/batches/celestia/[height]/[commitment]': `%network_name% ${ layerLabels.current } txn batch %height% %commitment%`,
'/blobs/[hash]': '%network_name% blob %hash% details',
'/ops': 'User operations on %network_name% - %network_name% explorer',
'/op/[hash]': '%network_name% user operation %hash%',
Expand Down
37 changes: 37 additions & 0 deletions lib/rollups/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { ZKEVM_L2_TX_STATUSES } from 'types/api/transaction';
import type { ZKEVM_L2_TX_BATCH_STATUSES } from 'types/api/zkEvmL2';
import type { ZKSYNC_L2_TX_BATCH_STATUSES } from 'types/api/zkSyncL2';

import config from 'configs/app';

const feature = config.features.rollup;

export const layerLabels = feature.isEnabled ? {
current: `L${ feature.layerNumber }`,
parent: `L${ feature.layerNumber - 1 }`,
} : {
current: 'L2',
parent: 'L1',
};

export const formatZkEvmTxStatus = (status: typeof ZKEVM_L2_TX_STATUSES[number]) => {
switch (status) {
case 'L1 Confirmed':
return `${ layerLabels.parent } Confirmed`;
default:
return status;
}
};

export const formatZkEvmL2TxnBatchStatus = (status: typeof ZKEVM_L2_TX_BATCH_STATUSES[number]) => {
switch (status) {
case 'L1 Sequence Confirmed':
return `${ layerLabels.parent } Sequence Confirmed`;
default:
return status;
}
};

export const formatZkSyncL2TxnBatchStatus = (status: typeof ZKSYNC_L2_TX_BATCH_STATUSES[number]) => {
return status.replace('L2', layerLabels.current).replace('L1', layerLabels.parent);
};
Loading
Loading