text stringlengths 269 30.6k |
|---|
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```use borsh::{
BorshDeserialize,
BorshSerialize,
};
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, PartialEq)]
pub struct Message {
/// Messenger/DM username.
pub nick: String,
/// Message... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn update_indexes(&mut self, clock: &Clock) -> MangoResult<()> {
let curr_ts = clock.unix_timestamp as u64;
for i in 0..NUM_TOKENS {
let interest_ra... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```fn invoke_cancel_orders<'a>(
open_orders_acc: &AccountInfo<'a>,
dex_prog_acc: &AccountInfo<'a>,
spot_market_acc: &AccountInfo<'a>,
bids_acc: &AccountInfo<'a>,
asks_acc: &AccountInfo<'a>,
signer_... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```use anchor_lang::prelude::*;
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod closing_accounts_insecure {
use super::*;
pub fn close(ctx: Context<Close>) -> ProgramResult {
... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn select_weighted_random(
&mut self,
rand: u16,
weight_sum: u64,
) -> Result<(u32, u32, u32), ProgramError> {
let selected = self.weights.last().unwrap();
let mut bound ... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn add_pack_voucher(&mut self) -> Result<(), ProgramError> {
self.pack_vouchers += self.pack_vouchers.error_increment()?;
Ok(())
}```. [/INST] Yes, it contains a vulnerability. It is classified ... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn select_weighted_random(
&mut self,
rand: u16,
weight_sum: u64,
) -> Result<(u32, u32, u32), ProgramError> {
let selected = self.weights.last().unwrap();
let mut bound ... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn delete_pack_config(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let pack_set_account = next_account_info(account_info_iter)?;
let pa... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn clean_up(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let pack_set_info = next_account_info(account_info_iter)?;
let pack_config_inf... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn request_card_for_redeem(
program_id: &Pubkey,
accounts: &[AccountInfo],
args: RequestCardToRedeemArgs,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let pack_set_account ... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn get_proving_process_data<'a>(
program_id: &Pubkey,
account_info: &AccountInfo<'a>,
user_wallet: &AccountInfo<'a>,
user_token: &Option<&AccountInfo<'a>>,
voucher_mint: &AccountInfo<'a>,
pa... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn edit_pack(
_program_id: &Pubkey,
accounts: &[AccountInfo],
args: EditPackSetArgs,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let pack_set_account = next_account_info(a... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn delete_pack(_program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let pack_set_account = next_account_info(account_info_iter)?;
let authorit... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn transfer_authority(_program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let pack_set_account = next_account_info(account_info_iter)?;
let a... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn claim_pack(
program_id: &Pubkey,
accounts: &[AccountInfo],
args: ClaimPackArgs,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let pack_set_account = next_account_info(acc... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn close_pack(_program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let pack_set_account = next_account_info(account_info_iter)?;
let authority... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn deactivate_pack(_program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let pack_set_account = next_account_info(account_info_iter)?;
let auth... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn activate_pack(_program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let pack_set_account = next_account_info(account_info_iter)?;
let author... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn assert_initialized<T: Pack + IsInitialized>(
account_info: &AccountInfo,
) -> Result<T, ProgramError> {
let account: T = T::unpack_unchecked(&account_info.data.borrow())?;
if !account.is_initialized(... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn lamports(&self) -> u64 {
**self.lamports.borrow()
}```. [/INST] Yes, it contains a vulnerability. It is classified as Missing Key Check and is related to the code:`self.lamports.borrow()`. In SWC it ... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn init_pack(
_program_id: &Pubkey,
accounts: &[AccountInfo],
args: InitPackSetArgs,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let pack_set_account = next_account_info(a... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub struct ClaimPackArgs {
pub index: u32,
}
pub struct RequestCardToRedeemArgs {
pub index: u32,
}
pub struct AddCardToPackArgs {
pub max_supply: u32,
pub weight: u16,
... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub struct RequestCardToRedeemArgs {
pub index: u32,
}
pub struct AddCardToPackArgs {
pub max_supply: u32,
pub weight: u16,
pub index: u32,
}```. [/INST] Yes, it contains a vulner... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub struct PackVoucher {
pub account_type: AccountType,
pub pack_set: Pubkey,
pub master: Pubkey,
pub metadata: Pubkey,
}
pub struct PackCard {
pub account_type: AccountT... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```//! Proxy program for interacting with the token mint.
#![deny(rustdoc::all)]
#![allow(rustdoc::missing_doc_code_examples)]
#[macro_use]
mod macros;
use anchor_lang::prelude::*;
use anchor_spl::token::Token;
use anch... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```use anchor_lang::prelude::*;
use anchor_lang::solana_program::sysvar;
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod secure {
use super::*;
pub fn check_sysvar_address(ctx: Co... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn assert_initialized<T: Pack + IsInitialized>(
account_info: &AccountInfo,
) -> Result<T, ProgramError> {
let account: T = T::unpack_unchecked(&account_info.data.borrow())?;
if !account.is_initialized(... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```use poc_framework::{solana_transaction_status::EncodedConfirmedTransaction, PrintableTransaction};
pub fn assert_tx_success(tx: EncodedConfirmedTransaction) -> EncodedConfirmedTransaction {
match &tx.transaction.m... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```#![deny(unused_results)]
pub use chain::*;
pub use error::*;
pub use vaa::*;
pub mod chain;
pub mod vaa;
#[macro_use]
pub mod error;
/// Helper method that attempts to parse and truncate UTF-8 from a byte stream.... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```// #![feature(const_generics)]
#![allow(non_upper_case_globals)]
#![allow(incomplete_features)]
pub mod api;
use solitaire::*;
#[cfg(feature = "no-entrypoint")]
pub mod instructions;
pub use api::{
post_message... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub rewarder: Account<'info, Rewarder>,
/// [Rewarder] of mines.
#[account(
init,
seeds = [
b"QuarryRegistry".as_ref(),
rewarder.key().to_bytes().as_ref()
],
... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub struct User {
authority: Pubkey,
}
pub struct Metadata {
account: Pubkey,
}
Accounts```. [/INST] Yes, it contains a vulnerability. It is classified as Type Confusion and is related to the code:`pub st... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn close_account(
pda_to_close: &mut AccountInfo,
sol_destination: &mut AccountInfo,
) -> Result<()> {
let dest_starting_lamports = sol_destination.lamports();
**sol_destination.lamports.borrow... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```//! Delegates Quarry Rewarder authority roles.
#![deny(rustdoc::all)]
#![allow(rustdoc::missing_doc_code_examples)]
use anchor_lang::prelude::*;
use quarry_mine::{Quarry, Rewarder};
use vipers::unwrap_int;
use vipers:... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```//! Program for redeeming IOU tokens for an underlying token.
#![deny(rustdoc::all)]
#![allow(rustdoc::missing_doc_code_examples)]
use anchor_lang::prelude::*;
use anchor_spl::token::Token;
use anchor_spl::token::{Min... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub struct User {
authority: Pubkey,
}
Accounts```. [/INST] Yes, it contains a vulnerability. It is classified as Type Confusion and is related to the code:`pub struct User {
authority: Pubkey,
}
Accounts... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```//! Anchor-compatible SDK for the StableSwap program.
#![deny(missing_docs)]
#![deny(rustdoc::all)]
#![allow(rustdoc::missing_doc_code_examples)]
#![allow(clippy::nonstandard_macro_braces)]
mod accounts;
mod instructi... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```fn withdraw(program_id: &Pubkey, accounts: &[AccountInfo], amount: u64) -> ProgramResult {
msg!("withdraw {}", amount);
let account_info_iter = &mut accounts.iter();
let wallet_info = next_account_info(acco... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```fn withdraw(program_id: &Pubkey, accounts: &[AccountInfo], amount: u64) -> ProgramResult {
msg!("withdraw {}", amount);
let account_info_iter = &mut accounts.iter();
let wallet_info = next_account_info(acco... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```use anchor_lang::prelude::*;
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod signer_authorization_insecure {
use super::*;
pub fn log_message(ctx: Context<LogMessage>) -> Progr... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn init_selling_resource<'info>(
ctx: Context<'_, '_, '_, 'info, InitSellingResource<'info>>,
_master_edition_bump: u8,
_vault_owner_bump: u8,
max_supply: Option<u64>,
) -> Progr... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn claim_resource<'info>(
ctx: Context<'_, '_, '_, 'info, ClaimResource<'info>>,
vault_owner_bump: u8,
) -> ProgramResult {
let market = &ctx.accounts.market;
let selling_resourc... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```fn withdraw(_program_id: &Pubkey, accounts: &[AccountInfo], amount: u64) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let wallet_info = next_account_info(account_info_iter)?;
let vault_i... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```fn withdraw(_program_id: &Pubkey, accounts: &[AccountInfo], amount: u64) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let wallet_info = next_account_info(account_info_iter)?;
let vault_i... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```fn deposit(_program_id: &Pubkey, accounts: &[AccountInfo], amount: u64) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let wallet_info = next_account_info(account_info_iter)?;
let vault_in... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn read_vaa(vaa: &AccountInfo) -> Result<PostedVAAData, WormholeError> {
Ok(PostedVAAData::try_from_slice(&vaa.data.borrow())
.map_err(|_| WormholeError::DeserializeFailed)?)
}```. [/INST] Yes, it contai... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn read_config(config: &AccountInfo) -> Result<BridgeConfig, WormholeError> {
let bridge_data = BridgeData::try_from_slice(&config.data.borrow())
.map_err(|_| WormholeError::DeserializeFailed)?;
Ok(... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn lamports(&self) -> u64 {
**self.lamports.borrow()
}```. [/INST] Yes, it contains a vulnerability. It is classified as Missing Key Check and is related to the code:`self.lamports.borrow()`. In SWC it ... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn process_set_authority(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let vault_info = next_account_info(account_info_iter)?;
let curre... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn process_update_external_price_account(
_: &Pubkey,
accounts: &[AccountInfo],
price_per_share: u64,
price_mint: Pubkey,
allowed_to_combine: bool,
) -> ProgramResult {
let account_info_iter... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn assert_initialized<T: Pack + IsInitialized>(
account_info: &AccountInfo,
) -> Result<T, ProgramError> {
let account: T = T::unpack_unchecked(&account_info.data.borrow())?;
if !account.is_initialized(... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub struct AmountArgs {
pub amount: u64,
}
pub struct NumberOfShareArgs {
pub number_of_shares: u64,
}
pub struct MintEditionProxyArgs {
pub edition: u64,
}```. [/INST] Yes, it contains a vulnerabilit... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub struct NumberOfShareArgs {
pub number_of_shares: u64,
}
pub struct MintEditionProxyArgs {
pub edition: u64,
}```. [/INST] Yes, it contains a vulnerability. It is classified as Type Confusion and is relat... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```// #![feature(const_generics)]
#![feature(adt_const_params)]
#![feature(const_generics_defaults)]
#![allow(warnings)]
//! Client-specific code
pub use solana_program::pubkey::Pubkey;
use solana_program::sysvar::Sysva... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn lamports(&self) -> u64 {
**self.lamports.borrow()
}```. [/INST] Yes, it contains a vulnerability. It is classified as Missing Key Check and is related to the code:`self.lamports.borrow()`. In SWC it ... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```use solana_program::{
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
pubkey::Pubkey,
};
entrypoint!(process_instruction);
pub fn process_instruction(
_program_id: &Pubkey,
_accounts... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub mod account;
pub mod errors;
pub mod try_math;
pub mod util;
pub use account::*;
pub use try_math::*;
pub use util::*;
// intentionally uncommented, otherwise leads to weird Result<> errors
// pub use errors::*; ... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn process_cancel_subscription(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let signer_info = next_account_info(account_info_iter)?;
l... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn process_renew_subscription(
program_id: &Pubkey,
accounts: &[AccountInfo],
quantity: i64,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let signer_info = next_account_in... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn process_subscribe(
program_id: &Pubkey,
accounts: &[AccountInfo],
name: String,
maybe_data: Option<String>,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let signer_... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn process_withdraw_payment(
program_id: &Pubkey,
accounts: &[AccountInfo],
close_order_account: bool,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let signer_info = next_a... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn get_amounts(amount: u64, fee_percentage: u128) -> (u64, u64) {
let mut fee_amount: u64 = 0;
let mut take_home_amount: u64 = amount;
if amount >= 100 {
let possible_fee_amount: u128 = (amount... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn lamports(&self) -> u64 {
**self.lamports.borrow()
}```. [/INST] Yes, it contains a vulnerability. It is classified as Missing Key Check and is related to the code:`self.lamports.borrow()`. In SWC it ... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn process_cancel_subscription(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let signer_info = next_account_info(account_info_iter)?;
l... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn process_cancel_subscription(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let signer_info = next_account_info(account_info_iter)?;
l... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn process_withdraw_payment(
program_id: &Pubkey,
accounts: &[AccountInfo],
close_order_account: bool,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let signer_info = next_a... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn create_program_owned_associated_token_account(
program_id: &Pubkey,
accounts: &[AccountInfo; 8],
rent: &Rent,
) -> ProgramResult {
let signer_info = &accounts[0];
let base_account_info = &acc... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn process_order(
program_id: &Pubkey,
accounts: &[AccountInfo],
amount: u64,
order_id: String,
secret: String,
maybe_data: Option<String>,
checkout_items: Option<OrderItems>,
) -> Progr... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub fn process_order(
program_id: &Pubkey,
accounts: &[AccountInfo],
amount: u64,
order_id: String,
secret: String,
maybe_data: Option<String>,
checkout_items: Option<OrderItems>,
) -> Progr... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```use borsh::{
BorshDeserialize,
BorshSerialize,
};
use cosmwasm_std::{
entry_point,
DepsMut,
Env,
MessageInfo,
Response,
StdError,
StdResult,
};
use wormhole_sdk::{
parse_vaa,
... |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```pub mod native_account_data;
pub mod native_processor;
pub mod native_stable_swap;
pub mod native_token; ```. [/INST] No, it does not contain any vulnerabilities. </s> |
<s> [INST] Can you check if the following smart contract written in Rust contains a vulnerability? ```use anchor_lang::prelude::*;
use anchor_spl::token::{self, Token, TokenAccount};
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod pda_sharing_insecure {
use super::*;
pub fn wi... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 4