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
50 changes: 25 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ resolver = "2"

[workspace.package]
# Solana Version (2.2.x)
version = "0.4.2"
version = "0.5.0"
authors = ["MagicBlock Maintainers <maintainers@magicblock.xyz>"]
repository = "https://github.com/magicblock-labs/ephemeral-validator"
homepage = "https://www.magicblock.xyz"
Expand Down
58 changes: 21 additions & 37 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,47 +31,31 @@
# Env: MBV_LIFECYCLE
lifecycle = "ephemeral"

# Remote connections for RPC, WebSocket, and gRPC.
# You can define multiple remotes of different kinds.
# The first RPC remote will be used for JSON-RPC calls.
# Each WebSocket/gRPC remote will create a pubsub client.
# Remote endpoints for syncing with the base chain.
# You can specify multiple remotes of different types.
# The first HTTP/HTTPS remote will be used for JSON-RPC calls.
# Each WebSocket/gRPC remote creates a subscription client.
#
# Available kinds:
# - "rpc": JSON-RPC HTTP connection (typically port 8899)
# - "websocket": WebSocket connection for PubSub (typically wss://)
# - "grpc": gRPC connection for streaming (typically port 50051)
# Supported URL schemes:
# - "http", "https": JSON-RPC HTTP connections
# - "ws", "wss": WebSocket connections for PubSub
# - "grpc", "grpcs": gRPC connections for streaming
#
# URL Aliases (automatically resolved based on kind):
# RPC aliases: "mainnet", "devnet", "local"
# WebSocket aliases: "mainnet", "devnet", "local"
# URL Aliases (resolved during parsing):
# - "mainnet": resolves to https://api.mainnet-beta.solana.com/
# - "devnet": resolves to https://api.devnet.solana.com/
# - "testnet": resolves to https://api.testnet.solana.com/
# - "localhost": resolves to http://localhost:8899/ (only for http/https schemes)
#
# Example 1: Using aliases
# [[remote]]
# kind = "rpc"
# url = "devnet"
# Examples:
# remotes = ["devnet"] # Single devnet HTTP endpoint
# remotes = ["mainnet", "wss://mainnet-beta.solana.com"] # Mainnet with explicit WebSocket
# remotes = ["http://localhost:8899", "ws://localhost:8900"] # Local endpoints
#
# [[remote]]
# kind = "websocket"
# url = "devnet"
#
# Example 2: Using full URLs with optional API key
# [[remote]]
# kind = "rpc"
# url = "https://api.devnet.solana.com"
# api-key = "optional-key"
#
# [[remote]]
# kind = "websocket"
# url = "wss://api.devnet.solana.com"
#
# [[remote]]
# kind = "grpc"
# url = "http://grpc.example.com:50051"
# api-key = "optional-key"

[[remote]]
kind = "rpc"
url = "devnet"
# If no remotes are specified, defaults to ["devnet"] with an auto-added WebSocket endpoint.
# Default: ["https://api.devnet.solana.com/"]
Comment thread
bmuddha marked this conversation as resolved.
# Env: Not supported (must be configured via TOML or CLI)
remotes = ["devnet", "wss://devnet.solana.com", "grpcs://solana.helius.com"]

# Root directory for application storage (ledger, accountsdb, snapshots).
# Default: "magicblock-test-storage" (created in current working directory)
Expand Down
34 changes: 12 additions & 22 deletions magicblock-api/src/magic_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ use magicblock_config::{
config::{
ChainOperationConfig, LedgerConfig, LifecycleMode, LoadableProgram,
},
consts::DEFAULT_REMOTE,
types::{resolve_url, RemoteKind},
ValidatorParams,
};
use magicblock_core::{
Expand Down Expand Up @@ -339,7 +337,7 @@ impl MagicValidator {
config.validator.keypair.insecure_clone(),
committor_persist_path,
ChainConfig {
rpc_uri: config.rpc_url_or_default(),
rpc_uri: config.rpc_url().to_owned(),
commitment: CommitmentConfig::confirmed(),
compute_budget_config: ComputeBudgetConfig::new(
config.commit.compute_unit_price,
Expand Down Expand Up @@ -370,22 +368,14 @@ impl MagicValidator {
faucet_pubkey: Pubkey,
) -> ApiResult<ChainlinkImpl> {
use magicblock_chainlink::remote_account_provider::Endpoint;
let rpc_url = config.rpc_url_or_default();
let endpoints = if config.has_subscription_url() {
config
.websocket_urls()
.map(|pubsub_url| Endpoint {
rpc_url: rpc_url.clone(),
pubsub_url: pubsub_url.to_string(),
})
.collect::<Vec<_>>()
} else {
let ws_url = resolve_url(RemoteKind::Websocket, DEFAULT_REMOTE);
vec![Endpoint {
let rpc_url = config.rpc_url().to_owned();
let endpoints = config
.websocket_urls()
.map(|pubsub_url| Endpoint {
rpc_url: rpc_url.clone(),
pubsub_url: ws_url,
}]
};
pubsub_url: pubsub_url.to_string(),
})
.collect::<Vec<_>>();

let cloner = ChainlinkCloner::new(
committor_service,
Expand Down Expand Up @@ -537,7 +527,7 @@ impl MagicValidator {
});

DomainRegistryManager::handle_registration_static(
self.config.rpc_url_or_default(),
self.config.rpc_url(),
&validator_keypair,
validator_info,
)
Expand All @@ -550,7 +540,7 @@ impl MagicValidator {
let validator_keypair = validator_authority();

DomainRegistryManager::handle_unregistration_static(
self.config.rpc_url_or_default(),
self.config.rpc_url(),
&validator_keypair,
)
.map_err(|err| {
Expand All @@ -563,7 +553,7 @@ impl MagicValidator {
const MIN_BALANCE_SOL: u64 = 5;

let lamports = RpcClient::new_with_commitment(
self.config.rpc_url_or_default(),
self.config.rpc_url().to_owned(),
CommitmentConfig::confirmed(),
)
.get_balance(&self.identity)
Expand Down Expand Up @@ -610,7 +600,7 @@ impl MagicValidator {
.map(|co| co.claim_fees_frequency)
{
self.claim_fees_task
.start(frequency, self.config.rpc_url_or_default());
.start(frequency, self.config.rpc_url().to_owned());
}

self.slot_ticker = Some(init_slot_ticker(
Expand Down
4 changes: 3 additions & 1 deletion magicblock-committor-program/src/state/chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ pub struct Chunks {
bits: Vec<u8>,
/// The tracking capacity which is
/// ```rust
/// let capacity = bits.len() * BIT_FIELD_SIZE
/// # const BIT_FIELD_SIZE: usize = 8;
/// # let bits = vec![0u8; 1];
/// let capacity = bits.len() * BIT_FIELD_SIZE;
/// ```
/// The amount of tracked chunks could be a bit smaller as it might only use
/// part of the last bit in [Chunks::bits].
Expand Down
Loading