Skip to content
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

issue 6319: copy raw sliced value as tail in new value to be converted #7194

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions crates/cast/bin/cmd/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,13 @@ impl StorageValue {
end = 32;
}
}
let mut value = [0u8; 32];

// reverse range, because the value is stored in big endian
let offset = 32 - offset;
let end = 32 - end;
let raw_sliced_value = &self.raw_slot_value.as_slice()[32 - end..32 - offset];

value[end..offset].copy_from_slice(&self.raw_slot_value.as_slice()[end..offset]);
// copy the raw sliced value as tail
let mut value = [0u8; 32];
value[32 - raw_sliced_value.len()..32].copy_from_slice(raw_sliced_value);
B256::from(value)
}
}
Expand Down
Loading