From d2d9bf406c77281008115c1b377c58594c2a23be Mon Sep 17 00:00:00 2001
From: Wei-Ning Huang <w@dexon.org>
Date: Tue, 16 Apr 2019 13:12:36 +0800
Subject: core: vm: fix emitReported (#367)

---
 core/vm/oracle_contracts.go | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/core/vm/oracle_contracts.go b/core/vm/oracle_contracts.go
index 55ea3f4dd..9adf98e53 100644
--- a/core/vm/oracle_contracts.go
+++ b/core/vm/oracle_contracts.go
@@ -1107,7 +1107,7 @@ func (s *GovernanceState) emitConfigurationChangedEvent() {
 	})
 }
 
-// event CRSProposed(uint256 round, bytes32 crs);
+// event CRSProposed(uint256 indexed Round, bytes32 CRS);
 func (s *GovernanceState) emitCRSProposed(round *big.Int, crs common.Hash) {
 	s.StateDB.AddLog(&types.Log{
 		Address: GovernanceContractAddress,
@@ -1180,28 +1180,37 @@ func (s *GovernanceState) emitNodeRemoved(nodeAddr common.Address) {
 	})
 }
 
-// event ForkReported(address indexed NodeAddress, address indexed Type, bytes Arg1, bytes Arg2);
+// event Reported(address indexed NodeAddress, uint256 Type, bytes Arg1, bytes Arg2);
 func (s *GovernanceState) emitReported(nodeAddr common.Address, reportType *big.Int, arg1, arg2 []byte) {
 
-	t, err := abi.NewType("bytes", nil)
+	t1, err := abi.NewType("uint256", nil)
+	if err != nil {
+		panic(err)
+	}
+	t2, err := abi.NewType("bytes", nil)
 	if err != nil {
 		panic(err)
 	}
 
 	arg := abi.Arguments{
+		abi.Argument{
+			Name:    "ReportType",
+			Type:    t1,
+			Indexed: false,
+		},
 		abi.Argument{
 			Name:    "Arg1",
-			Type:    t,
+			Type:    t2,
 			Indexed: false,
 		},
 		abi.Argument{
 			Name:    "Arg2",
-			Type:    t,
+			Type:    t2,
 			Indexed: false,
 		},
 	}
 
-	data, err := arg.Pack(arg1, arg2)
+	data, err := arg.Pack(reportType, arg1, arg2)
 	if err != nil {
 		panic(err)
 	}
-- 
cgit v1.2.3