Skip to content

Conversation

@AdekunleBamz
Copy link

Summary

This PR enhances the base-flashtypes crate with validation utilities, helper methods, and comprehensive unit tests to improve developer experience and code reusability.

Changes

New validation module

Added common validation functions for flashblock data:

  • is_non_zero_address() - validate non-zero addresses
  • is_valid_state_root() / is_valid_block_hash() - validate non-zero hashes
  • is_valid_blob_gas() - validate optional blob gas values
  • is_valid_gas_usage() - validate gas used vs limit
  • is_valid_timestamp() - validate non-zero timestamps
  • is_valid_transaction_bytes() - validate non-empty transaction data

Metadata helper methods

  • is_empty() - check if metadata has no receipts or balance updates
  • receipts_len() / balance_updates_len() - count tracked items
  • balance_for() - lookup balance by address
  • has_balance_update() - check if address has pending update

Flashblock convenience methods

  • has_base_payload() - check if base payload is present
  • is_first_chunk() - check if this is index 0
  • transaction_count() - get number of transactions
  • has_withdrawals() - check for withdrawal presence

Tests

  • Added unit tests for all new validation functions
  • Added unit tests for Metadata helper methods
  • Added unit tests for Flashblock convenience methods

Motivation

These utilities reduce boilerplate when working with flashblock types and provide a consistent API for common validation patterns used throughout the codebase.

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Jan 6, 2026

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

@meyer9 meyer9 closed this Jan 7, 2026
@AdekunleBamz
Copy link
Author

@meyer9, Can you please tell me why this was closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants