Skip to content

fix(svm): N-01 remove v3 from remaining functions and comments #964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion programs/svm-spoke/src/instructions/deposit.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Note: The `svm-spoke` does not support `speedUpV3Deposit` and `fillV3RelayWithUpdatedDeposit` due to cryptographic
// Note: The `svm-spoke` does not support `speedUpDeposit` and `fillRelayWithUpdatedDeposit` due to cryptographic
// incompatibilities between Solana (Ed25519) and Ethereum (ECDSA secp256k1). Specifically, Solana wallets cannot
// generate ECDSA signatures required for Ethereum verification. As a result, speed-up functionality on Solana is not
// implemented. For more details, refer to the documentation: https://docs.across.to
Expand Down
16 changes: 8 additions & 8 deletions scripts/svm/fakeFillWithRandomDistribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const argv = yargs(hideBin(process.argv))
.option("distributionCount", { type: "number", demandOption: false, describe: "Distribution count" })
.option("bufferParams", { type: "boolean", demandOption: false, describe: "Use buffer account for params" }).argv;

async function fillV3RelayToRandom(): Promise<void> {
async function fillRelayToRandom(): Promise<void> {
const resolvedArgv = await argv;
const depositor = new PublicKey(resolvedArgv.depositor);
const handler = new PublicKey(resolvedArgv.handler);
Expand Down Expand Up @@ -129,7 +129,7 @@ async function fillV3RelayToRandom(): Promise<void> {
message: encodedMessage,
};

console.log("Filling V3 Relay with handler...");
console.log("Filling Relay with handler...");

// Define the state account PDA
const [statePda] = PublicKey.findProgramAddressSync(
Expand Down Expand Up @@ -183,11 +183,11 @@ async function fillV3RelayToRandom(): Promise<void> {
);

// Prepare fill instruction as we will need to use Address Lookup Table (ALT).
const fillV3RelayValues: FillDataValues = [relayHash, relayData, repaymentChain, repaymentAddress];
const fillRelayValues: FillDataValues = [relayHash, relayData, repaymentChain, repaymentAddress];
if (bufferParams) {
await loadFillRelayParams(program, signer, fillV3RelayValues[1], fillV3RelayValues[2], fillV3RelayValues[3]);
await loadFillRelayParams(program, signer, fillRelayValues[1], fillRelayValues[2], fillRelayValues[3]);
}
const fillV3RelayParams: FillDataParams = bufferParams ? [fillV3RelayValues[0], null, null, null] : fillV3RelayValues;
const fillRelayParams: FillDataParams = bufferParams ? [fillRelayValues[0], null, null, null] : fillRelayValues;
const [instructionParams] = bufferParams
? PublicKey.findProgramAddressSync(
[Buffer.from("instruction_params"), signer.publicKey.toBuffer()],
Expand All @@ -213,7 +213,7 @@ async function fillV3RelayToRandom(): Promise<void> {
...multicallHandlerCoder.compiledKeyMetas,
];
const fillInstruction = await program.methods
.fillRelay(...fillV3RelayParams)
.fillRelay(...fillRelayParams)
.accounts(fillAccounts)
.remainingAccounts(remainingAccounts)
.instruction();
Expand All @@ -228,5 +228,5 @@ async function fillV3RelayToRandom(): Promise<void> {
console.log("Transaction signature:", txSignature);
}

// Run the fillV3RelayToRandom function
fillV3RelayToRandom();
// Run the fillRelayToRandom function
fillRelayToRandom();
2 changes: 1 addition & 1 deletion scripts/svm/nativeDeposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async function nativeDeposit(): Promise<void> {
const userTokenAccountInfo = await provider.connection.getAccountInfo(userTokenAccount);
const existingTokenAccount = userTokenAccountInfo !== null && userTokenAccountInfo.owner.equals(TOKEN_PROGRAM_ID);

console.log("Depositing V3...");
console.log("Depositing...");
console.table([
{ property: "seed", value: seed.toString() },
{ property: "recipient", value: recipient.toString() },
Expand Down
6 changes: 3 additions & 3 deletions scripts/svm/queryEventsV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const argvPromise = yargs(hideBin(process.argv))
describe: "Name of the event to query",
choices: [
"any",
"FilledV3Relay",
"V3FundsDeposited",
"FilledRelay",
"FundsDeposited",
"EnabledDepositRoute",
"RelayedRootBundle",
"ExecutedRelayerRefundRoot",
Expand All @@ -27,7 +27,7 @@ const argvPromise = yargs(hideBin(process.argv))
"PausedFills",
"SetXDomainAdmin",
"EmergencyDeletedRootBundle",
"RequestedV3SlowFill",
"RequestedSlowFill",
"ClaimedRelayerRefund",
"TokensBridged",
],
Expand Down
4 changes: 2 additions & 2 deletions scripts/svm/simpleDeposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async function deposit(): Promise<void> {
ASSOCIATED_TOKEN_PROGRAM_ID
);

console.log("Depositing V3...");
console.log("Depositing...");
console.table([
{ property: "seed", value: seed.toString() },
{ property: "recipient", value: recipient.toString() },
Expand Down Expand Up @@ -144,5 +144,5 @@ async function deposit(): Promise<void> {
console.log("Transaction signature:", tx);
}

// Run the depositV3 function
// Run the deposit function
deposit();
2 changes: 1 addition & 1 deletion scripts/svm/simpleFakeRelayerRepayment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async function testBundleLogic(): Promise<void> {

const tokenDecimals = (await getMint(provider.connection, inputToken, undefined, TOKEN_PROGRAM_ID)).decimals;

// Use program.methods.depositV3 to send tokens to the spoke. note this is NOT a valid deposit, we just want to
// Use program.methods.deposit to send tokens to the spoke. note this is NOT a valid deposit, we just want to
// seed tokens into the spoke to test repayment.

// Delegate state PDA to pull depositor tokens.
Expand Down
4 changes: 2 additions & 2 deletions scripts/svm/simpleFill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async function fillRelay(): Promise<void> {
// Define the signer (replace with your actual signer)
const signer = (provider.wallet as anchor.Wallet).payer;

console.log("Filling V3 Relay...");
console.log("Filling Relay...");

// Define the state account PDA
const [statePda, _] = PublicKey.findProgramAddressSync(
Expand Down Expand Up @@ -184,5 +184,5 @@ async function fillRelay(): Promise<void> {
console.log("Transaction signature:", tx);
}

// Run the fillV3Relay function
// Run the fillRelay function
fillRelay();
8 changes: 4 additions & 4 deletions test/svm/SvmSpoke.Deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe("svm_spoke.deposit", () => {
assertSE(u8Array32ToInt(event.depositId), 1, `depositId should recover to 1`);
assertSE(u8Array32ToBigNumber(event.depositId), BigNumber.from(1), `depositId should recover to 1`);

// Execute the second deposit_v3 call
// Execute the second deposit call
const tx2 = await approvedDeposit(depositDataValues);
events = await readEventsUntilFound(connection, tx2, [program]);
event = events[0].data; // 0th event is the latest event.
Expand Down Expand Up @@ -314,11 +314,11 @@ describe("svm_spoke.deposit", () => {
}
});

it("depositV3Now behaves as deposit but forces the quote timestamp as expected", async () => {
it("depositNow behaves as deposit but forces the quote timestamp as expected", async () => {
// Set up initial deposit data. Note that this method has a slightly different interface to deposit, using
// fillDeadlineOffset rather than fillDeadline. current chain time is added to fillDeadlineOffset to set the
// fillDeadline for the deposit. exclusivityPeriod operates the same as in standard deposit.
// Equally, depositV3Now does not have `quoteTimestamp`. this is set to the current time from the program.
// Equally, depositNow does not have `quoteTimestamp`. this is set to the current time from the program.
const fillDeadlineOffset = 60; // 60 seconds offset

// Delegate state PDA to pull depositor tokens.
Expand Down Expand Up @@ -497,7 +497,7 @@ describe("svm_spoke.deposit", () => {
tokenProgram
);

// Create the transaction for unsafeDepositV3
// Create the transaction for unsafeDeposit
const unsafeDepositIx = await program.methods
.unsafeDeposit(
depositData.depositor!,
Expand Down
10 changes: 4 additions & 6 deletions test/svm/SvmSpoke.Fill.AcrossPlus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,17 @@ describe("svm_spoke.fill.across_plus", () => {
const relayHash = Array.from(calculateRelayHashUint8Array(relayData, chainId));

// Prepare fill instruction.
const fillV3RelayValues: FillDataValues = [relayHash, relayData, new BN(1), relayer.publicKey];
const fillRelayValues: FillDataValues = [relayHash, relayData, new BN(1), relayer.publicKey];
if (bufferParams) {
await loadFillRelayParams(program, relayer, fillV3RelayValues[1], fillV3RelayValues[2], fillV3RelayValues[3]);
await loadFillRelayParams(program, relayer, fillRelayValues[1], fillRelayValues[2], fillRelayValues[3]);
[accounts.instructionParams] = PublicKey.findProgramAddressSync(
[Buffer.from("instruction_params"), relayer.publicKey.toBuffer()],
program.programId
);
}
const fillV3RelayParams: FillDataParams = bufferParams
? [fillV3RelayValues[0], null, null, null]
: fillV3RelayValues;
const fillRelayParams: FillDataParams = bufferParams ? [fillRelayValues[0], null, null, null] : fillRelayValues;
const fillIx = await program.methods
.fillRelay(...fillV3RelayParams)
.fillRelay(...fillRelayParams)
.accounts(accounts)
.remainingAccounts(remainingAccounts)
.instruction();
Expand Down
22 changes: 11 additions & 11 deletions test/svm/SvmSpoke.Fill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ describe("svm_spoke.fill", () => {
updateRelayData(initialRelayData);
});

it("Fills a V3 relay and verifies balances", async () => {
it("Fills a relay and verifies balances", async () => {
// Verify recipient's balance before the fill
let recipientAccount = await getAccount(connection, recipientTA);
assertSE(recipientAccount.amount, "0", "Recipient's balance should be 0 before the fill");
Expand Down Expand Up @@ -206,7 +206,7 @@ describe("svm_spoke.fill", () => {
assertSE(event.relayer, otherRelayer.publicKey, "Repayment address should match");
});

it("Fails to fill a V3 relay after the fill deadline", async () => {
it("Fails to fill a relay after the fill deadline", async () => {
updateRelayData({ ...relayData, fillDeadline: Math.floor(Date.now() / 1000) - 69 }); // 69 seconds ago

const relayHash = Array.from(calculateRelayHashUint8Array(relayData, chainId));
Expand All @@ -218,7 +218,7 @@ describe("svm_spoke.fill", () => {
}
});

it("Fails to fill a V3 relay by non-exclusive relayer before exclusivity deadline", async () => {
it("Fails to fill a relay by non-exclusive relayer before exclusivity deadline", async () => {
accounts.signer = otherRelayer.publicKey;
accounts.relayerTokenAccount = otherRelayerTA;

Expand Down Expand Up @@ -260,7 +260,7 @@ describe("svm_spoke.fill", () => {
);
});

it("Fails to fill a V3 relay with the same deposit data multiple times", async () => {
it("Fails to fill a relay with the same deposit data multiple times", async () => {
const relayHash = Array.from(calculateRelayHashUint8Array(relayData, chainId));

// First fill attempt
Expand All @@ -285,7 +285,7 @@ describe("svm_spoke.fill", () => {
systemProgram: anchor.web3.SystemProgram.programId,
};

// Execute the fill_v3_relay call
// Execute the fill_relay call
await approvedFillRelay([relayHash, relayData, new BN(1), relayer.publicKey]);

// Verify the fill PDA exists before closing
Expand Down Expand Up @@ -315,20 +315,20 @@ describe("svm_spoke.fill", () => {
assert.isNull(fillStatusAccountAfter, "Fill PDA should be closed after closing");
});

it("Fetches FillStatusAccount before and after fillV3Relay", async () => {
it("Fetches FillStatusAccount before and after fillRelay", async () => {
const relayHash = calculateRelayHashUint8Array(relayData, chainId);
const [fillStatusPDA] = PublicKey.findProgramAddressSync([Buffer.from("fills"), relayHash], program.programId);

// Fetch FillStatusAccount before fillV3Relay
// Fetch FillStatusAccount before fillRelay
let fillStatusAccount = await program.account.fillStatusAccount.fetchNullable(fillStatusPDA);
assert.isNull(fillStatusAccount, "FillStatusAccount should be uninitialized before fillV3Relay");
assert.isNull(fillStatusAccount, "FillStatusAccount should be uninitialized before fillRelay");

// Fill the relay
await approvedFillRelay([Array.from(relayHash), relayData, new BN(1), relayer.publicKey]);

// Fetch FillStatusAccount after fillV3Relay
// Fetch FillStatusAccount after fillRelay
fillStatusAccount = await program.account.fillStatusAccount.fetch(fillStatusPDA);
assert.isNotNull(fillStatusAccount, "FillStatusAccount should be initialized after fillV3Relay");
assert.isNotNull(fillStatusAccount, "FillStatusAccount should be initialized after fillRelay");
assert.equal(JSON.stringify(fillStatusAccount.status), `{\"filled\":{}}`, "FillStatus should be Filled");
assert.equal(fillStatusAccount.relayer.toString(), relayer.publicKey.toString(), "Caller should be set as relayer");
});
Expand Down Expand Up @@ -393,7 +393,7 @@ describe("svm_spoke.fill", () => {
}
});

it("Fills a V3 relay from custom relayer token account", async () => {
it("Fills a relay from custom relayer token account", async () => {
// Create and mint to custom relayer token account
const customKeypair = Keypair.generate();
const customRelayerTA = await createAccount(connection, payer, mint, relayer.publicKey, customKeypair);
Expand Down
4 changes: 2 additions & 2 deletions test/svm/SvmSpoke.SlowFill.AcrossPlus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ describe("svm_spoke.slow_fill.across_plus", () => {
program.programId
);
}
const requestV3SlowFillParams: RequestSlowFillDataParams = bufferParams
const requestSlowFillParams: RequestSlowFillDataParams = bufferParams
? [requestSlowFillValues[0], null]
: requestSlowFillValues;
const requestIx = await program.methods
.requestSlowFill(...requestV3SlowFillParams)
.requestSlowFill(...requestSlowFillParams)
.accounts(requestAccounts)
.instruction();

Expand Down
Loading
Loading