Skip to content

Commit

Permalink
Merge branch 'master' into reinis/acx-3592-n-03-duplicate-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinis-FRP committed Jan 10, 2025
2 parents 66caed6 + 86f17ee commit 250d1e5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
3 changes: 3 additions & 0 deletions test/evm/hardhat/fixtures/HubPool.Fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export const hubPoolFixture = hre.deployments.createFixture(async ({ ethers }) =
return await deployHubPool(ethers);
});

// Silence warnings from openzeppelin/hardhat-upgrades for this fixture.
hre.upgrades.silenceWarnings();

export async function deployHubPool(ethers: any, spokePoolName = "MockSpokePool") {
const [signer, crossChainAdmin] = await ethers.getSigners();

Expand Down
3 changes: 3 additions & 0 deletions test/evm/hardhat/fixtures/SpokePool.Fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export const spokePoolFixture = hre.deployments.createFixture(async ({ ethers })
return await deploySpokePool(ethers);
});

// Silence warnings from openzeppelin/hardhat-upgrades for this fixture.
hre.upgrades.silenceWarnings();

// Have a separate function that deploys the contract and returns the contract addresses. This is called by the fixture
// to have standard fixture features. It is also exported as a function to enable non-snapshoted deployments.
export async function deploySpokePool(
Expand Down
29 changes: 19 additions & 10 deletions test/svm/SvmSpoke.HandleReceiveMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ describe("svm_spoke.handle_receive_message", () => {
let usedNonces: web3.PublicKey;
let selfAuthority: web3.PublicKey;
let eventAuthority: web3.PublicKey;
const firstNonce = 1;
const attestation = Buffer.alloc(0);
let nonce = firstNonce;
let nonce = 0;
let remainingAccounts: web3.AccountMeta[];
const cctpMessageversion = 0;
let destinationCaller = new web3.PublicKey(new Uint8Array(32)); // We don't use permissioned caller.
Expand Down Expand Up @@ -57,10 +56,15 @@ describe("svm_spoke.handle_receive_message", () => {
[Buffer.from("message_transmitter")],
messageTransmitterProgram.programId
);
[usedNonces] = web3.PublicKey.findProgramAddressSync(
[Buffer.from("used_nonces"), Buffer.from(remoteDomain.toString()), Buffer.from(firstNonce.toString())],
messageTransmitterProgram.programId
);
usedNonces = await messageTransmitterProgram.methods
.getNoncePda({
nonce: new BN(nonce.toString()),
sourceDomain: remoteDomain.toNumber(),
})
.accounts({
messageTransmitter: messageTransmitterState,
})
.view();
[selfAuthority] = web3.PublicKey.findProgramAddressSync([Buffer.from("self_authority")], program.programId);
[eventAuthority] = web3.PublicKey.findProgramAddressSync([Buffer.from("__event_authority")], program.programId);

Expand Down Expand Up @@ -145,10 +149,15 @@ describe("svm_spoke.handle_receive_message", () => {

it("Block Wrong Source Domain", async () => {
const sourceDomain = 666;
[receiveMessageAccounts.usedNonces] = web3.PublicKey.findProgramAddressSync(
[Buffer.from("used_nonces"), Buffer.from(sourceDomain.toString()), Buffer.from(firstNonce.toString())],
messageTransmitterProgram.programId
);
receiveMessageAccounts.usedNonces = await messageTransmitterProgram.methods
.getNoncePda({
nonce: new BN(nonce.toString()),
sourceDomain,
})
.accounts({
messageTransmitter: messageTransmitterState,
})
.view();

const calldata = ethereumIface.encodeFunctionData("pauseDeposits", [true]);
const messageBody = Buffer.from(calldata.slice(2), "hex");
Expand Down

0 comments on commit 250d1e5

Please sign in to comment.