Implement CODESIZE

Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
xermicus
2024-06-06 15:10:21 +02:00
parent 39d78179d4
commit 10c7045e15
10 changed files with 73 additions and 24 deletions
+14
View File
@@ -126,6 +126,8 @@ sol!(
sol!(
contract ExtCode {
function ExtCodeSize(address who) public view returns (uint ret);
function CodeSize() public pure returns (uint ret);
}
);
@@ -461,6 +463,18 @@ impl Contract {
}
}
pub fn code_size() -> Self {
let code = include_str!("../contracts/ExtCode.sol");
let name = "ExtCode";
Self {
name,
evm_runtime: crate::compile_evm_bin_runtime(name, code),
pvm_runtime: crate::compile_blob(name, code),
calldata: ExtCode::CodeSizeCall::new(()).abi_encode(),
}
}
pub fn memcpy(payload: Vec<u8>) -> Self {
let code = include_str!("../contracts/MCopy.sol");
let name = "MCopy";