aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-29 03:43:55 +0800
committerGitHub <noreply@github.com>2017-08-29 03:43:55 +0800
commitb364bd048ffaf233782a23dabd13622431a75aa3 (patch)
tree2889d5cc2dc8be170c862345c0476e0b849923ab
parent3d228e98f1fe9dfdbebab2537eb1d8bcc1340d0b (diff)
parent0e11e5af10de880340a005f63f778909c8664c90 (diff)
downloaddexon-solidity-b364bd048ffaf233782a23dabd13622431a75aa3.tar
dexon-solidity-b364bd048ffaf233782a23dabd13622431a75aa3.tar.gz
dexon-solidity-b364bd048ffaf233782a23dabd13622431a75aa3.tar.bz2
dexon-solidity-b364bd048ffaf233782a23dabd13622431a75aa3.tar.lz
dexon-solidity-b364bd048ffaf233782a23dabd13622431a75aa3.tar.xz
dexon-solidity-b364bd048ffaf233782a23dabd13622431a75aa3.tar.zst
dexon-solidity-b364bd048ffaf233782a23dabd13622431a75aa3.zip
Merge pull request #2837 from ethereum/event-overloading-abi
Include all overloaded events in ABI
-rw-r--r--Changelog.md2
-rw-r--r--libsolidity/ast/AST.cpp12
-rw-r--r--test/libsolidity/SolidityABIJSON.cpp20
3 files changed, 31 insertions, 3 deletions
diff --git a/Changelog.md b/Changelog.md
index 49855369..4af4419d 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -5,9 +5,9 @@ Features:
* Type Checker: Warn on using literals as tight packing parameters in ``keccak256``, ``sha3``, ``sha256`` and ``ripemd160``.
Bugfixes:
+ * ABI JSON: Include all overloaded events.
* Parser: Crash fix related to parseTypeName.
-
### 0.4.16 (2017-08-24)
Features:
diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp
index 2e4ae72a..a805322b 100644
--- a/libsolidity/ast/AST.cpp
+++ b/libsolidity/ast/AST.cpp
@@ -176,11 +176,19 @@ vector<EventDefinition const*> const& ContractDefinition::interfaceEvents() cons
m_interfaceEvents.reset(new vector<EventDefinition const*>());
for (ContractDefinition const* contract: annotation().linearizedBaseContracts)
for (EventDefinition const* e: contract->events())
- if (eventsSeen.count(e->name()) == 0)
+ {
+ /// NOTE: this requires the "internal" version of an Event,
+ /// though here internal strictly refers to visibility,
+ /// and not to function encoding (jump vs. call)
+ auto const& function = e->functionType(true);
+ solAssert(function, "");
+ string eventSignature = function->externalSignature();
+ if (eventsSeen.count(eventSignature) == 0)
{
- eventsSeen.insert(e->name());
+ eventsSeen.insert(eventSignature);
m_interfaceEvents->push_back(e);
}
+ }
}
return *m_interfaceEvents;
}
diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp
index 0512ba1f..4b9223de 100644
--- a/test/libsolidity/SolidityABIJSON.cpp
+++ b/test/libsolidity/SolidityABIJSON.cpp
@@ -423,6 +423,8 @@ BOOST_AUTO_TEST_CASE(events)
function f(uint a) returns(uint d) { return a * 7; }
event e1(uint b, address indexed c);
event e2();
+ event e2(uint a);
+ event e3() anonymous;
}
)";
char const* interface = R"([
@@ -467,6 +469,24 @@ BOOST_AUTO_TEST_CASE(events)
"type": "event",
"anonymous": false,
"inputs": []
+ },
+ {
+ "name": "e2",
+ "type": "event",
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "a",
+ "type": "uint256"
+ }
+ ]
+ },
+ {
+ "name": "e3",
+ "type": "event",
+ "anonymous": true,
+ "inputs": []
}
])";