Update and add new tests for features of different EVM version

This commit is contained in:
Alex Beregszaszi 2020-07-03 00:19:44 +01:00
parent 2e6cbd8718
commit 9a94b89c48
6 changed files with 81 additions and 2 deletions

View File

@ -0,0 +1,16 @@
contract C {
function f() pure external {
assembly {
let s := returndatasize()
returndatacopy(0, 0, s)
}
}
function g() view external returns (uint ret) {
assembly {
ret := staticcall(0, gas(), 0, 0, 0, 0)
}
}
}
// ====
// EVMVersion: >=byzantium
// ----

View File

@ -0,0 +1,21 @@
contract C {
function f() pure external {
assembly {
let s := returndatasize()
returndatacopy(0, 0, s)
}
}
function g() view external returns (uint ret) {
assembly {
ret := staticcall(0, gas(), 0, 0, 0, 0)
}
}
}
// ====
// EVMVersion: =homestead
// ----
// TypeError 7756: (86-100): The "returndatasize" instruction is only available for Byzantium-compatible VMs (you are currently compiling for "homestead").
// DeclarationError 3812: (77-102): Variable count mismatch: 1 variables and 0 values.
// TypeError 7756: (115-129): The "returndatacopy" instruction is only available for Byzantium-compatible VMs (you are currently compiling for "homestead").
// TypeError 1503: (245-255): The "staticcall" instruction is only available for Byzantium-compatible VMs (you are currently compiling for "homestead").
// DeclarationError 8678: (238-277): Variable count does not match number of values (1 vs. 0)

View File

@ -0,0 +1,17 @@
contract C {
function f() view external returns (uint ret) {
assembly {
ret := shl(gas(), 5)
ret := shr(ret, 2)
ret := sar(ret, 2)
}
}
function g() external returns (address ret) {
assembly {
ret := create2(0, 0, 0, 0)
}
}
}
// ====
// EVMVersion: >=constantinople
// ----

View File

@ -0,0 +1,25 @@
contract C {
function f() view external returns (uint ret) {
assembly {
ret := shl(gas(), 5)
ret := shr(ret, 2)
ret := sar(ret, 2)
}
}
function g() external returns (address ret) {
assembly {
ret := create2(0, 0, 0, 0)
}
}
}
// ====
// EVMVersion: =byzantium
// ----
// TypeError 6612: (103-106): The "shl" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium").
// DeclarationError 8678: (96-116): Variable count does not match number of values (1 vs. 0)
// TypeError 6612: (136-139): The "shr" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium").
// DeclarationError 8678: (129-147): Variable count does not match number of values (1 vs. 0)
// TypeError 6612: (167-170): The "sar" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium").
// DeclarationError 8678: (160-178): Variable count does not match number of values (1 vs. 0)
// TypeError 6166: (283-290): The "create2" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium").
// DeclarationError 8678: (276-302): Variable count does not match number of values (1 vs. 0)

View File

@ -13,7 +13,7 @@ contract C {
// ====
// EVMVersion: =petersburg
// ----
// TypeError 7079: (101-108): The "chainid" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg").
// TypeError 1561: (101-108): The "chainid" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg").
// DeclarationError 8678: (95-110): Variable count does not match number of values (1 vs. 0)
// TypeError 7079: (215-226): The "selfbalance" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg").
// TypeError 3672: (215-226): The "selfbalance" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg").
// DeclarationError 8678: (209-228): Variable count does not match number of values (1 vs. 0)