@@ -75,85 +75,85 @@ func TestSmokeDebugData(t *testing.T) {
7575 }
7676
7777 tests := []test {
78- // {
79- // name: "test named inputs/outputs",
80- // method: "emitNamedInputsOutputs",
81- // params: []interface{}{big.NewInt(1337), "test"},
82- // write: true,
83- // output: seth.DecodedTransaction{
84- // CommonData: seth.CommonData{
85- // Input: map[string]interface{}{
86- // "inputVal1": big.NewInt(1337),
87- // "inputVal2": "test",
88- // },
89- // },
90- // },
91- // },
92- // // TODO: https://docs.soliditylang.org/en/v0.8.19/control-structures.html read and figure out if
93- // // decoding anynymous + named is heavily used and needed, usually people name params and omit output names
94- // {
95- // name: "test anonymous inputs/outputs",
96- // method: "emitInputsOutputs",
97- // params: []interface{}{big.NewInt(1337), "test"},
98- // write: true,
99- // output: seth.DecodedTransaction{
100- // CommonData: seth.CommonData{
101- // Input: map[string]interface{}{
102- // "inputVal1": big.NewInt(1337),
103- // "inputVal2": "test",
104- // },
105- // },
106- // },
107- // },
108- // {
109- // name: "test one log no index",
110- // method: "emitNoIndexEvent",
111- // write: true,
112- // output: seth.DecodedTransaction{
113- // Events: []seth.DecodedTransactionLog{
114- // {
115- // DecodedCommonLog: seth.DecodedCommonLog{
116- // EventData: map[string]interface{}{
117- // "sender": c.Addresses[0],
118- // },
119- // },
120- // },
121- // },
122- // },
123- // },
124- // {
125- // name: "test one log index",
126- // method: "emitOneIndexEvent",
127- // write: true,
128- // output: seth.DecodedTransaction{
129- // Events: []seth.DecodedTransactionLog{
130- // {
131- // DecodedCommonLog: seth.DecodedCommonLog{
132- // EventData: map[string]interface{}{
133- // "a": big.NewInt(83),
134- // },
135- // },
136- // },
137- // },
138- // },
139- // },
140- // {
141- // name: "test two log index",
142- // method: "emitTwoIndexEvent",
143- // write: true,
144- // output: seth.DecodedTransaction{
145- // Events: []seth.DecodedTransactionLog{
146- // {
147- // DecodedCommonLog: seth.DecodedCommonLog{
148- // EventData: map[string]interface{}{
149- // "roundId": big.NewInt(1),
150- // "startedBy": c.Addresses[0],
151- // },
152- // },
153- // },
154- // },
155- // },
156- // },
78+ {
79+ name : "test named inputs/outputs" ,
80+ method : "emitNamedInputsOutputs" ,
81+ params : []interface {}{big .NewInt (1337 ), "test" },
82+ write : true ,
83+ output : seth.DecodedTransaction {
84+ CommonData : seth.CommonData {
85+ Input : map [string ]interface {}{
86+ "inputVal1" : big .NewInt (1337 ),
87+ "inputVal2" : "test" ,
88+ },
89+ },
90+ },
91+ },
92+ // TODO: https://docs.soliditylang.org/en/v0.8.19/control-structures.html read and figure out if
93+ // decoding anynymous + named is heavily used and needed, usually people name params and omit output names
94+ {
95+ name : "test anonymous inputs/outputs" ,
96+ method : "emitInputsOutputs" ,
97+ params : []interface {}{big .NewInt (1337 ), "test" },
98+ write : true ,
99+ output : seth.DecodedTransaction {
100+ CommonData : seth.CommonData {
101+ Input : map [string ]interface {}{
102+ "inputVal1" : big .NewInt (1337 ),
103+ "inputVal2" : "test" ,
104+ },
105+ },
106+ },
107+ },
108+ {
109+ name : "test one log no index" ,
110+ method : "emitNoIndexEvent" ,
111+ write : true ,
112+ output : seth.DecodedTransaction {
113+ Events : []seth.DecodedTransactionLog {
114+ {
115+ DecodedCommonLog : seth.DecodedCommonLog {
116+ EventData : map [string ]interface {}{
117+ "sender" : c .Addresses [0 ],
118+ },
119+ },
120+ },
121+ },
122+ },
123+ },
124+ {
125+ name : "test one log index" ,
126+ method : "emitOneIndexEvent" ,
127+ write : true ,
128+ output : seth.DecodedTransaction {
129+ Events : []seth.DecodedTransactionLog {
130+ {
131+ DecodedCommonLog : seth.DecodedCommonLog {
132+ EventData : map [string ]interface {}{
133+ "a" : big .NewInt (83 ),
134+ },
135+ },
136+ },
137+ },
138+ },
139+ },
140+ {
141+ name : "test two log index" ,
142+ method : "emitTwoIndexEvent" ,
143+ write : true ,
144+ output : seth.DecodedTransaction {
145+ Events : []seth.DecodedTransactionLog {
146+ {
147+ DecodedCommonLog : seth.DecodedCommonLog {
148+ EventData : map [string ]interface {}{
149+ "roundId" : big .NewInt (1 ),
150+ "startedBy" : c .Addresses [0 ],
151+ },
152+ },
153+ },
154+ },
155+ },
156+ },
157157 {
158158 name : "test three log index" ,
159159 method : "emitThreeIndexEvent" ,
@@ -172,47 +172,47 @@ func TestSmokeDebugData(t *testing.T) {
172172 },
173173 },
174174 },
175- // {
176- // name: "test log no index string",
177- // method: "emitNoIndexEventString",
178- // write: true,
179- // output: seth.DecodedTransaction{
180- // Events: []seth.DecodedTransactionLog{
181- // {
182- // DecodedCommonLog: seth.DecodedCommonLog{
183- // EventData: map[string]interface{}{
184- // "str": "myString",
185- // },
186- // },
187- // },
188- // },
189- // },
190- // },
191- // // emitNoIndexStructEvent
192- // {
193- // name: "test log struct",
194- // method: "emitNoIndexStructEvent",
195- // write: true,
196- // output: seth.DecodedTransaction{
197- // Events: []seth.DecodedTransactionLog{
198- // {
199- // DecodedCommonLog: seth.DecodedCommonLog{
200- // EventData: map[string]interface{}{
201- // "a": struct {
202- // Name string `json:"name"`
203- // Balance uint64 `json:"balance"`
204- // DailyLimit *big.Int `json:"dailyLimit"`
205- // }{
206- // Name: "John",
207- // Balance: 5,
208- // DailyLimit: big.NewInt(10),
209- // },
210- // },
211- // },
212- // },
213- // },
214- // },
215- // },
175+ {
176+ name : "test log no index string" ,
177+ method : "emitNoIndexEventString" ,
178+ write : true ,
179+ output : seth.DecodedTransaction {
180+ Events : []seth.DecodedTransactionLog {
181+ {
182+ DecodedCommonLog : seth.DecodedCommonLog {
183+ EventData : map [string ]interface {}{
184+ "str" : "myString" ,
185+ },
186+ },
187+ },
188+ },
189+ },
190+ },
191+ // emitNoIndexStructEvent
192+ {
193+ name : "test log struct" ,
194+ method : "emitNoIndexStructEvent" ,
195+ write : true ,
196+ output : seth.DecodedTransaction {
197+ Events : []seth.DecodedTransactionLog {
198+ {
199+ DecodedCommonLog : seth.DecodedCommonLog {
200+ EventData : map [string ]interface {}{
201+ "a" : struct {
202+ Name string `json:"name"`
203+ Balance uint64 `json:"balance"`
204+ DailyLimit * big.Int `json:"dailyLimit"`
205+ }{
206+ Name : "John" ,
207+ Balance : 5 ,
208+ DailyLimit : big .NewInt (10 ),
209+ },
210+ },
211+ },
212+ },
213+ },
214+ },
215+ },
216216 // TODO: another case - figure out if indexed strings are used by anyone in events
217217 // https://ethereum.stackexchange.com/questions/6840/indexed-event-with-string-not-getting-logged
218218 }
0 commit comments