Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrevRandao Renaming #3616

Merged
merged 2 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cmd/rpcdaemon/commands/engine_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type ExecutionPayload struct {
StateRoot common.Hash `json:"stateRoot" gencodec:"required"`
ReceiptsRoot common.Hash `json:"receiptsRoot" gencodec:"required"`
LogsBloom hexutil.Bytes `json:"logsBloom" gencodec:"required"`
Random common.Hash `json:"random" gencodec:"required"`
PrevRandao common.Hash `json:"prevRandao" gencodec:"required"`
BlockNumber hexutil.Uint64 `json:"blockNumber" gencodec:"required"`
GasLimit hexutil.Uint64 `json:"gasLimit" gencodec:"required"`
GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"`
Expand All @@ -46,7 +46,7 @@ type ForkChoiceState struct {
// PayloadAttributes represent the attributes required to start assembling a payload
type PayloadAttributes struct {
Timestamp hexutil.Uint64 `json:"timestamp" gencodec:"required"`
Random common.Hash `json:"random" gencodec:"required"`
PrevRandao common.Hash `json:"prevRandao" gencodec:"required"`
SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient" gencodec:"required"`
}

Expand Down Expand Up @@ -94,7 +94,7 @@ func (e *EngineImpl) ForkchoiceUpdatedV1(ctx context.Context, forkChoiceState *F
if payloadAttributes != nil {
prepareParameters = &remote.EnginePayloadAttributes{
Timestamp: uint64(payloadAttributes.Timestamp),
Random: gointerfaces.ConvertHashToH256(payloadAttributes.Random),
PrevRandao: gointerfaces.ConvertHashToH256(payloadAttributes.PrevRandao),
SuggestedFeeRecipient: gointerfaces.ConvertAddressToH160(payloadAttributes.SuggestedFeeRecipient),
}
}
Expand Down Expand Up @@ -147,7 +147,7 @@ func (e *EngineImpl) NewPayloadV1(ctx context.Context, payload *ExecutionPayload
StateRoot: gointerfaces.ConvertHashToH256(payload.StateRoot),
ReceiptRoot: gointerfaces.ConvertHashToH256(payload.ReceiptsRoot),
LogsBloom: gointerfaces.ConvertBytesToH2048(([]byte)(payload.LogsBloom)),
Random: gointerfaces.ConvertHashToH256(payload.Random),
PrevRandao: gointerfaces.ConvertHashToH256(payload.PrevRandao),
BlockNumber: uint64(payload.BlockNumber),
GasLimit: uint64(payload.GasLimit),
GasUsed: uint64(payload.GasUsed),
Expand Down Expand Up @@ -190,7 +190,7 @@ func (e *EngineImpl) GetPayloadV1(ctx context.Context, payloadID hexutil.Bytes)
StateRoot: gointerfaces.ConvertH256ToHash(payload.StateRoot),
ReceiptsRoot: gointerfaces.ConvertH256ToHash(payload.ReceiptRoot),
LogsBloom: bloom[:],
Random: gointerfaces.ConvertH256ToHash(payload.Random),
PrevRandao: gointerfaces.ConvertH256ToHash(payload.PrevRandao),
BlockNumber: hexutil.Uint64(payload.BlockNumber),
GasLimit: hexutil.Uint64(payload.GasLimit),
GasUsed: hexutil.Uint64(payload.GasUsed),
Expand Down
8 changes: 4 additions & 4 deletions ethdb/privateapi/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var (
BlockHash: gointerfaces.ConvertHashToH256(payload1Hash),
ReceiptRoot: gointerfaces.ConvertHashToH256(common.HexToHash("0x3")),
StateRoot: gointerfaces.ConvertHashToH256(common.HexToHash("0x4")),
Random: gointerfaces.ConvertHashToH256(common.HexToHash("0x0b3")),
PrevRandao: gointerfaces.ConvertHashToH256(common.HexToHash("0x0b3")),
LogsBloom: gointerfaces.ConvertBytesToH2048(make([]byte, 256)),
ExtraData: make([]byte, 0),
BaseFeePerGas: gointerfaces.ConvertHashToH256(common.HexToHash("0x0b3")),
Expand All @@ -47,7 +47,7 @@ var (
BlockHash: gointerfaces.ConvertHashToH256(payload2Hash),
ReceiptRoot: gointerfaces.ConvertHashToH256(common.HexToHash("0x3")),
StateRoot: gointerfaces.ConvertHashToH256(common.HexToHash("0x4")),
Random: gointerfaces.ConvertHashToH256(common.HexToHash("0x0b3")),
PrevRandao: gointerfaces.ConvertHashToH256(common.HexToHash("0x0b3")),
LogsBloom: gointerfaces.ConvertBytesToH2048(make([]byte, 256)),
ExtraData: make([]byte, 0),
BaseFeePerGas: gointerfaces.ConvertHashToH256(common.HexToHash("0x0b3")),
Expand All @@ -63,7 +63,7 @@ var (
BlockHash: gointerfaces.ConvertHashToH256(payload3Hash),
ReceiptRoot: gointerfaces.ConvertHashToH256(common.HexToHash("0x3")),
StateRoot: gointerfaces.ConvertHashToH256(common.HexToHash("0x4")),
Random: gointerfaces.ConvertHashToH256(common.HexToHash("0x0b3")),
PrevRandao: gointerfaces.ConvertHashToH256(common.HexToHash("0x0b3")),
LogsBloom: gointerfaces.ConvertBytesToH2048(make([]byte, 256)),
ExtraData: make([]byte, 0),
BaseFeePerGas: gointerfaces.ConvertHashToH256(common.HexToHash("0x0b3")),
Expand Down Expand Up @@ -241,7 +241,7 @@ func TestNoTTD(t *testing.T) {
BlockHash: gointerfaces.ConvertHashToH256(common.HexToHash("0x3")),
ReceiptRoot: gointerfaces.ConvertHashToH256(common.HexToHash("0x4")),
StateRoot: gointerfaces.ConvertHashToH256(common.HexToHash("0x4")),
Random: gointerfaces.ConvertHashToH256(common.HexToHash("0x0b3")),
PrevRandao: gointerfaces.ConvertHashToH256(common.HexToHash("0x0b3")),
LogsBloom: gointerfaces.ConvertBytesToH2048(make([]byte, 256)),
ExtraData: make([]byte, 0),
BaseFeePerGas: gointerfaces.ConvertHashToH256(common.HexToHash("0x0b3")),
Expand Down
6 changes: 3 additions & 3 deletions ethdb/privateapi/ethbackend.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (s *EthBackendServer) EngineNewPayloadV1(ctx context.Context, req *types2.E
GasUsed: req.GasUsed,
GasLimit: req.GasLimit,
Time: req.Timestamp,
MixDigest: gointerfaces.ConvertH256ToHash(req.Random),
MixDigest: gointerfaces.ConvertH256ToHash(req.PrevRandao),
UncleHash: types.EmptyUncleHash,
Difficulty: serenity.SerenityDifficulty,
Nonce: serenity.SerenityNonce,
Expand Down Expand Up @@ -366,7 +366,7 @@ func (s *EthBackendServer) EngineGetPayloadV1(ctx context.Context, req *remote.E
ParentHash: gointerfaces.ConvertHashToH256(block.Header().ParentHash),
Coinbase: gointerfaces.ConvertAddressToH160(block.Header().Coinbase),
Timestamp: block.Header().Time,
Random: gointerfaces.ConvertHashToH256(block.Header().MixDigest),
PrevRandao: gointerfaces.ConvertHashToH256(block.Header().MixDigest),
StateRoot: gointerfaces.ConvertHashToH256(block.Root()),
ReceiptRoot: gointerfaces.ConvertHashToH256(block.ReceiptHash()),
LogsBloom: gointerfaces.ConvertBytesToH2048(block.Bloom().Bytes()),
Expand Down Expand Up @@ -441,7 +441,7 @@ func (s *EthBackendServer) EngineForkChoiceUpdatedV1(ctx context.Context, req *r

emptyHeader := core.MakeEmptyHeader(headHeader, s.config, req.PayloadAttributes.Timestamp, nil)
emptyHeader.Coinbase = gointerfaces.ConvertH160toAddress(req.PayloadAttributes.SuggestedFeeRecipient)
emptyHeader.MixDigest = gointerfaces.ConvertH256ToHash(req.PayloadAttributes.Random)
emptyHeader.MixDigest = gointerfaces.ConvertH256ToHash(req.PayloadAttributes.PrevRandao)

s.pendingPayloads[s.payloadId] = &pendingPayload{block: types.NewBlock(emptyHeader, nil, nil, nil)}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ require (
github.com/json-iterator/go v1.1.12
github.com/julienschmidt/httprouter v1.3.0
github.com/kevinburke/go-bindata v3.21.0+incompatible
github.com/ledgerwatch/erigon-lib v0.0.0-20220224081055-668109134e37
github.com/ledgerwatch/erigon-lib v0.0.0-20220224151801-2fc62cd2f54e
github.com/ledgerwatch/log/v3 v3.4.1
github.com/ledgerwatch/secp256k1 v1.0.0
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758 h1:0D5M2HQSGD3P
github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/ledgerwatch/erigon-lib v0.0.0-20220224081055-668109134e37 h1:jR6twE2zaYwOzIafLn7vgdNyZTGe+IJepOIAPo/GVsY=
github.com/ledgerwatch/erigon-lib v0.0.0-20220224081055-668109134e37/go.mod h1:41OU6sJsyPTkSc1S7x/2cpWsx3EpU0Ue+Szo4Wm6pHY=
github.com/ledgerwatch/erigon-lib v0.0.0-20220224151801-2fc62cd2f54e h1:itim41U3Opx3ooA19iGOagmGa6zm+n/DvTU8xfHW1m8=
github.com/ledgerwatch/erigon-lib v0.0.0-20220224151801-2fc62cd2f54e/go.mod h1:41OU6sJsyPTkSc1S7x/2cpWsx3EpU0Ue+Szo4Wm6pHY=
github.com/ledgerwatch/log/v3 v3.4.1 h1:/xGwlVulXnsO9Uq+tzaExc8OWmXXHU0dnLalpbnY5Bc=
github.com/ledgerwatch/log/v3 v3.4.1/go.mod h1:VXcz6Ssn6XEeU92dCMc39/g1F0OYAjw1Mt+dGP5DjXY=
github.com/ledgerwatch/secp256k1 v1.0.0 h1:Usvz87YoTG0uePIV8woOof5cQnLXGYa162rFf3YnwaQ=
Expand Down