-
Notifications
You must be signed in to change notification settings - Fork 18
feat: support running ix test environments #499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closes #471 Create a `Mergeable` derive trait that automatically merges the fields with default values with the non-default fields of another instance. It also handles nested Mergeable structs. Note: in order to handle nested Mergeable structs, it uses the heuristic that nested mergeable struct have a type name containing `Config`. This is not a very robust method, but it works as we only use it for internal config structs.
Closes #459 Renames the `test-bins` crate into `magicblock-validator` and the binary from `rpc` to `magicblock-validator`
Solves #418 This PR: - Adds a config parameter to skip ledger replay when starting a validator, discarding the old ledger but preserving accountsDB and the validator keypair. - Adds a test that checks that the state is still there but not the ledger ## Snippets TOML: ```toml [ledger] resume-strategy = "replay-and-resume" path = "ledger.example.com" size = 1000000000 ``` CLI: ```bash cargo run -- --ledger-resume-strategy replay-and-resume LEDGER_RESUME_STRATEGY=replay-and-resume cargo run ``` ## Migration Old config: ```toml [ledger] reset = true ``` Becomes: ```toml [ledger] resume-strategy = "reset" ``` --- Old config: ```toml [ledger] reset = false ``` Becomes: ```toml [ledger] resume-strategy = "replay" ```
Closes #468 and closes #469 Explorer was showing the transaction timestamp because it uses `getBlockTime`, which was returning an estimate of the slot time based on the slot period and the number of slots between the current slot and the requested slot. This is fixed by returning the timestamp of the block from the ledger. The timestamp written in the ledger was a different system time from the one used for the clock. This is fixed by writing in the ledger the latest value of the clock, which should also fix replay. <!-- greptile_comment --> ## Greptile Summary This PR fixes a critical timestamp synchronization issue across the validator system. The core problem was that different parts of the system were using different sources for timestamps: 1. The explorer was using `getBlockTime` which estimated timestamps based on slot periods 2. The ledger was using raw system time 3. The clock sysvar had its own timestamp The fix ensures all components use the bank's clock timestamp as the single source of truth, specifically: - Modified `magicblock-api/src/slot.rs` to use `bank.clock().unix_timestamp` instead of system time - Updated `magicblock-rpc/src/json_rpc_request_processor.rs` to prioritize actual block timestamps over estimates - Added comprehensive tests in `test_clocks_match.rs` to verify timestamp consistency This change is particularly important for: - Accurate transaction replay - Consistent timestamp reporting between explorer and ledger - Proper clock sysvar behavior ## Confidence score: 4.5/5 1. This PR is safe to merge as it fixes a critical timestamp consistency issue without introducing new risks 2. High confidence due to comprehensive test coverage and the straightforward nature of the fix - using a single source of truth 3. Files needing attention: - `magicblock-api/src/slot.rs`: Verify no edge cases in timestamp handling - `test_clocks_match.rs`: Ensure all critical timestamp scenarios are covered <sub>3 files reviewed, 2 comments</sub> <sub>[Edit PR Review Bot Settings](https://app.greptile.com/review/github) | [Greptile](https://greptile.com?utm_source=greptile_expert&utm_medium=github&utm_campaign=code_reviews&utm_content=magicblock-validator_454)</sub> <!-- /greptile_comment -->
#458) Closes #299 Add a parameter in the configuration to disable verification of the validator's pubkey during replay, enabling anyone to replay the ledger ## Snippets TOML ```toml [ledger] skip-keypair-match-check = false # Defaults to true ``` CLI ```bash cargo run -- --ledger-skip-keypair-match-check LEDGER_SKIP_KEYPAIR_MATCH_CHECK=FALSE cargo run ```
Implements fee claiming on validator startup, closes #303. - Adds `claim_fees method` to build/send delegation program's ValidatorClaimFees instruction - Added integration test `test_validator_claim_fees` --------- Co-authored-by: Dodecahedr0x <hexadecifish@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10 files reviewed, 3 comments
Dodecahedr0x
approved these changes
Aug 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds the ability to setup validator(s) for a specific test without running the tests.
This is useful when trying to create the environment while running a specific integration test
manually or even for other projects (like the cloning pipeline I'm currently working on).
Details
The env var
SETUP_ONLYtriggers this behavior when either set to:The following convenience tasks were added to the
Makefileof the test-integration workspace:Adjacent
I fixed a few clippy warnings while working on this, mainly inside ledger-restore tests
Greptile Summary
This PR introduces a new "setup-only" mode for the MagicBlock validator's integration test suite. The feature allows developers to start validator environments (devnet, ephemeral, or both) without executing the actual tests, controlled by the
SETUP_ONLYenvironment variable with valuesdevnet,ephem, orboth.The implementation adds a comprehensive configuration system through the new
TestConfigViaEnvVarsstruct inenv_config.rsthat parses environment variables to control test execution and validator setup behavior. A new signal handling module (signal.rs) provides graceful Ctrl-C interrupt handling, allowing users to cleanly shut down validators when done with manual testing.The changes integrate with the existing test infrastructure by modifying the main test runner (
run_tests.rs) to branch between traditional test execution and setup-only mode. When in setup mode, validators are started and kept running until the user presses Ctrl-C, at which point the signal handler ensures proper cleanup of validator processes.Thirteen new convenience Make targets were added to the integration test Makefile (e.g.,
setup-schedulecommit-devnet,setup-cloning-both) that set the appropriateSETUP_ONLYenvironment variable and execute the corresponding test binary. This provides an ergonomic interface for developers to quickly spin up specific validator environments.Additionally, the PR includes minor code quality improvements, such as replacing
assert_eq!(executable, true, ...)with the more idiomaticassert!(executable, ...)in ledger restoration tests, and commenting out an unnecessary Memo program configuration.Confidence score: 4/5
test-integration/test-runner/src/env_config.rsfor the configuration logic and signal handling implementation