Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7dde9d5
fix(sxt-core): remove unused imports and variables
iajoiner Dec 15, 2025
23bfa59
fix(eth-ecdsa): add missing module documentation
iajoiner Dec 15, 2025
f4034f0
fix(proof-of-sql-unversioned): add missing module documentation
iajoiner Dec 15, 2025
91327d4
fix(proof-of-sql-commitment-map): add missing module documentation
iajoiner Dec 15, 2025
953c97b
fix(commitment-sql): remove unused code and add module documentation
iajoiner Dec 15, 2025
1062130
fix(commitment-column-mapping): add missing module documentation
iajoiner Dec 15, 2025
9caed56
fix(pallet-zkpay): remove unused imports and prefix unused variables
iajoiner Dec 15, 2025
ef1dbbe
fix(native): remove unused imports
iajoiner Dec 15, 2025
f3236e9
fix(pallet-commitments): remove unused imports and add module documen…
iajoiner Dec 15, 2025
9bc4b65
fix(pallet-indexing): remove unused imports and prefix unused variables
iajoiner Dec 15, 2025
70b1e51
fix(pallet-tables): remove unused imports, add docs, and prefix unuse…
iajoiner Dec 15, 2025
dbf22e7
fix(pallet-system-tables): remove unused imports, add docs, and prefi…
iajoiner Dec 15, 2025
d0fbc47
fix(pallet-rewards): remove unused imports, mut, and prefix unused va…
iajoiner Dec 15, 2025
3f4acc2
fix(sxt-runtime): remove unused imports and prefix unused variable
iajoiner Dec 15, 2025
adfad45
fix(event-forwarder): remove unused imports and prefix unused function
iajoiner Dec 15, 2025
a7913db
fix(canaries): add missing documentation
iajoiner Dec 15, 2025
a90dbe5
fix(translation-layer): remove unused imports and prefix unused varia…
iajoiner Dec 15, 2025
e22953f
fix(attestation_tree): add missing module documentation
iajoiner Dec 15, 2025
b9f34f3
fix(commit-grouper): remove unused import
iajoiner Dec 15, 2025
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
4 changes: 4 additions & 0 deletions attestation_tree/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#![doc = include_str!("../README.md")]

/// Hash and key types for attestation tree nodes.
mod hash_and_key;
pub use hash_and_key::{HashAndKey, HashAndKeyTuple};

/// Prefix foliate implementation for storage key iteration.
mod prefix_foliate;
pub use prefix_foliate::{
decode_storage_key_and_value,
Expand All @@ -11,9 +13,11 @@ pub use prefix_foliate::{
PrefixFoliate,
};

/// Commitment map prefix foliate implementation.
mod commitment_map_prefix_foliate;
pub use commitment_map_prefix_foliate::CommitmentMapPrefixFoliate;

/// Core attestation tree construction and proof generation.
mod attestation_tree;
pub use attestation_tree::{
attestation_tree_from_prefixes,
Expand Down
9 changes: 8 additions & 1 deletion canaries/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
//! Canary prototype
/// Prometheus metrics collection and serving.
mod metrics;
/// Parsing utilities for canary data.
mod parsing;
/// RPC communication utilities.
mod rpc;
/// Storage operations for canary state.
mod storage;
use std::net::SocketAddr;

Expand Down Expand Up @@ -81,12 +85,15 @@ async fn main() -> Result<(), CanaryError> {
Ok(())
}

/// Simple block processor for canary monitoring.
struct SimpleProcessor {
/// The RPC URL to connect to.
pub rpc_url: Url,
}

impl SimpleProcessor {
fn get_http_url(&self) -> Result<Url, CanaryError> {
/// Converts the WebSocket URL to an HTTP URL.
fn _get_http_url(&self) -> Result<Url, CanaryError> {
let mut out = self.rpc_url.clone();
match self.rpc_url.scheme() {
"wss" => {
Expand Down
4 changes: 4 additions & 0 deletions canaries/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ pub(crate) fn record_staking(e: &StakingEvent) {
.inc_by(e.amount.saturated_into());
}

/// Records attestation metrics for a given block.
pub(crate) fn record_attestations(block_number: u32, attestations: Vec<Attestation<H256>>) {
// Count the total attestations for this block
BEST_ATTESTATION_COUNTER
Expand Down Expand Up @@ -138,18 +139,21 @@ pub(crate) fn record_balance(e: &BalanceEvent) {
.inc_by(e.amount.saturated_into());
}

/// Records the count of claimed unstakes for a given block.
pub(crate) fn record_claimed_unstake_count(block_number: u32, count: u64) {
UNSTAKE_CLAIMED_COUNTER
.with_label_values(&[block_number.to_string()])
.inc_by(count);
}

/// Records the total validator rewards for a given era.
pub(crate) fn record_era_rewards(era: u32, amount: u128) {
VALIDATOR_REWARD
.with_label_values(&[era.to_string()])
.set(amount as f64);
}

/// Records the total staked amount for a given era.
pub(crate) fn record_era_total_stake(era: u32, amount: u128) {
TOTAL_STAKED
.with_label_values(&[era.to_string()])
Expand Down
6 changes: 6 additions & 0 deletions canaries/src/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ pub(crate) fn parse_event_names(events: &[EventDetails<PolkadotConfig>]) -> Vec<
.collect::<Vec<_>>()
}

/// A staking event with its label and amount.
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
pub(crate) struct StakingEvent<'a> {
/// The event variant name.
pub label: &'a str,
/// The staking amount.
pub amount: u128,
}

Expand Down Expand Up @@ -54,9 +57,12 @@ pub(crate) fn parse_staking_stats(events: &[EventDetails<PolkadotConfig>]) -> Ve
.collect::<Vec<_>>()
}

/// A balance event with its label and amount.
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
pub(crate) struct BalanceEvent<'a> {
/// The event variant name.
pub label: &'a str,
/// The balance amount.
pub amount: u128,
}

Expand Down
1 change: 0 additions & 1 deletion canaries/src/rpc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use anyhow::Result;
use reqwest::Url;
use serde::{Deserialize, Serialize};
use sxt_core::attestation::Attestation;
use sxt_core::keystore::H256;

Expand Down
3 changes: 3 additions & 0 deletions canaries/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub(crate) async fn read_active_era(block: &Block, api: &API) -> Result<Option<u
}
}

/// Reads the total validator rewards for the specified era.
pub(crate) async fn read_era_rewards(era: u32, block: &Block, api: &API) -> Result<Option<u128>> {
let era_reward_query = sxt_chain_runtime::api::storage()
.staking()
Expand All @@ -36,6 +37,7 @@ pub(crate) async fn read_era_rewards(era: u32, block: &Block, api: &API) -> Resu
}
}

/// Reads the total staked amount for the specified era.
pub(crate) async fn read_total_staked(era: u32, block: &Block, api: &API) -> Result<Option<u128>> {
let total_staked_query = sxt_chain_runtime::api::storage()
.staking()
Expand All @@ -52,6 +54,7 @@ pub(crate) async fn read_total_staked(era: u32, block: &Block, api: &API) -> Res
}
}

/// Reads the count of claimed unstakes for the given block.
pub(crate) async fn read_unstaked_claims_count(block: &Block, api: &API) -> Result<u64> {
let claims = api
.runtime_api()
Expand Down
2 changes: 2 additions & 0 deletions eth-ecdsa/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#![doc = include_str!("../README.md")]
#![cfg_attr(not(feature = "std"), no_std)]

/// Ethereum-compatible ECDSA signature implementation.
mod signature;
pub use signature::{EthEcdsaSignature, EthEcdsaSigner};

/// Multi-signature support for combining multiple signature types.
mod multi_signature;
pub use multi_signature::MultiSignature;
2 changes: 0 additions & 2 deletions event-forwarder/src/block_processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ use subxt::PolkadotConfig;
use subxt_signer::sr25519::Keypair;
use sxt_core::sxt_chain_runtime::api::attestations::events::BlockAttested;
use sxt_core::sxt_chain_runtime::api::runtime_types::sxt_core::attestation::Attestation::EthereumAttestation;
use sxt_core::sxt_chain_runtime::api::runtime_types::sxt_runtime::RuntimeEvent;
use sxt_core::sxt_chain_runtime::api::staking::events::Unbonded;
use sxt_core::sxt_chain_runtime::api::Event;
use sxt_core::sxt_chain_runtime::{self};
use tokio::sync::mpsc;
use tokio::time::{sleep, Duration};
Expand Down
4 changes: 1 addition & 3 deletions event-forwarder/src/chain_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ use async_trait::async_trait;
use jsonrpsee::core::client::ClientT;
use jsonrpsee::ws_client::WsClientBuilder;
use log::{error, info};
use reqwest::Client;
use serde_json::json;
use subxt::backend::StreamOf;
use subxt::utils::H256;
use subxt::{OnlineClient, PolkadotConfig};
Expand Down Expand Up @@ -302,7 +300,7 @@ impl BlockStreamProvider for IncrementingBlockStream {
}
}

fn convert_ws_to_https(url: &str) -> String {
fn _convert_ws_to_https(url: &str) -> String {
url.replacen("ws://", "http://", 1)
.replacen("wss://", "https://", 1)
}
12 changes: 1 addition & 11 deletions native/src/sxt.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
#[cfg(feature = "std")]
use std::sync::Arc;

#[cfg(feature = "std")]
use arrow::{
array::{ArrayRef, StringArray},
datatypes::{DataType, Field, Schema},
ipc::reader::StreamReader,
ipc::writer::StreamWriter,
record_batch::RecordBatch,
};
use arrow::ipc::reader::StreamReader;
#[cfg(feature = "std")]
use commitment_sql::InsertAndCommitmentMetadata;
use proof_of_sql_commitment_map::{
Expand All @@ -18,7 +9,6 @@ use proof_of_sql_commitment_map::{
};
#[cfg(feature = "std")]
use proof_of_sql_static_setups::io::PUBLIC_SETUPS;
use sp_runtime::BoundedVec;
use sp_runtime_interface::runtime_interface;
use sxt_core::native::{
CreateStatementPassBy,
Expand Down
2 changes: 2 additions & 0 deletions pallets/commitments/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ mod test_insert;
#[cfg(test)]
mod test_table_commitments;

/// Error type conversions for commitment operations.
mod error_conversions;

/// Simulates end row insertion for commitment calculations.
mod end_row_insert_simulation;

pub mod runtime_api;
Expand Down
4 changes: 0 additions & 4 deletions pallets/commitments/src/runtime_api.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
//! Runtime APIs for reading from pallet-commitments.

use alloc::vec::Vec;

use frame_support::BoundedVec;
use proof_of_sql_commitment_map::generic_over_commitment::ConcreteType;
use proof_of_sql_commitment_map::{AnyCommitmentScheme, TableCommitmentBytes};
use sp_core::ConstU32;
use sxt_core::tables::TableIdentifier;

Expand Down
23 changes: 4 additions & 19 deletions pallets/indexing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,16 @@ pub mod native_pallet;
#[allow(clippy::manual_inspect)]
#[frame_support::pallet]
pub mod pallet {
use alloc::string::String;
use alloc::vec::Vec;

use codec::Decode;
use commitment_sql::InsertAndCommitmentMetadata;
use frame_support::dispatch::RawOrigin;
use frame_support::pallet_prelude::*;
use frame_support::{Blake2_128, Blake2_128Concat};
use frame_support::Blake2_128Concat;
use frame_system::pallet_prelude::*;
use hex::FromHex;
use native_api::NativeApi;
use on_chain_table::OnChainTable;
use sp_core::crypto::Ss58Codec;
use sp_core::{H256, U256};
use sp_runtime::traits::{Bounded, Hash, StaticLookup, UniqueSaturatedInto};
use sp_runtime::{BoundedVec, SaturatedConversion};
use sp_runtime::traits::Hash;
use sp_runtime::BoundedVec;
use sxt_core::permissions::{IndexingPalletPermission, PermissionLevel};
use sxt_core::tables::{
InsertQuorumSize,
QuorumScope,
TableIdentifier,
TableName,
TableNamespace,
};
use sxt_core::IdentLength;
use sxt_core::tables::{InsertQuorumSize, QuorumScope, TableIdentifier};

use super::*;

Expand Down
4 changes: 2 additions & 2 deletions pallets/indexing/src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use frame_election_provider_support::bounds::{ElectionBounds, ElectionBoundsBuilder};
use frame_election_provider_support::{onchain, SequentialPhragmen};
use frame_support::pallet_prelude::ConstU32;
use frame_support::traits::{ConstU128, VariantCountOf};
use frame_support::traits::ConstU128;
use frame_support::{derive_impl, parameter_types};
use native_api::Api;
use proof_of_sql_commitment_map::generic_over_commitment::ConcreteType;
use proof_of_sql_commitment_map::PerCommitmentScheme;
use proof_of_sql_static_setups::io::get_or_init_from_files_with_four_points_unchecked;
use sp_core::{ConstU64, H256};
use sp_runtime::traits::{ConvertInto, IdentityLookup, MaybeConvert, OpaqueKeys, TryConvertInto};
use sp_runtime::traits::{IdentityLookup, OpaqueKeys};
use sp_runtime::{BuildStorage, KeyTypeId};

use crate as pallet_indexing;
Expand Down
8 changes: 3 additions & 5 deletions pallets/indexing/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ use sp_core::Hasher;
use sp_runtime::BoundedVec;
use sxt_core::permissions::{IndexingPalletPermission, PermissionLevel, PermissionList};
use sxt_core::tables::{
CommitmentScheme,
CreateStatement,
InsertQuorumSize,
QuorumScope,
SourceAndMode,
TableIdentifier,
TableName,
TableNamespace,
Expand Down Expand Up @@ -579,7 +577,7 @@ fn inserting_data_fails_when_table_name_is_empty() {
.unwrap();
pallet_permissions::Permissions::<Test>::insert(who, permissions.clone());

let (table_id, create_statement) = sample_table_definition();
let (table_id, _create_statement) = sample_table_definition();
let test_identifier = TableIdentifier {
// Create an empty table name
name: TableName::try_from(b"".to_vec()).unwrap(),
Expand Down Expand Up @@ -1556,11 +1554,11 @@ fn we_can_submit_to_permissionless_table_with_no_permissions() {
batch_id: BatchId::try_from(b"test_batch".to_vec()).unwrap(),
data: row_data(),
};
let test_data_hash =
let _test_data_hash =
<<Test as frame_system::Config>::Hashing as Hasher>::hash(&test_submission.data);

let public_submitter = RuntimeOrigin::signed(sp_runtime::AccountId32::new([1; 32]));
let who = ensure_signed(public_submitter.clone()).unwrap();
let _who = ensure_signed(public_submitter.clone()).unwrap();

// permissionless submission
assert_ok!(submit_test_data(public_submitter, test_submission.clone()));
Expand Down
7 changes: 3 additions & 4 deletions pallets/rewards/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

extern crate alloc;
extern crate core;
use alloc::vec::Vec;

#[cfg(test)]
mod mock;
Expand Down Expand Up @@ -131,7 +130,7 @@ pub mod pallet {
/// payouts across a number of blocks until all payouts for the previous eras have been
/// paid.
fn on_initialize(_: BlockNumberFor<T>) -> Weight {
let mut total_weight: Weight = Weight::zero();
let total_weight: Weight = Weight::zero();

// Start by getting the last era we've paid out
let active_era = NextPaidEra::<T>::get();
Expand Down Expand Up @@ -188,11 +187,11 @@ pub mod pallet {
let reward_weight = rewards_for_era
.individual
.into_iter()
.filter(|(validator, points)| {
.filter(|(validator, _points)| {
pallet_staking::EraInfo::<T>::pending_rewards(active_era, validator)
})
.take(max_payouts)
.map(|(validator, points)| {
.map(|(validator, _points)| {
let origin = frame_system::RawOrigin::Signed(payer.clone()).into();
match pallet_staking::Pallet::<T>::payout_stakers(
origin,
Expand Down
16 changes: 3 additions & 13 deletions pallets/rewards/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,15 @@ use frame_election_provider_support::bounds::{ElectionBounds, ElectionBoundsBuil
use frame_election_provider_support::private::sp_arithmetic::FixedU128;
use frame_election_provider_support::{onchain, SequentialPhragmen};
use frame_support::pallet_prelude::ConstU32;
use frame_support::traits::{ConstU128, KeyOwnerProofSystem, VariantCountOf};
use frame_support::traits::{ConstU128, KeyOwnerProofSystem};
use frame_support::{derive_impl, parameter_types};
use pallet_grandpa::AuthorityId as GrandpaId;
use proof_of_sql_commitment_map::generic_over_commitment::ConcreteType;
use proof_of_sql_commitment_map::PerCommitmentScheme;
use proof_of_sql_static_setups::io::get_or_init_from_files_with_four_points_unchecked;
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_babe::AuthorityId as BabeId;
use sp_core::{ConstU64, H256};
use sp_runtime::traits::{
ConvertInto,
IdentityLookup,
MaybeConvert,
OpaqueKeys,
TryConvertInto,
UniqueSaturatedInto,
Zero,
};
use sp_runtime::{generic, BuildStorage, FixedPointNumber, KeyTypeId};
use sp_runtime::traits::{IdentityLookup, OpaqueKeys, UniqueSaturatedInto, Zero};
use sp_runtime::{BuildStorage, FixedPointNumber, KeyTypeId};

use crate as pallet_rewards;

Expand Down
2 changes: 1 addition & 1 deletion pallets/rewards/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::mock::{new_test_ext, Staking, System};
use crate::mock::new_test_ext;

#[test]
fn staking_rewards_pay_out() {
Expand Down
Loading