diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/node.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/node.ts index 82348bf9a5..43fc3091de 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/node.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/node.ts @@ -2146,6 +2146,12 @@ export class HardhatNode extends EventEmitter { )?.[1]; if (overridenAccount?.nonce !== undefined) { + const MAX_NONCE = 2n ** 64n - 1n; + if (overridenAccount.nonce > MAX_NONCE) { + throw new InvalidInputError( + `The 'nonce' property should occupy a maximum of 8 bytes (nonce=${nonce}).` + ); + } return overridenAccount.nonce; }