Skip to content

Commit 16c92dd

Browse files
refactor: use pubkey_eq in pinocchio
1 parent 6d01265 commit 16c92dd

File tree

24 files changed

+24
-24
lines changed

24 files changed

+24
-24
lines changed

src/app/content/challenges/pinocchio-flash-loan/de/pages/borrow.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'a> TryFrom<&'a [AccountInfo]> for LoanAccounts<'a> {
3232
return Err(ProgramError::NotEnoughAccountKeys);
3333
};
3434

35-
if instruction_sysvar.key() != &INSTRUCTIONS_ID {
35+
if !pubkey_eq(instruction_sysvar.key(), &INSTRUCTIONS_ID) {
3636
return Err(ProgramError::UnsupportedSysvar);
3737
}
3838

src/app/content/challenges/pinocchio-flash-loan/en/pages/borrow.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'a> TryFrom<&'a [AccountInfo]> for LoanAccounts<'a> {
3232
return Err(ProgramError::NotEnoughAccountKeys);
3333
};
3434

35-
if instruction_sysvar.key() != &INSTRUCTIONS_ID {
35+
if !pubkey_eq(instruction_sysvar.key(), &INSTRUCTIONS_ID) {
3636
return Err(ProgramError::UnsupportedSysvar);
3737
}
3838

src/app/content/challenges/pinocchio-flash-loan/fr/pages/borrow.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'a> TryFrom<&'a [AccountInfo]> for LoanAccounts<'a> {
3232
return Err(ProgramError::NotEnoughAccountKeys);
3333
};
3434

35-
if instruction_sysvar.key() != &INSTRUCTIONS_ID {
35+
if !pubkey_eq(instruction_sysvar.key(), &INSTRUCTIONS_ID) {
3636
return Err(ProgramError::UnsupportedSysvar);
3737
}
3838

src/app/content/challenges/pinocchio-flash-loan/id/pages/borrow.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'a> TryFrom<&'a [AccountInfo]> for LoanAccounts<'a> {
3232
return Err(ProgramError::NotEnoughAccountKeys);
3333
};
3434

35-
if instruction_sysvar.key() != &INSTRUCTIONS_ID {
35+
if !pubkey_eq(instruction_sysvar.key(), &INSTRUCTIONS_ID) {
3636
return Err(ProgramError::UnsupportedSysvar);
3737
}
3838

src/app/content/challenges/pinocchio-flash-loan/uk/pages/borrow.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'a> TryFrom<&'a [AccountInfo]> for LoanAccounts<'a> {
3232
return Err(ProgramError::NotEnoughAccountKeys);
3333
};
3434

35-
if instruction_sysvar.key() != &INSTRUCTIONS_ID {
35+
if !pubkey_eq(instruction_sysvar.key(), &INSTRUCTIONS_ID) {
3636
return Err(ProgramError::UnsupportedSysvar);
3737
}
3838

src/app/content/challenges/pinocchio-flash-loan/vi/pages/borrow.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'a> TryFrom<&'a [AccountInfo]> for LoanAccounts<'a> {
3232
return Err(ProgramError::NotEnoughAccountKeys);
3333
};
3434

35-
if instruction_sysvar.key() != &INSTRUCTIONS_ID {
35+
if !pubkey_eq(instruction_sysvar.key(), &INSTRUCTIONS_ID) {
3636
return Err(ProgramError::UnsupportedSysvar);
3737
}
3838

src/app/content/challenges/pinocchio-flash-loan/zh-CN/pages/borrow.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'a> TryFrom<&'a [AccountInfo]> for LoanAccounts<'a> {
3232
return Err(ProgramError::NotEnoughAccountKeys);
3333
};
3434

35-
if instruction_sysvar.key() != &INSTRUCTIONS_ID {
35+
if !pubkey_eq(instruction_sysvar.key(), &INSTRUCTIONS_ID) {
3636
return Err(ProgramError::UnsupportedSysvar);
3737
}
3838

src/app/content/challenges/pinocchio-flash-loan/zh-HK/pages/borrow.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'a> TryFrom<&'a [AccountInfo]> for LoanAccounts<'a> {
3232
return Err(ProgramError::NotEnoughAccountKeys);
3333
};
3434

35-
if instruction_sysvar.key() != &INSTRUCTIONS_ID {
35+
if !pubkey_eq(instruction_sysvar.key(), &INSTRUCTIONS_ID) {
3636
return Err(ProgramError::UnsupportedSysvar);
3737
}
3838

src/app/content/courses/instruction-introspection/introspection-with-pinocchio/de.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Wir können dann weitere programmspezifische Prüfungen basierend auf der Logik
5959
Wir können auch die Konten überprüfen, die in der analysierten Anweisung vorhanden sind. Dieser Schritt erfordert, dass wir die genaue Struktur der Kontostruktur kennen, da wir die Daten oder den öffentlichen Schlüssel eines Kontos an einem bestimmten Index abfragen werden, wie hier:
6060

6161
```rust
62-
if instruction.get_account_meta_at(0)?.key() != self.accounts.from.key() {
62+
if !pubkey_eq(instruction.get_account_meta_at(0)?.key(), self.accounts.from.key()) {
6363
return Err(ProgramError::InvalidAccountData);
6464
}
6565
```

src/app/content/courses/instruction-introspection/introspection-with-pinocchio/en.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ We can then perform more program-specific checks based on the logic of the instr
6060
We can also check the accounts present in the introspected instruction. This step requires us to know the exact structure of the account struct, since we'll be requesting the data or pubkey of an account at a specific index, like this:
6161

6262
```rust
63-
if instruction.get_account_meta_at(0)?.key() != self.accounts.from.key() {
63+
if !pubkey_eq(instruction.get_account_meta_at(0)?.key(), self.accounts.from.key()) {
6464
return Err(ProgramError::InvalidAccountData);
6565
}
6666
```

0 commit comments

Comments
 (0)