diff --git a/Cargo.lock b/Cargo.lock index 62219938e6..dfcce58d07 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -506,9 +506,9 @@ dependencies = [ [[package]] name = "bitcoin" -version = "0.32.3" +version = "0.32.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0032b0e8ead7074cda7fc4f034409607e3f03a6f71d66ade8a307f79b4d99e73" +checksum = "ce6bc65742dea50536e35ad42492b234c27904a27f0abdcbce605015cb4ea026" dependencies = [ "base58ck", "bech32", diff --git a/Cargo.toml b/Cargo.toml index 80a8b1b40e..e256de9ef0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ axum-server = "0.5.0" base64 = "0.22.0" bip322 = "0.0.8" bip39 = "2.0.0" -bitcoin = { version = "=0.32.3", features = ["rand"] } +bitcoin = { version = "0.32.5", features = ["rand"] } bitcoincore-rpc = "0.19.0" boilerplate = { version = "1.0.0", features = ["axum"] } brotli = "7.0.0" diff --git a/crates/mockcore/Cargo.toml b/crates/mockcore/Cargo.toml index 9ba3495753..07c841dd68 100644 --- a/crates/mockcore/Cargo.toml +++ b/crates/mockcore/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/ordinals/ord" [dependencies] base64 = "0.22.0" -bitcoin = { version = "0.32.3", features = ["serde", "rand"] } +bitcoin = { version = "0.32.5", features = ["serde", "rand"] } hex = "0.4.3" jsonrpc-core = "18.0.0" jsonrpc-derive = "18.0.0" diff --git a/crates/mockcore/src/lib.rs b/crates/mockcore/src/lib.rs index 0c1933f2e4..56484d5eb4 100644 --- a/crates/mockcore/src/lib.rs +++ b/crates/mockcore/src/lib.rs @@ -346,9 +346,10 @@ impl Handle { pub fn network(&self) -> String { match self.state().network { Network::Bitcoin => "mainnet".to_string(), - Network::Testnet => Network::Testnet.to_string(), - Network::Signet => Network::Signet.to_string(), Network::Regtest => Network::Regtest.to_string(), + Network::Signet => Network::Signet.to_string(), + Network::Testnet4 => Network::Testnet4.to_string(), + Network::Testnet => Network::Testnet.to_string(), _ => panic!(), } } diff --git a/crates/ordinals/Cargo.toml b/crates/ordinals/Cargo.toml index 6dcd561b2b..e0cde94f6a 100644 --- a/crates/ordinals/Cargo.toml +++ b/crates/ordinals/Cargo.toml @@ -9,7 +9,7 @@ license = "CC0-1.0" rust-version = "1.74.0" [dependencies] -bitcoin = { version = "=0.32.3", features = ["rand"] } +bitcoin = { version = "0.32.5", features = ["rand"] } derive_more = { version = "1.0.0", features = ["display", "from_str"] } serde = { version = "1.0.137", features = ["derive"] } serde_with = "3.7.0" diff --git a/crates/ordinals/src/sat_point.rs b/crates/ordinals/src/sat_point.rs index 144cf9e215..3e10a1b861 100644 --- a/crates/ordinals/src/sat_point.rs +++ b/crates/ordinals/src/sat_point.rs @@ -44,7 +44,7 @@ impl Encodable for SatPoint { } impl Decodable for SatPoint { - fn consensus_decode( + fn consensus_decode( d: &mut D, ) -> Result { Ok(SatPoint { diff --git a/deploy/setup b/deploy/setup index 508e2c7cd5..b923f1a812 100755 --- a/deploy/setup +++ b/deploy/setup @@ -53,11 +53,16 @@ case $CHAIN in CSP_ORIGIN=signet.ordinals.com ufw allow 38333 ;; - test) + testnet3) COOKIE_FILE_DIR=/var/lib/bitcoind/testnet3 CSP_ORIGIN=testnet.ordinals.com ufw allow 18333 ;; + testnet4) + COOKIE_FILE_DIR=/var/lib/bitcoind/testnet4 + CSP_ORIGIN=testnet4.ordinals.com + ufw allow 48333 + ;; *) echo "Unknown chain: $CHAIN" exit 1 diff --git a/justfile b/justfile index 2e9728dafd..6a295eefad 100644 --- a/justfile +++ b/justfile @@ -50,10 +50,14 @@ deploy-signet branch='master' remote='ordinals/ord': \ (deploy branch remote 'signet' 'signet.ordinals.net') deploy-testnet branch='master' remote='ordinals/ord': \ - (deploy branch remote 'test' 'testnet.ordinals.net') + (deploy branch remote 'testnet3' 'testnet.ordinals.net') + +deploy-testnet4 branch='master' remote='ordinals/ord': \ + (deploy branch remote 'testnet4' 'testnet4.ordinals.net') deploy-all: \ deploy-testnet \ + deploy-testnet4 \ deploy-signet \ deploy-mainnet-alpha \ deploy-mainnet-bravo \ @@ -66,7 +70,7 @@ delete-indices: \ delete-index domain: ssh root@{{domain}} 'systemctl stop ord && rm -f /var/lib/ord/*/index.redb' -servers := 'alpha bravo charlie signet testnet' +servers := 'alpha bravo charlie signet testnet3 testnet4' initialize-server-keys: #!/usr/bin/env bash diff --git a/src/chain.rs b/src/chain.rs index da0e3d7d5c..68a520073a 100644 --- a/src/chain.rs +++ b/src/chain.rs @@ -6,10 +6,11 @@ pub enum Chain { #[default] #[value(alias("main"))] Mainnet, + Regtest, + Signet, #[value(alias("test"))] Testnet, - Signet, - Regtest, + Testnet4, } impl Chain { @@ -23,13 +24,14 @@ impl Chain { Self::Regtest => 18443, Self::Signet => 38332, Self::Testnet => 18332, + Self::Testnet4 => 48332, } } pub(crate) fn inscription_content_size_limit(self) -> Option { match self { Self::Mainnet | Self::Regtest => None, - Self::Testnet | Self::Signet => Some(1024), + Self::Testnet | Self::Testnet4 | Self::Signet => Some(1024), } } @@ -39,6 +41,7 @@ impl Chain { Self::Regtest => 0, Self::Signet => 112402, Self::Testnet => 2413343, + Self::Testnet4 => 0, } } @@ -52,6 +55,7 @@ impl Chain { Self::Regtest => 110, Self::Signet => 175392, Self::Testnet => 2544192, + Self::Testnet4 => 0, } } @@ -73,9 +77,10 @@ impl Chain { pub(crate) fn join_with_data_dir(self, data_dir: impl AsRef) -> PathBuf { match self { Self::Mainnet => data_dir.as_ref().to_owned(), - Self::Testnet => data_dir.as_ref().join("testnet3"), - Self::Signet => data_dir.as_ref().join("signet"), Self::Regtest => data_dir.as_ref().join("regtest"), + Self::Signet => data_dir.as_ref().join("signet"), + Self::Testnet => data_dir.as_ref().join("testnet3"), + Self::Testnet4 => data_dir.as_ref().join("testnet4"), } } } @@ -84,9 +89,10 @@ impl From for Network { fn from(chain: Chain) -> Network { match chain { Chain::Mainnet => Network::Bitcoin, - Chain::Testnet => Network::Testnet, - Chain::Signet => Network::Signet, Chain::Regtest => Network::Regtest, + Chain::Signet => Network::Signet, + Chain::Testnet => Network::Testnet, + Chain::Testnet4 => Network::Testnet4, } } } @@ -101,6 +107,7 @@ impl Display for Chain { Self::Regtest => "regtest", Self::Signet => "signet", Self::Testnet => "testnet", + Self::Testnet4 => "testnet4", } ) } @@ -115,6 +122,7 @@ impl FromStr for Chain { "regtest" => Ok(Self::Regtest), "signet" => Ok(Self::Signet), "testnet" => Ok(Self::Testnet), + "testnet4" => Ok(Self::Testnet4), _ => Err(SnafuError::InvalidChain { chain: s.to_string(), }), @@ -132,6 +140,7 @@ mod tests { assert_eq!("regtest".parse::().unwrap(), Chain::Regtest); assert_eq!("signet".parse::().unwrap(), Chain::Signet); assert_eq!("testnet".parse::().unwrap(), Chain::Testnet); + assert_eq!("testnet4".parse::().unwrap(), Chain::Testnet4); assert_eq!( "foo".parse::().unwrap_err().to_string(), "Invalid chain `foo`" diff --git a/src/options.rs b/src/options.rs index 7ae22186ac..8ce04861f7 100644 --- a/src/options.rs +++ b/src/options.rs @@ -4,7 +4,7 @@ use super::*; #[command(group( ArgGroup::new("chains") .required(false) - .args(&["chain_argument", "signet", "regtest", "testnet"]), + .args(&["chain_argument", "signet", "regtest", "testnet", "testnet4"]), ))] pub struct Options { #[arg(long, help = "Load Bitcoin Core data dir from .")] @@ -82,4 +82,6 @@ pub struct Options { pub(crate) signet: bool, #[arg(long, short, help = "Use testnet. Equivalent to `--chain testnet`.")] pub(crate) testnet: bool, + #[arg(long, help = "Use testnet4. Equivalent to `--chain testnet4`.")] + pub(crate) testnet4: bool, } diff --git a/src/settings.rs b/src/settings.rs index 2fe46fad32..149aaf30e4 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -156,6 +156,7 @@ impl Settings { .then_some(Chain::Signet) .or(options.regtest.then_some(Chain::Regtest)) .or(options.testnet.then_some(Chain::Testnet)) + .or(options.testnet4.then_some(Chain::Testnet4)) .or(options.chain_argument), commit_interval: options.commit_interval, config: options.config, @@ -431,9 +432,10 @@ impl Settings { Ok(blockchain_info) => { break match blockchain_info.chain.to_string().as_str() { "bitcoin" => Chain::Mainnet, - "testnet" => Chain::Testnet, "regtest" => Chain::Regtest, "signet" => Chain::Signet, + "testnet" => Chain::Testnet, + "testnet4" => Chain::Testnet4, other => bail!("Bitcoin RPC server on unknown chain: {other}"), } } @@ -760,6 +762,20 @@ mod tests { } else { "/Bitcoin/signet/.cookie" })); + + let cookie_file = parse(&["--testnet4"]) + .cookie_file() + .unwrap() + .display() + .to_string(); + + assert!(cookie_file.ends_with(if cfg!(target_os = "linux") { + "/.bitcoin/testnet4/.cookie" + } else if cfg!(windows) { + r"\Bitcoin\testnet4\.cookie" + } else { + "/Bitcoin/testnet4/.cookie" + })); } #[test] @@ -817,6 +833,7 @@ mod tests { #[test] fn network_accepts_aliases() { + #[track_caller] fn check_network_alias(alias: &str, suffix: &str) { let data_dir = parse(&["--chain", alias]).data_dir().display().to_string(); @@ -857,6 +874,14 @@ mod tests { "ord/testnet3" }, ); + check_network_alias( + "testnet4", + if cfg!(windows) { + r"ord\testnet4" + } else { + "ord/testnet4" + }, + ); } #[test] diff --git a/src/subcommand/wallet/inscriptions.rs b/src/subcommand/wallet/inscriptions.rs index 2f235678a2..48b3b0bfc8 100644 --- a/src/subcommand/wallet/inscriptions.rs +++ b/src/subcommand/wallet/inscriptions.rs @@ -14,6 +14,7 @@ pub(crate) fn run(wallet: Wallet) -> SubcommandResult { Chain::Regtest => "http://localhost/inscription/", Chain::Signet => "https://signet.ordinals.com/inscription/", Chain::Testnet => "https://testnet.ordinals.com/inscription/", + Chain::Testnet4 => "https://testnet4.ordinals.com/inscription/", }; let mut output = Vec::new();