Skip to content

feat(sdk-node): expose feature-gate config in Node SDK#653

Open
amilz wants to merge 2 commits into
solana-foundation:mainfrom
amilz:feat(sdk)/add-feature-gate
Open

feat(sdk-node): expose feature-gate config in Node SDK#653
amilz wants to merge 2 commits into
solana-foundation:mainfrom
amilz:feat(sdk)/add-feature-gate

Conversation

@amilz
Copy link
Copy Markdown
Contributor

@amilz amilz commented May 11, 2026

Summary

Closes DEV-526.

  • Adds enableFeatures, disableFeatures, and allFeatures to the napi SurfnetConfig, parsed via the existing parse_feature_pubkey() helper (kebab-case name, snake_case name, or base58 pubkey).
  • Threads through new SurfnetBuilder::{enable_feature, disable_feature, feature_config} methods into SVM init.
  • Builder default now seeds SvmFeatureConfig::default_mainnet_features() so single-feature overrides layer on a mainnet baseline instead of flipping every gate on (matches CLI semantics — previously, .enable_feature(X) would activate every known gate, not just X).
  • Bumps @solana/surfpool to 1.3.0.

Usage

import { Surfnet } from '@solana/surfpool';

// Enable v1 transactions (SIMD-0385) on top of the mainnet feature baseline.
const surfnet = Surfnet.startWithConfig({
  enableFeatures: ['enable-loader-v4'],
  // Optional: also accepts base58 pubkeys, snake_case names,
  // or a top-level `allFeatures: true` to flip every known gate on.
});

console.log(surfnet.rpcUrl);
// ...send a versioned transaction, etc.

Unknown feature names reject at startup with an InvalidArg error listing the available gates.

Test plan

  • cargo test -p surfpool-types --lib features — 22/22 pass
  • cargo test -p surfpool-sdk --lib — 19/19 pass
  • cd crates/sdk-node && npm run build && npm test — 6/6 pass (incl. new feature-gate case + invalid-name rejection)
  • Follow-up: bump surfpool-sdk dep in @solana/kit-plugin-surfpool from ^1.2.0^1.3.0 once published, and add a kit-tools V1-transaction test that fails without enableFeatures and passes with it.

amilz added 2 commits May 11, 2026 15:44
Adds enableFeatures, disableFeatures, and allFeatures to the napi
SurfnetConfig, parsed via the existing parse_feature_pubkey() helper
(accepts kebab-case names, snake_case, or base58 pubkeys). Threads
through SurfnetBuilder::{enable_feature, disable_feature, feature_config}
into SVM init.

Builder default now seeds SvmFeatureConfig::default_mainnet_features()
so single-feature overrides layer on a mainnet baseline instead of
flipping every gate on (matches CLI semantics).

Bumps @solana/surfpool to 1.3.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant