Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 12 additions & 3 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
on:
push:
branches-ignore:
pull_request:
types: [opened, synchronize, reopened]
branches:
- "main"
- "experimental"

name: validate-compatibility
jobs:
Expand All @@ -13,10 +15,17 @@ jobs:
- name: install
run: make install
- name: buf breaking
run: make buf-breaking
env:
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
run: |
echo "base_ref=${{ github.event.pull_request.base.ref }}"
echo "BASE_BRANCH=$BASE_BRANCH"
make buf-breaking
- name: buf lint
run: make buf-lint
- name: build and compile test
run: make test
- name: run the check script
env:
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
run: ./scripts/check-proto-compabitility.sh
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ buf-build: node_modules/.bin/buf
./node_modules/.bin/buf build proto/

buf-breaking: node_modules/.bin/buf
./node_modules/.bin/buf breaking proto/ --against 'https://github.com/decentraland/protocol.git#subdir=proto'
./node_modules/.bin/buf breaking proto/ --against 'https://github.com/decentraland/protocol.git#branch=$(or $(BASE_BRANCH),main),subdir=proto'

test: buf-lint
bash scripts/test.sh
Expand Down
8 changes: 8 additions & 0 deletions proto/decentraland/kernel/comms/rfc4/comms.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ message Movement {
bool is_stunned = 15;

float rotation_y = 16;

message NetworkEntity {
uint32 entity_id = 1;
uint64 network_id = 2;
}

optional NetworkEntity network_entity = 17;
uint64 synced_timestamp = 18;
}

message MovementCompressed {
Expand Down
21 changes: 21 additions & 0 deletions proto/decentraland/sdk/components/network_entity.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
syntax = "proto3";

package decentraland.sdk.components;

import "decentraland/sdk/components/common/id.proto";
option (common.ecs_component_id) = 1098;

/**
* NetworkEntity marks an entity for network synchronization.

* When receiving network messages, to find which local entity they refer to,
* we look for an entity that has both the same networkId and entityId as the message.
*/
message PBNetworkEntity {
// The enumId or local entity ID
uint32 entity_id = 1;

// - 0 for fixed entities (created with enumId at initialization)
// - User's address hash for dynamic entities (created at runtime)
uint64 network_id = 2;
}
31 changes: 31 additions & 0 deletions proto/decentraland/sdk/components/synced_clock.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
syntax = "proto3";

package decentraland.sdk.components;

import "decentraland/sdk/components/common/id.proto";
option (common.ecs_component_id) = 1099;

// PBTimeComponent provides synchronized time information based on NTP server data
// This component can be used to maintain consistent time across all clients
message PBSyncedClock {
// The current synchronized time (in milliseconds since epoch)
uint64 synced_timestamp = 1;

// The synchronization status
SyncStatus status = 7;
}

// Status of time synchronization
enum SyncStatus {
// The component is not yet synchronized with the NTP server
SS_UNINITIALIZED = 0;

// The component is currently attempting to synchronize with the NTP server
SS_SYNCHRONIZING = 1;

// The component is successfully synchronized with the NTP server
SS_SYNCHRONIZED = 2;

// The component failed to synchronize with the NTP server
SS_ERROR = 3;
}
1 change: 1 addition & 0 deletions proto/decentraland/sdk/components/tween.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ message PBTween {

optional bool playing = 6; // default true (pause or running)
optional float current_time = 7; // between 0 and 1
optional uint64 start_synced_timestamp = 9; // timestamp (in milliseconds) when the tween started, allows synchronization across clients
}

message Move {
Expand Down
21 changes: 12 additions & 9 deletions scripts/check-proto-compabitility.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
#!/bin/bash
set -e -x

# Download the main branch ref zip
protocol_main_zip_url="https://github.com/decentraland/protocol/archive/refs/heads/main.zip"
protocol_main_zip_local="./protocol-main.zip"
# Use BASE_BRANCH environment variable or default to main
BRANCH="${BASE_BRANCH:-main}"

# Download the reference branch zip
protocol_branch_zip_url="https://github.com/decentraland/protocol/archive/refs/heads/${BRANCH}.zip"
protocol_branch_zip_local="./protocol-${BRANCH}.zip"

TMP_ZIP_DIR=$(mktemp -d)

curl -L "$protocol_main_zip_url" -o "$protocol_main_zip_local"
unzip "$protocol_main_zip_local" -d "$TMP_ZIP_DIR"
rm "$protocol_main_zip_local" || true
curl -L "$protocol_branch_zip_url" -o "$protocol_branch_zip_local"
unzip "$protocol_branch_zip_local" -d "$TMP_ZIP_DIR"
rm "$protocol_branch_zip_local" || true

ln -s "$(pwd)/node_modules" "$TMP_ZIP_DIR/protocol-main/node_modules"
ln -s "$(pwd)/node_modules" "$TMP_ZIP_DIR/protocol-${BRANCH}/node_modules"

# Run the `proto-compatibility-tool` and exclude the downloaded folder.
echo "Checking the compatibility against $base_url"
./node_modules/.bin/proto-compatibility-tool --recursive "$TMP_ZIP_DIR/protocol-main/proto" "proto"
echo "Checking the compatibility against branch: ${BRANCH}"
./node_modules/.bin/proto-compatibility-tool --recursive "$TMP_ZIP_DIR/protocol-${BRANCH}/proto" "proto"
# ../proto-compatibility-tool/dist/bin.js --recursive "$TMP_ZIP_DIR/protocol-main" "."

# rm -rf "$TMP_ZIP_DIR" || true
Loading