-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
//! Integration tests for EVM specifications. | ||
|
||
use crate::{config::*, test_helpers::TEST_DATA_DEFAULT}; | ||
use crate::{config::*, test_helpers::TEST_DATA_PARIS}; | ||
use foundry_evm::revm::primitives::SpecId; | ||
use foundry_test_utils::Filter; | ||
|
||
#[tokio::test(flavor = "multi_thread")] | ||
async fn test_shanghai_compat() { | ||
let filter = Filter::new("", "ShanghaiCompat", ".*spec"); | ||
TestConfig::with_filter(TEST_DATA_DEFAULT.runner(), filter).run().await; | ||
TestConfig::with_filter(TEST_DATA_PARIS.runner(), filter) | ||
.evm_spec(SpecId::SHANGHAI) | ||
.run() | ||
.await; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
pragma solidity ^0.8.18; | ||
|
||
import "ds-test/test.sol"; | ||
import "cheats/Vm.sol"; | ||
|
||
contract ShanghaiCompat is DSTest { | ||
Vm constant vm = Vm(HEVM_ADDRESS); | ||
|
||
function testPush0() public { | ||
address target = address(uint160(uint256(0xc4f3))); | ||
|
||
bytes memory bytecode = hex"365f5f37365ff3"; | ||
// 36 CALLDATASIZE | ||
// 5F PUSH0 | ||
// 5F PUSH0 | ||
// 37 CALLDATACOPY -> copies calldata at mem[0..calldatasize] | ||
|
||
// 36 CALLDATASIZE | ||
// 5F PUSH0 | ||
// F3 RETURN -> returns mem[0..calldatasize] | ||
|
||
vm.etch(target, bytecode); | ||
|
||
(bool success, bytes memory result) = target.call(bytes("hello PUSH0")); | ||
assertTrue(success); | ||
assertEq(string(result), "hello PUSH0"); | ||
} | ||
} |