Skip to content

Releases: streamingfast/substreams-rs

v0.7.6

03 Feb 21:40

Choose a tag to compare

Changed

  • Removed conditional compilation of WASM entrypoint which is causing a bunch of unused warnings in default editor configuration.

v0.7.5

03 Feb 16:14

Choose a tag to compare

Changed

  • Experimental substreams::testing module is now available in default target, it was causing issue in Rust analyzer for little gain.

v0.7.4

03 Feb 15:35

Choose a tag to compare

Added

  • Map handlers now generate testable __impl_<name> functions by default for easier unit testing:

    • The macro now generates a testable __impl_<name> function alongside the WASM export
    • Use #[substreams::handlers::map(no_testable)] to opt-out and get the legacy behavior
    • Supports all input types: protobuf messages, String params, store inputs (readable and writable), and Deltas
  • Experimental: Added substreams::testing module with utilities for unit testing handlers (only available in #[cfg(test)] builds):

    • map! macro to conveniently call testable handler functions
    • clock() function to create Clock instances from string specifications for testing
    • Example usage:
      use substreams::testing::{map, clock};
      
      #[substreams::handlers::map]
      fn map_transfers(clock: Clock, blk: eth::Block) -> Result<Events, Error> {
          // handler logic
      }
      
      #[test]
      fn test_map_transfers() {
          let clock = clock("12345@1609459200000"); // block 12345 with timestamp
          let blk = eth::Block::default();
          let result = map!(map_transfers(clock, blk));
          assert!(result.is_ok());
      }

    Note: This module is experimental. While we aim to minimize breaking changes, we reserve the right to modify the API as needed.

  • Experimental: Added substreams::sqe module with a high-performance expression parser that will replace expr_parser in a future release:

    • Parsing: 5-9x faster across all expression types
    • Matching: 3-14x faster with zero allocations (no more cloning on every match!)
    • Repeated matching: 9-14x faster - the main use case sees the biggest wins
    • Fully compatible with the existing expression syntax
    • Zero-copy parsing and zero-allocation matching
    • Available at substreams::sqe::{parse, ExprMatcher, expr_matcher, matches_keys_in_parsed_expr}

v0.7.3

13 Jan 04:16

Choose a tag to compare

Added

  • Added PartialEq and PartialOrd trait implementations for cross-type comparisons:
    • For BigDecimal:
      • PartialEq<bigdecimal::BigDecimal> and PartialOrd<bigdecimal::BigDecimal> - Compare with the underlying wrapped type
      • Reverse implementations allowing bigdecimal::BigDecimal to compare with BigDecimal
      • PartialEq and PartialOrd for all primitive integer types (i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize)
    • For BigInt:
      • PartialEq<num_bigint::BigInt> and PartialOrd<num_bigint::BigInt> - Compare with the underlying wrapped type
      • Reverse implementations allowing num_bigint::BigInt to compare with BigInt
      • PartialEq and PartialOrd for all primitive integer types (i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize)
    • Example usage:
      let a = BigInt::from(100);
      assert!(a > 50i32);
      assert!(a < 150u64);
      assert!(50isize < a);
      
      let b = BigDecimal::from(100);
      assert!(b > 50i32);
      assert!(150u64 > b);

Changed

  • Optimized BigInt::to_decimal to use a pre-computed lookup table for powers of 10 (decimals 0-18), avoiding repeated BigDecimal allocations for common token decimal values like ETH (18 decimals).

v0.7.2

10 Jan 01:48

Choose a tag to compare

Added

  • Added Neg (unary -) trait implementations for BigDecimal, &BigDecimal, BigInt, and &BigInt, enabling negation operations.
    • For BigDecimal:
      • impl Neg for BigDecimal - Consumes the value and returns its negation
      • impl Neg for &BigDecimal - Works with borrowed references without consuming the original value
    • For BigInt:
      • impl Neg for BigInt - Consumes the value and returns its negation
      • impl Neg for &BigInt - Works with borrowed references without consuming the original value
    • Example usage:
      let positive = BigInt::from(42);
      let negative = -positive;              // BigInt(-42)
      
      let value = BigDecimal::from(100);
      let negated = -&value;                 // BigDecimal(-100), value is still available

v0.7.1

10 Jan 00:46

Choose a tag to compare

Changed

  • Bumped minimum Rust version to 1.83.

Added

  • Added AddAssign (+=) and SubAssign (-=) trait implementations for BigDecimal and BigInt, enabling in-place mutation operations.
    • For BigDecimal:
      • AddAssign and SubAssign for BigDecimal, &BigDecimal, and BigInt
      • Specialized implementations for all primitive integer types (i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize)
    • For BigInt:
      • AddAssign and SubAssign for BigInt and &BigInt
      • Specialized implementations for all primitive integer types
    • Example usage:
      let mut balance = BigDecimal::from(100);
      balance += 50;                    // Primitive integers
      balance -= BigInt::from(25);      // BigInt values
      
      let mut count = BigInt::from(1000);
      count += 100;                     // Works for BigInt too
      count -= BigInt::from(50);

v0.7.0

06 Nov 12:41

Choose a tag to compare

Changed

  • Migrated foundational store Protobuf definitions to v2, updated related API and tests accordingly.
  • Upgraded Rust toolchain to 1.82.

v0.6.4

22 Oct 19:41

Choose a tag to compare

  • Updated foundational store protobuf definitions:
    • GetResponse: Renamed response field to code, added block_reached field (tag 3)
    • GetAllResponse: Added block_reached field
    • GetAllRequest: Removed omit_deleted field
    • GetRequest: Removed omit_deleted field

v0.6.2

03 Sep 16:13

Choose a tag to compare

  • [Experimental] Added Substreams Foundational Store first API support, more details to follow, API subject to changes.

v0.6.1

10 Mar 20:08

Choose a tag to compare

  • Substreams map or store input that starts with _ doesn't generate a warning about snake cases not being respected.