Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_01.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Expected length of length less than or equal to 4"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_02.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Cannot decode stream of Transaction"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_03.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Transaction decoding returned null"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_04.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Cannot decode stream of Transaction"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_05.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Unknown transaction type 10"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_06.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Cannot decode stream of Transaction"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_07.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid params"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_08.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "missing value for required argument 0"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_09.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "missing value for required argument 0"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_10.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid params"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_11.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid params"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_12.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Unknown transaction type 9"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_13.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Unknown transaction type 127"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_14.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Legacy transactions are not allowed in EIP-2718 Typed Transaction Envelope"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_15.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Cannot decode stream of Transaction"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_16.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Cannot decode stream of Transaction"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_17.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid params"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_18.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid params"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_19.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Transaction decoding returned null"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_20.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Transaction decoding returned null"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_21.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "Invalid RLP: Legacy transactions are not allowed in EIP-2718 Typed Transaction Envelope"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_22.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "missing value for required argument 0"}
}
}
]
2 changes: 1 addition & 1 deletion integration/mainnet/eth_sendRawTransaction/test_23.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"response": {
"id": 1,
"jsonrpc": "2.0",
"error": {"code": -32602, "message": null}
"error": {"code": -32602, "message": "missing value for required argument 0"}
}
}
]
18 changes: 0 additions & 18 deletions internal/compare/comparator.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,24 +126,6 @@ func ProcessResponse(
return
}
}
// Per-fixture "message": null sentinel -> compare only error code, ignore message.
if responseHasError && expectedHasError && expectedError != nil {
expErrMap, expErrIsMap := expectedError.(map[string]any)
if expErrIsMap {
if msg, hasMsg := expErrMap["message"]; hasMsg && msg == nil {
respErrMap, respErrIsMap := responseMap["error"].(map[string]any)
if respErrIsMap && jsonValuesEqual(respErrMap["code"], expErrMap["code"]) {
err := dumpJSONs(cfg.ForceDumpJSONs, daemonFile, expRspFile, outputDir, response, expectedResponse, &outcome.Metrics)
if err != nil {
outcome.Error = err
return
}
outcome.Success = true
return
}
}
}
}
}

// Detailed comparison: dump files and run diff
Expand Down
35 changes: 0 additions & 35 deletions internal/compare/comparator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,41 +157,6 @@ func TestProcessResponse_DoNotCompareError_DifferentCode(t *testing.T) {
}
}

func TestProcessResponse_NullMessageSentinel_SameCode(t *testing.T) {
dir := t.TempDir()
cfg := config.NewConfig()

outcome := &testdata.TestOutcome{}
response := map[string]any{"jsonrpc": "2.0", "id": float64(1), "error": map[string]any{"code": float64(-32602), "message": "some informative implementation-specific message"}}
expected := map[string]any{"jsonrpc": "2.0", "id": float64(1), "error": map[string]any{"code": float64(-32602), "message": nil}}

ProcessResponse(response, nil, expected, cfg, dir, "", "", "", outcome)

if !outcome.Success {
t.Errorf("\"message\": null sentinel should accept matching code regardless of message, error: %v", outcome.Error)
}
}

func TestProcessResponse_NullMessageSentinel_DifferentCode(t *testing.T) {
dir := t.TempDir()
cfg := config.NewConfig()
cfg.DiffKind = config.JsonDiffGo

daemonFile := filepath.Join(dir, "response.json")
expRspFile := filepath.Join(dir, "expected.json")
diffFile := filepath.Join(dir, "diff.json")

outcome := &testdata.TestOutcome{}
response := map[string]any{"jsonrpc": "2.0", "id": float64(1), "error": map[string]any{"code": float64(-32000), "message": "any"}}
expected := map[string]any{"jsonrpc": "2.0", "id": float64(1), "error": map[string]any{"code": float64(-32602), "message": nil}}

ProcessResponse(response, nil, expected, cfg, dir, daemonFile, expRspFile, diffFile, outcome)

if outcome.Success {
t.Error("\"message\": null sentinel should reject mismatched code")
}
}

func TestProcessResponse_DiffMismatch_JsonDiffGo(t *testing.T) {
dir := t.TempDir()
cfg := config.NewConfig()
Expand Down