Skip to content

Commit

Permalink
Fixed forkid for mergeBlock (#3686)
Browse files Browse the repository at this point in the history
* fixed forkid for mergeBlock

* ops

* ops again
  • Loading branch information
Giulio2002 authored Mar 12, 2022
1 parent f03d08c commit 7094dcc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
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.TerminalBlockNumber),
}, nil
}

Expand Down
3 changes: 2 additions & 1 deletion params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,9 @@ 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
TerminalBlockNumber *big.Int `json:"terminalBlockNumber,omitempty"` // Enforce particular terminal block; see TerminalBlockNumber in EIP-3675
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:"mergeForkBlock,omitempty"`

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

0 comments on commit 7094dcc

Please sign in to comment.