From f58a3dc16b28b77f82ab60d7574a567c1f5de223 Mon Sep 17 00:00:00 2001 From: Saolyn Date: Thu, 10 Oct 2024 10:21:08 +0200 Subject: [PATCH 1/2] add proto marshal and unmarshal --- proto/engine/v1/json_marshal_unmarshal.go | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/proto/engine/v1/json_marshal_unmarshal.go b/proto/engine/v1/json_marshal_unmarshal.go index 13ed85726cad..3bd8099421ff 100644 --- a/proto/engine/v1/json_marshal_unmarshal.go +++ b/proto/engine/v1/json_marshal_unmarshal.go @@ -1120,3 +1120,34 @@ func RecastHexutilByteSlice(h []hexutil.Bytes) [][]byte { } return r } + +type ExchangeCapabilitiesJSON struct { + SupportedMethods []string `json:"supported_methods"` +} + +func (b *ExchangeCapabilities) MarshalJSON() ([]byte, error) { + supportedMethods := make([]string, len(b.SupportedMethods)) + for i, sm := range b.SupportedMethods { + supportedMethods[i] = sm + } + return json.Marshal(ExchangeCapabilitiesJSON{ + SupportedMethods: supportedMethods, + }) +} + +func (b *ExchangeCapabilities) UnmarshalJSON(enc []byte) error { + var decoded *ExchangeCapabilitiesJSON + err := json.Unmarshal(enc, &decoded) + if err != nil { + return err + } + if len(decoded.SupportedMethods) == 0 { + b.SupportedMethods = make([]string, 0) + } + supportedMethods := make([]string, len(decoded.SupportedMethods)) + for i, sm := range decoded.SupportedMethods { + supportedMethods[i] = sm + } + b.SupportedMethods = supportedMethods + return nil +} From 6827bcb299443b5491e4bd782d43b09731e9c437 Mon Sep 17 00:00:00 2001 From: Saolyn Date: Thu, 10 Oct 2024 10:25:28 +0200 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02ec66722300..71a328a5a2a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Updated Sepolia bootnodes. - Make committee aware packing the default by deprecating `--enable-committee-aware-packing`. - Moved `ConvertKzgCommitmentToVersionedHash` to the `primitives` package. +- Fix `engine_exchangeCapabilities` implementation. ### Deprecated - `--disable-grpc-gateway` flag is deprecated due to grpc gateway removal.