Skip to content

Commit fc648c2

Browse files
committed
Web node file upload
File upload Fuzzing
1 parent 4ab2285 commit fc648c2

File tree

76 files changed

+1735
-235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1735
-235
lines changed

frontend/angular.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@
8787
],
8888
"outputHashing": "all"
8989
},
90+
"fuzzing": {
91+
"fileReplacements": [
92+
{
93+
"replace": "src/environments/environment.ts",
94+
"with": "src/environments/environment.fuzzing.ts"
95+
}
96+
],
97+
"outputHashing": "all"
98+
},
9099
"producer": {
91100
"fileReplacements": [
92101
{
@@ -110,6 +119,9 @@
110119
},
111120
"local": {
112121
"browserTarget": "frontend:build:local"
122+
},
123+
"fuzzing": {
124+
"browserTarget": "frontend:build:fuzzing"
113125
}
114126
},
115127
"options": {
@@ -185,6 +197,15 @@
185197
}
186198
]
187199
},
200+
"fuzzing": {
201+
"fileReplacements": [
202+
{
203+
"replace": "src/environments/environment.ts",
204+
"with": "src/environments/environment.fuzzing.ts"
205+
}
206+
],
207+
"outputHashing": "all"
208+
},
188209
"producer": {
189210
"outputHashing": "media",
190211
"fileReplacements": [

frontend/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "frontend",
3-
"version": "1.0.59",
3+
"version": "1.0.66",
44
"scripts": {
55
"install:deps": "npm install",
66
"start": "npm install && ng serve --configuration local --open",
77
"start:dev": "ng serve --configuration development",
88
"start:dev:mobile": "ng serve --configuration development --host 0.0.0.0",
9+
"start:fuzzing": "npm run install:deps && ng build --configuration fuzzing && npm run start:bundle",
910
"build": "ng build",
1011
"build:prod": "ng build --configuration production && npm run sentry:sourcemaps",
1112
"tests": "npx cypress open --config baseUrl=http://localhost:4200",
@@ -87,4 +88,4 @@
8788
"webpack": "^5.88.2",
8889
"webpack-bundle-analyzer": "^4.9.0"
8990
}
90-
}
91+
}

frontend/src/app/app.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<mina-toolbar></mina-toolbar>
2323
}
2424
<div id="mina-content"
25+
class="overflow-hidden"
2526
[class.no-toolbar]="hideToolbar"
2627
[class.no-submenus]="subMenusLength < 2"
2728
[class.mobile]="menu.isMobile">

frontend/src/app/app.component.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ mat-sidenav-content {
6060
$toolbar: 40px;
6161
height: calc(100% - #{$toolbar});
6262
border-top-left-radius: 6px;
63-
overflow: hidden;
6463
background-color: $base-surface;
6564

6665
&.no-toolbar {

frontend/src/app/app.routing.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const BLOCK_PRODUCTION_TITLE: string = APP_TITLE + ' - Block Production';
1515
export const MEMPOOL_TITLE: string = APP_TITLE + ' - Mempool';
1616
export const BENCHMARKS_TITLE: string = APP_TITLE + ' - Benchmarks';
1717
export const WEBNODE_TITLE: string = APP_TITLE + ' - Web Node';
18+
export const FUZZING_TITLE: string = APP_TITLE + ' - Fuzzing';
1819

1920

2021
function generateRoutes(): Routes {
@@ -57,17 +58,22 @@ function generateRoutes(): Routes {
5758
},
5859
{
5960
path: 'mempool',
60-
loadChildren: () => import('./features/mempool/mempool.module').then(m => m.MempoolModule),
61+
loadChildren: () => import('@mempool/mempool.module').then(m => m.MempoolModule),
6162
title: MEMPOOL_TITLE,
6263
},
6364
{
6465
path: 'benchmarks',
65-
loadChildren: () => import('./features/benchmarks/benchmarks.module').then(m => m.BenchmarksModule),
66+
loadChildren: () => import('@benchmarks/benchmarks.module').then(m => m.BenchmarksModule),
6667
title: BENCHMARKS_TITLE,
6768
},
69+
{
70+
path: 'fuzzing',
71+
loadChildren: () => import('@fuzzing/fuzzing.module').then(m => m.FuzzingModule),
72+
title: FUZZING_TITLE,
73+
},
6874
{
6975
path: 'loading-web-node',
70-
loadChildren: () => import('./features/webnode/webnode.module').then(m => m.WebnodeModule),
76+
loadChildren: () => import('@web-node/web-node.module').then(m => m.WebNodeModule),
7177
title: WEBNODE_TITLE,
7278
},
7379
];

frontend/src/app/app.setup.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ import { MempoolState } from '@app/features/mempool/mempool.state';
3535
import { mempoolReducer } from '@app/features/mempool/mempool.reducer';
3636
import { BenchmarksState } from '@benchmarks/benchmarks.state';
3737
import { benchmarksReducer } from '@benchmarks/benchmarks.reducer';
38+
import { fuzzingReducer } from '@fuzzing/fuzzing.reducer';
39+
import { FuzzingState } from '@fuzzing/fuzzing.state';
40+
import { FuzzingAction } from '@fuzzing/fuzzing.actions';
3841

3942
export interface MinaState {
4043
[APP_KEY]: AppState;
@@ -49,6 +52,7 @@ export interface MinaState {
4952
state: StateState;
5053
snarks: SnarksState;
5154
benchmarks: BenchmarksState;
55+
fuzzing: FuzzingState;
5256
}
5357

5458
type MinaAction =
@@ -59,6 +63,7 @@ type MinaAction =
5963
& ResourcesAction
6064
& StateAction
6165
& SnarksAction
66+
& FuzzingAction
6267
;
6368

6469
export const reducers: ActionReducerMap<MinaState, MinaAction> = {
@@ -74,6 +79,7 @@ export const reducers: ActionReducerMap<MinaState, MinaAction> = {
7479
state: stateReducer,
7580
snarks: snarksReducer,
7681
benchmarks: benchmarksReducer,
82+
fuzzing: fuzzingReducer,
7783
};
7884

7985
export const metaReducers: MetaReducer<MinaState, MinaAction>[] = [];

frontend/src/app/core/services/sentry.service.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ import * as Sentry from '@sentry/angular';
44
import { NodesOverviewBlock, NodesOverviewNodeBlockStatus } from '@shared/types/nodes/dashboard/nodes-overview-block.type';
55
import { lastItem, ONE_BILLION } from '@openmina/shared';
66
import { RustService } from '@core/services/rust.service';
7+
import { getElapsedTime } from '@shared/helpers/date.helper';
78

89
@Injectable({
910
providedIn: 'root',
1011
})
1112
export class SentryService {
1213

14+
private readonly rustService: RustService = inject(RustService);
1315
private ledgerIsSynced: boolean = false;
1416
private blockIsSynced: boolean = false;
15-
private rustService: RustService = inject(RustService);
17+
private ledgerSyncedTime: number;
18+
private blockSyncedTime: number;
1619

1720
updateLedgerSyncStatus(ledger: NodesOverviewLedger): void {
1821
if (this.ledgerIsSynced) {
@@ -40,8 +43,9 @@ export class SentryService {
4043
};
4144

4245
const syncedIn = Math.round((ledger.rootStaged.staged.reconstructEnd - ledger.stakingEpoch.snarked.fetchHashesStart) / ONE_BILLION);
46+
this.ledgerSyncedTime = syncedIn;
4347

44-
Sentry.captureMessage(`Ledger synced in ${syncedIn}s`, {
48+
Sentry.captureMessage(`Ledger synced in ${getElapsedTime(syncedIn)}s`, {
4549
level: 'info',
4650
tags: { type: 'webnode', subType: 'sync.ledger' },
4751
contexts: { ledger: syncDetails },
@@ -60,11 +64,20 @@ export class SentryService {
6064
blocks = blocks.slice(1);
6165
const bestTipBlock = blocks[0].height;
6266
const root = lastItem(blocks).height;
63-
Sentry.captureMessage(`Last 290 blocks synced in ${Math.round((Date.now() - startTime) / 1000)}s`, {
67+
this.blockSyncedTime = Math.round((Date.now() - startTime) / 1000);
68+
Sentry.captureMessage(`Last 290 blocks synced in ${getElapsedTime(this.blockSyncedTime)}s`, {
6469
level: 'info',
6570
tags: { type: 'webnode', subType: 'sync.block' },
6671
contexts: { blocks: { bestTipBlock, root } },
6772
});
73+
74+
const syncTotal = this.ledgerSyncedTime + this.blockSyncedTime;
75+
setTimeout(() => {
76+
Sentry.captureMessage(`Web Node Synced in ${getElapsedTime(syncTotal)}`, {
77+
level: 'info',
78+
tags: { type: 'webnode', subType: 'sync.total' },
79+
});
80+
}, 2000);
6881
}
6982
}
7083
}

frontend/src/app/core/services/web-node.service.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@ import { DashboardPeerStatus } from '@shared/types/dashboard/dashboard.peer';
88
import { FileProgressHelper } from '@core/helpers/file-progress.helper';
99
import { CONFIG } from '@shared/constants/config';
1010

11+
export interface PrivateStake {
12+
publicKey: string;
13+
password: string;
14+
stake: string;
15+
}
16+
1117
@Injectable({
1218
providedIn: 'root',
1319
})
1420
export class WebNodeService {
1521

1622
private readonly webnode$: BehaviorSubject<any> = new BehaviorSubject<any>(null);
1723
private readonly wasm$: BehaviorSubject<any> = new BehaviorSubject<any>(null);
24+
1825
private webNodeKeyPair: { publicKey: string, privateKey: string };
1926
private webNodeNetwork: String;
2027
private webNodeStartTime: number;
@@ -23,6 +30,7 @@ export class WebNodeService {
2330
readonly webnodeProgress$: BehaviorSubject<string> = new BehaviorSubject<string>('');
2431

2532
memory: WebAssembly.MemoryDescriptor;
33+
privateStake: PrivateStake;
2634

2735
constructor(private http: HttpClient) {
2836
FileProgressHelper.initDownloadProgress();
@@ -111,7 +119,9 @@ export class WebNodeService {
111119
}
112120
})();
113121
console.log('webnode config:', !!this.webNodeKeyPair.privateKey, this.webNodeNetwork, urls);
114-
return from(wasm.run(this.webNodeKeyPair.privateKey, urls.seeds, urls.genesisConfig));
122+
const privateKey = this.privateStake ? [this.privateStake.stake, this.privateStake.password] : this.webNodeKeyPair.privateKey;
123+
124+
return from(wasm.run(privateKey, urls.seeds, urls.genesisConfig));
115125
}),
116126
tap((webnode: any) => {
117127
any(window).webnode = webnode;
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
<span [tooltip]="'Started ' + startedAgo + ' ago'">{{ epoch }}</span>
2+
@if (isMobile) {
3+
<span [copyToClipboard]="publicKey" class="fx-row-vert-cent tertiary">
4+
<span>{{ publicKey | truncateMid: 6: 6 }}</span>
5+
<span class="mina-icon ml-5">content_copy</span>
6+
</span>
7+
}

0 commit comments

Comments
 (0)