Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ As these types were the only ones supported by the toolkit, this change is backw
## Fixed

* Improper weights for `set_main_chain_scripts` in `pallet_session_validator_management`
* Overflow error when running with mock data source and debug build.

## Added

Expand Down
4 changes: 2 additions & 2 deletions toolkit/data-sources/mock/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ impl BlockDataSourceMock {
) -> Result<Option<MainchainBlock>> {
// reverse of computation in `get_latest_stable_block_for`
let block_number = u32::from_be_bytes(hash.0[..4].try_into().unwrap());
let timestamp = block_number * 20000;
let timestamp = u64::from(block_number) * 20000;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could it be reading the last 8 bytes to u64 in the line above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

block_number is used as u32 later in this function

let epoch = block_number / self.block_per_epoch();
Ok(Some(MainchainBlock {
number: McBlockNumber(block_number),
hash,
epoch: McEpochNumber(epoch),
slot: McSlotNumber(epoch.into()),
timestamp: timestamp.into(),
timestamp,
}))
}
}
Expand Down
Loading