2021-04-16 22:29:22 +03:00
|
|
|
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
|
|
|
|
2022-01-31 15:22:35 +03:00
|
|
|
package beacon
|
2021-04-16 22:29:22 +03:00
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
|
|
)
|
|
|
|
|
2021-12-03 18:26:28 +03:00
|
|
|
var _ = (*payloadAttributesMarshaling)(nil)
|
2021-04-16 22:29:22 +03:00
|
|
|
|
|
|
|
// MarshalJSON marshals as JSON.
|
2021-12-03 18:26:28 +03:00
|
|
|
func (p PayloadAttributesV1) MarshalJSON() ([]byte, error) {
|
|
|
|
type PayloadAttributesV1 struct {
|
2021-12-17 17:38:58 +03:00
|
|
|
Timestamp hexutil.Uint64 `json:"timestamp" gencodec:"required"`
|
|
|
|
Random common.Hash `json:"random" gencodec:"required"`
|
|
|
|
SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient" gencodec:"required"`
|
2021-04-16 22:29:22 +03:00
|
|
|
}
|
2021-12-03 18:26:28 +03:00
|
|
|
var enc PayloadAttributesV1
|
|
|
|
enc.Timestamp = hexutil.Uint64(p.Timestamp)
|
|
|
|
enc.Random = p.Random
|
2021-12-17 17:38:58 +03:00
|
|
|
enc.SuggestedFeeRecipient = p.SuggestedFeeRecipient
|
2021-04-16 22:29:22 +03:00
|
|
|
return json.Marshal(&enc)
|
|
|
|
}
|
|
|
|
|
|
|
|
// UnmarshalJSON unmarshals from JSON.
|
2021-12-03 18:26:28 +03:00
|
|
|
func (p *PayloadAttributesV1) UnmarshalJSON(input []byte) error {
|
|
|
|
type PayloadAttributesV1 struct {
|
2021-12-17 17:38:58 +03:00
|
|
|
Timestamp *hexutil.Uint64 `json:"timestamp" gencodec:"required"`
|
|
|
|
Random *common.Hash `json:"random" gencodec:"required"`
|
|
|
|
SuggestedFeeRecipient *common.Address `json:"suggestedFeeRecipient" gencodec:"required"`
|
2021-04-16 22:29:22 +03:00
|
|
|
}
|
2021-12-03 18:26:28 +03:00
|
|
|
var dec PayloadAttributesV1
|
2021-04-16 22:29:22 +03:00
|
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if dec.Timestamp == nil {
|
2021-12-03 18:26:28 +03:00
|
|
|
return errors.New("missing required field 'timestamp' for PayloadAttributesV1")
|
2021-04-16 22:29:22 +03:00
|
|
|
}
|
2021-12-03 18:26:28 +03:00
|
|
|
p.Timestamp = uint64(*dec.Timestamp)
|
all: core rework for the merge transition (#23761)
* all: work for eth1/2 transtition
* consensus/beacon, eth: change beacon difficulty to 0
* eth: updates
* all: add terminalBlockDifficulty config, fix rebasing issues
* eth: implemented merge interop spec
* internal/ethapi: update to v1.0.0.alpha.2
This commit updates the code to the new spec, moving payloadId into
it's own object. It also fixes an issue with finalizing an empty blockhash.
It also properly sets the basefee
* all: sync polishes, other fixes + refactors
* core, eth: correct semantics for LeavePoW, EnterPoS
* core: fixed rebasing artifacts
* core: light: performance improvements
* core: use keyed field (f)
* core: eth: fix compilation issues + tests
* eth/catalyst: dbetter error codes
* all: move Merger to consensus/, remove reliance on it in bc
* all: renamed EnterPoS and LeavePoW to ReachTDD and FinalizePoS
* core: make mergelogs a function
* core: use InsertChain instead of InsertBlock
* les: drop merger from lightchain object
* consensus: add merger
* core: recoverAncestors in catalyst mode
* core: fix nitpick
* all: removed merger from beacon, use TTD, nitpicks
* consensus: eth: add docstring, removed unnecessary code duplication
* consensus/beacon: better comment
* all: easy to fix nitpicks by karalabe
* consensus/beacon: verify known headers to be sure
* core: comments
* core: eth: don't drop peers who advertise blocks, nitpicks
* core: never add beacon blocks to the future queue
* core: fixed nitpicks
* consensus/beacon: simplify IsTTDReached check
* consensus/beacon: correct IsTTDReached check
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-11-26 14:23:02 +03:00
|
|
|
if dec.Random == nil {
|
2021-12-03 18:26:28 +03:00
|
|
|
return errors.New("missing required field 'random' for PayloadAttributesV1")
|
all: core rework for the merge transition (#23761)
* all: work for eth1/2 transtition
* consensus/beacon, eth: change beacon difficulty to 0
* eth: updates
* all: add terminalBlockDifficulty config, fix rebasing issues
* eth: implemented merge interop spec
* internal/ethapi: update to v1.0.0.alpha.2
This commit updates the code to the new spec, moving payloadId into
it's own object. It also fixes an issue with finalizing an empty blockhash.
It also properly sets the basefee
* all: sync polishes, other fixes + refactors
* core, eth: correct semantics for LeavePoW, EnterPoS
* core: fixed rebasing artifacts
* core: light: performance improvements
* core: use keyed field (f)
* core: eth: fix compilation issues + tests
* eth/catalyst: dbetter error codes
* all: move Merger to consensus/, remove reliance on it in bc
* all: renamed EnterPoS and LeavePoW to ReachTDD and FinalizePoS
* core: make mergelogs a function
* core: use InsertChain instead of InsertBlock
* les: drop merger from lightchain object
* consensus: add merger
* core: recoverAncestors in catalyst mode
* core: fix nitpick
* all: removed merger from beacon, use TTD, nitpicks
* consensus: eth: add docstring, removed unnecessary code duplication
* consensus/beacon: better comment
* all: easy to fix nitpicks by karalabe
* consensus/beacon: verify known headers to be sure
* core: comments
* core: eth: don't drop peers who advertise blocks, nitpicks
* core: never add beacon blocks to the future queue
* core: fixed nitpicks
* consensus/beacon: simplify IsTTDReached check
* consensus/beacon: correct IsTTDReached check
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-11-26 14:23:02 +03:00
|
|
|
}
|
2021-12-03 18:26:28 +03:00
|
|
|
p.Random = *dec.Random
|
2021-12-17 17:38:58 +03:00
|
|
|
if dec.SuggestedFeeRecipient == nil {
|
|
|
|
return errors.New("missing required field 'suggestedFeeRecipient' for PayloadAttributesV1")
|
all: core rework for the merge transition (#23761)
* all: work for eth1/2 transtition
* consensus/beacon, eth: change beacon difficulty to 0
* eth: updates
* all: add terminalBlockDifficulty config, fix rebasing issues
* eth: implemented merge interop spec
* internal/ethapi: update to v1.0.0.alpha.2
This commit updates the code to the new spec, moving payloadId into
it's own object. It also fixes an issue with finalizing an empty blockhash.
It also properly sets the basefee
* all: sync polishes, other fixes + refactors
* core, eth: correct semantics for LeavePoW, EnterPoS
* core: fixed rebasing artifacts
* core: light: performance improvements
* core: use keyed field (f)
* core: eth: fix compilation issues + tests
* eth/catalyst: dbetter error codes
* all: move Merger to consensus/, remove reliance on it in bc
* all: renamed EnterPoS and LeavePoW to ReachTDD and FinalizePoS
* core: make mergelogs a function
* core: use InsertChain instead of InsertBlock
* les: drop merger from lightchain object
* consensus: add merger
* core: recoverAncestors in catalyst mode
* core: fix nitpick
* all: removed merger from beacon, use TTD, nitpicks
* consensus: eth: add docstring, removed unnecessary code duplication
* consensus/beacon: better comment
* all: easy to fix nitpicks by karalabe
* consensus/beacon: verify known headers to be sure
* core: comments
* core: eth: don't drop peers who advertise blocks, nitpicks
* core: never add beacon blocks to the future queue
* core: fixed nitpicks
* consensus/beacon: simplify IsTTDReached check
* consensus/beacon: correct IsTTDReached check
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-11-26 14:23:02 +03:00
|
|
|
}
|
2021-12-17 17:38:58 +03:00
|
|
|
p.SuggestedFeeRecipient = *dec.SuggestedFeeRecipient
|
2021-04-16 22:29:22 +03:00
|
|
|
return nil
|
|
|
|
}
|