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

Fixed forkid for mergeBlock #3686

Merged
merged 3 commits into from
Mar 12, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
12 changes: 6 additions & 6 deletions cmd/rpcdaemon/commands/engine_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ type PayloadAttributes struct {

// TransitionConfiguration represents the correct configurations of the CL and the EL
type TransitionConfiguration struct {
TerminalTotalDifficulty *hexutil.Big `json:"terminalTotalDifficulty" gencodec:"required"`
TerminalBlockHash common.Hash `json:"terminalBlockHash" gencodec:"required"`
TerminalBlockNumber hexutil.Uint64 `json:"terminalBlockNumber" gencodec:"required"`
TerminalTotalDifficulty *hexutil.Big `json:"terminalTotalDifficulty" gencodec:"required"`
TerminalBlockHash common.Hash `json:"terminalBlockHash" gencodec:"required"`
TerminalBlockNumber *hexutil.Big `json:"terminalBlockNumber" gencodec:"required"`
}

// EngineAPI Beacon chain communication endpoint
Expand Down Expand Up @@ -214,8 +214,8 @@ func (e *EngineImpl) ExchangeTransitionConfigurationV1(ctx context.Context, beac

defer tx.Rollback()
// terminal block number must always be zero
if beaconConfig.TerminalBlockNumber != 0 {
return TransitionConfiguration{}, fmt.Errorf("received the wrong terminal block number. expected zero, but instead got: %d", beaconConfig.TerminalBlockNumber)
if beaconConfig.TerminalBlockNumber.ToInt().Cmp(common.Big0) != 0 {
return TransitionConfiguration{}, fmt.Errorf("received the wrong terminal block number. expected zero, but instead got: %d", beaconConfig.TerminalBlockNumber.ToInt())
}

chainConfig, err := e.BaseAPI.chainConfig(tx)
Expand All @@ -242,7 +242,7 @@ func (e *EngineImpl) ExchangeTransitionConfigurationV1(ctx context.Context, beac
return TransitionConfiguration{
TerminalTotalDifficulty: (*hexutil.Big)(terminalTotalDifficulty),
TerminalBlockHash: chainConfig.TerminalBlockHash,
TerminalBlockNumber: hexutil.Uint64(chainConfig.TerminalBlockNumber),
TerminalBlockNumber: (*hexutil.Big)(chainConfig.MergeForkBlock),
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ type ChainConfig struct {
// EIP-3675: Upgrade consensus to Proof-of-Stake
TerminalTotalDifficulty *big.Int `json:"terminalTotalDifficulty,omitempty"` // The merge happens when terminal total difficulty is reached
TerminalBlockHash common.Hash `json:"terminalBlockHash,omitempty"` // Enforce particular terminal block; see TERMINAL_BLOCK_HASH in EIP-3675
TerminalBlockNumber uint64 `json:"terminalBlockNumber,omitempty"` // Enforce particular terminal block; see TERMINAL_BLOCK_NUMBER in EIP-3675
MergeForkBlock *big.Int `json:"terminalBlockNumber,omitempty"` // Enforce particular terminal block; see TERMINAL_BLOCK_NUMBER in EIP-3675

// Various consensus engines
Ethash *EthashConfig `json:"ethash,omitempty"`
Expand Down