Skip to content

[config] ChainConfig missing #[non_exhaustive] after adding priority_fee_gwei field #190

@obchain

Description

@obchain

Summary

PR #43 adds priority_fee_gwei: u64 to ChainConfig in crates/charon-core/src/config.rs. ChainConfig is a public struct used in test fixtures across crates. It does not carry #[non_exhaustive].

Every time a new chain-level config field is added (as happened here), any downstream code that constructs ChainConfig { chain_id, ws_url, http_url } by name fails to compile. The fix requires touching every test fixture instead of one struct annotation.

The established codebase pattern is to mark public structs with growing field sets as #[non_exhaustive] (types.rs, PR #27).

File

crates/charon-core/src/config.rsChainConfig struct (line ~64 on main)

Fix

#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct ChainConfig {
    pub chain_id: u64,
    pub ws_url: String,
    pub http_url: String,
    #[serde(default = "default_priority_fee_gwei")]
    pub priority_fee_gwei: u64,
}

fn default_priority_fee_gwei() -> u64 { 1 }

Update any test fixtures that construct ChainConfig by struct literal to use a builder or ..Default::default().

Refs #43

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlayer:rustRust crates (core / scanner / protocols / executor / cli)pr-reviewFindings from PR review processpriority:p2-polishNice-to-have / polishstatus:readyScoped and ready to pick up

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions