INNER CODE UNIT · Rust
merged_dev_conf
TheMaxMur/RS-Key · crates/rsk-devconf/src/lib.rs:292
fn merged_dev_conf<S: Storage>(
fs: &mut Fs<S>,
incoming: &[u8],
out: &mut [u8],
) -> Result<usize, DevConfError> {
let m = overlay_dev_conf(fs, incoming, out)?;
Ok(trim_to_cap(out, m, incoming.len()))
}
/// Drop whole stored entries from the front of a merged record until it fits
/// [`EF_DEV_CONF_MAX`], never touching the trailing `keep` bytes the request itself
/// contributed, and never [`TAG_USB_ENABLED`].
///
/// [`overlay_dev_conf`] emits the stored, un-restated entries first and appends the
/// request last, so trimming the front evicts the oldest stored fields and always
/// leaves the owner's own write intact. Without it, stored bytes could veto a write:
/// released firmware bounded writes at [`EF_DEV_CONF_READ_MAX`] with no shape
/// validation, so a field device may carry a record the write cap refuses, and one