Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Refactor _transparent methods
Browse files Browse the repository at this point in the history
rewrote commits, stashed the typo changes to remove some diff noise
fixed my unverified email commit
  • Loading branch information
pgherveou committed Mar 16, 2023
1 parent 48e7cb1 commit 2141598
Show file tree
Hide file tree
Showing 7 changed files with 182 additions and 255 deletions.
24 changes: 12 additions & 12 deletions frame/contracts/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ where
fn store(&self, items: &Vec<(FixSizedKey, Vec<u8>)>) -> Result<(), &'static str> {
let info = self.info()?;
for item in items {
info.write(&item.0 as &FixSizedKey, Some(item.1.clone()), None, false)
info.write(&item.0.into(), Some(item.1.clone()), None, false)
.map_err(|_| "Failed to write storage to restoration dest")?;
}
<ContractInfoOf<T>>::insert(&self.account_id, info);
Expand Down Expand Up @@ -1035,7 +1035,7 @@ benchmarks! {
let info = instance.info()?;
for key in keys {
info.write(
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?,
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?.into(),
Some(vec![]),
None,
false,
Expand Down Expand Up @@ -1083,7 +1083,7 @@ benchmarks! {
let info = instance.info()?;
for key in keys {
info.write(
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?,
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?.into(),
Some(vec![]),
None,
false,
Expand Down Expand Up @@ -1131,7 +1131,7 @@ benchmarks! {
let info = instance.info()?;
for key in keys {
info.write(
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?,
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?.into(),
Some(vec![42u8; (n * 2048) as usize]), // value_len increments by 2kb up to max payload_len
None,
false,
Expand Down Expand Up @@ -1181,7 +1181,7 @@ benchmarks! {
let info = instance.info()?;
for key in keys {
info.write(
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?,
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?.into(),
Some(vec![]),
None,
false,
Expand Down Expand Up @@ -1228,7 +1228,7 @@ benchmarks! {
let info = instance.info()?;
for key in keys {
info.write(
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?,
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?.into(),
Some(vec![42u8; (n * 2048) as usize]), // value_len increments by 2kb up to max payload_len
None,
false,
Expand Down Expand Up @@ -1282,7 +1282,7 @@ benchmarks! {
let info = instance.info()?;
for key in keys {
info.write(
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?,
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?.into(),
Some(vec![]),
None,
false,
Expand Down Expand Up @@ -1336,7 +1336,7 @@ benchmarks! {
let info = instance.info()?;
for key in keys {
info.write(
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?,
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?.into(),
Some(vec![42u8; (n * 2048) as usize]), // value_len increments by 2kb up to max payload_len
None,
false,
Expand Down Expand Up @@ -1385,7 +1385,7 @@ benchmarks! {
let info = instance.info()?;
for key in keys {
info.write(
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?,
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?.into(),
Some(vec![]),
None,
false,
Expand Down Expand Up @@ -1432,7 +1432,7 @@ benchmarks! {
let info = instance.info()?;
for key in keys {
info.write(
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?,
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?.into(),
Some(vec![42u8; (n * 2048) as usize]), // value_len increments by 2kb up to max payload_len
None,
false,
Expand Down Expand Up @@ -1486,7 +1486,7 @@ benchmarks! {
let info = instance.info()?;
for key in keys {
info.write(
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?,
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?.into(),
Some(vec![]),
None,
false,
Expand Down Expand Up @@ -1540,7 +1540,7 @@ benchmarks! {
let info = instance.info()?;
for key in keys {
info.write(
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?,
&VarSizedKey::<T>::try_from(key).map_err(|e| "Key has wrong length")?.into(),
Some(vec![42u8; (n * 2048) as usize]), // value_len increments by 2kb up to max payload_len
None,
false,
Expand Down
Loading

0 comments on commit 2141598

Please sign in to comment.