Skip to content

Commit

Permalink
add block proof support
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan-rosianu committed Feb 21, 2025
1 parent 887bd0b commit 9230a21
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/endpoints/blocks/entities/block.proof.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ApiProperty } from '@nestjs/swagger';

export class BlockProofDto {
@ApiProperty({
type: String,
description: "Bitmap representing public keys involved in the proof",
example: "7702",
})
pubKeysBitmap?: string;

@ApiProperty({
type: String,
description: "Aggregated BLS signature for the proof",
example: "50224d66a42a019991d16f25dba375b581f279d4394d4c254876c1484f61bed90fb20456f8af107c54e4eed1763e2a92",
})
aggregatedSignature?: string;

@ApiProperty({
type: String,
description: "Hash of the block header being proven",
example: "414d526161587ae9f53453aa0392971272c48dbb3cc54a33448972d388e0deeb",
})
headerHash?: string;

@ApiProperty({type: Number, description: "Epoch number of the block header", example: 130})
headerEpoch?: number;

@ApiProperty({type: Number, description: "Nonce value of the block header", example: 13137})
headerNonce?: number;

@ApiProperty({type: Number, description: "Round number of the block header", example: 13163})
headerRound?: number;
}
7 changes: 7 additions & 0 deletions src/endpoints/blocks/entities/block.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ApiUtils } from "@multiversx/sdk-nestjs-http";
import { ApiProperty } from "@nestjs/swagger";
import { Identity } from "src/endpoints/identities/entities/identity";
import { BlockProofDto } from "./block.proof";

export class Block {
constructor(init?: Partial<Block>) {
Expand Down Expand Up @@ -64,6 +65,12 @@ export class Block {
@ApiProperty({ type: String, nullable: true, required: false })
scheduledRootHash: string | undefined = undefined;

@ApiProperty({ type: BlockProofDto, nullable: true, required: false })
previousHeaderProof: BlockProofDto | undefined = undefined;

@ApiProperty({ type: BlockProofDto, nullable: true, required: false })
proof: BlockProofDto | undefined = undefined;

static mergeWithElasticResponse<T extends Block>(newBlock: T, blockRaw: any): T {
blockRaw.shard = blockRaw.shardId;

Expand Down

0 comments on commit 9230a21

Please sign in to comment.