Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Revert #9048 to fix the testnet genesis block issue (#9071)
Browse files Browse the repository at this point in the history
:arrow_back: Revert #9048
  • Loading branch information
shuse2 authored Oct 7, 2023
1 parent cc369ee commit 0d984bd
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions elements/lisk-chain/src/block_header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ export class BlockHeader {
});
}

if (header.aggregateCommit.height !== header.height) {
if (header.aggregateCommit.height !== 0) {
errors.push({
message: 'Genesis block header aggregateCommit.height must equal to the genesis height',
message: 'Genesis block header aggregateCommit.height must equal 0',
keyword: 'const',
dataPath: 'aggregateCommit.height',
schemaPath: 'properties.aggregateCommit.height',
params: { allowedValue: header.height },
params: { allowedValue: 0 },
});
}

Expand Down
2 changes: 1 addition & 1 deletion elements/lisk-chain/test/unit/block.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('block', () => {
maxHeightGenerated: 0,
validatorsHash: utils.hash(Buffer.alloc(0)),
aggregateCommit: {
height: 1009988,
height: 0,
aggregationBits: Buffer.alloc(0),
certificateSignature: EMPTY_BUFFER,
},
Expand Down
4 changes: 2 additions & 2 deletions elements/lisk-chain/test/unit/block_header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ describe('block_header', () => {
);
});

it('should throw error if aggregateCommit.height is not equal to the height', () => {
it('should throw error if aggregateCommit.height is not equal to 0', () => {
const block = getGenesisBlockAttrs();
const blockHeader = new BlockHeader({
...block,
aggregateCommit: { ...block.aggregateCommit, height: 10 },
});

expect(() => blockHeader.validateGenesis()).toThrow(
'Genesis block header aggregateCommit.height must equal to the genesis height',
'Genesis block header aggregateCommit.height must equal 0',
);
});

Expand Down
2 changes: 1 addition & 1 deletion framework/src/genesis_block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const generateGenesisBlock = async (
impliesMaxPrevotes: true,
assetRoot,
aggregateCommit: {
height,
height: 0,
aggregationBits: EMPTY_BUFFER,
certificateSignature: EMPTY_BUFFER,
},
Expand Down
1 change: 0 additions & 1 deletion framework/test/unit/genesis_block.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ describe('generateGenesisBlock', () => {
expect(result.header.validatorsHash).toHaveLength(32);
expect(result.header.eventRoot).toHaveLength(32);
expect(result.header.version).toBe(0);
expect(result.header.aggregateCommit.height).toBe(30);

expect(stateMachine.executeGenesisBlock).toHaveBeenCalledTimes(1);
});
Expand Down

0 comments on commit 0d984bd

Please sign in to comment.