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
10 changes: 5 additions & 5 deletions .github/packages/npm-package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magicblock-labs/ephemeral-validator",
"version": "0.6.2",
"version": "0.7.0",
"description": "MagicBlock Ephemeral Validator",
"homepage": "https://github.com/magicblock-labs/magicblock-validator#readme",
"bugs": {
Expand Down Expand Up @@ -30,10 +30,10 @@
"typescript": "^4.9.4"
},
"optionalDependencies": {
"@magicblock-labs/ephemeral-validator-darwin-arm64": "0.6.2",
"@magicblock-labs/ephemeral-validator-darwin-x64": "0.6.2",
"@magicblock-labs/ephemeral-validator-linux-arm64": "0.6.2",
"@magicblock-labs/ephemeral-validator-linux-x64": "0.6.2",
"@magicblock-labs/ephemeral-validator-darwin-arm64": "0.7.0",
"@magicblock-labs/ephemeral-validator-darwin-x64": "0.7.0",
"@magicblock-labs/ephemeral-validator-linux-arm64": "0.7.0",
"@magicblock-labs/ephemeral-validator-linux-x64": "0.7.0",
"@magicblock-labs/vrf-oracle-linux-x64": "0.2.3",
"@magicblock-labs/vrf-oracle-linux-arm64": "0.2.3",
"@magicblock-labs/vrf-oracle-darwin-x64": "0.2.3",
Expand Down
2 changes: 1 addition & 1 deletion .github/packages/npm-package/package.json.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@magicblock-labs/${node_pkg}",
"description": "Ephemeral Validator (${node_pkg})",
"version": "0.6.2",
"version": "0.7.0",
"repository": {
"type": "git",
"url": "git+https://github.com/magicblock-labs/magicblock-validator.git"
Expand Down
53 changes: 27 additions & 26 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions 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.6.2"
version = "0.7.0"
authors = ["MagicBlock Maintainers <maintainers@magicblock.xyz>"]
repository = "https://github.com/magicblock-labs/ephemeral-validator"
homepage = "https://www.magicblock.xyz"
Expand Down Expand Up @@ -138,7 +138,7 @@ serde_json = "1.0"
serde_with = "3.16"
serial_test = "3.2"
sha3 = "0.10.8"
solana-account = { git = "https://github.com/magicblock-labs/solana-account.git", rev = "2246929" }
solana-account = { git = "https://github.com/magicblock-labs/solana-account.git", rev = "6eae52b" }
solana-account-decoder = { version = "2.2" }
solana-account-decoder-client-types = { version = "2.2" }
solana-account-info = { version = "2.2" }
Expand Down Expand Up @@ -217,7 +217,7 @@ spl-token-2022 = "7.0"

[workspace.dependencies.solana-svm]
git = "https://github.com/magicblock-labs/magicblock-svm.git"
rev = "3e9456ec4"
rev = "bdbaac86"
features = ["dev-context-only-utils"]

[workspace.dependencies.rocksdb]
Expand All @@ -229,9 +229,9 @@ version = "0.22.0"
# some solana dependencies have solana-storage-proto as dependency
# we need to patch them with our version, because they use protobuf-src v1.1.0
# and we use protobuf-src v2.1.1. Otherwise compilation fails
solana-account = { git = "https://github.com/magicblock-labs/solana-account.git", rev = "2246929" }
solana-account = { git = "https://github.com/magicblock-labs/solana-account.git", rev = "6eae52b" }
solana-storage-proto = { path = "./storage-proto" }
solana-svm = { git = "https://github.com/magicblock-labs/magicblock-svm.git", rev = "3e9456ec4" }
solana-svm = { git = "https://github.com/magicblock-labs/magicblock-svm.git", rev = "bdbaac86" }
# Fork is used to enable `disable_manual_compaction` usage
# Fork is based on commit d4e9e16 of rocksdb (parent commit of 0.23.0 release)
# without patching update isn't possible due to conflict with solana deps
Expand Down
13 changes: 9 additions & 4 deletions magicblock-accounts-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub type AccountsDbResult<T> = Result<T, AccountsDbError>;

/// A global lock used to suspend all write operations during critical
/// sections (like snapshots).
pub type GlobalWriteLock = Arc<RwLock<()>>;
pub type GlobalSyncLock = Arc<RwLock<()>>;

pub const ACCOUNTSDB_DIR: &str = "accountsdb";

Expand All @@ -41,7 +41,7 @@ pub struct AccountsDb {
/// Global lock ensures atomic snapshots by pausing writes.
/// Note: Reads are generally wait-free/lock-free via mmap,
/// unless they require index cursor stability.
write_lock: GlobalWriteLock,
write_lock: GlobalSyncLock,
/// Configured interval (in slots) for creating snapshots.
snapshot_frequency: u64,
}
Expand Down Expand Up @@ -86,7 +86,7 @@ impl AccountsDb {
storage,
index,
snapshot_manager,
write_lock: GlobalWriteLock::default(),
write_lock: GlobalSyncLock::default(),
snapshot_frequency: config.snapshot_frequency,
};

Expand Down Expand Up @@ -169,6 +169,11 @@ impl AccountsDb {
}
};
}
// The ephemeral account has been closed, remove it from DB
if account.ephemeral() && account.owner() == &Pubkey::default() {
self.index.remove(pubkey, txn!())?;
return Ok(());
}
match account {
AccountSharedData::Borrowed(acc) => {
if acc.owner_changed() {
Expand Down Expand Up @@ -366,7 +371,7 @@ impl AccountsDb {
self.index.flush();
}

pub fn write_lock(&self) -> GlobalWriteLock {
pub fn write_lock(&self) -> GlobalSyncLock {
self.write_lock.clone()
}
}
Expand Down
13 changes: 13 additions & 0 deletions magicblock-api/src/fund_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use magicblock_program::MagicContext;
use solana_account::{AccountSharedData, WritableAccount};
use solana_keypair::Keypair;
use solana_pubkey::Pubkey;
use solana_rent::Rent;
use solana_signer::Signer;

use crate::{
Expand Down Expand Up @@ -82,3 +83,15 @@ pub(crate) fn fund_magic_context(accountsdb: &AccountsDb) {
let _ = accountsdb
.insert_account(&magic_program::MAGIC_CONTEXT_PUBKEY, &magic_context);
}

pub(crate) fn fund_ephemeral_vault(accountsdb: &AccountsDb) {
let lamports = Rent::default().minimum_balance(0);
fund_account(accountsdb, &magic_program::EPHEMERAL_VAULT_PUBKEY, lamports);
let mut vault = accountsdb
.get_account(&magic_program::EPHEMERAL_VAULT_PUBKEY)
.expect("vault should have been created");
vault.set_ephemeral(true);
vault.set_owner(magic_program::ID);
let _ = accountsdb
.insert_account(&magic_program::EPHEMERAL_VAULT_PUBKEY, &vault);
}
Loading