Skip to content

Commit dc1eb8b

Browse files
authored
feat(quick-sync): TCT frontier support (#2303)
## Description of Changes quick sync using the state commitment tree snapshots to initialize the view server for freshly generated wallets. currently failing on mainnet with `ConnectError: [unimplemented]` when attempting to call the SCT frontier service, but works with testnet rpc. cc @conorsch -------------------- https://github.com/user-attachments/assets/b4f333e2-f80a-49d6-bd2b-af258e2fdf23 ## Related Issue references penumbra-zone/penumbra#1128 and penumbra-zone/penumbra#1131 extension of penumbra-zone/penumbra#5179 and pairs with prax-wallet/prax#336 ## Checklist Before Requesting Review - [x] I have ensured that any relevant minifront changes do not cause the existing extension to break.
1 parent 6d69fee commit dc1eb8b

File tree

12 files changed

+421
-66
lines changed

12 files changed

+421
-66
lines changed

.changeset/cool-bugs-stick.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@penumbra-zone/services': major
3+
'@penumbra-zone/protobuf': minor
4+
'@penumbra-zone/storage': minor
5+
'@penumbra-zone/types': minor
6+
'@penumbra-zone/wasm': minor
7+
---
8+
9+
tct frontier support for freshly generated wallets

packages/protobuf/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"gen:ibc": "buf generate buf.build/cosmos/ibc:7ab44ae956a0488ea04e04511efa5f70",
1717
"gen:ics23": "buf generate buf.build/cosmos/ics23:55085f7c710a45f58fa09947208eb70b",
1818
"gen:noble": "buf generate buf.build/noble-assets/forwarding:5a8609a6772d417584a9c60cd8b80881",
19-
"gen:penumbra": "buf generate buf.build/penumbra-zone/penumbra:02e7203c4f7343972a15bb92ab240de63af19795",
19+
"gen:penumbra": "buf generate buf.build/penumbra-zone/penumbra:c9cad1174337c69d8270816ae52f3dfa820df3f3",
2020
"lint": "eslint src",
2121
"lint:fix": "eslint src --fix",
2222
"lint:strict": "tsc --noEmit && eslint src --max-warnings 0",

packages/services/src/sct-service/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { timestampByHeight } from './timestamp-by-height.js';
55

66
export type Impl = ServiceImpl<typeof SctService>;
77

8-
export const sctImpl: Omit<Impl, 'anchorByHeight'> = {
8+
export const sctImpl: Omit<Impl, 'anchorByHeight' | 'sctFrontier'> = {
99
epochByHeight,
1010
timestampByHeight,
1111
};

packages/storage/src/indexed-db/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,14 @@ export class IndexedDb implements IndexedDbInterface {
231231
await this.u.updateAll(txs);
232232
}
233233

234+
async saveFullSyncHeight(height: bigint) {
235+
await this.u.update({
236+
table: 'FULL_SYNC_HEIGHT',
237+
value: height,
238+
key: 'height',
239+
});
240+
}
241+
234242
async getFullSyncHeight() {
235243
return this.db.get('FULL_SYNC_HEIGHT', 'height');
236244
}
@@ -1042,7 +1050,7 @@ export class IndexedDb implements IndexedDbInterface {
10421050
txs.add({ table: 'TREE_HASHES', value: h });
10431051
}
10441052

1045-
// TODO: What about updates.delete_ranges?
1053+
// TODO: What about updates.delete_ranges (https://github.com/penumbra-zone/web/issues/818)?
10461054
}
10471055

10481056
private addNewNotes(txs: IbdUpdates, notes: SpendableNoteRecord[]): void {

packages/types/src/indexed-db.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export interface IndexedDbInterface {
6666
constants(): IdbConstants;
6767
clear(): Promise<void>;
6868
getFullSyncHeight(): Promise<bigint | undefined>;
69+
saveFullSyncHeight(height: bigint): Promise<void>;
6970
getSpendableNoteByNullifier(nullifier: Nullifier): Promise<SpendableNoteRecord | undefined>;
7071
getSpendableNoteByCommitment(
7172
commitment: StateCommitment,
@@ -423,6 +424,7 @@ export const IDB_TABLES: Tables = {
423424
transactions: 'TRANSACTIONS',
424425
full_sync_height: 'FULL_SYNC_HEIGHT',
425426
tree_commitments: 'TREE_COMMITMENTS',
427+
tree_hashes: 'TREE_HASHES',
426428
tree_last_position: 'TREE_LAST_POSITION',
427429
tree_last_forgotten: 'TREE_LAST_FORGOTTEN',
428430
lqt_historical_votes: 'LQT_HISTORICAL_VOTES',

packages/types/src/querier.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ import {
99
DutchAuction,
1010
} from '@penumbra-zone/protobuf/penumbra/core/component/auction/v1/auction_pb';
1111
import { CompactBlock } from '@penumbra-zone/protobuf/penumbra/core/component/compact_block/v1/compact_block_pb';
12+
import {
13+
CurrentGasPricesRequest,
14+
CurrentGasPricesResponse,
15+
} from '@penumbra-zone/protobuf/penumbra/core/component/fee/v1/fee_pb';
1216
import { LqtCheckNullifierResponse } from '@penumbra-zone/protobuf/penumbra/core/component/funding/v1/funding_pb';
1317
import {
1418
Nullifier,
19+
SctFrontierRequest,
20+
SctFrontierResponse,
1521
TimestampByHeightRequest,
1622
TimestampByHeightResponse,
1723
} from '@penumbra-zone/protobuf/penumbra/core/component/sct/v1/sct_pb';
@@ -85,8 +91,13 @@ export interface AuctionQuerierInterface {
8591

8692
export interface SctQuerierInterface {
8793
timestampByHeight(req: TimestampByHeightRequest): Promise<TimestampByHeightResponse>;
94+
sctFrontier(req: SctFrontierRequest): Promise<SctFrontierResponse>;
8895
}
8996

9097
export interface FundingQuerierInterface {
9198
lqtCheckNullifier(epochIndex: bigint, nullifier: Nullifier): Promise<LqtCheckNullifierResponse>;
9299
}
100+
101+
export interface FeeQuerierInterface {
102+
currentGasPrices(req: CurrentGasPricesRequest): Promise<CurrentGasPricesResponse>;
103+
}

0 commit comments

Comments
 (0)