contracts: Use WeakBoundedVec for instrumented code (#12186)

* Use WeakBoundedVec for instrumented code

* Remove `RelaxedMaxCodeLen` from kitchensink
This commit is contained in:
Alexander Theißen
2022-09-19 12:56:46 +02:00
committed by GitHub
parent f7ac2cd20f
commit 0d2adf1fa1
5 changed files with 13 additions and 28 deletions
+1 -11
View File
@@ -35,11 +35,7 @@ use crate::{
Schedule,
};
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
dispatch::{DispatchError, DispatchResult},
ensure,
traits::Get,
};
use frame_support::dispatch::{DispatchError, DispatchResult};
use sp_core::crypto::UncheckedFrom;
use sp_sandbox::{SandboxEnvironmentBuilder, SandboxInstance, SandboxMemory};
use sp_std::prelude::*;
@@ -134,12 +130,6 @@ where
schedule,
owner,
)?;
// When instrumenting a new code we apply a stricter limit than enforced by the
// `RelaxedCodeVec` in order to leave some headroom for reinstrumentation.
ensure!(
module.code.len() as u32 <= T::MaxCodeLen::get(),
(<Error<T>>::CodeTooLarge.into(), ""),
);
Ok(module)
}