Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
This is a branch that claude had previously hammered out before samwise was introduced. Pushing this up to review so that samwise has a more established framework to add tests with. |
|
what of these tools belong in the SDK to help direct testing of sim? |
5c7c34e to
713e563
Compare
0c7a426 to
f5ff67b
Compare
713e563 to
0c00683
Compare
6f4dc39 to
a7df3eb
Compare
0c00683 to
717194a
Compare
Most of this could go into the SDK. The parts I'd keep in the builder specifically are just around the test setup. The SDK has the |
a7df3eb to
140035f
Compare
717194a to
eb263c0
Compare
c601de3 to
f8e58c5
Compare
8115ba5 to
9ad68c9
Compare
9ad68c9 to
0788c93
Compare
Fraser999
left a comment
There was a problem hiding this comment.
We should probably gate the whole test_utils mod behind #[cfg(test)].
| /// Set the simulation environment builder. | ||
| /// The environments will be built from this builder when `build()` is called. | ||
| pub fn with_sim_env_builder(mut self, builder: TestSimEnvBuilder) -> Self { | ||
| self.sim_env_builder = Some(builder); | ||
| self.rollup_env = None; | ||
| self.host_env = None; | ||
| self | ||
| } | ||
|
|
||
| /// Set the rollup environment directly. | ||
| pub fn with_rollup_env(mut self, env: TestRollupEnv) -> Self { | ||
| self.rollup_env = Some(env); | ||
| self | ||
| } | ||
|
|
||
| /// Set the host environment directly. | ||
| pub fn with_host_env(mut self, env: TestHostEnv) -> Self { | ||
| self.host_env = Some(env); | ||
| self | ||
| } |
There was a problem hiding this comment.
It might be better to have a small enum like
enum Env {
Builder(TestSimEnvBuilder),
Built {
rollup: TestRollupEnv,
host: TestHostEnv,
}
}and merging with_rollup_env and with_host_env into a single with_envs(rollup: ..., host: ...) so the builder is always in a consistent state?
| /// Build the test `BlockBuild` instance. | ||
| /// This creates a `BlockBuild` ready for simulation. | ||
| /// Call `.build().await` on the result to execute the simulation and get a `BuiltBlock`. | ||
| pub fn build(self) -> TestBlockBuild { |
There was a problem hiding this comment.
Maybe renaming to into_block_build would be clearer and would avoid the .build().build() chain?
| rollup_env: Option<TestRollupEnv>, | ||
| host_env: Option<TestHostEnv>, | ||
| sim_env_builder: Option<TestSimEnvBuilder>, | ||
| sim_cache: SimCache, | ||
| deadline_duration: Duration, | ||
| concurrency_limit: usize, | ||
| max_gas: u64, | ||
| max_host_gas: u64, |
There was a problem hiding this comment.
mega nit, even though this is test code, but inline comments would be good
| rollup_db: TestDb, | ||
| host_db: TestDb, | ||
| rollup_block_env: BlockEnv, | ||
| host_block_env: BlockEnv, | ||
| constants: SignetSystemConstants, |
- adds a builder test harness for simulating blocks that doesn't require network access and doesn't use alloy for test setup - adds test scenario helpers for future setup and use
070c4f7 to
e1e7db5
Compare

tests: adds builder simulation test harness
access and doesn't use alloy for test setup