CodeChain-io / CodeChain-io/codechain-indexer

Validate `firstEvaluatedKey` and `lastEvaluatedKey`'s length

Open
#349 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
21
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Here is the code that validates `firstEvaluatedKey` and `lastEvaluatedKey`.

```
export const txPaginationSchema = {
firstEvaluatedKey: Joi.array().items(Joi.number(), Joi.number()),
lastEvaluatedKey: Joi.array().items(Joi.number(), Joi.number())
};
```

The above condition does not check an input array's length. All of these inputs `[]`, `[1]`, `[1,2]` and `[1,2,3]` are valid in the current implementation. Only `[1,2]` should pass the validation and other `[]`, `[1]`, `[1,2,3]` should fail the validation.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the txPaginationSchema definition shown in the issue and inspect nearby validation tests or usage. Verify the schema's behavior for empty, one-element, two-element, and three-element arrays; done means only the two-element case is accepted for both keys.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.