Conversation
| /// database that does not contain the parent (genesis). This triggers the same | ||
| /// `NoPrevBlockHeader` error via `load_block_header` returning `None`. | ||
| #[tokio::test] | ||
| async fn genesis_replacement_rejected() { |
There was a problem hiding this comment.
@Mirko-von-Leipzig note that because the API takes in a ProposedBlock, its impossible for genesis block to be overridden (a proposed block can only be constructed with reference to some parent block).
So this test is a contrived way of testing the related logic.
There was a problem hiding this comment.
Ah. I see, for some reason I assumed we were getting the proposed block's header, but its actually the parents..
I was essentially worried one could construct a proposed genesis block via bytes (since that's what we receive), but the literal definition prohibits that.
I'm also okay with removing this test, its testing the code path but not really something practical. Up to you - we could also name it a database protection test I guess :D In case we lose the block header somehow.
Or actually -- I guess this tests that the database must be properly initialized with genesis which is good. In which case just a test rename?
Up to you.
Mirko-von-Leipzig
left a comment
There was a problem hiding this comment.
This is great! Thank you!
| async fn chain_tip_replacement_succeeds() { | ||
| let mut tv = TestValidator::new().await; | ||
|
|
||
| // Apply block 1 to advance the chain tip. |
There was a problem hiding this comment.
Nit: explain the why not the what
| // Apply block 1 to advance the chain tip. | |
| // The genesis block can never be replaced, so we advance the chain | |
| // to block 1, which we can then replace. |
|
|
||
| /// A block with the wrong previous block commitment should be rejected. | ||
| #[tokio::test] | ||
| async fn commitment_mismatch_rejected() { |
There was a problem hiding this comment.
Could we add a similar test for replacement + commitment mismatch?
| /// database that does not contain the parent (genesis). This triggers the same | ||
| /// `NoPrevBlockHeader` error via `load_block_header` returning `None`. | ||
| #[tokio::test] | ||
| async fn genesis_replacement_rejected() { |
There was a problem hiding this comment.
Ah. I see, for some reason I assumed we were getting the proposed block's header, but its actually the parents..
I was essentially worried one could construct a proposed genesis block via bytes (since that's what we receive), but the literal definition prohibits that.
I'm also okay with removing this test, its testing the code path but not really something practical. Up to you - we could also name it a database protection test I guess :D In case we lose the block header somehow.
Or actually -- I guess this tests that the database must be properly initialized with genesis which is good. In which case just a test rename?
Up to you.
No description provided.