diff --git a/packages/evm/jsonrpc/jsonrpctest/jsonrpc_test.go b/packages/evm/jsonrpc/jsonrpctest/jsonrpc_test.go index 928ff2cb3c..1cf1bf2ea7 100644 --- a/packages/evm/jsonrpc/jsonrpctest/jsonrpc_test.go +++ b/packages/evm/jsonrpc/jsonrpctest/jsonrpc_test.go @@ -827,7 +827,7 @@ func TestRPCTraceBlock(t *testing.T) { require.Equal(t, strings.ToLower(creatorAddress.String()), strings.ToLower(call11Action["from"].(string))) require.Equal(t, strings.ToLower(contractAddress.String()), strings.ToLower(call11Action["to"].(string))) require.Equal(t, "0x7b", call11Action["value"].(string)) - expectedInput, err := contractABI.Pack("sendTo", common.Address{0x1}, big.NewInt(2)) //nolint:govet + expectedInput, err := contractABI.Pack("sendTo", common.Address{0x1}, big.NewInt(2)) require.NoError(t, err) require.Equal(t, hex.EncodeToString(expectedInput), call11Action["input"].(string)[2:]) require.Empty(t, call11.Error) @@ -845,7 +845,7 @@ func TestRPCTraceBlock(t *testing.T) { require.Equal(t, strings.ToLower(creatorAddress2.String()), strings.ToLower(call21Action["from"].(string))) require.Equal(t, strings.ToLower(contractAddress.String()), strings.ToLower(call21Action["to"].(string))) require.Equal(t, "0x141", call21Action["value"].(string)) - expectedInput, err = contractABI.Pack("sendTo", common.Address{0x2}, big.NewInt(3)) //nolint:govet + expectedInput, err = contractABI.Pack("sendTo", common.Address{0x2}, big.NewInt(3)) require.NoError(t, err) require.Equal(t, hex.EncodeToString(expectedInput), call21Action["input"].(string)[2:]) require.Empty(t, call21.Error) diff --git a/packages/evm/jsonrpc/trace_block.go b/packages/evm/jsonrpc/trace_block.go index c17fd2450f..1dd9efcef9 100644 --- a/packages/evm/jsonrpc/trace_block.go +++ b/packages/evm/jsonrpc/trace_block.go @@ -63,11 +63,11 @@ type TraceResult struct { // Trace types const ( - CALL = "call" - STATIC_CALL = "staticcall" - DELEGATE_CALL = "delegatecall" - CREATE = "create" - SUICIDE = "suicide" + call = "call" + staticCall = "staticcall" + delegateCall = "delegatecall" + create = "create" + suicide = "suicide" ) func convertToTrace(debugTrace CallFrame, blockHash *common.Hash, blockNumber uint64, txHash *common.Hash, txPosition uint64) []*Trace { @@ -123,17 +123,17 @@ func parseTraceInternal(debugTrace CallFrame, blockHash *common.Hash, blockNumbe traceCopy := make([]int, len(traceAddress)) copy(traceCopy, traceAddress) - subTraceAddress := append(traceCopy, subCalls) + traceCopy = append(traceCopy, subCalls) var traces []*Trace - traces, _ = parseTraceInternal(call, blockHash, blockNumber, txHash, txPosition, subTraceAddress) + traces, _ = parseTraceInternal(call, blockHash, blockNumber, txHash, txPosition, traceCopy) traceResult = append(traceResult, traces...) - subCalls += 1 + subCalls++ } traceEntry.Subtraces = subCalls switch traceTypeSimple { - case CALL: + case call: action := CallTraceAction{} action.CallType = traceType action.From = &debugTrace.From @@ -149,7 +149,7 @@ func parseTraceInternal(debugTrace CallFrame, blockHash *common.Hash, blockNumbe result.Output = debugTrace.Output traceEntry.Result = result - case CREATE: + case create: action := CreateTraceAction{} action.From = &debugTrace.From action.Gas = hexutil.Uint64(gas) @@ -164,7 +164,7 @@ func parseTraceInternal(debugTrace CallFrame, blockHash *common.Hash, blockNumbe result.Address = debugTrace.To traceEntry.Result = result - case SUICIDE: + case suicide: action := SuicideTraceAction{} action.Address = &debugTrace.From action.RefundAddress = debugTrace.To @@ -179,15 +179,15 @@ func parseTraceInternal(debugTrace CallFrame, blockHash *common.Hash, blockNumbe func mapTraceType(traceType string) string { switch traceType { case "CALL", "CALLCODE": - return CALL + return call case "STATICCALL": - return STATIC_CALL + return staticCall case "DELEGATECALL": - return DELEGATE_CALL + return delegateCall case "CREATE", "CREATE2": - return CREATE + return create case "SELFDESTRUCT": - return SUICIDE + return suicide } return "" } @@ -195,11 +195,11 @@ func mapTraceType(traceType string) string { func mapTraceTypeSimple(traceType string) string { switch traceType { case "CALL", "CALLCODE", "STATICCALL", "DELEGATECALL": - return CALL + return call case "CREATE", "CREATE2": - return CREATE + return create case "SELFDESTRUCT": - return SUICIDE + return suicide } return "" } diff --git a/packages/evm/jsonrpc/trace_block_test.go b/packages/evm/jsonrpc/trace_block_test.go index fbd53984f7..54291842ed 100644 --- a/packages/evm/jsonrpc/trace_block_test.go +++ b/packages/evm/jsonrpc/trace_block_test.go @@ -133,16 +133,16 @@ func TestConvertToTrace(t *testing.T) { expectedAction, ok := expected[i].Action.(map[string]interface{}) assert.True(t, ok, "Expected action should be a map") - actionJson, err := json.Marshal(actual[i].Action) + actionJSON, err := json.Marshal(actual[i].Action) assert.NoError(t, err) actualAction := map[string]interface{}{} - err = json.Unmarshal(actionJson, &actualAction) + err = json.Unmarshal(actionJSON, &actualAction) assert.NoError(t, err) - resultJson, err := json.Marshal(actual[i].Result) + resultJSON, err := json.Marshal(actual[i].Result) assert.NoError(t, err) actualResult := map[string]interface{}{} - err = json.Unmarshal(resultJson, &actualResult) + err = json.Unmarshal(resultJSON, &actualResult) assert.NoError(t, err) assert.Equal(t, expectedAction["from"], actualAction["from"])