Compare commits

...

2 Commits

Author SHA1 Message Date
Saolyn
6827bcb299 changelog 2024-10-10 10:25:28 +02:00
Saolyn
f58a3dc16b add proto marshal and unmarshal 2024-10-10 10:21:08 +02:00
2 changed files with 32 additions and 0 deletions

View File

@@ -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.

View File

@@ -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
}