Commit 8311c65 sklppy88
committed
1 parent dfca718 commit 8311c65 Copy full SHA for 8311c65
File tree 8 files changed +42
-0
lines changed
noir-projects/aztec-nr/aztec/src/oracle
8 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,18 @@ unconstrained fn get_app_tagging_secret_oracle(
221
221
_recipient : AztecAddress ,
222
222
) -> [Field ; INDEXED_TAGGING_SECRET_LENGTH ] {}
223
223
224
+
225
+ pub unconstrained fn increment_app_tagging_secret (
226
+ to_increment : IndexedTaggingSecret ,
227
+ ) {
228
+ increment_app_tagging_secret_oracle (to_increment );
229
+ }
230
+
231
+ #[oracle(incrementAppTaggingSecret)]
232
+ unconstrained fn increment_app_tagging_secret_oracle (
233
+ to_increment : IndexedTaggingSecret ,
234
+ ) {}
235
+
224
236
/// Returns the tagging secrets for a given recipient and all the senders in PXE's address book,
225
237
// siloed for the current contract address.
226
238
/// Includes the last known index used for tagging with this secret.
Original file line number Diff line number Diff line change @@ -6,4 +6,8 @@ export class IndexedTaggingSecret {
6
6
toFields ( ) : Fr [ ] {
7
7
return [ this . secret , new Fr ( this . index ) ] ;
8
8
}
9
+
10
+ static fromFields ( fields : Fr [ ] ) : IndexedTaggingSecret {
11
+ return new this ( fields [ 0 ] , fields [ 1 ] . toNumber ( ) ) ;
12
+ }
9
13
}
Original file line number Diff line number Diff line change @@ -252,6 +252,10 @@ export class SimulatorOracle implements DBOracle {
252
252
return new IndexedTaggingSecret ( secret , index ) ;
253
253
}
254
254
255
+ public async incrementAppTaggingSecret ( indexedSecret : IndexedTaggingSecret ) : Promise < void > {
256
+ await this . db . incrementTaggingSecretsIndexes ( [ indexedSecret . secret ] ) ;
257
+ }
258
+
255
259
/**
256
260
* Returns the siloed tagging secrets for a given recipient and all the senders in the address book
257
261
* @param contractAddress - The contract address to silo the secret for
Original file line number Diff line number Diff line change 1
1
import { MerkleTreeId , UnencryptedL2Log } from '@aztec/circuit-types' ;
2
+ import { IndexedTaggingSecret } from '@aztec/circuits.js' ;
2
3
import { FunctionSelector , NoteSelector } from '@aztec/foundation/abi' ;
3
4
import { AztecAddress } from '@aztec/foundation/aztec-address' ;
4
5
import { Fr } from '@aztec/foundation/fields' ;
@@ -417,6 +418,12 @@ export class Oracle {
417
418
return taggingSecret . toFields ( ) . map ( toACVMField ) ;
418
419
}
419
420
421
+ async incrementAppTaggingSecret ( indexedTaggingSecret : ACVMField [ ] ) {
422
+ await this . typedOracle . incrementAppTaggingSecret (
423
+ IndexedTaggingSecret . fromFields ( indexedTaggingSecret . map ( fromACVMField ) ) ,
424
+ ) ;
425
+ }
426
+
420
427
async getAppTaggingSecretsForSenders ( [ recipient ] : ACVMField [ ] ) : Promise < ACVMField [ ] > {
421
428
const taggingSecrets = await this . typedOracle . getAppTaggingSecretsForSenders ( AztecAddress . fromString ( recipient ) ) ;
422
429
return taggingSecrets . flatMap ( taggingSecret => taggingSecret . toFields ( ) . map ( toACVMField ) ) ;
Original file line number Diff line number Diff line change @@ -258,6 +258,10 @@ export abstract class TypedOracle {
258
258
throw new OracleMethodNotAvailableError ( 'getAppTaggingSecret' ) ;
259
259
}
260
260
261
+ incrementAppTaggingSecret ( _indexedTaggingSecret : IndexedTaggingSecret ) : Promise < void > {
262
+ throw new OracleMethodNotAvailableError ( 'incrementAppTaggingSecret' ) ;
263
+ }
264
+
261
265
getAppTaggingSecretsForSenders ( _recipient : AztecAddress ) : Promise < IndexedTaggingSecret [ ] > {
262
266
throw new OracleMethodNotAvailableError ( 'getAppTaggingSecretsForSenders' ) ;
263
267
}
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
17
17
CallContext ,
18
18
FunctionSelector ,
19
19
type Header ,
20
+ IndexedTaggingSecret ,
20
21
PRIVATE_CONTEXT_INPUTS_LENGTH ,
21
22
PUBLIC_DISPATCH_SELECTOR ,
22
23
PrivateContextInputs ,
@@ -609,4 +610,8 @@ export class ClientExecutionContext extends ViewDataOracle {
609
610
public getDebugFunctionName ( ) {
610
611
return this . db . getDebugFunctionName ( this . contractAddress , this . callContext . functionSelector ) ;
611
612
}
613
+
614
+ public override async incrementAppTaggingSecret ( indexedTaggingSecret : IndexedTaggingSecret ) {
615
+ await this . db . incrementAppTaggingSecret ( indexedTaggingSecret ) ;
616
+ }
612
617
}
Original file line number Diff line number Diff line change @@ -209,6 +209,8 @@ export interface DBOracle extends CommitmentsDB {
209
209
recipient : AztecAddress ,
210
210
) : Promise < IndexedTaggingSecret > ;
211
211
212
+ incrementAppTaggingSecret ( indexedSecret : IndexedTaggingSecret ) : Promise < void > ;
213
+
212
214
/**
213
215
* Returns the siloed tagging secrets for a given recipient and all the senders in the address book
214
216
* @param contractAddress - The contract address to silo the secret for
Original file line number Diff line number Diff line change @@ -752,6 +752,10 @@ export class TXE implements TypedOracle {
752
752
return ;
753
753
}
754
754
755
+ async incrementAppTaggingSecret ( indexedSecret : IndexedTaggingSecret ) : Promise < void > {
756
+ await this . txeDatabase . incrementTaggingSecretsIndexes ( [ indexedSecret . secret ] ) ;
757
+ }
758
+
755
759
async getAppTaggingSecret ( sender : AztecAddress , recipient : AztecAddress ) : Promise < IndexedTaggingSecret > {
756
760
const senderCompleteAddress = await this . getCompleteAddress ( sender ) ;
757
761
const senderIvsk = await this . keyStore . getMasterIncomingViewingSecretKey ( sender ) ;
You can’t perform that action at this time.
0 commit comments