Skip to content

Commit

Permalink
pr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
matzayonc committed Mar 27, 2024
1 parent 5d20c17 commit df48665
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions system-contracts/test/NonceHolder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { BigNumber } from "ethers";
describe("NonceHolder tests", () => {
const wallet = getWallets()[0];
let nonceHolder: NonceHolder;
let systemNonceHolder: NonceHolder;
let nonceHolderAccount: ethers.Signer;
let systemAccount: ethers.Signer;
let deployerAccount: ethers.Signer;
Expand All @@ -24,7 +23,6 @@ describe("NonceHolder tests", () => {
await deployContractOnAddress(await wallet.getAddress(), "NonceHolder");
await deployContractOnAddress(TEST_NONCE_HOLDER_SYSTEM_CONTRACT_ADDRESS, "NonceHolder");
nonceHolder = NonceHolderFactory.connect(await wallet.getAddress(), wallet);
systemNonceHolder = NonceHolderFactory.connect(TEST_NONCE_HOLDER_SYSTEM_CONTRACT_ADDRESS, wallet);
nonceHolderAccount = await ethers.getImpersonatedSigner(await wallet.getAddress());
systemAccount = await ethers.getImpersonatedSigner("0x000000000000000000000000000000000000900b");
deployerAccount = await ethers.getImpersonatedSigner(TEST_DEPLOYER_SYSTEM_CONTRACT_ADDRESS);
Expand Down Expand Up @@ -61,12 +59,12 @@ describe("NonceHolder tests", () => {
expect(rawNonceBefore).to.equal(rawNonceAfter);
});

// it("should increase account minNonce by many", async () => {
// const nonceBefore = await nonceHolder.getMinNonce(systemAccount.address);
// await nonceHolder.connect(systemAccount).increaseMinNonce(2 ** 4);
// const result = await nonceHolder.getMinNonce(systemAccount.address);
// expect(result).to.equal(nonceBefore.add(2 ** 4));
// });
it("should increase account minNonce by many", async () => {
const nonceBefore = await nonceHolder.getMinNonce(systemAccount.address);
await nonceHolder.connect(systemAccount).increaseMinNonce(2 ** 4);
const result = await nonceHolder.getMinNonce(systemAccount.address);
expect(result).to.equal(nonceBefore.add(2 ** 4));
});

it("should fail with too high", async () => {
const nonceBefore = await nonceHolder.getMinNonce(systemAccount.address);
Expand All @@ -87,7 +85,7 @@ describe("NonceHolder tests", () => {
describe("incrementMinNonceIfEquals", async () => {
it("should revert This method require system call flag", async () => {
const expectedNonce = await nonceHolder.getMinNonce(systemAccount.address);
await expect(systemNonceHolder.incrementMinNonceIfEquals(expectedNonce)).to.be.rejectedWith(
await expect(nonceHolder.incrementMinNonceIfEquals(expectedNonce)).to.be.rejectedWith(
"This method require system call flag"
);
});
Expand Down Expand Up @@ -167,7 +165,7 @@ describe("NonceHolder tests", () => {
expect(storedValue).to.equal(333);
});

it("should emit ValueSetUnderNonce event", async () => {
it("should emit ValueSetUnderNonce event not in order", async () => {
const currentNonce = await nonceHolder.getMinNonce(systemAccount.address);
await nonceHolder.connect(systemAccount).incrementMinNonceIfEquals(currentNonce);
const encodedAccountInfo = ethers.utils.defaultAbiCoder.encode(["tuple(uint8, uint8)"], [[1, 0]]);
Expand Down

0 comments on commit df48665

Please sign in to comment.