forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: deplete compute meter for vm errors (#3751)
* feat: deplete compute meter for vm errors * add tests * rekey apply_cost_tracker_during_replay (cherry picked from commit b120fc1) # Conflicts: # programs/sbf/tests/programs.rs # sdk/src/feature_set.rs
- Loading branch information
Showing
7 changed files
with
568 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "solana-sbf-rust-divide-by-zero" | ||
version = { workspace = true } | ||
description = { workspace = true } | ||
authors = { workspace = true } | ||
repository = { workspace = true } | ||
homepage = { workspace = true } | ||
license = { workspace = true } | ||
edition = { workspace = true } | ||
|
||
[dependencies] | ||
solana-program = { workspace = true } | ||
|
||
[lib] | ||
crate-type = ["cdylib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//! Example/test program to trigger vm error by dividing by zero | ||
#![feature(asm_experimental_arch)] | ||
|
||
extern crate solana_program; | ||
use { | ||
solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}, | ||
std::arch::asm, | ||
}; | ||
|
||
solana_program::entrypoint_no_alloc!(process_instruction); | ||
fn process_instruction( | ||
_program_id: &Pubkey, | ||
_accounts: &[AccountInfo], | ||
_instruction_data: &[u8], | ||
) -> ProgramResult { | ||
unsafe { | ||
asm!( | ||
" | ||
mov64 r0, 0 | ||
mov64 r1, 0 | ||
div64 r0, r1 | ||
" | ||
); | ||
} | ||
Ok(()) | ||
} |
Oops, something went wrong.