-
Notifications
You must be signed in to change notification settings - Fork 51
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
test(block_production): Add tests to block_production_task method #478
base: main
Are you sure you want to change the base?
Conversation
6b9d8ec
to
da627d1
Compare
#[rstest::fixture] | ||
fn pending_block_state_diff() -> StateDiff { | ||
StateDiff { | ||
storage_diffs: vec![ | ||
ContractStorageDiffItem { | ||
address: Felt::ONE, | ||
storage_entries: vec![ | ||
StorageEntry { key: Felt::ZERO, value: Felt::ZERO }, | ||
StorageEntry { key: Felt::ONE, value: Felt::ONE }, | ||
StorageEntry { key: Felt::TWO, value: Felt::TWO }, | ||
], | ||
}, | ||
ContractStorageDiffItem { | ||
address: Felt::TWO, | ||
storage_entries: vec![ | ||
StorageEntry { key: Felt::ZERO, value: Felt::ZERO }, | ||
StorageEntry { key: Felt::ONE, value: Felt::ONE }, | ||
StorageEntry { key: Felt::TWO, value: Felt::TWO }, | ||
], | ||
}, | ||
ContractStorageDiffItem { | ||
address: Felt::THREE, | ||
storage_entries: vec![ | ||
StorageEntry { key: Felt::ZERO, value: Felt::ZERO }, | ||
StorageEntry { key: Felt::ONE, value: Felt::ONE }, | ||
StorageEntry { key: Felt::TWO, value: Felt::TWO }, | ||
], | ||
}, | ||
], | ||
deprecated_declared_classes: vec![Felt::ZERO], | ||
declared_classes: vec![ | ||
DeclaredClassItem { class_hash: Felt::ONE, compiled_class_hash: Felt::ONE }, | ||
DeclaredClassItem { class_hash: Felt::TWO, compiled_class_hash: Felt::TWO }, | ||
], | ||
deployed_contracts: vec![DeployedContractItem { address: Felt::THREE, class_hash: Felt::THREE }], | ||
replaced_classes: vec![ReplacedClassItem { contract_address: Felt::TWO, class_hash: Felt::TWO }], | ||
nonces: vec![ | ||
NonceUpdate { contract_address: Felt::ONE, nonce: Felt::ONE }, | ||
NonceUpdate { contract_address: Felt::TWO, nonce: Felt::TWO }, | ||
NonceUpdate { contract_address: Felt::THREE, nonce: Felt::THREE }, | ||
], | ||
} | ||
} |
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.
I'm not sure its a good idea to have a fixture
for the pending block state diff as this is very subject to change depending on the test we are running. Imo this is too specific and we should probably be defining this on a per-test basis. Wdyt?
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.
I created this on a point of testing that many more tests used this pending block setup and the file was getting ridiculously long. In hindsight, it shouldn't have been a fixture anyway because of what you said, but maybe it could be a method that creates a simple pending block from the fixtures if need be and more tests are created.
da627d1
to
96948a1
Compare
Pull Request type
Please add the labels corresponding to the type of changes your PR introduces:
What is the current behavior?
Resolves: #NA
The block production tests currently only test block sealing when starting a new service.
What is the new behavior?
This PR aims to add tests on the
block_production_task
method and related methods to thoroughly test the code.Does this introduce a breaking change?
No.
Other information
The testing format is based on #468. All feedback is welcome!