Skip to content

chore(constants): re-introduce pecorino #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 22, 2025
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2"

[workspace.package]
version = "0.8.0"
version = "0.8.1"
edition = "2021"
rust-version = "1.81"
authors = ["init4"]
Expand Down
2 changes: 2 additions & 0 deletions crates/constants/src/chains/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;

pub mod pecorino;
100 changes: 100 additions & 0 deletions crates/constants/src/chains/pecorino.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
//! Constants for the Pecorino testnet.

use crate::{
HostConstants, HostTokens, HostUsdRecord, RollupConstants, RollupTokens, SignetConstants,
SignetEnvironmentConstants, SignetSystemConstants, UsdRecords,
};
use alloy::primitives::{address, Address};
use std::borrow::Cow;

/// Name for the host chain.
pub const HOST_NAME: &str = "Pecorino Host";
/// Chain ID for the Pecorino testnet host chain.
pub const HOST_CHAIN_ID: u64 = 3151908;
/// Deployment height for the Pecorino testnet host chain.
pub const DEPLOY_HEIGHT: u64 = 149984;
/// `Zenith` contract address for the Pecorino testnet host chain.
pub const HOST_ZENITH: Address = address!("0xbe45611502116387211D28cE493D6Fb3d192bc4E");
/// `Orders` contract address for the Pecorino testnet host chain.
pub const HOST_ORDERS: Address = address!("0x4E8cC181805aFC307C83298242271142b8e2f249");
/// `Passage` contract address for the Pecorino testnet host chain.
pub const HOST_PASSAGE: Address = address!("0xd553C4CA4792Af71F4B61231409eaB321c1Dd2Ce");
/// `Transactor` contract address for the Pecorino testnet host chain.
pub const HOST_TRANSACTOR: Address = address!("0x1af3A16857C28917Ab2C4c78Be099fF251669200");

/// USDC token for the Pecorino testnet host chain.
pub const HOST_USDC: Address = address!("0x885F8DB528dC8a38aA3DDad9D3F619746B4a6A81");
/// USDT token for the Pecorino testnet host chain.
pub const HOST_USDT: Address = address!("0x7970D259D4a96764Fa9B23FF0715A35f06f52D1A");
/// WBTC token for the Pecorino testnet host chain.
pub const HOST_WBTC: Address = address!("0x9aeDED4224f3dD31aD8A0B1FcD05E2d7829283a7");
/// WETH token for the Pecorino testnet host chain.
pub const HOST_WETH: Address = address!("0x572C4d72080ed9E9997509b583a22B785B70cB3f");
Comment on lines +17 to +32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually verified updated host addresses


/// USDC token record for the Pecorino testnet host chain.
pub const HOST_USDC_RECORD: HostUsdRecord = HostUsdRecord::new(HOST_USDC, Cow::Borrowed("USDC"), 6);
/// USDT token record for the Pecorino testnet host chain.
pub const HOST_USDT_RECORD: HostUsdRecord = HostUsdRecord::new(HOST_USDT, Cow::Borrowed("USDT"), 6);
/// Host USD records for the Pecorino testnet host chain.
pub const HOST_USD_RECORDS: UsdRecords = {
let mut records = UsdRecords::new();
records.push(HOST_USDC_RECORD);
records.push(HOST_USDT_RECORD);
records
};
/// Host system tokens for Pecorino.
pub const HOST_TOKENS: HostTokens = HostTokens::new(HOST_USD_RECORDS, HOST_WBTC, HOST_WETH);

/// Host system constants for Pecorino.
pub const HOST: HostConstants = crate::HostConstants::new(
HOST_CHAIN_ID,
DEPLOY_HEIGHT,
HOST_ZENITH,
HOST_ORDERS,
HOST_PASSAGE,
HOST_TRANSACTOR,
HOST_TOKENS,
);

/// Name for the network.
pub const RU_NAME: &str = "Pecorino";
/// Chain ID for the Pecorino testnet RU chain.
pub const RU_CHAIN_ID: u64 = 14174;

/// WETH token for the Pecorino testnet RU chain.
pub const RU_WETH: Address = address!("0x0000000000000000007369676e65742d77657468");
/// WBTC token for the Pecorino testnet RU chain.
pub const RU_WBTC: Address = address!("0x0000000000000000007369676e65742D77627463");
/// `Orders` contract address for the Pecorino testnet RU chain.
pub const RU_ORDERS: Address = address!("0x000000000000007369676E65742D6f7264657273");
/// `Passage` contract address for the Pecorino testnet RU chain.
/// This is currently a dummy value and will be replaced with the actual Passage contract address in the future.
pub const RU_PASSAGE: Address = address!("0x0000000000007369676E65742D70617373616765");
/// The WETH9-based wrapped native USD token contract.
/// This is signet's native token in wrapped form.
pub const WRAPPED: Address = address!("0x0000000000000000007369676e65742D77757364");
Comment on lines +65 to +75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually verified updated rollup addresses

/// RU pre-approved system tokens for Pecorino.
pub const RU_TOKENS: RollupTokens = RollupTokens::new(RU_WBTC, RU_WETH);

/// Base fee recipient address for the Pecorino testnet RU chain.
pub const BASE_FEE_RECIPIENT: Address = address!("0xe0eDA3701D44511ce419344A4CeD30B52c9Ba231");

/// RU system constants for Pecorino.
pub const ROLLUP: RollupConstants =
crate::RollupConstants::new(RU_CHAIN_ID, RU_ORDERS, RU_PASSAGE, BASE_FEE_RECIPIENT, RU_TOKENS);

/// Signet system constants for Pecorino.
pub const PECORINO_SYS: SignetSystemConstants = crate::SignetSystemConstants::new(HOST, ROLLUP);

/// Signet environment constants for Pecorino.
pub const PECORINO_ENV: SignetEnvironmentConstants = SignetEnvironmentConstants::new(
Cow::Borrowed(HOST_NAME),
Cow::Borrowed(RU_NAME),
Cow::Borrowed(TX_CACHE_URL),
);

/// Signet constants for Pecorino.
pub const PECORINO: SignetConstants = SignetConstants::new(PECORINO_SYS, PECORINO_ENV);

/// The URL of the Transaction Cache endpoint.
pub const TX_CACHE_URL: &str = "https://transactions.pecorino.signet.sh";
2 changes: 2 additions & 0 deletions crates/constants/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ mod chains;
#[cfg(any(test, feature = "test-utils"))]
pub use chains::test_utils;

pub use chains::pecorino;

mod types;
pub use types::{
ConfigError, HostConstants, HostPermitted, HostTokens, HostUsdRecord, KnownChains,
Expand Down
3 changes: 3 additions & 0 deletions crates/constants/src/types/chains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ pub enum ParseChainError {
/// Known chains for the Signet system.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum KnownChains {
/// Pecorino chain.
Pecorino,
/// Test chain.
#[cfg(any(test, feature = "test-utils"))]
Test,
Expand All @@ -27,6 +29,7 @@ impl FromStr for KnownChains {
match s.as_str() {
#[cfg(any(test, feature = "test-utils"))]
"test" => Ok(Self::Test),
"pecorino" => Ok(Self::Pecorino),
_ => Err(ParseChainError::ChainNotSupported(s)),
}
}
Expand Down
6 changes: 6 additions & 0 deletions crates/constants/src/types/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ impl SignetEnvironmentConstants {
Self { host_name, rollup_name, transaction_cache }
}

/// Get the hard-coded Pecorino environment constants.
pub const fn pecorino() -> Self {
crate::chains::pecorino::PECORINO_ENV
}

/// Get the hard-coded local test rollup constants.
#[cfg(any(test, feature = "test-utils"))]
pub const fn test() -> Self {
Expand Down Expand Up @@ -49,6 +54,7 @@ impl TryFrom<KnownChains> for SignetEnvironmentConstants {

fn try_from(chain: KnownChains) -> Result<Self, Self::Error> {
match chain {
KnownChains::Pecorino => Ok(Self::pecorino()),
#[cfg(any(test, feature = "test-utils"))]
KnownChains::Test => Ok(Self::test()),
}
Expand Down
6 changes: 6 additions & 0 deletions crates/constants/src/types/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ impl HostConstants {
Self { chain_id, deploy_height, zenith, orders, passage, transactor, tokens }
}

/// Get the hard-coded Pecorino host constants.
pub const fn pecorino() -> Self {
crate::chains::pecorino::HOST
}

/// Get the hard-coded local test host constants.
#[cfg(any(test, feature = "test-utils"))]
pub const fn test() -> Self {
Expand Down Expand Up @@ -142,6 +147,7 @@ impl FromStr for HostConstants {
fn from_str(s: &str) -> Result<Self, Self::Err> {
let chain: KnownChains = s.parse()?;
match chain {
KnownChains::Pecorino => Ok(Self::pecorino()),
#[cfg(any(test, feature = "test-utils"))]
KnownChains::Test => Ok(Self::test()),
}
Expand Down
12 changes: 12 additions & 0 deletions crates/constants/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ impl SignetSystemConstants {
Self { host, rollup }
}

/// Get the hard-coded Pecorino constants.
pub const fn pecorino() -> Self {
crate::chains::pecorino::PECORINO_SYS
}

/// Get the hard-coded local test constants.
#[cfg(any(test, feature = "test-utils"))]
pub const fn test() -> Self {
Expand Down Expand Up @@ -221,6 +226,7 @@ impl TryFrom<KnownChains> for SignetSystemConstants {

fn try_from(chain: KnownChains) -> Result<Self, Self::Error> {
match chain {
KnownChains::Pecorino => Ok(Self::pecorino()),
#[cfg(any(test, feature = "test-utils"))]
KnownChains::Test => Ok(Self::test()),
}
Expand Down Expand Up @@ -253,6 +259,11 @@ impl SignetConstants {
Self { system, environment }
}

/// Get the hard-coded Pecorino rollup constants.
pub const fn pecorino() -> Self {
crate::chains::pecorino::PECORINO
}

/// Get the hard-coded local test rollup constants.
#[cfg(any(test, feature = "test-utils"))]
pub const fn test() -> Self {
Expand Down Expand Up @@ -285,6 +296,7 @@ impl TryFrom<KnownChains> for SignetConstants {

fn try_from(chain: KnownChains) -> Result<Self, Self::Error> {
match chain {
KnownChains::Pecorino => Ok(Self::pecorino()),
#[cfg(any(test, feature = "test-utils"))]
KnownChains::Test => Ok(Self::test()),
}
Expand Down
6 changes: 6 additions & 0 deletions crates/constants/src/types/rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ impl RollupConstants {
Self { chain_id, orders, passage, base_fee_recipient, tokens }
}

/// Get the hard-coded Pecorino rollup constants.
pub const fn pecorino() -> Self {
crate::chains::pecorino::ROLLUP
}

/// Get the hard-coded local test rollup constants.
#[cfg(any(test, feature = "test-utils"))]
pub const fn test() -> Self {
Expand Down Expand Up @@ -107,6 +112,7 @@ impl TryFrom<KnownChains> for RollupConstants {

fn try_from(chain: KnownChains) -> Result<Self, Self::Error> {
match chain {
KnownChains::Pecorino => Ok(Self::pecorino()),
#[cfg(any(test, feature = "test-utils"))]
KnownChains::Test => Ok(Self::test()),
}
Expand Down
6 changes: 6 additions & 0 deletions crates/test-utils/src/specs/host_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ impl HostBlockSpec {
}
}

/// Make a new block spec with Pecorino constants.
pub const fn pecorino() -> Self {
Self::new(SignetSystemConstants::pecorino())
}

/// Make a new block spec with test constants.
pub const fn test() -> Self {
Self::new(SignetSystemConstants::test())
Expand Down Expand Up @@ -411,6 +416,7 @@ impl TryFrom<KnownChains> for HostBlockSpec {

fn try_from(chain: KnownChains) -> Result<Self, Self::Error> {
match chain {
KnownChains::Pecorino => Ok(Self::pecorino()),
KnownChains::Test => Ok(Self::test()),
}
}
Expand Down
6 changes: 6 additions & 0 deletions crates/test-utils/src/specs/ru_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ impl RuBlockSpec {
Self { constants, tx: vec![], gas_limit: None, reward_address: None }
}

/// Create a new empty RU block spec with the Pecorino constants.
pub const fn pecorino() -> Self {
Self::new(SignetSystemConstants::pecorino())
}

/// Create a new empty RU block spec with the test constants.
pub const fn test() -> Self {
Self::new(SignetSystemConstants::test())
Expand Down Expand Up @@ -146,6 +151,7 @@ impl TryFrom<KnownChains> for RuBlockSpec {

fn try_from(chain: KnownChains) -> Result<Self, Self::Error> {
match chain {
KnownChains::Pecorino => Ok(Self::pecorino()),
KnownChains::Test => Ok(Self::test()),
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/tx-cache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ repository.workspace = true

[dependencies]
signet-bundle.workspace = true
signet-constants.workspace = true
signet-types.workspace = true

alloy.workspace = true
Expand Down
14 changes: 14 additions & 0 deletions crates/tx-cache/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use alloy::consensus::TxEnvelope;
use eyre::Error;
use serde::{de::DeserializeOwned, Serialize};
use signet_bundle::SignetEthBundle;
use signet_constants::pecorino;
use signet_types::SignedOrder;
use tracing::{instrument, warn};

Expand Down Expand Up @@ -41,6 +42,19 @@ impl TxCache {
Ok(Self::new(url))
}

/// Connect to the transaction cache with the Pecorino URL.
pub fn pecorino() -> Self {
Self::new_from_string(pecorino::TX_CACHE_URL).expect("pecorino tx cache URL is invalid")
}

/// Connect to the transaction cache with the Pecorino URL and a specific [`reqwest::Client`].
pub fn pecorino_with_client(client: reqwest::Client) -> Self {
Self::new_with_client(
pecorino::TX_CACHE_URL.parse().expect("pecorino tx cache URL is invalid"),
client,
)
}

/// Get the client used to send requests
pub const fn client(&self) -> &reqwest::Client {
&self.client
Expand Down