-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Archiver and node return L2 block number and hash for `getTxEffect` - PXE database stores L2 block number and hash for each note - PXE database exposes a method for pruning notes after a given block number - PXE synchronizer uses L2 block stream to detect reorgs and clean up notes
- Loading branch information
1 parent
6fec1dc
commit 1b55bed
Showing
45 changed files
with
627 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Fr } from '@aztec/circuits.js'; | ||
import { schemas } from '@aztec/foundation/schemas'; | ||
|
||
import { type ZodTypeAny, z } from 'zod'; | ||
|
||
import { type L2Block } from './l2_block.js'; | ||
|
||
export type InBlock<T> = { | ||
l2BlockNumber: number; | ||
l2BlockHash: string; | ||
data: T; | ||
}; | ||
|
||
export function randomInBlock<T>(data: T): InBlock<T> { | ||
return { | ||
data, | ||
l2BlockNumber: Math.floor(Math.random() * 1000), | ||
l2BlockHash: Fr.random().toString(), | ||
}; | ||
} | ||
|
||
export function wrapInBlock<T>(data: T, block: L2Block): InBlock<T> { | ||
return { | ||
data, | ||
l2BlockNumber: block.number, | ||
l2BlockHash: block.hash().toString(), | ||
}; | ||
} | ||
|
||
export function inBlockSchemaFor<T extends ZodTypeAny>(schema: T) { | ||
return z.object({ | ||
data: schema, | ||
l2BlockNumber: schemas.Integer, | ||
l2BlockHash: z.string(), | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.