mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix external ABI type name for contracts
This commit is contained in:
parent
94053c9a52
commit
0f4b53e9a0
@ -24,6 +24,8 @@ Compiler Features:
|
|||||||
Bugfixes:
|
Bugfixes:
|
||||||
* SMTChecker: Implement Boolean short-circuiting.
|
* SMTChecker: Implement Boolean short-circuiting.
|
||||||
* SMTChecker: SSA control-flow did not take into account state variables that were modified inside inlined functions that were called inside branches.
|
* SMTChecker: SSA control-flow did not take into account state variables that were modified inside inlined functions that were called inside branches.
|
||||||
|
* Type System: Use correct type name for contracts in event parameters when used in
|
||||||
|
libraries. This affected code generation.
|
||||||
* Yul: Properly register functions and disallow shadowing between function variables and variables in the outside scope.
|
* Yul: Properly register functions and disallow shadowing between function variables and variables in the outside scope.
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"name": "IncorrectEventSignatureInLibraries",
|
||||||
|
"summary": "Contract types used in events in libraries cause an incorrect event signature hash",
|
||||||
|
"description": "Instead of using the type `address` in the hashed signature, the actual contract name was used, leading to a wrong hash in the logs.",
|
||||||
|
"introduced": "0.3.0",
|
||||||
|
"fixed": "0.5.8",
|
||||||
|
"severity": "very low"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "ABIEncoderV2PackedStorage",
|
"name": "ABIEncoderV2PackedStorage",
|
||||||
"summary": "Storage structs and arrays with types shorter than 32 bytes can cause data corruption if encoded directly from storage using the experimental ABIEncoderV2.",
|
"summary": "Storage structs and arrays with types shorter than 32 bytes can cause data corruption if encoded directly from storage using the experimental ABIEncoderV2.",
|
||||||
|
@ -211,6 +211,7 @@
|
|||||||
},
|
},
|
||||||
"0.3.0": {
|
"0.3.0": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -231,6 +232,7 @@
|
|||||||
},
|
},
|
||||||
"0.3.1": {
|
"0.3.1": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -250,6 +252,7 @@
|
|||||||
},
|
},
|
||||||
"0.3.2": {
|
"0.3.2": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -269,6 +272,7 @@
|
|||||||
},
|
},
|
||||||
"0.3.3": {
|
"0.3.3": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -287,6 +291,7 @@
|
|||||||
},
|
},
|
||||||
"0.3.4": {
|
"0.3.4": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -305,6 +310,7 @@
|
|||||||
},
|
},
|
||||||
"0.3.5": {
|
"0.3.5": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -323,6 +329,7 @@
|
|||||||
},
|
},
|
||||||
"0.3.6": {
|
"0.3.6": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -339,6 +346,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.0": {
|
"0.4.0": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -355,6 +363,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.1": {
|
"0.4.1": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -371,6 +380,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.10": {
|
"0.4.10": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -383,6 +393,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.11": {
|
"0.4.11": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -394,6 +405,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.12": {
|
"0.4.12": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -404,6 +416,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.13": {
|
"0.4.13": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -414,6 +427,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.14": {
|
"0.4.14": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -423,6 +437,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.15": {
|
"0.4.15": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector"
|
"ZeroFunctionSelector"
|
||||||
@ -431,6 +446,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.16": {
|
"0.4.16": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector"
|
"ZeroFunctionSelector"
|
||||||
@ -439,6 +455,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.17": {
|
"0.4.17": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"EventStructWrongData",
|
"EventStructWrongData",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
@ -448,6 +465,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.18": {
|
"0.4.18": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"EventStructWrongData",
|
"EventStructWrongData",
|
||||||
"NestedArrayFunctionCallDecoder"
|
"NestedArrayFunctionCallDecoder"
|
||||||
@ -456,6 +474,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.19": {
|
"0.4.19": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage",
|
"ABIEncoderV2PackedStorage",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"EventStructWrongData",
|
"EventStructWrongData",
|
||||||
@ -465,6 +484,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.2": {
|
"0.4.2": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -480,6 +500,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.20": {
|
"0.4.20": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage",
|
"ABIEncoderV2PackedStorage",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"EventStructWrongData",
|
"EventStructWrongData",
|
||||||
@ -489,6 +510,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.21": {
|
"0.4.21": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage",
|
"ABIEncoderV2PackedStorage",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"EventStructWrongData",
|
"EventStructWrongData",
|
||||||
@ -498,6 +520,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.22": {
|
"0.4.22": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage",
|
"ABIEncoderV2PackedStorage",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"EventStructWrongData",
|
"EventStructWrongData",
|
||||||
@ -507,6 +530,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.23": {
|
"0.4.23": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage",
|
"ABIEncoderV2PackedStorage",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"EventStructWrongData"
|
"EventStructWrongData"
|
||||||
@ -515,6 +539,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.24": {
|
"0.4.24": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage",
|
"ABIEncoderV2PackedStorage",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"EventStructWrongData"
|
"EventStructWrongData"
|
||||||
@ -523,12 +548,14 @@
|
|||||||
},
|
},
|
||||||
"0.4.25": {
|
"0.4.25": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage"
|
"ABIEncoderV2PackedStorage"
|
||||||
],
|
],
|
||||||
"released": "2018-09-12"
|
"released": "2018-09-12"
|
||||||
},
|
},
|
||||||
"0.4.3": {
|
"0.4.3": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -543,6 +570,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.4": {
|
"0.4.4": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -556,6 +584,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.5": {
|
"0.4.5": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -570,6 +599,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.6": {
|
"0.4.6": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -583,6 +613,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.7": {
|
"0.4.7": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -595,6 +626,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.8": {
|
"0.4.8": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -607,6 +639,7 @@
|
|||||||
},
|
},
|
||||||
"0.4.9": {
|
"0.4.9": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ExpExponentCleanup",
|
"ExpExponentCleanup",
|
||||||
"NestedArrayFunctionCallDecoder",
|
"NestedArrayFunctionCallDecoder",
|
||||||
"ZeroFunctionSelector",
|
"ZeroFunctionSelector",
|
||||||
@ -619,36 +652,42 @@
|
|||||||
},
|
},
|
||||||
"0.5.0": {
|
"0.5.0": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage"
|
"ABIEncoderV2PackedStorage"
|
||||||
],
|
],
|
||||||
"released": "2018-11-13"
|
"released": "2018-11-13"
|
||||||
},
|
},
|
||||||
"0.5.1": {
|
"0.5.1": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage"
|
"ABIEncoderV2PackedStorage"
|
||||||
],
|
],
|
||||||
"released": "2018-12-03"
|
"released": "2018-12-03"
|
||||||
},
|
},
|
||||||
"0.5.2": {
|
"0.5.2": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage"
|
"ABIEncoderV2PackedStorage"
|
||||||
],
|
],
|
||||||
"released": "2018-12-19"
|
"released": "2018-12-19"
|
||||||
},
|
},
|
||||||
"0.5.3": {
|
"0.5.3": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage"
|
"ABIEncoderV2PackedStorage"
|
||||||
],
|
],
|
||||||
"released": "2019-01-22"
|
"released": "2019-01-22"
|
||||||
},
|
},
|
||||||
"0.5.4": {
|
"0.5.4": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage"
|
"ABIEncoderV2PackedStorage"
|
||||||
],
|
],
|
||||||
"released": "2019-02-12"
|
"released": "2019-02-12"
|
||||||
},
|
},
|
||||||
"0.5.5": {
|
"0.5.5": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage",
|
"ABIEncoderV2PackedStorage",
|
||||||
"IncorrectByteInstructionOptimization",
|
"IncorrectByteInstructionOptimization",
|
||||||
"DoubleShiftSizeOverflow"
|
"DoubleShiftSizeOverflow"
|
||||||
@ -657,13 +696,16 @@
|
|||||||
},
|
},
|
||||||
"0.5.6": {
|
"0.5.6": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries",
|
||||||
"ABIEncoderV2PackedStorage",
|
"ABIEncoderV2PackedStorage",
|
||||||
"IncorrectByteInstructionOptimization"
|
"IncorrectByteInstructionOptimization"
|
||||||
],
|
],
|
||||||
"released": "2019-03-13"
|
"released": "2019-03-13"
|
||||||
},
|
},
|
||||||
"0.5.7": {
|
"0.5.7": {
|
||||||
"bugs": [],
|
"bugs": [
|
||||||
|
"IncorrectEventSignatureInLibraries"
|
||||||
|
],
|
||||||
"released": "2019-03-26"
|
"released": "2019-03-26"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -147,6 +147,21 @@ bool fitsIntoBits(bigint const& _value, unsigned _bits, bool _signed)
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result<TypePointers> transformParametersToExternal(TypePointers const& _parameters, bool _inLibrary)
|
||||||
|
{
|
||||||
|
TypePointers transformed;
|
||||||
|
|
||||||
|
for (auto const& type: _parameters)
|
||||||
|
{
|
||||||
|
if (TypePointer ext = type->interfaceType(_inLibrary).get())
|
||||||
|
transformed.push_back(ext);
|
||||||
|
else
|
||||||
|
return Result<TypePointers>::err("Parameter should have external type.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return transformed;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StorageOffsets::computeOffsets(TypePointers const& _types)
|
void StorageOffsets::computeOffsets(TypePointers const& _types)
|
||||||
@ -2904,27 +2919,22 @@ FunctionTypePointer FunctionType::interfaceFunctionType() const
|
|||||||
{
|
{
|
||||||
// Note that m_declaration might also be a state variable!
|
// Note that m_declaration might also be a state variable!
|
||||||
solAssert(m_declaration, "Declaration needed to determine interface function type.");
|
solAssert(m_declaration, "Declaration needed to determine interface function type.");
|
||||||
bool isLibraryFunction = dynamic_cast<ContractDefinition const&>(*m_declaration->scope()).isLibrary();
|
bool isLibraryFunction = kind() != Kind::Event && dynamic_cast<ContractDefinition const&>(*m_declaration->scope()).isLibrary();
|
||||||
|
|
||||||
TypePointers paramTypes;
|
Result<TypePointers> paramTypes =
|
||||||
TypePointers retParamTypes;
|
transformParametersToExternal(m_parameterTypes, isLibraryFunction);
|
||||||
|
|
||||||
for (auto type: m_parameterTypes)
|
if (!paramTypes.message().empty())
|
||||||
{
|
|
||||||
if (auto ext = type->interfaceType(isLibraryFunction).get())
|
|
||||||
paramTypes.push_back(ext);
|
|
||||||
else
|
|
||||||
return FunctionTypePointer();
|
return FunctionTypePointer();
|
||||||
}
|
|
||||||
for (auto type: m_returnParameterTypes)
|
Result<TypePointers> retParamTypes =
|
||||||
{
|
transformParametersToExternal(m_returnParameterTypes, isLibraryFunction);
|
||||||
if (auto ext = type->interfaceType(isLibraryFunction).get())
|
|
||||||
retParamTypes.push_back(ext);
|
if (!retParamTypes.message().empty())
|
||||||
else
|
|
||||||
return FunctionTypePointer();
|
return FunctionTypePointer();
|
||||||
}
|
|
||||||
auto variable = dynamic_cast<VariableDeclaration const*>(m_declaration);
|
auto variable = dynamic_cast<VariableDeclaration const*>(m_declaration);
|
||||||
if (variable && retParamTypes.empty())
|
if (variable && retParamTypes.get().empty())
|
||||||
return FunctionTypePointer();
|
return FunctionTypePointer();
|
||||||
|
|
||||||
return make_shared<FunctionType>(
|
return make_shared<FunctionType>(
|
||||||
@ -3139,13 +3149,15 @@ string FunctionType::externalSignature() const
|
|||||||
|
|
||||||
// "inLibrary" is only relevant if this is not an event.
|
// "inLibrary" is only relevant if this is not an event.
|
||||||
bool const inLibrary = kind() != Kind::Event && dynamic_cast<ContractDefinition const&>(*m_declaration->scope()).isLibrary();
|
bool const inLibrary = kind() != Kind::Event && dynamic_cast<ContractDefinition const&>(*m_declaration->scope()).isLibrary();
|
||||||
FunctionTypePointer external = interfaceFunctionType();
|
|
||||||
solAssert(!!external, "External function type requested.");
|
auto extParams = transformParametersToExternal(m_parameterTypes, inLibrary);
|
||||||
auto parameterTypes = external->parameterTypes();
|
|
||||||
auto typeStrings = parameterTypes | boost::adaptors::transformed([&](TypePointer _t) -> string
|
solAssert(extParams.message().empty(), extParams.message());
|
||||||
|
|
||||||
|
auto typeStrings = extParams.get() | boost::adaptors::transformed([&](TypePointer _t) -> string
|
||||||
{
|
{
|
||||||
solAssert(_t, "Parameter should have external type.");
|
|
||||||
string typeName = _t->signatureInExternalFunction(inLibrary);
|
string typeName = _t->signatureInExternalFunction(inLibrary);
|
||||||
|
|
||||||
if (inLibrary && _t->dataStoredIn(DataLocation::Storage))
|
if (inLibrary && _t->dataStoredIn(DataLocation::Storage))
|
||||||
typeName += " storage";
|
typeName += " storage";
|
||||||
return typeName;
|
return typeName;
|
||||||
|
@ -15607,6 +15607,33 @@ BOOST_AUTO_TEST_CASE(contract_name)
|
|||||||
ABI_CHECK(callContractFunction("constantNameAccessor()"), argsLong);
|
ABI_CHECK(callContractFunction("constantNameAccessor()"), argsLong);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(event_wrong_abi_name)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
library ClientReceipt {
|
||||||
|
event Deposit(Test indexed _from, bytes32 indexed _id, uint _value);
|
||||||
|
function deposit(bytes32 _id) public {
|
||||||
|
Test a;
|
||||||
|
emit Deposit(a, _id, msg.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
contract Test {
|
||||||
|
function f() public {
|
||||||
|
ClientReceipt.deposit("123");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
compileAndRun(sourceCode, 0, "ClientReceipt", bytes());
|
||||||
|
compileAndRun(sourceCode, 0, "Test", bytes(), map<string, Address>{{"ClientReceipt", m_contractAddress}});
|
||||||
|
u256 value(18);
|
||||||
|
u256 id(0x1234);
|
||||||
|
|
||||||
|
callContractFunction("f()");
|
||||||
|
BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
|
||||||
|
BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
|
||||||
|
BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 3);
|
||||||
|
BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Deposit(address,bytes32,uint256)")));
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user