Skip to content

Commit

Permalink
Preserve requests nil-ness in (un)marshalling (#12221)
Browse files Browse the repository at this point in the history
This change was necessary for `TestExecutionSpec` to pass in e2.

Without this change the following check 		
```
if !reflect.DeepEqual(rss, requests) {
  return nil, nil, nil, fmt.Errorf("invalid requests for block %d", header.Number.Uint64())
}
```
from `FinalizeBlockExecution` fails in e2. Apparently this check in not
called in e3.
  • Loading branch information
yperbasis authored Oct 9, 2024
1 parent b481789 commit d33a84a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/types/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ func (r *Requests) Withdrawals() WithdrawalRequests {
}

func MarshalRequestsBinary(requests Requests) ([][]byte, error) {
if requests == nil {
return nil, nil
}
ret := make([][]byte, 0)
for _, req := range requests {
buf := new(bytes.Buffer)
Expand All @@ -155,6 +158,10 @@ func MarshalRequestsBinary(requests Requests) ([][]byte, error) {
}

func UnmarshalRequestsFromBinary(requests [][]byte) (reqs Requests, err error) {
if requests == nil {
return nil, nil
}
reqs = make(Requests, 0)
for _, b := range requests {
switch b[0] {
case DepositRequestType:
Expand Down

0 comments on commit d33a84a

Please sign in to comment.