Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
326 changes: 184 additions & 142 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ resolver = "2"
[workspace.dependencies]
actix-cors = "0.7.0"
actix-web = { version = "4", default-features = false }
agave-feature-set = { version = "3.1", default-features = false }
agave-feature-set = { version = "3.1.9", default-features = false }
agave-geyser-plugin-interface = { version = "3.1", default-features = false }
agave-reserved-account-keys = { version = "3.1", default-features = false }
anchor-lang-idl = "0.1.2"
Expand Down
1 change: 1 addition & 0 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ ratatui = { workspace = true }
rust-embed = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
agave-feature-set = { workspace = true }
solana-clock = { workspace = true }
solana-commitment-config = { workspace = true }
solana-epoch-info = { workspace = true }
Expand Down
43 changes: 19 additions & 24 deletions crates/cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use surfpool_types::{
DEFAULT_DEVNET_RPC_URL, DEFAULT_GOSSIP_PORT, DEFAULT_MAINNET_RPC_URL, DEFAULT_NETWORK_HOST,
DEFAULT_RPC_PORT, DEFAULT_SLOT_TIME_MS, DEFAULT_TESTNET_RPC_URL, DEFAULT_TPU_PORT,
DEFAULT_TPU_QUIC_PORT, DEFAULT_WS_PORT, RpcConfig, SimnetConfig, SimnetEvent, StudioConfig,
SubgraphConfig, SurfpoolConfig, SvmFeature, SvmFeatureConfig,
SubgraphConfig, SurfpoolConfig, SvmFeatureConfig, parse_feature_pubkey,
};
use txtx_cloud::LoginCommand;
use txtx_core::manifest::WorkspaceManifest;
Expand Down Expand Up @@ -235,13 +235,17 @@ pub struct StartSimnet {
/// Path to the Test.toml test suite files to load (eg. surfpool start --anchor-test-config-path ./path/to/Test.toml)
#[arg(long = "anchor-test-config-path")]
pub anchor_test_config_paths: Vec<String>,
/// Enable specific SVM features. Can be specified multiple times. (eg. surfpool start --feature enable-loader-v4 --feature enable-sbpf-v2-deployment-and-execution)
#[arg(long = "feature", short = 'f', value_parser = parse_svm_feature)]
pub features: Vec<SvmFeature>,
/// Disable specific SVM features. Can be specified multiple times. (eg. surfpool start --disable-feature disable-fees-sysvar)
#[arg(long = "disable-feature", value_parser = parse_svm_feature)]
pub disable_features: Vec<SvmFeature>,
/// Enable all SVM features (override mainnet defaults which are used by default)
/// Enable specific SVM features by pubkey. Can be specified multiple times. (eg. surfpool start --feature <base58-pubkey> --feature <another-pubkey>)
/// Note: providing feature names has been deprecated. Previously supported feature names will still work, but this will be dropped in the future.
/// Instead, you should migrate to providing the pubkey for the feature.
#[arg(long = "feature", short = 'f', value_parser = parse_feature_pubkey)]
pub features: Vec<Pubkey>,
/// Disable specific SVM features by pubkey. Can be specified multiple times. (eg. surfpool start --disable-feature <base58-pubkey> --disable-feature <another-pubkey>)
/// Note: providing feature names has been deprecated. Previously supported feature names will still work, but this will be dropped in the future.
/// Instead, you should migrate to providing the pubkey for the feature.
#[arg(long = "disable-feature", value_parser = parse_feature_pubkey)]
pub disable_features: Vec<Pubkey>,
/// Enable all SVM features from agave-feature-set (override mainnet defaults)
#[clap(long = "features-all", action=ArgAction::SetTrue, default_value = "false")]
pub all_features: bool,
/// A set of inputs to use for the runbook (eg. surfpool start --runbook-input myInputs.json)
Expand All @@ -265,15 +269,6 @@ pub struct StartSimnet {
pub skip_signature_verification: bool,
}

fn parse_svm_feature(s: &str) -> Result<SvmFeature, String> {
SvmFeature::from_str(s).map_err(|_| {
format!(
"Unknown SVM feature: '{}'. Use --help to see available features.",
s
)
})
}

#[derive(clap::ValueEnum, PartialEq, Clone, Debug)]
pub enum NetworkType {
/// Solana Mainnet-Beta (https://api.mainnet-beta.solana.com)
Expand Down Expand Up @@ -369,10 +364,10 @@ impl StartSimnet {

pub fn feature_config(&self) -> SvmFeatureConfig {
let mut config = if self.all_features {
// Enable all SVM features (override mainnet defaults)
// Enable all SVM features from agave-feature-set (override mainnet defaults)
let mut cfg = SvmFeatureConfig::default();
for feature in SvmFeature::all() {
cfg = cfg.enable(feature);
for pubkey in agave_feature_set::FEATURE_NAMES.keys() {
cfg = cfg.enable(*pubkey);
}
cfg
} else {
Expand All @@ -381,13 +376,13 @@ impl StartSimnet {
};

// Apply explicit enables (these override defaults)
for feature in &self.features {
config = config.enable(*feature);
for pubkey in &self.features {
config = config.enable(*pubkey);
}

// Apply explicit disables (these override defaults)
for feature in &self.disable_features {
config = config.disable(*feature);
for pubkey in &self.disable_features {
config = config.disable(*pubkey);
}

config
Expand Down
20 changes: 13 additions & 7 deletions crates/core/src/surfnet/locker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,15 @@ impl SurfnetSvmLocker {

if result.is_none() {
return match svm_reader.get_account_from_feature_set(pubkey) {
Some(account) => GetAccountResult::FoundAccount(
*pubkey, account,
// mark as not an account that should be updated in the SVM, since this is a local read and it already exists
false,
),
Some(account) => {
GetAccountResult::FoundAccount(
*pubkey, account,
// mark this as an account to insert into the SVM, since the feature is activated and LiteSVM doesn't
// automatically insert activated feature accounts
// TODO: mark as false once https://github.com/LiteSVM/litesvm/pull/308 is released
true,
)
}
None => GetAccountResult::None(*pubkey),
};
} else {
Expand Down Expand Up @@ -326,8 +330,10 @@ impl SurfnetSvmLocker {
result = match svm_reader.get_account_from_feature_set(pubkey) {
Some(account) => GetAccountResult::FoundAccount(
*pubkey, account,
// mark as not an account that should be updated in the SVM, since this is a local read and it already exists
false,
// mark this as an account to insert into the SVM, since the feature is activated and LiteSVM doesn't
// automatically insert activated feature accounts
// TODO: mark as false once https://github.com/LiteSVM/litesvm/pull/308 is released
true,
),
None => GetAccountResult::None(*pubkey),
}
Expand Down
5 changes: 4 additions & 1 deletion crates/core/src/surfnet/surfnet_lite_svm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ impl SurfnetLiteSvm {
self.svm = LiteSVM::new()
.with_blockhash_check(false)
.with_sigverify(false)
.with_feature_set(feature_set);
.with_feature_set(feature_set)
.with_builtins()
.with_sysvars()
.with_default_programs();

create_native_mint(self);
self
Expand Down
Loading
Loading