Fix bug in storage processor and remove duplicate Constant (#4294)

* Fix bug in storage processor and remove duplicate Constant

* Add test

* Bump replicator timeout
This commit is contained in:
Sagar Dhawan
2019-05-15 13:28:56 -07:00
committed by GitHub
parent 2bef1b0433
commit 4576250342
7 changed files with 28 additions and 13 deletions

View File

@@ -81,11 +81,11 @@ impl<'a> StorageAccount<'a> {
if let StorageContract::ReplicatorStorage { proofs, .. } = &mut storage_contract {
let segment_index = get_segment_from_slot(slot);
if segment_index > proofs.len() || proofs.is_empty() {
proofs.resize(cmp::max(1, segment_index), Proof::default());
if segment_index >= proofs.len() || proofs.is_empty() {
proofs.resize(cmp::max(1, segment_index + 1), Proof::default());
}
if segment_index > proofs.len() {
if segment_index >= proofs.len() {
// only possible if usize max < u64 max
return Err(InstructionError::InvalidArgument);
}