Preliminary Off-Chain for Deposits#342
Conversation
keyan-m
left a comment
There was a problem hiding this comment.
Nice work :) Some of the files need rearrangements.
Deposit tx builder
keyan-m
left a comment
There was a problem hiding this comment.
Looking good 👍 We can start focusing on proper time management next.
| const LATEST_DEPOSIT_FETCH_TIME: Ref.Ref<bigint> = yield* Ref.make( | ||
| BigInt(0), |
There was a problem hiding this comment.
This and LATEST_SYNC_OF_STATE_QUEUE_LENGTH should be of the same type, i.e. either both of type number or both of type bigint.
| // TODO?: We might be able to avoid `as` here. | ||
| const UNCONFIRMED_SUBMITTED_BLOCK: Ref.Ref<"" | TxHash> = yield* Ref.make( | ||
| "" as "" | TxHash, | ||
| const UNCONFIRMED_SUBMITTED_BLOCK_HASH: Ref.Ref<"" | TxHash> = |
There was a problem hiding this comment.
UNCONFIRMED_SUBMITTED_BLOCK_HASH implies this stores the header hash, but this hash is the transaction hash that had submitted the block.
There was a problem hiding this comment.
I wonder, do you have any suggestions for a variable name in mind?
The same goes for LATEST_SYNC_OF_STATE_QUEUE_LENGTH, the name doesn't reflect that it has anything to do with time -- I assumed that it's a queue length.
There was a problem hiding this comment.
I think either UNCONFIRMED_SUBMITTED_BLOCK or UNCONFIRMED_SUBMITTED_BLOCK_TX_HASH would be fine.
For LATEST_SYNC_OF_STATE_QUEUE_LENGTH my thinking was that the term "latest" would sufficiently imply its temporal nature. If you prefer a more explicit name perhaps we can go with LATEST_SYNC_TIME_OF_STATE_QUEUE_LENGTH, although I think I prefer the former.
| depositUTxO: Deposit.DepositUTxO, | ||
| inclusionStartTime: POSIXTime, | ||
| inclusionEndTime: POSIXTime, | ||
| ): Boolean => { |
There was a problem hiding this comment.
| ): Boolean => { | |
| ): boolean => { |
| ): Boolean => { | ||
| const depositData = depositUTxO.datum; | ||
| return ( | ||
| inclusionStartTime <= depositData.inclusionTime && |
There was a problem hiding this comment.
Let's make the lower bound exclusive for now.
| inclusionStartTime <= depositData.inclusionTime && | |
| inclusionStartTime < depositData.inclusionTime && |
| export type SuccessfulSubmissionOutput = { | ||
| type: "SuccessfulSubmissionOutput"; | ||
| submittedTxHash: string; | ||
| submittionTime: bigint; |
There was a problem hiding this comment.
No need to pass back the upper bound of a submitted block. We only care about the upper bound of a submitted block after it's been confirmed on L1 (which we can retrieve from its global variable).
| submittionTime: bigint; |
- Use `Pick` for HubOracleValidators to ensure type consistency. - Update HubOracleInitParams to nest validators in a dedicated object. - Remove unnecessary datum parameter from Scheduler initialization. - Standardize rootData initialization to "00" for Registered and Retired operators. - Update initialization transaction programs to align with new type definitions.
- refactor(genesis): replace `getGenesisUtxosFromValidators` with `getGenesisScriptInputs` to generate index-to-hash mappings for the validator catalogue - feat(initialization): update `computeGenesisMptRoot` to use `keyValueMptRoot` with the new catalogue inputs - chore(mpt): remove unused `computeRootFromUtxos` helper - fix(listen): update error handling to match new MPT root calculation return types
Maps 4-byte indices to Blake2b-224 validator script hashes per spec §4.1. Uses concurrent hashing with deterministic ordering defined in VALIDATOR_ORDER. Tests verify pre-image retrieval, determinism, and 28-byte hash format. Note: Validator ordering should be verified against on-chain code before production.
- Complete hub oracle schema with all validator addresses and policy IDs - Rename test file: mpt_roots.test.ts → fraud-proof-catalogue.test.ts - Remove scheduler initialization datum - Improve test validation to verify hash correctness - Clean up test utilities (remove dotenv.config)
Expand the Initialization Process to Include All the Contracts
Failure of submitting a block with 0 tx requests with deposit events did not revert the changes applied to the ledger trie. This commit implements the reversal logic as a potentionally temporary solution.
Apply Deposit Events to Ledger
Also fixed inclusion time inclusivity.
No description provided.