diff --git a/consensus/polybft/state_sync_commitment.go b/consensus/polybft/state_sync_commitment.go index 8aeeb45f44..6f109d834f 100644 --- a/consensus/polybft/state_sync_commitment.go +++ b/consensus/polybft/state_sync_commitment.go @@ -198,10 +198,5 @@ func createMerkleTree(stateSyncEvents []*contractsapi.StateSyncedEvent) (*merkle stateSyncData[i] = data } - if len(stateSyncEvents) == 1 { - //nolint:makezero - stateSyncData = append(stateSyncData, []byte{}) - } - return merkle.NewMerkleTree(stateSyncData) } diff --git a/e2e-polybft/e2e/bridge_test.go b/e2e-polybft/e2e/bridge_test.go index 661fb97c25..ceb97f572b 100644 --- a/e2e-polybft/e2e/bridge_test.go +++ b/e2e-polybft/e2e/bridge_test.go @@ -4,7 +4,9 @@ import ( "encoding/hex" "fmt" "math/big" + "os" "path" + "path/filepath" "strings" "testing" "time" @@ -30,6 +32,20 @@ const ( chainConfigFileName = "genesis.json" ) +func init() { + wd, err := os.Getwd() + if err != nil { + return + } + + parent := filepath.Dir(wd) + wd = filepath.Join(parent, "../artifacts/polygon-edge") + os.Setenv("EDGE_BINARY", wd) + os.Setenv("E2E_TESTS", "true") + os.Setenv("E2E_LOGS", "true") + os.Setenv("E2E_LOG_LEVEL", "debug") +} + func TestE2E_Bridge_Transfers(t *testing.T) { const ( transfersCount = 5 diff --git a/merkle-tree/merkle_tree_test.go b/merkle-tree/merkle_tree_test.go index 426014c5e0..2f342a9277 100644 --- a/merkle-tree/merkle_tree_test.go +++ b/merkle-tree/merkle_tree_test.go @@ -90,22 +90,3 @@ func TestMerkleTree_VerifyProof_TreeWithOneNode(t *testing.T) { // empty leaf require.ErrorContains(t, VerifyProof(11, []byte{}, proof, tree.Hash()), "empty leaf") } - -func TestMerkleTree_WithOneLeaf_AndOneEmptyLeaf(t *testing.T) { - t.Parallel() - - leafData := []byte{1} - treeData := [][]byte{leafData, {}} // with one empty leaf - - tree, err := NewMerkleTree(treeData) - require.NoError(t, err) - - proof, err := tree.GenerateProof(leafData) - require.NoError(t, err) - require.NotEmpty(t, proof) - - index, err := tree.LeafIndex(leafData) - require.NoError(t, err) - require.Equal(t, uint64(0), index) // should be 0 - require.NoError(t, VerifyProof(index, leafData, proof, tree.Hash())) -}