Skip to content

feat: add override_genesis_time flag in node cmd#188

Merged
g11tech merged 3 commits intoblockblaz:mainfrom
GrapeBaBa:override_genesis_time
Sep 16, 2025
Merged

feat: add override_genesis_time flag in node cmd#188
g11tech merged 3 commits intoblockblaz:mainfrom
GrapeBaBa:override_genesis_time

Conversation

@GrapeBaBa
Copy link
Copy Markdown
Member

This pull request introduces support for overriding the genesis time via CLI and configuration. At the same time fixs config and node tests not run bug.

Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for overriding the genesis time via CLI flag and configuration, while also fixing test configuration issues that prevented configs and node tests from running properly.

  • Introduces override_genesis_time parameter to genesis configuration loading
  • Adds CLI flag support for overriding genesis time in node command
  • Fixes test configuration in build.zig to include missing configs tests

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
pkgs/configs/src/lib.zig Adds override_genesis_time parameter to genesisConfigFromYAML function and improves test cleanup
pkgs/cli/src/node.zig Updates loadGenesisConfig to accept override_genesis_time parameter and fixes memory leak in tests
pkgs/cli/src/main.zig Adds override_genesis_time CLI flag and enables recursive test discovery
build.zig Adds missing configs_tests configuration to test suite
Comments suppressed due to low confidence (1)

pkgs/cli/src/node.zig:1

  • There's a typo in line 251: gstd.testing.allocator.free(nodes) should be std.testing.allocator.free(nodes). The 'g' prefix appears to be a typo.
const std = @import("std");

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


const genesis_config = try genesisConfigFromYAML(yaml);
std.debug.print("genesis config = {any}\n", .{genesis_config});
const genesis_config = try genesisConfigFromYAML(yaml, null);
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the debug print statement that was commented out in the original code. The line std.debug.print("genesis config = {any}\n", .{genesis_config}); should be removed entirely to keep the test clean.

Copilot uses AI. Check for mistakes.
defer start_options.deinit(allocator);

try node.loadGenesisConfig(allocator, custom_genesis, &start_options);
try node.loadGenesisConfig(allocator, custom_genesis, leancmd.override_genesis_time, &start_options);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this a boolean flag and if true pass time.now here to laodgenesisconfig else null

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will lead to different genesis time for different nodes, I think it doesn't make sense.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm make sense that way

@g11tech g11tech merged commit ee3bf0b into blockblaz:main Sep 16, 2025
6 checks passed
@g11tech
Copy link
Copy Markdown
Member

g11tech commented Sep 16, 2025

@GrapeBaBa now we can probably add a CI job

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