diff --git a/packages/block/src/constructors.ts b/packages/block/src/constructors.ts index 8152f6323e..2b6094326c 100644 --- a/packages/block/src/constructors.ts +++ b/packages/block/src/constructors.ts @@ -522,12 +522,15 @@ export function createSealedCliqueBlock( cliqueSigner: Uint8Array, opts: BlockOptions = {}, ): Block { - const sealedCliqueBlock = createBlock(blockData, opts) + const sealedCliqueBlock = createBlock(blockData, { ...opts, ...{ freeze: false } }) ;(sealedCliqueBlock.header.extraData as any) = retrieveCliqueBlockExtraData( sealedCliqueBlock.header, cliqueSigner, ) - + if (opts?.freeze === true) { + // We have to freeze here since we can't freeze the block when constructing it since we are overwriting `extraData` + Object.freeze(sealedCliqueBlock) + } return sealedCliqueBlock } diff --git a/packages/blockchain/test/clique.spec.ts b/packages/blockchain/test/clique.spec.ts index d16578ac1f..f4307ac872 100644 --- a/packages/blockchain/test/clique.spec.ts +++ b/packages/blockchain/test/clique.spec.ts @@ -159,7 +159,7 @@ function getBlock( // set signer const cliqueSigner = signer.privateKey - return createSealedCliqueBlock(blockData, cliqueSigner, { common, freeze: false }) + return createSealedCliqueBlock(blockData, cliqueSigner, { common }) } const addNextBlockReorg = async ( @@ -230,6 +230,7 @@ describe('Clique: Initialization', () => { ) const block = createSealedCliqueBlock({ header: { number, extraData } }, A.privateKey, { common: COMMON, + freeze: false, }) try { await blockchain.putBlock(block)