cmd/evm: fix state dump (#17832)
This commit is contained in:
		
				
					committed by
					
						
						Martin Holst Swende
					
				
			
			
				
	
			
			
			
						parent
						
							82a1c771ef
						
					
				
				
					commit
					bfa0f96822
				
			@@ -97,6 +97,10 @@ func stateTestCmd(ctx *cli.Context) error {
 | 
				
			|||||||
			// Run the test and aggregate the result
 | 
								// Run the test and aggregate the result
 | 
				
			||||||
			result := &StatetestResult{Name: key, Fork: st.Fork, Pass: true}
 | 
								result := &StatetestResult{Name: key, Fork: st.Fork, Pass: true}
 | 
				
			||||||
			state, err := test.Run(st, cfg)
 | 
								state, err := test.Run(st, cfg)
 | 
				
			||||||
 | 
								// print state root for evmlab tracing
 | 
				
			||||||
 | 
								if ctx.GlobalBool(MachineFlag.Name) && state != nil {
 | 
				
			||||||
 | 
									fmt.Fprintf(os.Stderr, "{\"stateRoot\": \"%x\"}\n", state.IntermediateRoot(false))
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				// Test failed, mark as so and dump any state to aid debugging
 | 
									// Test failed, mark as so and dump any state to aid debugging
 | 
				
			||||||
				result.Pass, result.Error = false, err.Error()
 | 
									result.Pass, result.Error = false, err.Error()
 | 
				
			||||||
@@ -105,10 +109,6 @@ func stateTestCmd(ctx *cli.Context) error {
 | 
				
			|||||||
					result.State = &dump
 | 
										result.State = &dump
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			// print state root for evmlab tracing (already committed above, so no need to delete objects again
 | 
					 | 
				
			||||||
			if ctx.GlobalBool(MachineFlag.Name) && state != nil {
 | 
					 | 
				
			||||||
				fmt.Fprintf(os.Stderr, "{\"stateRoot\": \"%x\"}\n", state.IntermediateRoot(false))
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			results = append(results, *result)
 | 
								results = append(results, *result)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user