Skip to content

Commit

Permalink
doc: fix JSDoc typos
Browse files Browse the repository at this point in the history
  • Loading branch information
zmalatrax committed Jul 29, 2024
1 parent 6452271 commit 6c2cd53
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/errors/squashedDictManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Felt } from 'primitives/felt';

class SquashedDictManagerError extends Error {}

/** There is no key in the squashed dictionnary manager */
/** There is no keys left in the squashed dictionnary manager */
export class EmptyKeys extends SquashedDictManagerError {
constructor() {
super('There is no keys left in the squashed dictionnary manager.');
Expand Down
5 changes: 4 additions & 1 deletion src/hints/assertLeFindSmallArc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export const assertLeFindSmallArcsParser = z

/**
* AssertLeFindSmallArcs hint
*
* Find the two small arcs from [(0, a), (a, b), (b, PRIME)] and
* assert them to the range check segment.
*/
export type AssertLeFindSmallArcs = z.infer<typeof assertLeFindSmallArcsParser>;

Expand All @@ -33,7 +36,7 @@ export type Arc = {
};

/**
* Compute the three arcs `a`, `b - a` and `PRIME - 1 - b`
* Compute the three arcs [(0, a), (a, b), (b, PRIME)]
*
* Set the biggest arc to the scope variable `excluded_arc`
*
Expand Down
4 changes: 3 additions & 1 deletion src/hints/assertLeIsFirstArcExcluded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ export const assertLeIsFirstArcExcludedParser = z

/**
* AssertLeIsFirstArcExcluded hint
*
* Assert if the arc (0, a) was excluded.
*/
export type AssertLeIsFirstArcExcluded = z.infer<
typeof assertLeIsFirstArcExcludedParser
>;

/**
* Check whether the first arc from `AssertLeFindSmallArcs` is excluded.
* Assert if the arc (0, a) from `AssertLeFindSmallArcs` was excluded.
*
* Read the value in scope at `excluded_arc`
*/
Expand Down
4 changes: 3 additions & 1 deletion src/hints/assertLeIsSecondArcExcluded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ export const assertLeIsSecondArcExcludedParser = z

/**
* AssertLeIsSecondArcExcluded hint
*
* Assert if the arc (a, b) was excluded.
*/
export type AssertLeIsSecondArcExcluded = z.infer<
typeof assertLeIsSecondArcExcludedParser
>;

/**
* Check whether the second arc from `AssertLeFindSmallArcs` is excluded.
* Assert if the arc (a, b) from `AssertLeFindSmallArcs` was excluded.
*
* Read the value in scope at `excluded_arc`
*/
Expand Down
2 changes: 1 addition & 1 deletion src/hints/dict/felt252DictEntryInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type Felt252DictEntryInit = z.infer<typeof felt252DictEntryInitParser>;
* Read the current value at `key` if any,
* Initialize `dict[key]` to 0 if undefined.
*
* Assert the value at key to the `dict` segment.
* Assert the value at `key` to the `dict` segment.
*
*/
export const felt252DictEntryInit = (
Expand Down
2 changes: 1 addition & 1 deletion src/hints/dict/felt252DictEntryUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const felt252DictEntryUpdateParser = z
/**
* Felt252DictEntryUpdate hint
*
* Set a value in a dict: `dict[key] = value`
* Update an existing dict entry `key` to `value`: `dict[key] = value`
*/
export type Felt252DictEntryUpdate = z.infer<
typeof felt252DictEntryUpdateParser
Expand Down
3 changes: 1 addition & 2 deletions src/hints/dict/getCurrentAccessDelta.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { z } from 'zod';

import { Felt } from 'primitives/felt';
import { VirtualMachine } from 'vm/virtualMachine';

import { HintName } from 'hints/hintName';
Expand All @@ -17,7 +16,7 @@ export const getCurrentAccessDeltaParser = z
/**
* GetCurrentAccessDelta hint
*
* Assert to memory the difference between the current and previous indices.
* Assert to memory the difference between the current index to the next one.
*
*/
export type GetCurrentAccessDelta = z.infer<typeof getCurrentAccessDeltaParser>;
Expand Down
5 changes: 1 addition & 4 deletions src/hints/dict/getCurrentAccessIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ export const getCurrentAccessIndexParser = z
rangeCheckPtr: range_check_ptr,
}));

/**
* GetCurrentAccessIndex hint
*
*/
/** GetCurrentAccessIndex hint */
export type GetCurrentAccessIndex = z.infer<typeof getCurrentAccessIndexParser>;

/**
Expand Down
4 changes: 1 addition & 3 deletions src/hints/dict/getNextDictKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ export const getNextDictKeyParser = z
nextKey: next_key,
}));

/**
* GetNextDictKey hint
*/
/** GetNextDictKey hint */
export type GetNextDictKey = z.infer<typeof getNextDictKeyParser>;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/hints/dict/getSegmentArenaIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const getSegmentArenaIndexParser = z
/**
* GetSegmentArenaIndex hint
*
* Assert the index of the dictionnary to its segment.
* Retrieve the index of the given dict in the info segment.
* Used when finalizing the dictionnaries.
*/
export type GetSegmentArenaIndex = z.infer<typeof getSegmentArenaIndexParser>;
Expand Down
10 changes: 3 additions & 7 deletions src/hints/dict/shouldContinueSquashLoop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@ export const shouldContinueSquashLoopParser = z
shouldContinue: should_continue,
}));

/**
* ShouldContinueSquashLoop hint
*
* Check whether the squash loop should be skipped.
*/
/** ShouldContinueSquashLoop hint */
export type ShouldContinueSquashLoop = z.infer<
typeof shouldContinueSquashLoopParser
>;

/**
* Check whether the squash loop should be skipped.
* Assert whether the squash loop should be continued.
*
* If there is still indices to be squashed, the loop is skipped.
* If there is still indices to be squashed, the loop continue.
*/
export const shouldContinueSquashLoop = (
vm: VirtualMachine,
Expand Down
8 changes: 2 additions & 6 deletions src/hints/dict/shouldSkipSquashLoop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,13 @@ export const shouldSkipSquashLoopParser = z
shouldSkipLoop: should_skip_loop,
}));

/**
* ShouldSkipSquashLoop hint
*
* Check whether the squash loop should be skipped.
*/
/** ShouldSkipSquashLoop hint */
export type ShouldSkipSquashLoop = z.infer<typeof shouldSkipSquashLoopParser>;

/**
* Check whether the squash loop should be skipped.
*
* If there is still indices to be squashed, the loop is skipped.
* If there is no more indices to be squashed, the loop is skipped.
*/
export const shouldSkipSquashLoop = (
vm: VirtualMachine,
Expand Down
9 changes: 7 additions & 2 deletions src/hints/hintHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@ import {
} from './dict/shouldSkipSquashLoop';
import { TestLessThan, testLessThan } from './math/testLessThan';

export const handlers: Record<
/**
* Map hint names to the function executing their logic.
*/
export type HintHandler = Record<
HintName,
(vm: VirtualMachine, hint: Hint) => void
> = {
>;

export const handlers: HintHandler = {
[HintName.AllocFelt252Dict]: (vm, hint) => {
const h = hint as AllocFelt252Dict;
allocFelt252Dict(vm, h.segmentArenaPtr);
Expand Down
2 changes: 1 addition & 1 deletion src/hints/squashedDictManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Felt } from 'primitives/felt';
export class SquashedDictManager {
/** Maps the key of a dictionnary to its taken values accross the run. */
public keyToIndices: Map<string, Felt[]>;
/** An array containing the keys that still needs to be squashed. */
/** An array containing the keys that still need to be squashed. */
public keys: Felt[];

constructor() {
Expand Down

0 comments on commit 6c2cd53

Please sign in to comment.