mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 05:47:59 -05:00
begin testing happy case of reconstruction func
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
"github.com/holiman/uint256"
|
||||
"github.com/pkg/errors"
|
||||
@@ -563,6 +564,13 @@ func TestReconstructFullBellatrixBlock(t *testing.T) {
|
||||
execBlock, ok := fix["ExecutionBlock"].(*pb.ExecutionBlock)
|
||||
require.Equal(t, true, ok)
|
||||
require.NotNil(t, execBlock)
|
||||
tx := types.NewTransaction(
|
||||
0,
|
||||
common.HexToAddress("095e7baea6a6c7c4c2dfeb977efac326af552d87"),
|
||||
big.NewInt(0), 0, big.NewInt(0),
|
||||
nil,
|
||||
)
|
||||
txs := []*types.Transaction{tx}
|
||||
|
||||
header, err := bellatrix.PayloadToHeader(payload)
|
||||
require.NoError(t, err)
|
||||
@@ -577,7 +585,7 @@ func TestReconstructFullBellatrixBlock(t *testing.T) {
|
||||
respJSON := map[string]interface{}{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"result": execBlock,
|
||||
"result": execBlockWithTxs,
|
||||
}
|
||||
require.NoError(t, json.NewEncoder(w).Encode(respJSON))
|
||||
}))
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package wrapper
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/consensus-types/forks/bellatrix"
|
||||
@@ -175,6 +177,8 @@ func BuildSignedBeaconBlockFromExecutionPayload(
|
||||
return nil, errors.Wrap(err, "could not hash tree root payload header")
|
||||
}
|
||||
if payloadRoot != payloadHeaderRoot {
|
||||
json.NewEncoder(os.Stdout).Encode(payload)
|
||||
json.NewEncoder(os.Stdout).Encode(payloadHeader)
|
||||
return nil, fmt.Errorf(
|
||||
"payload %#x and header %#x roots do not match",
|
||||
payloadRoot,
|
||||
|
||||
Reference in New Issue
Block a user