From 7707d10d3dbae6bb7536c16c186b212e9e67e475 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Wed, 10 Jul 2024 09:42:37 -0500 Subject: [PATCH 1/2] eth/catalyst: fix (*SimulatedBeacon).AdjustTime() conversion --- eth/catalyst/simulated_beacon.go | 2 +- ethclient/simulated/backend_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index 2d6569e42218..31e49cab1ca9 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -302,7 +302,7 @@ func (c *SimulatedBeacon) AdjustTime(adjustment time.Duration) error { return errors.New("parent not found") } withdrawals := c.withdrawals.gatherPending(10) - return c.sealBlock(withdrawals, parent.Time+uint64(adjustment)) + return c.sealBlock(withdrawals, parent.Time+uint64(adjustment/1e9)) } func RegisterSimulatedBeaconAPIs(stack *node.Node, sim *SimulatedBeacon) { diff --git a/ethclient/simulated/backend_test.go b/ethclient/simulated/backend_test.go index a8fd7913c334..b70086b3854c 100644 --- a/ethclient/simulated/backend_test.go +++ b/ethclient/simulated/backend_test.go @@ -106,7 +106,7 @@ func TestAdjustTime(t *testing.T) { block2, _ := client.BlockByNumber(context.Background(), nil) prevTime := block1.Time() newTime := block2.Time() - if newTime-prevTime != uint64(time.Minute) { + if newTime-prevTime != 60 { t.Errorf("adjusted time not equal to 60 seconds. prev: %v, new: %v", prevTime, newTime) } } From 19f711d21296877e9bc2799c78232ec2984723a4 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Mon, 15 Jul 2024 08:14:11 -0500 Subject: [PATCH 2/2] s/1e9/time.Second --- eth/catalyst/simulated_beacon.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index 31e49cab1ca9..8bdf94b80e81 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -302,7 +302,7 @@ func (c *SimulatedBeacon) AdjustTime(adjustment time.Duration) error { return errors.New("parent not found") } withdrawals := c.withdrawals.gatherPending(10) - return c.sealBlock(withdrawals, parent.Time+uint64(adjustment/1e9)) + return c.sealBlock(withdrawals, parent.Time+uint64(adjustment/time.Second)) } func RegisterSimulatedBeaconAPIs(stack *node.Node, sim *SimulatedBeacon) {