Skip to content

Commit 72209a4

Browse files
committed
fix: support code getters for cache
1 parent 5d5f0b2 commit 72209a4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

frame/evm/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,13 @@ impl<T: Config> Pallet<T> {
929929
/// Get the account metadata (hash and size) from storage if it exists,
930930
/// or compute it from code and store it if it doesn't exist.
931931
pub fn account_code_metadata(address: H160) -> CodeMetadata {
932+
if let Some(code) = <T as Config>::OnMethodCall::get_code(&address) {
933+
return CodeMetadata {
934+
size: code.len() as u64,
935+
// TODO: Store code hash in OnMethodCall
936+
hash: H256::from(sp_io::hashing::keccak_256(&code)),
937+
};
938+
}
932939
if let Some(meta) = <AccountCodesMetadata<T>>::get(address) {
933940
return meta;
934941
}

0 commit comments

Comments
 (0)