Skip to content

Commit

Permalink
Merge pull request #28 from PowerLoom/hotfix/local_collector_random_i…
Browse files Browse the repository at this point in the history
…d_branch_pull

Hotfix: local collector connects to trusted sequencer
  • Loading branch information
anomit authored Jul 19, 2024
2 parents d87f31d + c126041 commit e53d606
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.
18 changes: 10 additions & 8 deletions build-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,16 @@ fi
# setting up git submodules
git submodule update --init --recursive
# check if snapshotter-lite-local-collector exists
if [ -d "./snapshotter-lite-local-collector" ]; then
echo "snapshotter-lite-local-collector exists, do you want to delete and clone a fresh one? (y/n)";
read response;
if [ "$response" == "y" ]; then
rm -rf ./snapshotter-lite-local-collector
git clone https://github.com/PowerLoom/snapshotter-lite-local-collector/ snapshotter-lite-local-collector --single-branch --branch main
fi
fi
# if [ -d "./snapshotter-lite-local-collector" ]; then
# echo "snapshotter-lite-local-collector exists, do you want to delete and clone a fresh one? (y/n)";
# read response;
# if [ "$response" == "y" ]; then
# rm -rf ./snapshotter-lite-local-collector

# fi
# fi
rm -rf snapshotter-lite-local-collector
git clone https://github.com/PowerLoom/snapshotter-lite-local-collector/ snapshotter-lite-local-collector --single-branch --branch fix/generate-new-p2pid
cd ./snapshotter-lite-local-collector/ && chmod +x build-docker.sh && ./build-docker.sh;
cd ../;

Expand Down
2 changes: 1 addition & 1 deletion config
Submodule config updated 1 files
+1 −0 settings.example.json
1 change: 1 addition & 0 deletions docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ services:
- IPFS_API_SECRET=$IPFS_API_SECRET
- PROTOCOL_STATE_CONTRACT=$PROTOCOL_STATE_CONTRACT
- SLACK_REPORTING_URL=$SLACK_REPORTING_URL
- LOCAL_COLLECTOR_PORT=$LOCAL_COLLECTOR_PORT
- POWERLOOM_REPORTING_URL=$POWERLOOM_REPORTING_URL
- WEB3_STORAGE_TOKEN=$WEB3_STORAGE_TOKEN
- NAMESPACE=$NAMESPACE
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ services:
- IPFS_API_KEY=$IPFS_API_KEY
- IPFS_API_SECRET=$IPFS_API_SECRET
- PROTOCOL_STATE_CONTRACT=$PROTOCOL_STATE_CONTRACT
- LOCAL_COLLECTOR_PORT=$LOCAL_COLLECTOR_PORT
- SLACK_REPORTING_URL=$SLACK_REPORTING_URL
- POWERLOOM_REPORTING_URL=$POWERLOOM_REPORTING_URL
- WEB3_STORAGE_TOKEN=$WEB3_STORAGE_TOKEN
Expand Down
2 changes: 2 additions & 0 deletions snapshotter/system_event_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def __init__(self, name, **kwargs):
self._initialized = False

async def init(self):
self._logger.info('Initializing SystemEventDetector. Awaiting local collector initialization and bootstrapping...')
await asyncio.sleep(20)
await self.processor_distributor.init()
await self._init_check_and_report()
await asyncio.sleep(120)
Expand Down
2 changes: 1 addition & 1 deletion snapshotter/utils/generic_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ async def _init_httpx_client(self):
async def _init_grpc(self):
self._grpc_channel = Channel(
host='snapshotter-lite-local-collector',
port=50051,
port=settings.local_collector_port,
ssl=False,
)
self._grpc_stub = SubmissionStub(self._grpc_channel)
Expand Down
1 change: 1 addition & 0 deletions snapshotter/utils/models/settings_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class Settings(BaseModel):
core_api: CoreAPI
instance_id: str
signer_private_key: str
local_collector_port: int
slot_id: int
rpc: RPCConfigFull
rlimit: RLimit
Expand Down
4 changes: 3 additions & 1 deletion snapshotter_autofill.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export ipfs_api_key="${IPFS_API_KEY:-}"
export ipfs_api_secret="${IPFS_API_SECRET:-}"
export web3_storage_token="${WEB3_STORAGE_TOKEN:-}"
export relayer_host="${RELAYER_HOST:-https://relayer-nms-testnet-public.powerloom.io}"

export local_collector_port="${LOCAL_COLLECTOR_PORT:-50051}"
export slack_reporting_url="${SLACK_REPORTING_URL:-}"
export powerloom_reporting_url="${POWERLOOM_REPORTING_URL:-}"

Expand Down Expand Up @@ -120,4 +120,6 @@ sed -i'.backup' "s#https://powerloom-reporting-url#$powerloom_reporting_url#" co
sed -i'.backup' "s#signer-account-private-key#$SIGNER_ACCOUNT_PRIVATE_KEY#" config/settings.json
sed -i'.backup' "s#https://relayer-url#$relayer_host#" config/settings.json

sed -i'.backup' "s#local-collector-port#$local_collector_port#" config/settings.json

echo 'settings has been populated!'

0 comments on commit e53d606

Please sign in to comment.