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

updating the goethereum dependency #14351

Open
wants to merge 69 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
0e5a86e
updating the goethereum dependency
james-prysm Aug 15, 2024
ba32681
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Aug 15, 2024
4a19a7e
fixing dependencies
james-prysm Aug 16, 2024
4f8b842
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Aug 16, 2024
8c853fc
reverting workspace
james-prysm Aug 16, 2024
412fa61
more fixes, work in progress
james-prysm Aug 16, 2024
3540b4b
trying with upgraded geth version
james-prysm Aug 16, 2024
7b72d09
fixing deprecated functions except for the time related ones on eth1 …
james-prysm Aug 19, 2024
2fb1599
fixing time issues
james-prysm Aug 19, 2024
9e75d25
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Aug 19, 2024
dc92e95
gaz
james-prysm Aug 19, 2024
b7e326e
fixing test and upgrading some dependencies and reverting others
james-prysm Aug 19, 2024
d8b13a4
Disable cgo in hid, delete old vendored usb library
prestonvanloon Aug 20, 2024
611be64
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Aug 20, 2024
86abac1
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Aug 30, 2024
a58c1d7
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Sep 3, 2024
0b67dc9
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Sep 16, 2024
56b4ec1
changelog
james-prysm Sep 17, 2024
c943260
rolling back dependencies
james-prysm Sep 17, 2024
e47892d
fixing go mod tidy
james-prysm Sep 17, 2024
902d029
Geth v1.13.6
prestonvanloon Sep 23, 2024
6e16bb5
fix tests
prestonvanloon Sep 23, 2024
95d2a70
Add ping interval, set to 500ms for tests. This didnt work
prestonvanloon Sep 24, 2024
2c81dd9
Update to v1.14.8
nisdas Sep 25, 2024
c468f65
Spread it out to different bootnodes
nisdas Sep 25, 2024
2edc281
Fix it
nisdas Sep 25, 2024
5193595
Remove Memsize
nisdas Sep 25, 2024
24001d3
Update all out of date dependencies
nisdas Sep 25, 2024
d6af5a3
Fix geth body change
nisdas Sep 25, 2024
8fd2ea6
Fix Test
nisdas Sep 25, 2024
18d6b8a
Fix Build
nisdas Sep 25, 2024
964695b
Fix Tests
nisdas Sep 25, 2024
14b4bb2
Fix Tests Again
nisdas Sep 25, 2024
d36cefd
Fix Tests Again
nisdas Sep 25, 2024
20c790b
Fix Tests
nisdas Sep 25, 2024
277a3dd
Fix Test
nisdas Sep 25, 2024
f722441
Copy USB Package for HID
nisdas Sep 25, 2024
de52ebb
Push it up
nisdas Sep 26, 2024
809cc04
Finally fix all tests with felix's changes
nisdas Sep 27, 2024
023c81a
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Oct 18, 2024
0ec080f
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Oct 23, 2024
b45a666
updating geth dependency
james-prysm Oct 23, 2024
97fe7d3
Merge develop
prestonvanloon Oct 23, 2024
146b4bc
Update go-ethereum to v1.14.11
prestonvanloon Oct 23, 2024
eb1faea
Merge remote-tracking branch 'origin/debugging-geth-upgrade' into upd…
james-prysm Oct 23, 2024
976d839
fixing import
james-prysm Oct 23, 2024
01988cb
reverting blob change
james-prysm Oct 23, 2024
f3356f8
fixing Implicit memory aliasing in for loop.
james-prysm Oct 23, 2024
bd3e68f
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Oct 25, 2024
3af8c58
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Oct 28, 2024
6c8c65e
WIP changes
james-prysm Oct 29, 2024
d1fbd2c
wip getting a little further on e2e runs
james-prysm Oct 30, 2024
6d62bbf
getting a little further
james-prysm Oct 30, 2024
229254e
getting a little further
james-prysm Oct 30, 2024
c83cd76
setting everything to capella
james-prysm Oct 30, 2024
0905831
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Oct 30, 2024
d0a2e10
more partial fixes
james-prysm Oct 30, 2024
6f2dc61
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Oct 31, 2024
4345016
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Oct 31, 2024
e80f522
more fixes but still WIP
james-prysm Nov 1, 2024
cde5d63
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Nov 1, 2024
5326ac9
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Nov 4, 2024
9d891bb
fixing access list transactions"
james-prysm Nov 4, 2024
29b93ec
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Nov 4, 2024
608eb1a
some cleanup
james-prysm Nov 4, 2024
2939be1
making configs dynamic
james-prysm Nov 5, 2024
098254b
Merge branch 'develop' into update-geth-to-v1.14
james-prysm Nov 5, 2024
f94cc3b
reverting time
james-prysm Nov 5, 2024
92b03a3
skip lower bound in builder
james-prysm Nov 5, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
- Only Build the Protobuf state once during serialization.
- Capella blocks are execution.
- Fixed panic when http request to subscribe to event stream fails.
- updated geth to 1.14 ~
- e2e tests start from capella

### Deprecated

Expand Down
7 changes: 4 additions & 3 deletions beacon-chain/blockchain/kzg/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ func Verify(sidecars ...blocks.ROBlob) error {
cmts := make([]GoKZG.KZGCommitment, len(sidecars))
proofs := make([]GoKZG.KZGProof, len(sidecars))
for i, sidecar := range sidecars {
blobs[i] = bytesToBlob(sidecar.Blob)
blobs[i] = *bytesToBlob(sidecar.Blob)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is caused by upgrading kzg from 0.7.0 -> 1.0.0

cmts[i] = bytesToCommitment(sidecar.KzgCommitment)
proofs[i] = bytesToKZGProof(sidecar.KzgProof)
}
return kzgContext.VerifyBlobKZGProofBatch(blobs, cmts, proofs)
}

func bytesToBlob(blob []byte) (ret GoKZG.Blob) {
func bytesToBlob(blob []byte) *GoKZG.Blob {
var ret GoKZG.Blob
copy(ret[:], blob)
return
return &ret
}

func bytesToCommitment(commitment []byte) (ret GoKZG.KZGCommitment) {
Expand Down
6 changes: 3 additions & 3 deletions beacon-chain/blockchain/kzg/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ func GetRandBlob(seed int64) GoKZG.Blob {
}

func GenerateCommitmentAndProof(blob GoKZG.Blob) (GoKZG.KZGCommitment, GoKZG.KZGProof, error) {
commitment, err := kzgContext.BlobToKZGCommitment(blob, 0)
commitment, err := kzgContext.BlobToKZGCommitment(&blob, 0)
if err != nil {
return GoKZG.KZGCommitment{}, GoKZG.KZGProof{}, err
}
proof, err := kzgContext.ComputeBlobKZGProof(blob, commitment, 0)
proof, err := kzgContext.ComputeBlobKZGProof(&blob, commitment, 0)
if err != nil {
return GoKZG.KZGCommitment{}, GoKZG.KZGProof{}, err
}
Expand All @@ -68,7 +68,7 @@ func TestBytesToAny(t *testing.T) {
blob := GoKZG.Blob{0x01, 0x02}
commitment := GoKZG.KZGCommitment{0x01, 0x02}
proof := GoKZG.KZGProof{0x01, 0x02}
require.DeepEqual(t, blob, bytesToBlob(bytes))
require.DeepEqual(t, blob, *bytesToBlob(bytes))
require.DeepEqual(t, commitment, bytesToCommitment(bytes))
require.DeepEqual(t, proof, bytesToKZGProof(bytes))
}
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/execution/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ go_test(
"//testing/util:go_default_library",
"//time/slots:go_default_library",
"@com_github_ethereum_go_ethereum//:go_default_library",
"@com_github_ethereum_go_ethereum//accounts/abi/bind/backends:go_default_library",
"@com_github_ethereum_go_ethereum//beacon/engine:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
"@com_github_ethereum_go_ethereum//core/types:go_default_library",
"@com_github_ethereum_go_ethereum//ethclient/simulated:go_default_library",
"@com_github_ethereum_go_ethereum//rpc:go_default_library",
"@com_github_holiman_uint256//:go_default_library",
"@com_github_pkg_errors//:go_default_library",
Expand Down
25 changes: 17 additions & 8 deletions beacon-chain/execution/block_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
dbutil "github.com/prysmaticlabs/prysm/v5/beacon-chain/db/testing"
mockExecution "github.com/prysmaticlabs/prysm/v5/beacon-chain/execution/testing"
"github.com/prysmaticlabs/prysm/v5/beacon-chain/execution/types"
"github.com/prysmaticlabs/prysm/v5/config/params"
contracts "github.com/prysmaticlabs/prysm/v5/contracts/deposit"
"github.com/prysmaticlabs/prysm/v5/contracts/deposit/mock"
"github.com/prysmaticlabs/prysm/v5/testing/assert"
Expand Down Expand Up @@ -44,7 +45,7 @@ func TestLatestMainchainInfo_OK(t *testing.T) {
web3Service = setDefaultMocks(web3Service)
web3Service.rpcClient = &mockExecution.RPCClient{Backend: testAcc.Backend}

web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend.Client())
require.NoError(t, err)
testAcc.Backend.Commit()

Expand Down Expand Up @@ -141,7 +142,7 @@ func TestBlockExists_ValidHash(t *testing.T) {
web3Service = setDefaultMocks(web3Service)
web3Service.rpcClient = &mockExecution.RPCClient{Backend: testAcc.Backend}
testAcc.Backend.Commit()
block, err := testAcc.Backend.BlockByNumber(context.Background(), big.NewInt(0))
block, err := testAcc.Backend.Client().BlockByNumber(context.Background(), big.NewInt(0))
assert.NoError(t, err)

exists, height, err := web3Service.BlockExists(context.Background(), block.Hash())
Expand Down Expand Up @@ -201,8 +202,10 @@ func TestBlockExists_UsesCachedBlockInfo(t *testing.T) {
}

func TestService_BlockNumberByTimestamp(t *testing.T) {
ctx := context.Background()
beaconDB := dbutil.SetupDB(t)
testAcc, err := mock.Setup()

require.NoError(t, err, "Unable to set up simulated backend")
server, endpoint, err := mockExecution.SetupRPCServer()
require.NoError(t, err)
Expand All @@ -216,16 +219,22 @@ func TestService_BlockNumberByTimestamp(t *testing.T) {
require.NoError(t, err)
web3Service = setDefaultMocks(web3Service)
web3Service.rpcClient = &mockExecution.RPCClient{Backend: testAcc.Backend}

// simulated backend sets eth1 block
params.SetupTestConfigCleanup(t)
conf := params.BeaconConfig().Copy()
conf.SecondsPerETH1Block = 1
params.OverrideBeaconConfig(conf)
initialHead, err := testAcc.Backend.Client().HeaderByNumber(ctx, nil)
require.NoError(t, err)
for i := 0; i < 200; i++ {
testAcc.Backend.Commit()
}
ctx := context.Background()
hd, err := testAcc.Backend.HeaderByNumber(ctx, nil)

hd, err := testAcc.Backend.Client().HeaderByNumber(ctx, nil)
require.NoError(t, err)
web3Service.latestEth1Data.BlockTime = hd.Time
web3Service.latestEth1Data.BlockHeight = hd.Number.Uint64()
blk, err := web3Service.BlockByTimestamp(ctx, 1000 /* time */)
blk, err := web3Service.BlockByTimestamp(ctx, initialHead.Time+100 /* time */)
require.NoError(t, err)
if blk.Number.Cmp(big.NewInt(0)) == 0 {
t.Error("Returned a block with zero number, expected to be non zero")
Expand Down Expand Up @@ -253,7 +262,7 @@ func TestService_BlockNumberByTimestampLessTargetTime(t *testing.T) {
testAcc.Backend.Commit()
}
ctx := context.Background()
hd, err := testAcc.Backend.HeaderByNumber(ctx, nil)
hd, err := testAcc.Backend.Client().HeaderByNumber(ctx, nil)
require.NoError(t, err)
web3Service.latestEth1Data.BlockTime = hd.Time
// Use extremely small deadline to illustrate that context deadlines are respected.
Expand Down Expand Up @@ -291,7 +300,7 @@ func TestService_BlockNumberByTimestampMoreTargetTime(t *testing.T) {
testAcc.Backend.Commit()
}
ctx := context.Background()
hd, err := testAcc.Backend.HeaderByNumber(ctx, nil)
hd, err := testAcc.Backend.Client().HeaderByNumber(ctx, nil)
require.NoError(t, err)
web3Service.latestEth1Data.BlockTime = hd.Time
// Use extremely small deadline to illustrate that context deadlines are respected.
Expand Down
61 changes: 36 additions & 25 deletions beacon-chain/execution/log_processing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestProcessDepositLog_OK(t *testing.T) {
)
require.NoError(t, err, "unable to setup web3 ETH1.0 chain service")
web3Service = setDefaultMocks(web3Service)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend.Client())
require.NoError(t, err)

testAcc.Backend.Commit()
Expand All @@ -72,7 +72,7 @@ func TestProcessDepositLog_OK(t *testing.T) {
},
}

logs, err := testAcc.Backend.FilterLogs(web3Service.ctx, query)
logs, err := testAcc.Backend.Client().FilterLogs(web3Service.ctx, query)
require.NoError(t, err, "Unable to retrieve logs")

if len(logs) == 0 {
Expand Down Expand Up @@ -116,7 +116,7 @@ func TestProcessDepositLog_InsertsPendingDeposit(t *testing.T) {
)
require.NoError(t, err, "unable to setup web3 ETH1.0 chain service")
web3Service = setDefaultMocks(web3Service)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend.Client())
require.NoError(t, err)

testAcc.Backend.Commit()
Expand Down Expand Up @@ -144,7 +144,7 @@ func TestProcessDepositLog_InsertsPendingDeposit(t *testing.T) {
},
}

logs, err := testAcc.Backend.FilterLogs(web3Service.ctx, query)
logs, err := testAcc.Backend.Client().FilterLogs(web3Service.ctx, query)
require.NoError(t, err, "Unable to retrieve logs")

web3Service.chainStartData.Chainstarted = true
Expand Down Expand Up @@ -176,7 +176,7 @@ func TestUnpackDepositLogData_OK(t *testing.T) {
)
require.NoError(t, err, "unable to setup web3 ETH1.0 chain service")
web3Service = setDefaultMocks(web3Service)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend.Client())
require.NoError(t, err)

testAcc.Backend.Commit()
Expand All @@ -199,7 +199,7 @@ func TestUnpackDepositLogData_OK(t *testing.T) {
},
}

logz, err := testAcc.Backend.FilterLogs(web3Service.ctx, query)
logz, err := testAcc.Backend.Client().FilterLogs(web3Service.ctx, query)
require.NoError(t, err, "Unable to retrieve logs")

loggedPubkey, withCreds, _, loggedSig, index, err := contracts.UnpackDepositLogData(logz[0].Data)
Expand Down Expand Up @@ -232,7 +232,7 @@ func TestProcessETH2GenesisLog_8DuplicatePubkeys(t *testing.T) {
)
require.NoError(t, err, "unable to setup web3 ETH1.0 chain service")
web3Service = setDefaultMocks(web3Service)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend.Client())
require.NoError(t, err)

params.SetupTestConfigCleanup(t)
Expand Down Expand Up @@ -269,7 +269,7 @@ func TestProcessETH2GenesisLog_8DuplicatePubkeys(t *testing.T) {
},
}

logs, err := testAcc.Backend.FilterLogs(web3Service.ctx, query)
logs, err := testAcc.Backend.Client().FilterLogs(web3Service.ctx, query)
require.NoError(t, err, "Unable to retrieve logs")

for i := range logs {
Expand Down Expand Up @@ -307,7 +307,7 @@ func TestProcessETH2GenesisLog(t *testing.T) {
)
require.NoError(t, err, "unable to setup web3 ETH1.0 chain service")
web3Service = setDefaultMocks(web3Service)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend.Client())
web3Service.rpcClient = &mockExecution.RPCClient{Backend: testAcc.Backend}
require.NoError(t, err)
params.SetupTestConfigCleanup(t)
Expand Down Expand Up @@ -342,7 +342,7 @@ func TestProcessETH2GenesisLog(t *testing.T) {
},
}

logs, err := testAcc.Backend.FilterLogs(web3Service.ctx, query)
logs, err := testAcc.Backend.Client().FilterLogs(web3Service.ctx, query)
require.NoError(t, err, "Unable to retrieve logs")
require.Equal(t, depositsReqForChainStart, len(logs))

Expand Down Expand Up @@ -400,16 +400,18 @@ func TestProcessETH2GenesisLog_CorrectNumOfDeposits(t *testing.T) {
)
require.NoError(t, err, "unable to setup web3 ETH1.0 chain service")
web3Service = setDefaultMocks(web3Service)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend.Client())
require.NoError(t, err)
web3Service.rpcClient = &mockExecution.RPCClient{Backend: testAcc.Backend}
web3Service.httpLogger = testAcc.Backend
web3Service.httpLogger = testAcc.Backend.Client()
web3Service.latestEth1Data.LastRequestedBlock = 0
web3Service.latestEth1Data.BlockHeight = testAcc.Backend.Blockchain().CurrentBlock().Number.Uint64()
web3Service.latestEth1Data.BlockTime = testAcc.Backend.Blockchain().CurrentBlock().Time
block, err := testAcc.Backend.Client().BlockByNumber(context.Background(), nil)
require.NoError(t, err)
web3Service.latestEth1Data.BlockHeight = block.NumberU64()
web3Service.latestEth1Data.BlockTime = block.Time()
bConfig := params.MinimalSpecConfig().Copy()
bConfig.MinGenesisTime = 0
bConfig.SecondsPerETH1Block = 10
bConfig.SecondsPerETH1Block = 1
params.OverrideBeaconConfig(bConfig)
nConfig := params.BeaconNetworkConfig()
nConfig.ContractDeploymentBlock = 0
Expand Down Expand Up @@ -444,8 +446,10 @@ func TestProcessETH2GenesisLog_CorrectNumOfDeposits(t *testing.T) {
for i := uint64(0); i < params.BeaconConfig().Eth1FollowDistance; i++ {
testAcc.Backend.Commit()
}
web3Service.latestEth1Data.BlockHeight = testAcc.Backend.Blockchain().CurrentBlock().Number.Uint64()
web3Service.latestEth1Data.BlockTime = testAcc.Backend.Blockchain().CurrentBlock().Time
b, err := testAcc.Backend.Client().BlockByNumber(context.Background(), nil)
require.NoError(t, err)
web3Service.latestEth1Data.BlockHeight = b.NumberU64()
web3Service.latestEth1Data.BlockTime = b.Time()

// Set up our subscriber now to listen for the chain started event.
stateChannel := make(chan *feed.Event, 1)
Expand Down Expand Up @@ -497,13 +501,15 @@ func TestProcessETH2GenesisLog_LargePeriodOfNoLogs(t *testing.T) {
)
require.NoError(t, err, "unable to setup web3 ETH1.0 chain service")
web3Service = setDefaultMocks(web3Service)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend.Client())
require.NoError(t, err)
web3Service.rpcClient = &mockExecution.RPCClient{Backend: testAcc.Backend}
web3Service.httpLogger = testAcc.Backend
web3Service.httpLogger = testAcc.Backend.Client()
web3Service.latestEth1Data.LastRequestedBlock = 0
web3Service.latestEth1Data.BlockHeight = testAcc.Backend.Blockchain().CurrentBlock().Number.Uint64()
web3Service.latestEth1Data.BlockTime = testAcc.Backend.Blockchain().CurrentBlock().Time
b, err := testAcc.Backend.Client().BlockByNumber(context.Background(), nil)
require.NoError(t, err)
web3Service.latestEth1Data.BlockHeight = b.NumberU64()
web3Service.latestEth1Data.BlockTime = b.Time()
bConfig := params.MinimalSpecConfig().Copy()
bConfig.SecondsPerETH1Block = 10
params.OverrideBeaconConfig(bConfig)
Expand Down Expand Up @@ -540,14 +546,19 @@ func TestProcessETH2GenesisLog_LargePeriodOfNoLogs(t *testing.T) {
for i := uint64(0); i < 1500; i++ {
testAcc.Backend.Commit()
}
wantedGenesisTime := testAcc.Backend.Blockchain().CurrentBlock().Time
genesisBlock, err := testAcc.Backend.Client().BlockByNumber(context.Background(), nil)
require.NoError(t, err)

wantedGenesisTime := genesisBlock.Time()

// Forward the chain to account for the follow distance
for i := uint64(0); i < params.BeaconConfig().Eth1FollowDistance; i++ {
testAcc.Backend.Commit()
}
web3Service.latestEth1Data.BlockHeight = testAcc.Backend.Blockchain().CurrentBlock().Number.Uint64()
web3Service.latestEth1Data.BlockTime = testAcc.Backend.Blockchain().CurrentBlock().Time
currBlock, err := testAcc.Backend.Client().BlockByNumber(context.Background(), nil)
require.NoError(t, err)
web3Service.latestEth1Data.BlockHeight = currBlock.NumberU64()
web3Service.latestEth1Data.BlockTime = currBlock.Time()

// Set the genesis time 500 blocks ahead of the last
// deposit log.
Expand Down Expand Up @@ -608,7 +619,7 @@ func newPowchainService(t *testing.T, eth1Backend *mock.TestAccount, beaconDB db
)
require.NoError(t, err, "unable to setup web3 ETH1.0 chain service")
web3Service = setDefaultMocks(web3Service)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(eth1Backend.ContractAddr, eth1Backend.Backend)
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(eth1Backend.ContractAddr, eth1Backend.Backend.Client())
require.NoError(t, err)

web3Service.rpcClient = &mockExecution.RPCClient{Backend: eth1Backend.Backend}
Expand Down
Loading
Loading