Skip to content

Commit

Permalink
test_: merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
fbarbu15 committed Feb 6, 2025
2 parents 655c663 + 848b411 commit dfce889
Show file tree
Hide file tree
Showing 63 changed files with 1,161 additions and 1,196 deletions.
50 changes: 24 additions & 26 deletions _assets/scripts/migration_check.sh
Original file line number Diff line number Diff line change
@@ -1,48 +1,46 @@
#!/usr/bin/env bash

set -e
set -o pipefail
set -euo pipefail

source _assets/scripts/colors.sh

check_migration_order() {
local prev_migration=""
for file in "$@"; do
current_migration=$(echo "$file" | cut -d'-' -f1)
current_migration=$(basename "$file")

if [[ ! -z "$prev_migration" && "$current_migration" < "$prev_migration" ]]; then
echo "migration ${current_migration} is not in order with ${prev_migration}"
echo "Error: Migration files are out of order. Please ensure migrations are added in chronological order."
echo -e "${YLW}migration ${RST}${current_migration} ${YLW}is not in order with ${RST}${prev_migration}"
echo -e "${YLW}Error: Migration files are out of order. Please ensure migrations are added in chronological order."
exit 1
fi

prev_migration="$current_migration"
done
}

git checkout origin/develop
git pull origin develop
git checkout -
committed_files=$(git ls-tree -r --name-only HEAD protocol/migrations/sqlite/*.sql | sort)
staged_files=$(git diff --name-only origin/develop protocol/migrations/sqlite/*.sql | sort)

all_files=$(echo -e "$committed_files\n$staged_files")
BASE_BRANCH=${BASE_BRANCH:-develop}
BASE_COMMIT=${1:-origin/${BASE_BRANCH}}

# protocol migrations
check_migration_order $all_files
MIGRATION_DIRS=( \
"protocol/migrations/sqlite" \
"appdatabase/migrations/sql" \
"protocol/encryption/migrations/sqlite" \
"walletdatabase/migrations/sql" \
)

committed_files=$(git ls-tree -r --name-only HEAD appdatabase/migrations/sql/*.sql | sort)
staged_files=$(git diff --name-only origin/develop appdatabase/migrations/sql/*.sql | sort)

all_files=$(echo -e "$committed_files\n$staged_files")

# account migrations
check_migration_order $all_files
git checkout ${BASE_COMMIT}
git pull origin ${BASE_BRANCH}
git checkout -

committed_files=$(git ls-tree -r --name-only HEAD protocol/encryption/migrations/sqlite/*.sql | sort)
staged_files=$(git diff --name-only origin/develop protocol/encryption/migrations/sqlite/*.sql | sort)
for MIGRATION_DIR in ${MIGRATION_DIRS[@]}; do
echo -e "${GRN}Checking migrations:${RST} ${MIGRATION_DIR}"

all_files=$(echo -e "$committed_files\n$staged_files")
base_files=$(git ls-tree -r --name-only ${BASE_COMMIT} ${MIGRATION_DIR}/*.sql | sort)
new_files=$(git diff --name-only ${BASE_COMMIT} ${MIGRATION_DIR}/*.sql | sort)
all_files=$(echo -e "$base_files\n$new_files")

# encryption migrations
check_migration_order $all_files
check_migration_order $all_files
done

exit 0
5 changes: 2 additions & 3 deletions eth-node/bridge/geth/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
gethnode "github.com/status-im/status-go/eth-node/node"
enstypes "github.com/status-im/status-go/eth-node/types/ens"

wakubridge "github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -50,15 +49,15 @@ func (w *gethNodeWrapper) GetWaku(ctx interface{}) (wakutypes.Waku, error) {
return nil, errors.New("waku service is not available")
}

return wakubridge.NewGethWakuWrapper(w.waku1), nil
return w.waku1, nil
}

func (w *gethNodeWrapper) GetWakuV2(ctx interface{}) (wakutypes.Waku, error) {
if w.waku2 == nil {
return nil, errors.New("waku service is not available")
}

return wakubridge.NewGethWakuV2Wrapper(w.waku2), nil
return w.waku2, nil
}

func (w *gethNodeWrapper) AddPeer(url string) error {
Expand Down
3 changes: 1 addition & 2 deletions mailserver/mailserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/logutils"
"github.com/status-im/status-go/params"
"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
"github.com/status-im/status-go/wakuv1"
wakuv1common "github.com/status-im/status-go/wakuv1/common"
Expand Down Expand Up @@ -126,7 +125,7 @@ func (s *WakuMailServer) Close() {
}

func (s *WakuMailServer) Archive(env *wakuv1common.Envelope) {
s.ms.Archive(bridge.NewWakuEnvelope(env))
s.ms.Archive(wakuv1.NewWakuEnvelope(env))
}

func (s *WakuMailServer) Deliver(peerID []byte, req wakuv1common.MessagesRequest) {
Expand Down
4 changes: 2 additions & 2 deletions mailserver/mailserver_db_postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/postgres"
"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
"github.com/status-im/status-go/wakuv1"
wakuv1common "github.com/status-im/status-go/wakuv1/common"
)

Expand Down Expand Up @@ -126,5 +126,5 @@ func newTestEnvelope(topic []byte) (wakutypes.Envelope, error) {
if err != nil {
return nil, err
}
return bridge.NewWakuEnvelope(envelope), nil
return wakuv1.NewWakuEnvelope(envelope), nil
}
4 changes: 4 additions & 0 deletions protocol/activity_center.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ const (
ActivityCenterNotificationTypeCommunityUnbanned
ActivityCenterNotificationTypeNewInstallationReceived
ActivityCenterNotificationTypeNewInstallationCreated
ActivityCenterNotificationTypeBackupSyncingFetching
ActivityCenterNotificationTypeBackupSyncingSuccess
ActivityCenterNotificationTypeBackupSyncingPartialFailure
ActivityCenterNotificationTypeBackupSyncingFailure
)

type ActivityCenterMembershipStatus int
Expand Down
3 changes: 1 addition & 2 deletions protocol/common/message_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

transport2 "github.com/status-im/status-go/protocol/transport"
"github.com/status-im/status-go/t/helpers"
"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
"github.com/status-im/status-go/wakuv1"

Expand Down Expand Up @@ -74,7 +73,7 @@ func (s *MessageSenderSuite) SetupTest() {
s.Require().NoError(shh.Start())

whisperTransport, err := transport2.NewTransport(
bridge.NewGethWakuWrapper(shh),
shh,
identity,
database,
"waku_keys",
Expand Down
7 changes: 3 additions & 4 deletions protocol/communities_messenger_shared_member_address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/tt"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -89,13 +88,13 @@ func (s *MessengerCommunitiesSharedMemberAddressSuite) TearDownTest() {
TearDownMessenger(&s.Suite, s.bob)
TearDownMessenger(&s.Suite, s.alice)
if s.ownerWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.ownerWaku).Stop())
s.Require().NoError(s.ownerWaku.Stop())
}
if s.bobWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.bobWaku).Stop())
s.Require().NoError(s.bobWaku.Stop())
}
if s.aliceWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.aliceWaku).Stop())
s.Require().NoError(s.aliceWaku.Stop())
}
_ = s.logger.Sync()
}
Expand Down
3 changes: 1 addition & 2 deletions protocol/communities_messenger_test_suite_base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/wakuv1"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -52,7 +51,7 @@ func (s *CommunitiesMessengerTestSuiteBase) SetupTest() {
config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = bridge.NewGethWakuWrapper(shh)
s.shh = shh
s.Require().NoError(shh.Start())
}

Expand Down
10 changes: 5 additions & 5 deletions protocol/communities_messenger_token_permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/services/wallet/thirdparty"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -200,13 +199,13 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) TearDownTest() {
TearDownMessenger(&s.Suite, s.bob)
TearDownMessenger(&s.Suite, s.alice)
if s.ownerWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.ownerWaku).Stop())
s.Require().NoError(s.ownerWaku.Stop())
}
if s.bobWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.bobWaku).Stop())
s.Require().NoError(s.bobWaku.Stop())
}
if s.aliceWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.aliceWaku).Stop())
s.Require().NoError(s.aliceWaku.Stop())
}
_ = s.logger.Sync()
}
Expand Down Expand Up @@ -494,7 +493,8 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) TestBecomeMemberPermissions(
}
wakuStoreNode := NewTestWakuV2(&s.Suite, cfg)

storeNodeListenAddresses := wakuStoreNode.ListenAddresses()
storeNodeListenAddresses, err := wakuStoreNode.ListenAddresses()
s.Require().NoError(err)
s.Require().LessOrEqual(1, len(storeNodeListenAddresses))

storeNodeAddress := storeNodeListenAddresses[0]
Expand Down
14 changes: 14 additions & 0 deletions protocol/messenger.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ type Messenger struct {
peersyncingRequests map[string]uint64

mvdsStatusChangeEvent chan datasyncnode.PeerStatusChangeEvent

backedUpFetchingStatus *BackupFetchingStatus
}

type EnvelopeEventsInterceptor struct {
Expand Down Expand Up @@ -917,6 +919,18 @@ func (m *Messenger) Start() (*MessengerResponse, error) {
}
}

if m.processBackedupMessages {
m.backedUpFetchingStatus = &BackupFetchingStatus{
dataProgress: make(map[string]FetchingBackedUpDataTracking),
lastKnownMsgClock: 0,
fetchingCompleted: false,
}
err = m.startBackupFetchingTracking(response)
if err != nil {
return nil, err
}
}

return response, nil
}

Expand Down
Loading

0 comments on commit dfce889

Please sign in to comment.