Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"post-shanghai-bad-receipts-hash","fail":true, "reason":"failed to verify block hash"}

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"post-shanghai-bad-transactions-hash","fail":true, "reason":"failed to verify block hash"}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"post-shanghai-bad-transactions-nil","fail":true, "reason": "block tx 0 is nil"}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"post-shanghai-bad-transactions","fail":true}
{"name":"post-shanghai-bad-transactions","fail":true, "reason": "failed to verify transactions list"}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"post-shanghai-bad-withdrawals-hash","fail":true, "reason":"failed to verify block hash"}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"post-shanghai-bad-withdrawals-nil","fail":true, "reason": "block withdrawal 0 is null"}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"post-shanghai-bad-withdrawals","fail":true}
{"name":"post-shanghai-bad-withdrawals","fail":true,"reason": "failed to verify withdrawals list"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"pre-shanghai-bad-receipts-hash","fail":true, "reason":"failed to verify block hash"}

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"pre-shanghai-bad-transactions-hash","fail":true, "reason":"failed to verify block hash"}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"pre-shanghai-bad-transactions","fail":true}
{"name":"pre-shanghai-bad-transactions","fail":true,"reason": "failed to verify transactions list"}
10 changes: 0 additions & 10 deletions op-service/sources/testdata/gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,8 @@ generate_test_vector() {
$mutation_func "$data_file" $metadata_file
}

mkdir -p data/blocks
mkdir -p data/headers

# Blocks
generate_test_vector "pre-shanghai-success" "0x9ef7cd2241202b919a0e51240818a8666c73f7ce4b908931e3ae6d26d30f7663" true success_case
generate_test_vector "pre-shanghai-bad-transactions" "0x9ef7cd2241202b919a0e51240818a8666c73f7ce4b908931e3ae6d26d30f7663" true bad_transactions_root
generate_test_vector "pre-shanghai-bad-receipts" "0x9ef7cd2241202b919a0e51240818a8666c73f7ce4b908931e3ae6d26d30f7663" true bad_receipts_root
generate_test_vector "post-shanghai-success" "0xa16c6bcda4fdca88b5761965c4d724f7afc6a6900d9051a204e544870adb3452" true success_case
generate_test_vector "post-shanghai-bad-withdrawals" "0xa16c6bcda4fdca88b5761965c4d724f7afc6a6900d9051a204e544870adb3452" true bad_withdrawals_root
generate_test_vector "post-shanghai-bad-transactions" "0xa16c6bcda4fdca88b5761965c4d724f7afc6a6900d9051a204e544870adb3452" true bad_transactions_root
generate_test_vector "post-shanghai-bad-receipts" "0xa16c6bcda4fdca88b5761965c4d724f7afc6a6900d9051a204e544870adb3452" true bad_receipts_root

# Headers
generate_test_vector "pre-shanghai-success" "0x9ef7cd2241202b919a0e51240818a8666c73f7ce4b908931e3ae6d26d30f7663" false success_case
generate_test_vector "pre-shanghai-bad-transactions" "0x9ef7cd2241202b919a0e51240818a8666c73f7ce4b908931e3ae6d26d30f7663" false bad_transactions_root
Expand Down
6 changes: 4 additions & 2 deletions op-service/sources/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import (
var blocksTestdata embed.FS

type testMetadata struct {
Name string `json:"name"`
Fail bool `json:"fail,omitempty"`
Name string `json:"name"`
Fail bool `json:"fail,omitempty"`
Reason string `json:"reason,omitempty"`
}

func readJsonTestdata(t *testing.T, name string, dest any) {
Expand Down Expand Up @@ -67,6 +68,7 @@ func TestBlockJSON(t *testing.T) {
err := block.verify()
if metadata.Fail {
require.NotNil(t, err, "expecting verification error")
require.ErrorContains(t, err, metadata.Reason, "validation failed for incorrect reason")
} else {
require.NoError(t, err, "verification should pass")
}
Expand Down