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

Max transcript size #106

Merged
merged 2 commits into from
Oct 8, 2024
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
10 changes: 0 additions & 10 deletions src/entries/Background/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export type RequestHistory = {
method: string;
headers: { [key: string]: string };
body?: string;
maxTranscriptSize: number;
maxSentData: number;
maxRecvData: number;
notaryUrl: string;
Expand Down Expand Up @@ -328,7 +327,6 @@ async function handleProveRequestStart(
method,
headers,
body,
maxTranscriptSize,
maxSentData,
maxRecvData,
notaryUrl,
Expand All @@ -344,7 +342,6 @@ async function handleProveRequestStart(
body,
maxSentData,
maxRecvData,
maxTranscriptSize,
notaryUrl,
websocketProxyUrl,
secretHeaders,
Expand All @@ -369,7 +366,6 @@ async function handleProveRequestStart(
method,
headers,
body,
maxTranscriptSize,
maxSentData,
maxRecvData,
notaryUrl,
Expand Down Expand Up @@ -399,14 +395,12 @@ async function runPluginProver(request: BackgroundAction, now = Date.now()) {
const websocketProxyUrl = _websocketProxyUrl || (await getProxyApi());
const maxSentData = _maxSentData || (await getMaxSent());
const maxRecvData = _maxRecvData || (await getMaxRecv());
const maxTranscriptSize = 16384;

const { id } = await addNotaryRequest(now, {
url,
method,
headers,
body,
maxTranscriptSize,
notaryUrl,
websocketProxyUrl,
maxRecvData,
Expand All @@ -433,7 +427,6 @@ async function runPluginProver(request: BackgroundAction, now = Date.now()) {
method,
headers,
body,
maxTranscriptSize,
notaryUrl,
websocketProxyUrl,
maxRecvData,
Expand Down Expand Up @@ -808,7 +801,6 @@ async function handleNotarizeRequest(request: BackgroundAction) {
body,
maxSentData = await getMaxSent(),
maxRecvData = await getMaxRecv(),
maxTranscriptSize,
notaryUrl = await getNotaryApi(),
websocketProxyUrl = await getProxyApi(),
origin,
Expand All @@ -823,7 +815,6 @@ async function handleNotarizeRequest(request: BackgroundAction) {
body,
maxSentData,
maxRecvData,
maxTranscriptSize,
notaryUrl,
websocketProxyUrl,
metadata,
Expand Down Expand Up @@ -866,7 +857,6 @@ async function handleNotarizeRequest(request: BackgroundAction) {
method,
headers,
body,
maxTranscriptSize,
maxSentData,
maxRecvData,
notaryUrl,
Expand Down
2 changes: 0 additions & 2 deletions src/entries/Content/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class TLSN {
websocketProxyUrl?: string;
maxSentData?: number;
maxRecvData?: number;
maxTranscriptSize?: number;
metadata?: {
[k: string]: string;
};
Expand All @@ -60,7 +59,6 @@ class TLSN {
body: requestOptions?.body,
maxSentData: proofOptions?.maxSentData,
maxRecvData: proofOptions?.maxRecvData,
maxTranscriptSize: proofOptions?.maxTranscriptSize,
notaryUrl: proofOptions?.notaryUrl,
websocketProxyUrl: proofOptions?.websocketProxyUrl,
metadata: proofOptions?.metadata,
Expand Down
3 changes: 0 additions & 3 deletions src/entries/Content/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ import { urlify } from '../../utils/misc';
websocketProxyUrl?: string;
maxSentData?: number;
maxRecvData?: number;
maxTranscriptSize?: number;
}>,
) => {
const {
Expand All @@ -94,7 +93,6 @@ import { urlify } from '../../utils/misc';
body,
maxSentData,
maxRecvData,
maxTranscriptSize,
notaryUrl,
websocketProxyUrl,
metadata,
Expand All @@ -112,7 +110,6 @@ import { urlify } from '../../utils/misc';
body,
maxSentData,
maxRecvData,
maxTranscriptSize,
notaryUrl,
websocketProxyUrl,
metadata,
Expand Down
3 changes: 0 additions & 3 deletions src/pages/Notarize/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import {
} from '../../utils/storage';
import { useDispatch } from 'react-redux';

const maxTranscriptSize = 16384;

export default function Notarize(): ReactElement {
const params = useParams<{ requestId: string }>();
const req = useRequest(params.requestId);
Expand Down Expand Up @@ -58,7 +56,6 @@ export default function Notarize(): ReactElement {
body: req.requestBody,
maxSentData,
maxRecvData,
maxTranscriptSize,
notaryUrl,
websocketProxyUrl,
secretHeaders,
Expand Down
1 change: 0 additions & 1 deletion src/pages/RequestBuilder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ export default function RequestBuilder(props?: {
maxRecvData,
secretHeaders: [],
secretResps: [],
maxTranscriptSize: 0,
notaryUrl,
websocketProxyUrl,
},
Expand Down
1 change: 0 additions & 1 deletion src/reducers/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export const notarizeRequest = (options: RequestHistory) => async () => {
method: options.method,
headers: options.headers,
body: options.body,
maxTranscriptSize: options.maxTranscriptSize,
maxSentData,
maxRecvData,
secretHeaders: options.secretHeaders,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const EXPLORER_API = 'https://explorer.tlsnotary.org';
export const NOTARY_API = 'https://notary.pse.dev/v0.1.0-alpha.5';
export const NOTARY_API = 'https://notary.pse.dev/v0.1.0-alpha.7';
export const NOTARY_PROXY = 'wss://notary.pse.dev/proxy';
export const MAX_RECV = 16384;
export const MAX_SENT = 4096;
9 changes: 5 additions & 4 deletions src/utils/storage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LoggingLevel } from 'tlsn-js';
import { MAX_RECV, MAX_SENT, NOTARY_API, NOTARY_PROXY } from './constants';

export const NOTARY_API_LS_KEY = 'notary-api';
export const PROXY_API_LS_KEY = 'proxy-api';
Expand All @@ -18,19 +19,19 @@ export async function get(key: string, defaultValue?: string) {
}

export async function getMaxSent() {
return parseInt(await get(MAX_SENT_LS_KEY, '4096'));
return parseInt(await get(MAX_SENT_LS_KEY, MAX_SENT.toString()));
}

export async function getMaxRecv() {
return parseInt(await get(MAX_RECEIVED_LS_KEY, '16384'));
return parseInt(await get(MAX_RECEIVED_LS_KEY, MAX_RECV.toString()));
}

export async function getNotaryApi() {
return await get(NOTARY_API_LS_KEY, 'https://notary.pse.dev/v0.1.0-alpha.7');
return await get(NOTARY_API_LS_KEY, NOTARY_API);
}

export async function getProxyApi() {
return await get(PROXY_API_LS_KEY, 'wss://notary.pse.dev/proxy');
return await get(PROXY_API_LS_KEY, NOTARY_PROXY);
}

export async function getLoggingFilter(): Promise<LoggingLevel> {
Expand Down
Loading