mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Consider extcodehash as part of Constantinople
This commit is contained in:
		
							parent
							
								
									5fc8e29fff
								
							
						
					
					
						commit
						cb7b053a4a
					
				| @ -4,6 +4,7 @@ Language Features: | ||||
| 
 | ||||
| 
 | ||||
| Compiler Features: | ||||
|  * Inline Assembly: Consider ``extcodehash`` as part of Constantinople. | ||||
|  * SMTChecker: Do not report underflow/overflow if they always revert. This removes false positives when using ``SafeMath``. | ||||
|  * Static Analyzer: Warn about expressions with custom types when they have no effect. | ||||
|  * Optimizer: Add rule for shifts with constants for Constantinople. | ||||
|  | ||||
| @ -74,6 +74,7 @@ public: | ||||
| 	bool hasStaticCall() const { return *this >= byzantium(); } | ||||
| 	bool hasBitwiseShifting() const { return *this >= constantinople(); } | ||||
| 	bool hasCreate2() const { return *this >= constantinople(); } | ||||
| 	bool hasExtCodeHash() const { return *this >= constantinople(); } | ||||
| 
 | ||||
| 	/// Whether we have to retain the costs for the call opcode itself (false),
 | ||||
| 	/// or whether we can just forward easily all remaining gas (true).
 | ||||
|  | ||||
| @ -655,19 +655,7 @@ void AsmAnalyzer::warnOnInstructions(solidity::Instruction _instr, SourceLocatio | ||||
| 		); | ||||
| 	}; | ||||
| 
 | ||||
| 	if (_instr == solidity::Instruction::EXTCODEHASH) | ||||
| 	{ | ||||
| 		m_errorReporter.warning( | ||||
| 			_location, | ||||
| 			"The \"" + | ||||
| 			boost::to_lower_copy(instructionInfo(_instr).name) | ||||
| 			+ "\" instruction is not supported by the VM version \"" + | ||||
| 			"" + m_evmVersion.name() + | ||||
| 			"\" you are currently compiling for. " + | ||||
| 			"It will be interpreted as an invalid instruction on this VM." | ||||
| 		); | ||||
| 	} | ||||
| 	else if (( | ||||
| 	if (( | ||||
| 		_instr == solidity::Instruction::RETURNDATACOPY || | ||||
| 		_instr == solidity::Instruction::RETURNDATASIZE | ||||
| 	) && !m_evmVersion.supportsReturndata()) | ||||
| @ -690,6 +678,10 @@ void AsmAnalyzer::warnOnInstructions(solidity::Instruction _instr, SourceLocatio | ||||
| 	{ | ||||
| 		warningForVM("only available for Constantinople-compatible"); | ||||
| 	} | ||||
| 	else if (_instr == solidity::Instruction::EXTCODEHASH && !m_evmVersion.hasExtCodeHash()) | ||||
| 	{ | ||||
| 		warningForVM("only available for Constantinople-compatible"); | ||||
| 	} | ||||
| 	else if (_instr == solidity::Instruction::JUMP || _instr == solidity::Instruction::JUMPI || _instr == solidity::Instruction::JUMPDEST) | ||||
| 	{ | ||||
| 		if (m_dialect->flavour == AsmFlavour::Loose) | ||||
|  | ||||
| @ -417,10 +417,12 @@ BOOST_AUTO_TEST_CASE(extcodehash_as_variable) | ||||
| 	)"; | ||||
| 	// This needs special treatment, because the message mentions the EVM version,
 | ||||
| 	// so cannot be run via isoltest.
 | ||||
| 	CHECK_ALLOW_MULTI(text, (std::vector<std::pair<Error::Type, std::string>>{ | ||||
| 		{Error::Type::Warning, "Variable is shadowed in inline assembly by an instruction of the same name"}, | ||||
| 		{Error::Type::Warning, "The \"extcodehash\" instruction is not supported by the VM version"}, | ||||
| 	})); | ||||
| 	vector<pair<Error::Type, std::string>> expectations(vector<pair<Error::Type, std::string>>{ | ||||
| 		{Error::Type::Warning, "Variable is shadowed in inline assembly by an instruction of the same name"} | ||||
| 	}); | ||||
| 	if (!dev::test::Options::get().evmVersion().hasExtCodeHash()) | ||||
| 		expectations.emplace_back(make_pair(Error::Type::Warning, std::string("\"extcodehash\" instruction is only available for Constantinople-compatible VMs."))); | ||||
| 	CHECK_ALLOW_MULTI(text, expectations); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(getter_is_memory_type) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user