Move storage bound checking to driver

This commit is contained in:
Julien Cretin
2020-04-29 15:09:50 +02:00
parent 88920035fa
commit 5c2b72ce83
2 changed files with 39 additions and 12 deletions

View File

@@ -145,7 +145,6 @@ const PAGE_SIZE: usize = 0x1000;
// 0xc0000-0xfffff: Store
#[cfg(not(any(test, feature = "ram_storage")))]
const STORE_ADDR: usize = 0xC0000;
const STORE_SIZE_LIMIT: usize = 0x40000;
const STORE_SIZE: usize = NUM_PAGES * PAGE_SIZE;
impl PersistentStore {
@@ -155,8 +154,6 @@ impl PersistentStore {
///
/// This should be at most one instance of persistent store per program lifetime.
pub fn new(rng: &mut impl Rng256) -> PersistentStore {
// This should ideally be a compile-time assert, but Rust doesn't have native support.
assert!(STORE_SIZE <= STORE_SIZE_LIMIT);
#[cfg(not(any(test, feature = "ram_storage")))]
let storage = PersistentStore::new_prod_storage();
#[cfg(any(test, feature = "ram_storage"))]