Skip to content

Commit

Permalink
Explicitly pass bucket id to filter options
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Apr 29, 2023
1 parent 90ed272 commit 3ed8d04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export class AttestationByTargetRepository {

async getAll(pubkey: BLSPubkey, limit?: number): Promise<SlashingProtectionAttestation[]> {
const attestations = await this.db.values({
...this.dbReqOpts,
limit,
gte: this.encodeKey(pubkey, 0),
lt: this.encodeKey(pubkey, Number.MAX_SAFE_INTEGER),
bucketId: this.bucketId,
});
return attestations.map((attestation) => this.type.deserialize(attestation));
}
Expand All @@ -69,7 +69,7 @@ export class AttestationByTargetRepository {
}

async listPubkeys(): Promise<BLSPubkey[]> {
const keys = await this.db.keys({...this.dbReqOpts, gte: this.minKey, lt: this.maxKey});
const keys = await this.db.keys({gte: this.minKey, lt: this.maxKey, bucketId: this.bucketId});
return uniqueVectorArr(keys.map((key) => this.decodeKey(key).pubkey));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ export class BlockBySlotRepository {

async getAll(pubkey: BLSPubkey, limit?: number): Promise<SlashingProtectionBlock[]> {
const blocks = await this.db.values({
...this.dbReqOpts,
limit,
gte: this.encodeKey(pubkey, 0),
lt: this.encodeKey(pubkey, Number.MAX_SAFE_INTEGER),
bucketId: this.bucketId,
});
return blocks.map((block) => this.type.deserialize(block));
}
Expand All @@ -73,7 +73,7 @@ export class BlockBySlotRepository {
}

async listPubkeys(): Promise<BLSPubkey[]> {
const keys = await this.db.keys({...this.dbReqOpts, gte: this.minKey, lt: this.maxKey});
const keys = await this.db.keys({gte: this.minKey, lt: this.maxKey, bucketId: this.bucketId});
return uniqueVectorArr(keys.map((key) => this.decodeKey(key).pubkey));
}

Expand Down

0 comments on commit 3ed8d04

Please sign in to comment.