mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 23:48:06 -05:00
Use GetPayloadBodies in our Engine Client (#12630)
* add it to our engine client * lint * add better debugging info * temp debugging * fix * fix it * pretty * dumb bug * Revert "pretty" This reverts commit6a6df3cc5f. * Revert "fix it" This reverts commit73dc617bb0. * Revert "fix" This reverts commit3aecdaac6d. * Revert "temp debugging" This reverts commitffcd2c61a0. * Revert "add better debugging info" This reverts commit96184e8567. * raul's comment * regression test --------- Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
@@ -678,5 +678,6 @@ func (b *ExecutionPayloadBodyV1) UnmarshalJSON(enc []byte) error {
|
||||
transactions[i] = tx
|
||||
}
|
||||
b.Transactions = transactions
|
||||
b.Withdrawals = decoded.Withdrawals
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -487,6 +487,32 @@ func TestPayloadIDBytes_MarshalUnmarshalJSON(t *testing.T) {
|
||||
require.Equal(t, true, item == *res)
|
||||
}
|
||||
|
||||
func TestExecutionPayloadBody_MarshalUnmarshalJSON(t *testing.T) {
|
||||
pBody := &enginev1.ExecutionPayloadBodyV1{
|
||||
Transactions: [][]byte{[]byte("random1"), []byte("random2"), []byte("random3")},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
&enginev1.Withdrawal{
|
||||
Index: 200,
|
||||
ValidatorIndex: 20303,
|
||||
Amount: 3200000000,
|
||||
Address: bytesutil.PadTo([]byte("junk"), 20),
|
||||
},
|
||||
&enginev1.Withdrawal{
|
||||
Index: 200,
|
||||
ValidatorIndex: 70303,
|
||||
Amount: 3200000800,
|
||||
Address: bytesutil.PadTo([]byte("junk2"), 20),
|
||||
},
|
||||
},
|
||||
}
|
||||
enc, err := json.Marshal(pBody)
|
||||
require.NoError(t, err)
|
||||
res := &enginev1.ExecutionPayloadBodyV1{}
|
||||
err = res.UnmarshalJSON(enc)
|
||||
require.NoError(t, err)
|
||||
require.DeepEqual(t, pBody, res)
|
||||
}
|
||||
|
||||
func TestExecutionBlock_MarshalUnmarshalJSON_MainnetBlock(t *testing.T) {
|
||||
newBlock := &enginev1.ExecutionBlock{}
|
||||
require.NoError(t, newBlock.UnmarshalJSON([]byte(blockJson)))
|
||||
|
||||
Reference in New Issue
Block a user