Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

feat(all): disable no beacon client seen warning #279

Merged
merged 31 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
87517f0
test engine edit
RogerLamTd Jun 9, 2023
5381604
rudimentary loop
RogerLamTd Jun 9, 2023
11fbcf3
fix lint
RogerLamTd Jun 9, 2023
a4bfc28
add backoff
RogerLamTd Jun 9, 2023
88f2164
add ttd uint256 to hexutil.Big
RogerLamTd Jun 10, 2023
4a743a4
add test
RogerLamTd Jun 12, 2023
01c5112
add d.wg
RogerLamTd Jun 12, 2023
44de543
fix
RogerLamTd Jun 12, 2023
e3e6c8a
test
RogerLamTd Jun 12, 2023
886cf08
sleep then wg.done
RogerLamTd Jun 12, 2023
d753c97
fix test
RogerLamTd Jun 12, 2023
cd1d7f4
fix chan
RogerLamTd Jun 12, 2023
ecbe7e4
fix wg
RogerLamTd Jun 12, 2023
98cc4f9
shorten test time
RogerLamTd Jun 12, 2023
53f0194
fix
RogerLamTd Jun 12, 2023
6d84b1b
switch to Done() to prevent context error on other test
RogerLamTd Jun 12, 2023
7cf9b1f
add second driver/context to run 2 cancel tests
RogerLamTd Jun 13, 2023
6fca532
fix lint
RogerLamTd Jun 13, 2023
5c663be
undo
RogerLamTd Jun 13, 2023
8965bcb
add close?
RogerLamTd Jun 13, 2023
1265678
Merge branch 'main' into disablebeaconwarning
RogerLamTd Jun 13, 2023
4688f55
disable
RogerLamTd Jun 13, 2023
acb5b88
logs
RogerLamTd Jun 13, 2023
6912b95
Merge branch 'main' into disablebeaconwarning
RogerLamTd Jun 13, 2023
712c84c
Merge branch 'main' into disablebeaconwarning
RogerLamTd Jun 14, 2023
1fa5483
more logs
RogerLamTd Jun 14, 2023
223df42
more logs, disable check
RogerLamTd Jun 14, 2023
aa17d61
remove logs, reenable test
RogerLamTd Jun 14, 2023
40b4fe0
extend time.after
RogerLamTd Jun 14, 2023
7f9fc17
fix test?
RogerLamTd Jun 14, 2023
ed5e749
feat: improve some code
davidtaikocha Jun 15, 2023
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
40 changes: 40 additions & 0 deletions driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ package driver

import (
"context"
"math/big"
"sync"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/ethereum/go-ethereum/beacon/engine"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
Expand Down Expand Up @@ -103,6 +107,7 @@ func (d *Driver) Start() error {
d.wg.Add(2)
go d.eventLoop()
go d.reportProtocolStatus()
go d.checkTransitionConfig()

return nil
}
Expand Down Expand Up @@ -220,6 +225,41 @@ func (d *Driver) reportProtocolStatus() {
}
}

func (d *Driver) checkTransitionConfig() {
if d.ctx.Err() != nil {
log.Warn("Driver context error", "error", d.ctx.Err())
return
}

ticker := time.NewTicker(60 * time.Second)
defer func() {
ticker.Stop()
d.wg.Done()
RogerLamTd marked this conversation as resolved.
Show resolved Hide resolved
}()

for {
select {
case <-d.ctx.Done():
return
case <-ticker.C:
tmp := new(big.Int)
tmp.SetString("115792089237316195423570985008687907853269984665640564039457584007913129638912", 10)
RogerLamTd marked this conversation as resolved.
Show resolved Hide resolved
ttd := (*hexutil.Big)(tmp)
tc, err := d.rpc.L2Engine.ExchangeTransitionConfiguration(d.ctx, &engine.TransitionConfigurationV1{
TerminalTotalDifficulty: ttd,
TerminalBlockHash: common.Hash{},
TerminalBlockNumber: 0,
})
if err != nil {
log.Error("Failed to exchange Transition Configuration", "error", err)
continue
}
log.Info("exchanged transition config",
"transitionconfig", tc)
}
}
}

// Name returns the application name.
func (d *Driver) Name() string {
return "driver"
Expand Down
6 changes: 6 additions & 0 deletions driver/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ func (s *DriverTestSuite) TestStartClose() {
s.d.Close()
}

func (s *DriverTestSuite) TestCheckTransitionConfig() {
s.d.checkTransitionConfig()
s.cancel()
s.d.Close()
}

func TestDriverTestSuite(t *testing.T) {
suite.Run(t, new(DriverTestSuite))
}
15 changes: 15 additions & 0 deletions pkg/rpc/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,18 @@ func (c *EngineClient) GetPayload(

return result.ExecutionPayload, nil
}

func (c *EngineClient) ExchangeTransitionConfiguration(
ctx context.Context,
cfg *engine.TransitionConfigurationV1,
) (*engine.TransitionConfigurationV1, error) {
timeoutCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()

var result *engine.TransitionConfigurationV1
if err := c.Client.CallContext(timeoutCtx, &result, "engine_exchangeTransitionConfigurationV1", cfg); err != nil {
return nil, err
}

return result, nil
}