Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(katana): node config builder #2648

Open
kariy opened this issue Nov 6, 2024 · 1 comment · May be fixed by #2653
Open

feat(katana): node config builder #2648

kariy opened this issue Nov 6, 2024 · 1 comment · May be fixed by #2653
Assignees
Labels
enhancement New feature or request katana This issue is related to Katana

Comments

@kariy
Copy link
Member

kariy commented Nov 6, 2024

Problem

we have a main config struct that encapsulates bunch of other smaller configs. this config struct is then passed to the katana_node::build() method.

/// Node configurations.
///
/// List of all possible options that can be used to configure a node.
#[derive(Debug, Clone, Default)]
pub struct Config {
/// The chain specification.
pub chain: ChainSpec,
/// Database options.
pub db: DbConfig,
/// Forking options.

/// Build the node components from the given [`Config`].
///
/// This returns a [`Node`] instance which can be launched with the all the necessary components
/// configured.
pub async fn build(mut config: Config) -> Result<Node> {
if config.metrics.is_some() {
// Metrics recorder must be initialized before calling any of the metrics macros, in order

because there are many configurations, it can be quite a hassle to specify each one of them. especially when you only want to specify some of them and want to use the default values for the rest. for example, in the dojo-test-utils:

pub fn get_default_test_config(sequencing: SequencingConfig) -> Config {
let dev = DevConfig { fee: false, account_validation: true, fixed_gas_prices: None };
let mut chain = ChainSpec { id: ChainId::SEPOLIA, ..Default::default() };
chain.genesis.sequencer_address = *DEFAULT_SEQUENCER_ADDRESS;
let rpc = RpcConfig {
allowed_origins: None,
port: 0,


it'd be nice to have a ConfigBuilder where you can set individual values using the builder pattern. the logic for the katana_node::build() can then be moved to ConfigBuilder::build() method.

@kariy kariy added enhancement New feature or request katana This issue is related to Katana labels Nov 6, 2024
@kariy kariy self-assigned this Nov 6, 2024
@edisontim
Copy link
Contributor

Hey! Would be down to work on this!

@kariy kariy assigned edisontim and unassigned kariy Nov 6, 2024
@edisontim edisontim linked a pull request Nov 7, 2024 that will close this issue
10 tasks
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request katana This issue is related to Katana
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants