Skip to main content

Crate blueprint_tangle_extra

Crate blueprint_tangle_extra 

Source
Expand description

Tangle Extra - Producer/Consumer for Tangle v2 EVM contracts

This crate provides the producer/consumer pattern for processing jobs on Tangle v2 EVM contracts. It uses EVM events and transactions.

§Overview

  • Producer: Polls for JobSubmitted events and converts them to JobCall streams
  • Consumer: Submits job results via the submitResult contract function
  • Extractors: Extract metadata from job calls (call_id, service_id, etc.)
  • Keepers: Background services for lifecycle automation (epoch, round, stream)

§Usage

use blueprint_tangle_extra::{TangleProducer, TangleConsumer};
use blueprint_client_tangle::TangleClient;

async fn example(client: TangleClient) {
    // Create producer to receive job events
    let producer = TangleProducer::new(client.clone(), service_id);

    // Create consumer to submit results
    let consumer = TangleConsumer::new(client);

    // Process jobs with the blueprint runner...
}

§Keepers (feature: keepers)

Background services that automate lifecycle operations:

use blueprint_tangle_extra::services::{
    EpochKeeper, RoundKeeper, StreamKeeper, KeeperConfig, BackgroundKeeper,
};

// Configure keepers
let config = KeeperConfig::new(rpc_url, keystore)
    .with_inflation_pool(inflation_pool_address)
    .with_multi_asset_delegation(mad_address);

// Start background services
let epoch_handle = EpochKeeper::start(config.clone(), shutdown.subscribe());
let round_handle = RoundKeeper::start(config.clone(), shutdown.subscribe());

Re-exports§

pub use aggregating_consumer::AggregatingConsumer;
pub use aggregation::AggregatedResult;
pub use aggregation::AggregationError;
pub use aggregation::G1Point;
pub use aggregation::G2Point;
pub use aggregation::SignerBitmap;
pub use cache::CacheError;
pub use cache::CacheInvalidationEvent;
pub use cache::CacheStats;
pub use cache::CacheSyncService;
pub use cache::DEFAULT_CACHE_TTL;
pub use cache::OperatorWeights;
pub use cache::ServiceConfigCache;
pub use cache::ServiceOperators;
pub use cache::SharedServiceConfigCache;
pub use cache::shared_cache;
pub use cache::shared_cache_with_ttl;
pub use consumer::TangleConsumer;
pub use layers::TangleLayer;
pub use producer::TangleProducer;
pub use strategy::AggregatedSignatureResult;
pub use strategy::AggregationStrategy;
pub use strategy::StrategyError;
pub use strategy::ThresholdType;

Modules§

aggregating_consumer
Aggregation-Aware Job Consumer
aggregation
BLS Signature Aggregation for Tangle Jobs
cache
Service Configuration Cache
consumer
Tangle Consumer
extract
Tangle Extractors
layers
Tangle Layers
producer
Tangle Producer
strategy
Aggregation Strategy for BLS Signature Aggregation