Skip to content

Commit

Permalink
devnet: fix infinite recursion & enable TestStateSync & TestCallContr…
Browse files Browse the repository at this point in the history
…act integration tests (erigontech#9183)

This PR fixes an infinite recursion (stack overflow) error in devnet
integration tests that surfaced in our integration CI a week or more ago
and additionally enables some integration tests that are now fixed -
`TestStateSync` & `TestCallContract`.

![Screenshot 2024-01-09 at 17 10
24](https://github.com/ledgerwatch/erigon/assets/94537774/a5a8c9c9-9f68-4084-9e08-1bf3c1601cab)
  • Loading branch information
taratorio authored and ImTei committed Apr 9, 2024
1 parent a6dfae0 commit 7065012
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
6 changes: 2 additions & 4 deletions cmd/devnet/devnet/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,8 @@ func CurrentNetwork(ctx context.Context) *Network {
return cn.network
}

if current := CurrentNode(ctx); current != nil {
if n, ok := current.(*devnetNode); ok {
return n.network
}
if cn, ok := ctx.Value(ckNode).(*cnode); ok && cn.node != nil {
return cn.node.(*devnetNode).network
}

if devnet, ok := ctx.Value(ckDevnet).(Devnet); ok {
Expand Down
5 changes: 2 additions & 3 deletions cmd/devnet/tests/bor/devnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ import (
"context"
"testing"

"github.com/stretchr/testify/require"

"github.com/ledgerwatch/erigon-lib/chain/networkname"
accounts_steps "github.com/ledgerwatch/erigon/cmd/devnet/accounts/steps"
contracts_steps "github.com/ledgerwatch/erigon/cmd/devnet/contracts/steps"
"github.com/ledgerwatch/erigon/cmd/devnet/requests"
"github.com/ledgerwatch/erigon/cmd/devnet/services"
"github.com/ledgerwatch/erigon/cmd/devnet/tests"
"github.com/stretchr/testify/require"
)

func TestStateSync(t *testing.T) {
t.Skip("FIXME: hangs in GenerateSyncEvents without any visible progress")

runCtx, err := tests.ContextStart(t, networkname.BorDevnetChainName)
require.Nil(t, err)
var ctx context.Context = runCtx
Expand Down
5 changes: 2 additions & 3 deletions cmd/devnet/tests/generic/devnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/ledgerwatch/erigon/cmd/devnet/accounts"
"github.com/ledgerwatch/erigon/cmd/devnet/admin"
"github.com/ledgerwatch/erigon/cmd/devnet/contracts/steps"
"github.com/ledgerwatch/erigon/cmd/devnet/requests"
"github.com/ledgerwatch/erigon/cmd/devnet/services"
"github.com/ledgerwatch/erigon/cmd/devnet/tests"
"github.com/ledgerwatch/erigon/cmd/devnet/transactions"
"github.com/stretchr/testify/require"
)

func testDynamicTx(t *testing.T, ctx context.Context) {
Expand Down Expand Up @@ -51,8 +52,6 @@ func TestDynamicTxAnyNode(t *testing.T) {
}

func TestCallContract(t *testing.T) {
t.Skip("FIXME: DeployAndCallLogSubscriber step fails: Log result is incorrect expected txIndex: 1, actual txIndex 2")

runCtx, err := tests.ContextStart(t, "")
require.Nil(t, err)
ctx := runCtx.WithCurrentNetwork(0)
Expand Down

0 comments on commit 7065012

Please sign in to comment.