From 2fa432a530b9d280ef7419c1616c6d28c4fec6af Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 12 Sep 2024 18:10:02 +0200 Subject: [PATCH] core/types: fix deposit request encoding --- core/types/deposit.go | 2 +- core/types/deposit_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/types/deposit.go b/core/types/deposit.go index 42f90b70e6..c97f7a4b47 100644 --- a/core/types/deposit.go +++ b/core/types/deposit.go @@ -32,7 +32,7 @@ func DepositLogToRequest(data []byte) ([]byte, error) { } var outputRequest = make([]byte, depositRequestSize) - outputRequest[0] = depositRequestSize + outputRequest[0] = depositRequestType const ( pubkeyOffset = 1 withdrawalCredOffset = pubkeyOffset + 48 diff --git a/core/types/deposit_test.go b/core/types/deposit_test.go index 3d1fc8edd4..5ffad9833a 100644 --- a/core/types/deposit_test.go +++ b/core/types/deposit_test.go @@ -86,6 +86,9 @@ func FuzzUnpackIntoDeposit(f *testing.F) { if err != nil { t.Errorf("error unpacking deposit: %v", err) } + if len(got) != depositRequestSize { + t.Errorf("wrong output size: %d, want %d", len(got), depositRequestSize) + } if !bytes.Equal(enc, got) { t.Errorf("roundtrip failed: want %x, got %x", enc, got) }