Skip to content

Commit cd8f172

Browse files
1nonlypiececlaude
andcommitted
Fix master CI after contract and frontend merges
- Regenerate packages/escrow-client bindings for the new escrow ABI (two-step admin/ownership, attestor allowlist, BelowMinimum). - Move the SDK-free pause policy into soroban/protocol-policy.ts and lazy-load getProtocolStatus so stellar-sdk leaves the first-load bundle of every route. - Rebaseline the /dashboard bundle budget for the features merged since the last baseline (dispute UI, exact amounts, pause/yield status). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent aedf61f commit cd8f172

8 files changed

Lines changed: 326 additions & 121 deletions

File tree

‎packages/escrow-client/src/index.ts‎

Lines changed: 204 additions & 10 deletions
Large diffs are not rendered by default.

‎performance-budgets.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"maxBytes": 110418
1111
},
1212
"/dashboard": {
13-
"baselineBytes": 99811,
14-
"maxBytes": 109793
13+
"baselineBytes": 112784,
14+
"maxBytes": 115000
1515
}
1616
}
1717
}

‎src/app/create/page.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
} from '@/lib/commitments';
2323
import { useWallet } from '@/components/WalletProvider';
2424
import { useProtocolStatus } from '@/components/ProtocolStatusProvider';
25-
import { getActionPauseReason } from '@/lib/soroban/protocol-status';
25+
import { getActionPauseReason } from '@/lib/soroban/protocol-policy';
2626
import { ESCROW_CONTRACT_ID, explorerContractUrl, config } from '@/lib/config';
2727
import { useProtocolParams } from '@/lib/protocol';
2828
import {

‎src/app/dashboard/page.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { ConfirmDialog } from '@/components/ConfirmDialog';
2222
import { DisputeDialog } from '@/components/DisputeDialog';
2323
import { useWallet } from '@/components/WalletProvider';
2424
import { useProtocolStatus } from '@/components/ProtocolStatusProvider';
25-
import { getActionPauseReason } from '@/lib/soroban/protocol-status';
25+
import { getActionPauseReason } from '@/lib/soroban/protocol-policy';
2626
import { YieldCoverageChip } from '@/components/YieldCoverageChip';
2727
import { fetchXlmBalance, shortAddress } from '@/lib/wallet';
2828
import type { DecodedEscrowEvent } from '@/lib/soroban/events';

‎src/components/ProtocolStatusProvider.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client';
22

33
import React, { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';
4-
import { getProtocolStatus, type ProtocolStatus } from '@/lib/soroban/protocol-status';
4+
import type { ProtocolStatus } from '@/lib/soroban/protocol-policy';
55

66
export type ProtocolStatusState = 'loading' | 'ok' | 'unavailable';
77

@@ -38,7 +38,9 @@ export function ProtocolStatusProvider({ children }: { children: React.ReactNode
3838

3939
const task = (async () => {
4040
try {
41-
const res = await getProtocolStatus();
41+
// Loaded on demand so stellar-sdk stays out of the first-load bundle.
42+
const { getProtocolStatus } = await import('@/lib/soroban/protocol-status');
43+
const res: ProtocolStatus = await getProtocolStatus();
4244
setState({
4345
status: res.status,
4446
paused: res.paused,

‎src/components/YieldCoverageChip.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { COVERAGE_WARNING_MESSAGE, isPayoutUncovered } from '@/lib/soroban/protocol-status';
2+
import { COVERAGE_WARNING_MESSAGE, isPayoutUncovered } from '@/lib/soroban/protocol-policy';
33

44
export interface YieldCoverageChipProps {
55
accruedYield: bigint | number;

‎src/lib/soroban/protocol-policy.ts‎

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/**
2+
* Escrow pause policy and protocol-status types. Kept free of
3+
* `@stellar/stellar-sdk` so pages can import it without pulling the SDK into
4+
* their first-load bundle; the RPC reads live in `./protocol-status`.
5+
*/
6+
7+
export interface ProtocolStatus {
8+
status: 'ok' | 'unavailable';
9+
paused: boolean;
10+
yieldPool: bigint;
11+
fetchedAt: number;
12+
error?: string;
13+
}
14+
15+
export type EscrowAction =
16+
| 'create_commitment'
17+
| 'create_commitment_default'
18+
| 'fund_escrow'
19+
| 'refund'
20+
| 'refund_partial'
21+
| 'early_exit'
22+
| 'release'
23+
| 'settle';
24+
25+
export interface ActionPolicy {
26+
action: EscrowAction;
27+
pausedBlocked: boolean;
28+
pausedReason?: string;
29+
contractDoc: string;
30+
}
31+
32+
/**
33+
* Escrow pause policy table documenting contract entrypoint behavior.
34+
* Mirrors contracts/escrow/src/lib.rs:
35+
* - create_commitment: L433 (checks is_paused_internal -> Error::Paused)
36+
* - create_commitment_default: L501 (checks is_paused_internal -> Error::Paused)
37+
* - fund_escrow: L571 (checks is_paused_internal -> Error::Paused)
38+
* - refund: L712 (checks is_paused_internal -> Error::Paused)
39+
* - refund_partial: L723 (checks is_paused_internal -> Error::Paused)
40+
* - early_exit: applies refund under the hood (checks is_paused_internal -> Error::Paused)
41+
* - release: does NOT check pause on-chain (remains active for mature payouts)
42+
* - settle: does NOT check pause on-chain (remains active for mature payouts)
43+
*/
44+
export const ACTION_POLICIES: Record<EscrowAction, ActionPolicy> = {
45+
create_commitment: {
46+
action: 'create_commitment',
47+
pausedBlocked: true,
48+
pausedReason: 'Commitment creation is temporarily paused by the contract operator.',
49+
contractDoc: 'contracts/escrow/src/lib.rs: create_commitment checks is_paused_internal',
50+
},
51+
create_commitment_default: {
52+
action: 'create_commitment_default',
53+
pausedBlocked: true,
54+
pausedReason: 'Commitment creation is temporarily paused by the contract operator.',
55+
contractDoc: 'contracts/escrow/src/lib.rs: create_commitment_default checks is_paused_internal',
56+
},
57+
fund_escrow: {
58+
action: 'fund_escrow',
59+
pausedBlocked: true,
60+
pausedReason: 'Escrow funding is temporarily paused by the contract operator.',
61+
contractDoc: 'contracts/escrow/src/lib.rs: fund_escrow checks is_paused_internal',
62+
},
63+
refund: {
64+
action: 'refund',
65+
pausedBlocked: true,
66+
pausedReason: 'Refunds are temporarily paused by the contract operator.',
67+
contractDoc: 'contracts/escrow/src/lib.rs: refund checks is_paused_internal',
68+
},
69+
refund_partial: {
70+
action: 'refund_partial',
71+
pausedBlocked: true,
72+
pausedReason: 'Partial refunds are temporarily paused by the contract operator.',
73+
contractDoc: 'contracts/escrow/src/lib.rs: refund_partial checks is_paused_internal',
74+
},
75+
early_exit: {
76+
action: 'early_exit',
77+
pausedBlocked: true,
78+
pausedReason: 'Early exits are temporarily disabled while the contract is paused.',
79+
contractDoc: 'contracts/escrow/src/lib.rs: early_exit / refund checks is_paused_internal',
80+
},
81+
release: {
82+
action: 'release',
83+
pausedBlocked: false,
84+
contractDoc: 'contracts/escrow/src/lib.rs: release does not check pause',
85+
},
86+
settle: {
87+
action: 'settle',
88+
pausedBlocked: false,
89+
contractDoc: 'contracts/escrow/src/lib.rs: settle_commitment / release does not check pause',
90+
},
91+
};
92+
93+
export function isActionBlocked(action: EscrowAction, paused: boolean): boolean {
94+
if (!paused) return false;
95+
return Boolean(ACTION_POLICIES[action]?.pausedBlocked);
96+
}
97+
98+
export function getActionPauseReason(action: EscrowAction, paused: boolean): string | undefined {
99+
if (!paused) return undefined;
100+
return ACTION_POLICIES[action]?.pausedBlocked ? ACTION_POLICIES[action]?.pausedReason : undefined;
101+
}
102+
103+
export const COVERAGE_WARNING_MESSAGE =
104+
'Yield pool currently cannot cover this payout; settlement will fail until it is topped up.';
105+
106+
export function isPayoutUncovered(
107+
accruedYield: bigint | number,
108+
yieldPool: bigint | number,
109+
): boolean {
110+
return BigInt(accruedYield) > BigInt(yieldPool);
111+
}

‎src/lib/soroban/protocol-status.ts‎

Lines changed: 2 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -2,111 +2,9 @@ import { rpc, scValToBigInt, scValToNative, xdr } from '@stellar/stellar-sdk';
22
import { config } from '../config';
33
import { simulateRead } from './tx';
44

5-
export interface ProtocolStatus {
6-
status: 'ok' | 'unavailable';
7-
paused: boolean;
8-
yieldPool: bigint;
9-
fetchedAt: number;
10-
error?: string;
11-
}
12-
13-
export type EscrowAction =
14-
| 'create_commitment'
15-
| 'create_commitment_default'
16-
| 'fund_escrow'
17-
| 'refund'
18-
| 'refund_partial'
19-
| 'early_exit'
20-
| 'release'
21-
| 'settle';
22-
23-
export interface ActionPolicy {
24-
action: EscrowAction;
25-
pausedBlocked: boolean;
26-
pausedReason?: string;
27-
contractDoc: string;
28-
}
29-
30-
/**
31-
* Escrow pause policy table documenting contract entrypoint behavior.
32-
* Mirrors contracts/escrow/src/lib.rs:
33-
* - create_commitment: L433 (checks is_paused_internal -> Error::Paused)
34-
* - create_commitment_default: L501 (checks is_paused_internal -> Error::Paused)
35-
* - fund_escrow: L571 (checks is_paused_internal -> Error::Paused)
36-
* - refund: L712 (checks is_paused_internal -> Error::Paused)
37-
* - refund_partial: L723 (checks is_paused_internal -> Error::Paused)
38-
* - early_exit: applies refund under the hood (checks is_paused_internal -> Error::Paused)
39-
* - release: does NOT check pause on-chain (remains active for mature payouts)
40-
* - settle: does NOT check pause on-chain (remains active for mature payouts)
41-
*/
42-
export const ACTION_POLICIES: Record<EscrowAction, ActionPolicy> = {
43-
create_commitment: {
44-
action: 'create_commitment',
45-
pausedBlocked: true,
46-
pausedReason: 'Commitment creation is temporarily paused by the contract operator.',
47-
contractDoc: 'contracts/escrow/src/lib.rs: create_commitment checks is_paused_internal',
48-
},
49-
create_commitment_default: {
50-
action: 'create_commitment_default',
51-
pausedBlocked: true,
52-
pausedReason: 'Commitment creation is temporarily paused by the contract operator.',
53-
contractDoc: 'contracts/escrow/src/lib.rs: create_commitment_default checks is_paused_internal',
54-
},
55-
fund_escrow: {
56-
action: 'fund_escrow',
57-
pausedBlocked: true,
58-
pausedReason: 'Escrow funding is temporarily paused by the contract operator.',
59-
contractDoc: 'contracts/escrow/src/lib.rs: fund_escrow checks is_paused_internal',
60-
},
61-
refund: {
62-
action: 'refund',
63-
pausedBlocked: true,
64-
pausedReason: 'Refunds are temporarily paused by the contract operator.',
65-
contractDoc: 'contracts/escrow/src/lib.rs: refund checks is_paused_internal',
66-
},
67-
refund_partial: {
68-
action: 'refund_partial',
69-
pausedBlocked: true,
70-
pausedReason: 'Partial refunds are temporarily paused by the contract operator.',
71-
contractDoc: 'contracts/escrow/src/lib.rs: refund_partial checks is_paused_internal',
72-
},
73-
early_exit: {
74-
action: 'early_exit',
75-
pausedBlocked: true,
76-
pausedReason: 'Early exits are temporarily disabled while the contract is paused.',
77-
contractDoc: 'contracts/escrow/src/lib.rs: early_exit / refund checks is_paused_internal',
78-
},
79-
release: {
80-
action: 'release',
81-
pausedBlocked: false,
82-
contractDoc: 'contracts/escrow/src/lib.rs: release does not check pause',
83-
},
84-
settle: {
85-
action: 'settle',
86-
pausedBlocked: false,
87-
contractDoc: 'contracts/escrow/src/lib.rs: settle_commitment / release does not check pause',
88-
},
89-
};
5+
import type { ProtocolStatus } from './protocol-policy';
906

91-
export function isActionBlocked(action: EscrowAction, paused: boolean): boolean {
92-
if (!paused) return false;
93-
return Boolean(ACTION_POLICIES[action]?.pausedBlocked);
94-
}
95-
96-
export function getActionPauseReason(action: EscrowAction, paused: boolean): string | undefined {
97-
if (!paused) return undefined;
98-
return ACTION_POLICIES[action]?.pausedBlocked ? ACTION_POLICIES[action]?.pausedReason : undefined;
99-
}
100-
101-
export const COVERAGE_WARNING_MESSAGE =
102-
'Yield pool currently cannot cover this payout; settlement will fail until it is topped up.';
103-
104-
export function isPayoutUncovered(
105-
accruedYield: bigint | number,
106-
yieldPool: bigint | number,
107-
): boolean {
108-
return BigInt(accruedYield) > BigInt(yieldPool);
109-
}
7+
export * from './protocol-policy';
1108

1119
export function decodeBool(val: unknown): boolean {
11210
if (typeof val === 'boolean') return val;

0 commit comments

Comments
 (0)