Skip to content

Commit

Permalink
Add removed tests back
Browse files Browse the repository at this point in the history
  • Loading branch information
0xVolosnikov committed Dec 16, 2024
1 parent 99eb1c4 commit 3b437a5
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion system-contracts/test/KnownCodesStorage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { KnownCodesStorageFactory } from "../typechain";
import {
TEST_BOOTLOADER_FORMAL_ADDRESS,
TEST_COMPRESSOR_CONTRACT_ADDRESS,
TEST_DEPLOYER_SYSTEM_CONTRACT_ADDRESS,
TEST_KNOWN_CODE_STORAGE_CONTRACT_ADDRESS,
} from "./shared/constants";
import { encodeCalldata, getMock, prepareEnvironment } from "./shared/mocks";
Expand Down Expand Up @@ -85,12 +86,34 @@ describe("KnownCodesStorage tests", function () {
});

describe("publishEVMBytecode", function () {
let deployerAccount: ethers.Signer;

const InvalidBytecode =
"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";

beforeEach(async () => {
deployerAccount = await ethers.getImpersonatedSigner(TEST_DEPLOYER_SYSTEM_CONTRACT_ADDRESS);
});

it("non-deployer failed to call", async () => {
await expect(knownCodesStorage.publishEVMBytecode(32, "0x00")).to.be.revertedWithCustomError(
await expect(knownCodesStorage.publishEVMBytecode(1, "0x00")).to.be.revertedWithCustomError(
knownCodesStorage,
"Unauthorized"
);
});

it("bytecode with even length failed to publish", async () => {
await expect(
knownCodesStorage.connect(deployerAccount).publishEVMBytecode(64, InvalidBytecode)
).to.be.revertedWithCustomError(knownCodesStorage, "MalformedBytecode");
});

it("invalid length bytecode failed to call", async () => {
await expect(knownCodesStorage.connect(deployerAccount).publishEVMBytecode(1, "0x00")).to.be.revertedWithCustomError(

Check failure on line 112 in system-contracts/test/KnownCodesStorage.spec.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `knownCodesStorage.connect(deployerAccount).publishEVMBytecode(1,·"0x00")).to.be.revertedWithCustomError(⏎········knownCodesStorage,⏎········"MalformedBytecode"⏎······` with `⏎········knownCodesStorage.connect(deployerAccount).publishEVMBytecode(1,·"0x00")⏎······).to.be.revertedWithCustomError(knownCodesStorage,·"MalformedBytecode"`

Check failure on line 112 in system-contracts/test/KnownCodesStorage.spec.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `knownCodesStorage.connect(deployerAccount).publishEVMBytecode(1,·"0x00")).to.be.revertedWithCustomError(⏎········knownCodesStorage,⏎········"MalformedBytecode"⏎······` with `⏎········knownCodesStorage.connect(deployerAccount).publishEVMBytecode(1,·"0x00")⏎······).to.be.revertedWithCustomError(knownCodesStorage,·"MalformedBytecode"`

Check failure on line 112 in system-contracts/test/KnownCodesStorage.spec.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `knownCodesStorage.connect(deployerAccount).publishEVMBytecode(1,·"0x00")).to.be.revertedWithCustomError(⏎········knownCodesStorage,⏎········"MalformedBytecode"⏎······` with `⏎········knownCodesStorage.connect(deployerAccount).publishEVMBytecode(1,·"0x00")⏎······).to.be.revertedWithCustomError(knownCodesStorage,·"MalformedBytecode"`
knownCodesStorage,
"MalformedBytecode"
);
});
});

describe("markFactoryDeps", function () {
Expand Down

0 comments on commit 3b437a5

Please sign in to comment.