Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
266 commits
Select commit Hold shift + click to select a range
18108f7
fix
pgherveou Jul 4, 2025
68e4ae4
fixes
pgherveou Jul 4, 2025
7f650f3
fixes
pgherveou Jul 4, 2025
380a1b4
fix build
pgherveou Jul 5, 2025
e0e5316
Update from github-actions[bot] running command 'bench --runtime dev …
github-actions[bot] Jul 5, 2025
8c21f11
Fix seal_call benchmark
pgherveou Jul 6, 2025
8158cea
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] Jul 6, 2025
215e8a3
Update from github-actions[bot] running command 'bench --runtime dev …
github-actions[bot] Jul 6, 2025
a2aa1a1
Merge branch 'master' into pg/fix-seal-call-weights
pgherveou Jul 7, 2025
0c6059f
Merge branch 'pg/fix-seal-call-weights' into pg/eth-decimals
pgherveou Jul 7, 2025
be98709
fixes
pgherveou Jul 7, 2025
66d14f8
add migration
pgherveou Jul 7, 2025
cb06489
get rid of dust_account_id
pgherveou Jul 7, 2025
1edd2c2
fixes
pgherveou Jul 7, 2025
7840bdd
Update from github-actions[bot] running command 'bench --runtime dev …
github-actions[bot] Jul 7, 2025
3631e90
lint fix
pgherveou Jul 7, 2025
c387d13
nit updates
pgherveou Jul 7, 2025
e9e6038
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] Jul 7, 2025
3ce1df7
fix pallet-xcm test
pgherveou Jul 8, 2025
a1d9b7c
fix build err
pgherveou Jul 8, 2025
3f27159
fix assets precompible build
pgherveou Jul 8, 2025
e3403f3
fix
pgherveou Jul 8, 2025
5b9c6ed
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] Jul 8, 2025
f386278
Merge branch 'master' into pg/eth-decimals
pgherveou Jul 9, 2025
5f7adfa
pallet-xcm
pgherveou Jul 9, 2025
0cae21f
Update bench tests
pgherveou Jul 9, 2025
8a11d71
Update from github-actions[bot] running command 'bench --runtime dev …
github-actions[bot] Jul 9, 2025
74cb003
Update cargo files
pgherveou Jul 16, 2025
fc31a0e
store the runtime code for EVM instantiate
pgherveou Jul 16, 2025
bf2c046
wip
pgherveou Jul 17, 2025
4c3c09f
wip
pgherveou Jul 17, 2025
279c132
fix
pgherveou Jul 17, 2025
9e7ee08
fix
pgherveou Jul 17, 2025
a37dd15
PR review move has_dust and has_balance and remove pub
pgherveou Jul 18, 2025
a764344
use local function instead of closure
pgherveou Jul 18, 2025
6eb87c8
make migration
pgherveou Jul 18, 2025
2959185
scope function
pgherveou Jul 18, 2025
41c7afd
charge 0 for input_data_len on err
pgherveou Jul 18, 2025
e74ed21
comment bench_map
pgherveou Jul 18, 2025
2d8d417
use drain to remove old storage in migration
pgherveou Jul 18, 2025
bdc1365
make balance, dust private in BalanceWithDust
pgherveou Jul 18, 2025
c94be4f
Update substrate/frame/revive/src/migrations/v1.rs
pgherveou Jul 18, 2025
7d3bca0
Revert "Update substrate/frame/revive/src/migrations/v1.rs"
pgherveou Jul 18, 2025
a2a5a18
add migration unit test
pgherveou Jul 18, 2025
0dc2210
typo
pgherveou Jul 18, 2025
e8ca9fb
Add additional tests
pgherveou Jul 18, 2025
1da95a2
Merge branch 'master' into pg/eth-decimals
pgherveou Jul 18, 2025
7e9f2c9
Merge branch 'pg/eth-decimals' into pg/revm
pgherveou Jul 18, 2025
874e7c0
update lock
pgherveou Jul 18, 2025
d7eb888
wip
pgherveou Jul 19, 2025
38c2b80
add instructions
pgherveou Jul 20, 2025
a55cc7a
wip
pgherveou Jul 20, 2025
3a42cf7
split evm / pvm
pgherveou Jul 20, 2025
8af812d
basic host interaction
pgherveou Jul 20, 2025
165b7e7
fix gas
pgherveou Jul 21, 2025
ec3d84f
Merge branch 'master' into pg/revm
pgherveou Jul 22, 2025
ade709b
wip
pgherveou Jul 22, 2025
65ddd58
update lock
pgherveou Jul 22, 2025
006cb15
fix
pgherveou Jul 22, 2025
c3ff24a
rm
pgherveou Jul 22, 2025
661d251
fix
pgherveou Jul 22, 2025
8b55fe8
Update
pgherveou Jul 22, 2025
8335340
fix
pgherveou Jul 22, 2025
538bf49
comment bitwise test for now
pgherveou Jul 22, 2025
70d07b9
Add AllowEVMBytecode config
pgherveou Jul 22, 2025
364201c
wip
pgherveou Jul 23, 2025
a2edcbe
fix compile error
pgherveou Jul 23, 2025
97c00f4
fixes
pgherveou Jul 23, 2025
6edb4a1
use 0 value
pgherveou Jul 23, 2025
053c548
[pallet-revive] revm tests scaffolding (#9290)
xermicus Jul 24, 2025
b45b1a2
move back fixture to fixtures folder and generate them from build.rs
pgherveou Jul 24, 2025
27b62f7
add skeleton for fixtures
pgherveou Jul 24, 2025
acf0e6e
wip
pgherveou Jul 25, 2025
f47d7b5
fixes
pgherveou Jul 25, 2025
31c0595
update build.rs
pgherveou Jul 25, 2025
3a07569
nit
pgherveou Jul 25, 2025
9adf741
fixes
pgherveou Jul 26, 2025
b1dbf5d
add missing headers
pgherveou Jul 26, 2025
4341d6d
Merge branch 'master' into pg/revm
pgherveou Jul 27, 2025
91e59e5
add test allow_evm_bytecode_config_works
pgherveou Jul 27, 2025
da7473d
fix lock
pgherveou Jul 27, 2025
df8d71d
Update from github-actions[bot] running command 'fmt'
github-actions[bot] Jul 27, 2025
359b181
fixes
pgherveou Jul 27, 2025
58b9220
Rve/revm arithmetic instructions WIP (#9361)
0xRVE Jul 30, 2025
5b304a0
fixes gas computation of evm arithemtic instructions (#9379)
0xRVE Jul 30, 2025
c441672
Add block info instructions to revm
smiasojed Jul 30, 2025
3736b5c
Fix timestamp test
smiasojed Jul 31, 2025
6da9ed6
Add tx info instructions
smiasojed Jul 31, 2025
05fa48b
Add system instructions
smiasojed Aug 1, 2025
b9c5780
Add call instruction support
smiasojed Aug 6, 2025
cf22948
Improve cross contract calls
smiasojed Aug 10, 2025
d318b27
Cleanup
smiasojed Aug 11, 2025
37de6ea
Fix error codes
smiasojed Aug 11, 2025
8817d7e
Revert "fixes gas computation of evm arithemtic instructions (#9379)"
Aug 12, 2025
02198ce
Revert "Rve/revm arithmetic instructions WIP (#9361)"
Aug 12, 2025
fccdb93
charge precompile call base costs
xermicus Aug 12, 2025
bb14f1c
[pallet-revive] do not silently fail Solidity fixtures compilation (#…
xermicus Aug 12, 2025
b5782a4
more generic call tester
xermicus Aug 12, 2025
490d59c
Merge branch 'pg/revm' into sm/vm-instr
xermicus Aug 12, 2025
1bfbaa8
refactor more benchmarks
pgherveou Aug 14, 2025
7d867a4
Add CREATE opcode support
smiasojed Aug 14, 2025
eafa023
Add Create opcode test
smiasojed Aug 14, 2025
fa34f22
Applied comments
smiasojed Aug 14, 2025
42bea89
Apply comments
smiasojed Aug 14, 2025
452c853
Create2 works
smiasojed Aug 15, 2025
155f2d4
Add delegate and call instructions
smiasojed Aug 15, 2025
7f79d2e
Merge branch 'master' into pg/revm
pgherveou Aug 18, 2025
076246c
Merge branch 'master' into pg/revm
pgherveou Aug 18, 2025
b2ceaae
revm file shuffling
pgherveou Aug 18, 2025
7e68c51
fixes
pgherveou Aug 18, 2025
6ec1681
rm stuff for later
pgherveou Aug 18, 2025
c89d026
rm evm
pgherveou Aug 18, 2025
d53e0ac
rm evm stuff
pgherveou Aug 18, 2025
edde1d1
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] Aug 18, 2025
4f38703
rm
pgherveou Aug 18, 2025
ab3761e
taplo fix
pgherveou Aug 18, 2025
7dadbc1
fix up cargo.lock
pgherveou Aug 18, 2025
abcd13c
try
pgherveou Aug 18, 2025
6d30298
fixes
pgherveou Aug 18, 2025
68e9a84
Merge branch 'master' into pg/revm-base
pgherveou Aug 18, 2025
551c711
rm vm/runtime.rs
pgherveou Aug 18, 2025
2c308d7
Merge branch 'pg/revm-base' into pg/revm
pgherveou Aug 18, 2025
2debf91
fix
pgherveou Aug 18, 2025
0175328
nit
pgherveou Aug 18, 2025
22aff1d
Add gas and keccak256 instructions
smiasojed Aug 18, 2025
59e59e8
fixes
pgherveou Aug 18, 2025
6a38acd
Address comments
smiasojed Aug 18, 2025
f1f2ffc
nit
pgherveou Aug 18, 2025
82ea9bc
update call_with_code_per_byte
pgherveou Aug 18, 2025
20511d1
fixes
pgherveou Aug 18, 2025
e1bbcb9
added migration
pgherveou Aug 18, 2025
78c92d3
Merge branch 'master' into pg/revm-base
pgherveou Aug 19, 2025
3789665
Merge branch 'pg/revm-base' into pg/revm
pgherveou Aug 19, 2025
f8da76f
refactoring
pgherveou Aug 19, 2025
b1b1192
fix clippy
pgherveou Aug 19, 2025
50aeaab
Merge remote-tracking branch 'origin/pg/revm' into sm/vm-instr
smiasojed Aug 19, 2025
a829fab
fix clippy
pgherveou Aug 19, 2025
9f9cbc1
Add instantiate with code type support
smiasojed Aug 19, 2025
b6e6738
Add system instruction tests
smiasojed Aug 20, 2025
3c4f5c4
Merge branch 'master' into pg/revm
pgherveou Aug 21, 2025
953ee61
merge fix
pgherveou Aug 21, 2025
7cee5be
simplify migration tests
pgherveou Aug 21, 2025
b8dc717
add migration
pgherveou Aug 21, 2025
81578a0
remove unneeded tests for this PR
pgherveou Aug 21, 2025
6000ed4
fixes
pgherveou Aug 21, 2025
c679776
keep these files for next PR
pgherveou Aug 21, 2025
5f839b6
comments
pgherveou Aug 21, 2025
8110392
fixes
pgherveou Aug 21, 2025
7a1c0a6
fix
pgherveou Aug 21, 2025
83ea8cd
Update from github-actions[bot] running command 'bench --runtime dev …
github-actions[bot] Aug 21, 2025
1c39f58
Add system instr and tests cleanup
smiasojed Aug 21, 2025
165957c
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] Aug 21, 2025
2b07ca6
rename seal_to_account_id
pgherveou Aug 21, 2025
f96fa39
update PRDOC
pgherveou Aug 21, 2025
2f369ad
Merge branch 'master' into pg/revm
pgherveou Aug 21, 2025
b66b47a
fix bench
pgherveou Aug 21, 2025
3fea6b5
Improve gas handling for CREATE intruction
smiasojed Aug 22, 2025
4d0db7e
output.data shoudl be untouched
pgherveou Aug 22, 2025
79b84da
install solidity in job
pgherveou Aug 22, 2025
4b80099
use resolc too
pgherveou Aug 22, 2025
4b6f4d2
rm line
pgherveou Aug 22, 2025
ab15dc1
enforce evm code size limit
pgherveou Aug 23, 2025
e93c1a0
fix
pgherveou Aug 25, 2025
04d0551
fix
pgherveou Aug 25, 2025
8f8ebcc
fix
pgherveou Aug 25, 2025
dec0849
PR review
pgherveou Aug 26, 2025
cc45f5b
Code cleanup and calls refactoring
smiasojed Aug 26, 2025
ea5011b
Update substrate/frame/revive/src/exec.rs
smiasojed Aug 26, 2025
dbfc430
make pristine unbounded and check PVM & EVM code size
pgherveou Aug 26, 2025
b4e868f
create: set caller frame
xermicus Aug 26, 2025
87b7b4e
nit
pgherveou Aug 26, 2025
b769010
refcount = 1 for evm
pgherveou Aug 26, 2025
5a6c9f2
the exec error to halt reason mapping function
xermicus Aug 26, 2025
0abfc74
fix
pgherveou Aug 26, 2025
6060eb4
fix
pgherveou Aug 26, 2025
2007fb5
add one more assert
pgherveou Aug 26, 2025
f219e06
nit
pgherveou Aug 26, 2025
5a965c7
the callcode instruction is unsupported
xermicus Aug 26, 2025
6f25eed
typos
xermicus Aug 26, 2025
99718d6
typos
xermicus Aug 26, 2025
2a88092
format the fixtures
xermicus Aug 26, 2025
33e9216
Remove refcount and owner for EVM CodeInfo
pgherveou Aug 26, 2025
f75403a
rm unused
pgherveou Aug 26, 2025
d26d8ac
origin should be held not caller
pgherveou Aug 26, 2025
cc8cef4
Merge branch 'master' into pg/revm
pgherveou Aug 27, 2025
b61416a
Rm copy cost from call
smiasojed Aug 27, 2025
e405e18
rollback refcount removals
pgherveou Aug 27, 2025
8b1669f
Update Cargo.toml
pgherveou Aug 27, 2025
4f86e9b
Update prdoc/pr_9285.prdoc
pgherveou Aug 27, 2025
315ae52
Update substrate/frame/revive/src/call_builder.rs
pgherveou Aug 27, 2025
3598d6f
Update substrate/frame/revive/src/benchmarking.rs
pgherveou Aug 27, 2025
3272e99
rm charge_evm_init_cost
pgherveou Aug 27, 2025
e2242a2
fix
pgherveou Aug 27, 2025
7fa6421
rm - 1
pgherveou Aug 27, 2025
ae647b6
restore legacy behaviour
pgherveou Aug 27, 2025
3197e68
Add revert test and fix errors mapping
smiasojed Aug 27, 2025
9c56173
Add call tests
smiasojed Aug 27, 2025
4971e97
the unified error mapping approach
xermicus Aug 28, 2025
90656f2
Enable invalid opcode test for EVM
smiasojed Aug 28, 2025
1a073b6
update
pgherveou Aug 28, 2025
ce5254d
the instruction result to exec error mapping function
xermicus Aug 28, 2025
d4d8c1a
deadcode unused for now
pgherveou Aug 28, 2025
511fe2b
the INVALID EVM opcode test
xermicus Aug 28, 2025
115c860
Reject bytecode starting with 0xef (EOF)
smiasojed Aug 28, 2025
17b713a
Merge branch 'pg/revm' into sm/vm-instr
xermicus Aug 28, 2025
eac460a
the create tester needs value to instantiate contracts
xermicus Aug 28, 2025
e286c49
deposit fixes
pgherveou Aug 28, 2025
f9aebdc
add missing assert
pgherveou Aug 28, 2025
7232f99
tweak tests
pgherveou Aug 28, 2025
f175c1b
ensure pallet_account exits
pgherveou Aug 28, 2025
76a2078
Use U256 converter
smiasojed Aug 28, 2025
bf19cf0
fixes
pgherveou Aug 29, 2025
7211711
nit
pgherveou Aug 29, 2025
c1ba77d
update comment
pgherveou Aug 29, 2025
46f6dfb
Add back remove_code
pgherveou Aug 29, 2025
135a9e0
Merge remote-tracking branch 'origin/pg/revm' into sm/vm-instr
smiasojed Aug 29, 2025
a7c3083
Add missing license
smiasojed Aug 29, 2025
546d65d
nit
pgherveou Aug 29, 2025
972a51f
Address comment
smiasojed Aug 29, 2025
9a34932
Update substrate/frame/revive/src/vm/evm.rs
smiasojed Aug 29, 2025
d820477
Update substrate/frame/revive/src/lib.rs
pgherveou Aug 29, 2025
c16e6ce
mint balance in migration
pgherveou Aug 29, 2025
1541263
rm check
pgherveou Aug 29, 2025
0a8935c
fmt
pgherveou Aug 29, 2025
692abb2
fixes
pgherveou Aug 29, 2025
a504987
reject hash == 0
pgherveou Aug 29, 2025
3a9f3d7
warm up pallet_account
pgherveou Aug 29, 2025
c245621
Update substrate/frame/revive/src/migrations/v2.rs
pgherveou Aug 29, 2025
f04044f
Apply comments
smiasojed Aug 29, 2025
88c6b23
Update ExtBuilder
pgherveou Aug 29, 2025
60b168d
Fmt
smiasojed Aug 29, 2025
5dc7d0b
Add assert for gas checking
smiasojed Aug 29, 2025
3201fb2
Merge branch 'master' into pg/revm
pgherveou Aug 29, 2025
400c912
Update .github/workflows/tests-misc.yml
pgherveou Aug 29, 2025
a1178f3
Update from github-actions[bot] running command 'bench --runtime dev …
github-actions[bot] Aug 29, 2025
d502f36
fix tests-misc
pgherveou Sep 1, 2025
28a1b65
fix
pgherveou Sep 1, 2025
80b2d56
Merge branch 'pg/revm' into sm/vm-instr
pgherveou Sep 1, 2025
d85b361
Merge branch 'master' into sm/vm-instr
pgherveou Sep 1, 2025
44ea81c
fix log level
pgherveou Sep 1, 2025
4e58574
fix
pgherveou Sep 1, 2025
cf357ae
the caller fixture bubbles up errors
xermicus Sep 1, 2025
ce8a282
add missing instruction error handling
xermicus Sep 1, 2025
e49b5b4
Update substrate/frame/revive/src/exec.rs
xermicus Sep 1, 2025
edbc42c
rename the trait method
xermicus Sep 1, 2025
109841b
rename the trait method
xermicus Sep 1, 2025
6d4878e
Merge branch 'master' into sm/vm-instr
xermicus Sep 1, 2025
216d9d9
Update from github-actions[bot] running command 'fmt'
github-actions[bot] Sep 1, 2025
c561085
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] Sep 1, 2025
039dccf
prdoc
xermicus Sep 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions prdoc/pr_9414.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
title: '[pallet-revive] EVM backend: Implement tx, block system and call stack instructions'
doc:
- audience: Runtime Dev
description: |-
This PR is part of the road to EVM.
- Implement call and create frames, allowing to call and instantiate other contracts.
- Implement support for tx info, block info, system and contract opcodes.
- The `InstructionResult` <-> `ExecError` conversion functions.
crates:
- name: pallet-revive
bump: major
- name: pallet-revive-fixtures
bump: minor
32 changes: 32 additions & 0 deletions substrate/frame/revive/fixtures/contracts/BlockInfo.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract BlockInfo {
function blockNumber() public view returns (uint) {
return block.number;
}

function coinbase() public view returns (address) {
return block.coinbase;
}

function timestamp() public view returns (uint) {
return block.timestamp;
}

function difficulty() public view returns (uint) {
return block.difficulty;
}

function gaslimit() public view returns (uint) {
return block.gaslimit;
}

function chainid() public view returns (uint) {
return block.chainid;
}

function basefee() public view returns (uint) {
return block.basefee;
}
}
35 changes: 35 additions & 0 deletions substrate/frame/revive/fixtures/contracts/Callee.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.0;

contract Callee {
uint public stored;

function echo(uint _data) external pure returns (uint data) {
data = _data;
}

function whoSender() external view returns (address) {
return msg.sender;
}

function store(uint _data) external {
stored = _data;
}

function revert() public pure returns (uint256) {
require(false, "This is a revert");
return 42; // never reached
}

function invalid() public pure returns (uint256 result) {
assembly {
invalid() // 0xFE opcode
}
}

function stop() public pure returns (uint256 result) {
assembly {
stop()
}
}
}
61 changes: 61 additions & 0 deletions substrate/frame/revive/fixtures/contracts/Caller.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.0;

contract Caller {
function normal(
address _callee,
uint _value,
bytes memory _data,
uint _gas
) external returns (bool success, bytes memory output) {
(success, output) = _callee.call{value: _value, gas: _gas}(_data);
}

function delegate(
address _callee,
bytes memory _data,
uint _gas
) external returns (bool success, bytes memory output) {
(success, output) = _callee.delegatecall{gas: _gas}(_data);
}

function staticCall(
// Don't rename to `static` (it's a Rust keyword).
address _callee,
bytes memory _data,
uint _gas
) external view returns (bool success, bytes memory output) {
(success, output) = _callee.staticcall{gas: _gas}(_data);
}

function create(
bytes memory initcode
) external payable returns (address addr) {
assembly {
// CREATE with no value
addr := create(0, add(initcode, 0x20), mload(initcode))
if iszero(addr) {
// bubble failure
let returnDataSize := returndatasize()
returndatacopy(0, 0, returnDataSize)
revert(0, returnDataSize)
}
}
}

function create2(
bytes memory initcode,
bytes32 salt
) external payable returns (address addr) {
assembly {
// CREATE2 with no value
addr := create2(0, add(initcode, 0x20), mload(initcode), salt)
if iszero(addr) {
// bubble failure
let returnDataSize := returndatasize()
returndatacopy(0, 0, returnDataSize)
revert(0, returnDataSize)
}
}
}
}
4 changes: 4 additions & 0 deletions substrate/frame/revive/fixtures/contracts/Dummy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;

contract Dummy {}
117 changes: 117 additions & 0 deletions substrate/frame/revive/fixtures/contracts/Host.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Host {
function balance(address account) public view returns (uint256) {
return account.balance;
}

function extcodesize(address account) public view returns (uint256) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size;
}

function extcodecopy(
address /* account */,
uint256 /* destOffset */,
uint256 /* offset */,
uint256 size
) public pure returns (bytes memory) {
bytes memory code = new bytes(size);
return code;
}

function extcodehash(address account) public view returns (bytes32) {
bytes32 hash;
assembly {
hash := extcodehash(account)
}
return hash;
}

function blockhash(uint256 blockNumber) public view returns (bytes32) {
return blockhash(blockNumber);
}

function sload(uint256 slot) public view returns (uint256) {
uint256 value;
assembly {
value := sload(slot)
}
return value;
}

function sstore(uint256 slot, uint256 value) public returns (uint256) {
assembly {
sstore(slot, value)
}
return value;
}

function tload(uint256 slot) public view returns (uint256) {
uint256 value;
assembly {
value := tload(slot)
}
return value;
}

function tstore(uint256 slot, uint256 value) public returns (uint256) {
assembly {
tstore(slot, value)
}
return value;
}

function log0(bytes32 data) public {
assembly {
log0(data, 0x20)
}
}

function log1(bytes32 data, bytes32 topic1) public {
assembly {
log1(data, 0x20, topic1)
}
}

function log2(bytes32 data, bytes32 topic1, bytes32 topic2) public {
assembly {
log2(data, 0x20, topic1, topic2)
}
}

function log3(
bytes32 data,
bytes32 topic1,
bytes32 topic2,
bytes32 topic3
) public {
assembly {
log3(data, 0x20, topic1, topic2, topic3)
}
}

function log4(
bytes32 data,
bytes32 topic1,
bytes32 topic2,
bytes32 topic3,
bytes32 topic4
) public {
assembly {
log4(data, 0x20, topic1, topic2, topic3, topic4)
}
}

function selfdestruct(address payable recipient) public {
selfdestruct(recipient);
}

function selfbalance() public view returns (uint256) {
return address(this).balance;
}
}
95 changes: 95 additions & 0 deletions substrate/frame/revive/fixtures/contracts/System.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

contract System {
function keccak256Func(bytes memory data) public pure returns (bytes32) {
return keccak256(data);
}

function addressFunc() public view returns (address) {
return address(this);
}

function caller() public view returns (address) {
return msg.sender;
}

function callvalue() public payable returns (uint256) {
return msg.value;
}

function calldataload(uint256 offset) public pure returns (bytes32) {
bytes32 data;
assembly {
data := calldataload(offset)
}
return data;
}

function calldatasize() public pure returns (uint256) {
return msg.data.length;
}

function calldatacopy(
uint256 destOffset,
uint256 offset,
uint256 size
) public pure returns (bytes memory) {
bytes memory data = new bytes(size);
assembly {
calldatacopy(add(data, 0x20), offset, size)
}
return data;
}

function codesize() public pure returns (uint256) {
uint256 size;
assembly {
size := codesize()
}
return size;
}

function codecopy(
uint256 /* destOffset */,
uint256 /* offset */,
uint256 size
) public pure returns (bytes memory) {
bytes memory code = new bytes(size);
return code;
}

function returndatasize(
address _callee,
bytes memory _data,
uint _gas
) public returns (uint256) {
uint256 size;
_callee.staticcall{gas: _gas}(_data);
assembly {
size := returndatasize()
}
return size;
}

function returndatacopy(
address _callee,
bytes memory _data,
uint _gas,
uint256 destOffset,
uint256 offset,
uint256 size
) public returns (bytes memory) {
bytes memory data = new bytes(size);
_callee.staticcall{gas: _gas}(_data);
assembly {
returndatacopy(add(data, 0x20), offset, size)
}
return data;
}

function gas() public view returns (uint256) {
return gasleft();
}
}
16 changes: 16 additions & 0 deletions substrate/frame/revive/fixtures/contracts/TransactionInfo.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract TransactionInfo {
function origin() public view returns (address) {
return tx.origin;
}

function gasprice() public view returns (uint256) {
return tx.gasprice;
}

function blobhash(uint256 index) public view returns (bytes32) {
return blobhash(index);
}
}
Loading
Loading