Skip to content

Commit 8da298b

Browse files
author
Nikolay
committed
Starknet. Final pre-commit scan done
1 parent 6e147b0 commit 8da298b

File tree

14 files changed

+38
-24
lines changed

14 files changed

+38
-24
lines changed

docs/pre-merge-tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ npm run install-pre-commit-mac
4242
npm run run-pre-commit
4343
```
4444

45-
4. Optionally, run [shellcheck](https://github.com/koalaman/shellcheck) to check for common problems in your shell scripts.
45+
4. Optionally, run [shellcheck](https://github.com/koalaman/shellcheck) to check for common problems in your shell scripts.

lib/starknet/.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ node_modules
88
cdk.out
99
.idea
1010

11-
*-node.json
11+
*-node.json

lib/starknet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ A script on the Starknet node publishes current block and blocks behind metrics
151151
152152
# Undeploy Single Node
153153
npx cdk destroy starknet-single-node
154-
154+
155155
# Undeploy AMB Etheruem node
156156
npx cdk destroy starknet-ethereum-l1-node
157157

lib/starknet/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ new StarknetAMBEthereumSingleNodeStack(app, "starknet-ethereum-l1-node", {
2727
new StarknetSingleNodeStack(app, "starknet-single-node", {
2828
stackName: `starknet-single-node-${config.baseNodeConfig.starknetNetworkId}`,
2929
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },
30-
30+
3131
instanceType: config.baseNodeConfig.instanceType,
3232
instanceCpuType: config.baseNodeConfig.instanceCpuType,
3333
dataVolume: config.baseNodeConfig.dataVolume,
@@ -44,4 +44,4 @@ cdk.Aspects.of(app).add(
4444
reports: true,
4545
logIgnores: false,
4646
})
47-
);
47+
);

lib/starknet/lib/amb-ethereum-single-node-stack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class StarknetAMBEthereumSingleNodeStack extends cdk.Stack {
4040
value: ambEthereumNode.wssRpcUrlWithBillingToken,
4141
exportName: "AmbEthereumNodeRpcUrlWithBillingToken",
4242
});
43-
43+
4444
// Adding suppressions to the stack
4545
nag.NagSuppressions.addResourceSuppressions(
4646
this,

lib/starknet/lib/assets/restore-from-snapshot.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ tar -xvf $SNAPSHOT_DIR/$SNAPSHOT_FILE_NAME -C /data 2>&1 | tee unzip.log && ech
4646

4747
echo "Decompresed snapshot, cleaning up..."
4848

49+
rm -f /data/juno
4950
mv /data/juno_$STARKNET_NETWORK_ID /data/juno && \
5051
rm -rf $SNAPSHOT_DIR/$SNAPSHOT_FILE_NAME
5152

@@ -54,4 +55,4 @@ echo "Snapshot is ready, starting the service.."
5455
chown -R ubuntu:ubuntu /data
5556

5657
sudo systemctl daemon-reload
57-
sudo systemctl enable --now starknet
58+
sudo systemctl enable --now starknet

lib/starknet/lib/assets/setup-instance-store-volumes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ if [ -n "$DATA_VOLUME_ID" ]; then
3434
else
3535
echo "Data volume is mounted, nothing changed"
3636
fi
37-
fi
37+
fi

lib/starknet/lib/assets/sync-checker/syncchecker-starknet.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,19 @@ EC2_INTERNAL_IP=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s "http://169.254.
77
STARKNET_SYNC_STATS=$(curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"starknet_syncing","params":[],"id":1}' http://$EC2_INTERNAL_IP:6060 | jq -r ".result")
88

99
if [[ "$STARKNET_SYNC_STATS" == "false" ]]; then
10-
echo "Node is fully synced. No syncing data available."
11-
exit 0
10+
STARKNET_CURRENT_BLOCK=$(curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"starknet_blockNumber","params":[],"id":1}' http://$EC2_INTERNAL_IP:6060 | jq -r ".result")
11+
STARKNET_HIGHEST_BLOCK=$STARKNET_CURRENT_BLOCK
1212
else
1313
# Extract current and highest block numbers from the syncing status
1414
STARKNET_CURRENT_BLOCK=$(echo "$STARKNET_SYNC_STATS" | jq -r ".current_block_num")
1515
STARKNET_HIGHEST_BLOCK=$(echo "$STARKNET_SYNC_STATS" | jq -r ".highest_block_num")
16-
17-
# Echo the current and highest block numbers for verification
18-
echo "Current Block: $STARKNET_CURRENT_BLOCK"
19-
echo "Highest Block: $STARKNET_HIGHEST_BLOCK"
2016
fi
2117

2218
STARKNET_BLOCKS_BEHIND="$((STARKNET_HIGHEST_BLOCK-STARKNET_CURRENT_BLOCK))"
23-
24-
echo "STARKNET_BLOCKS_BEHIND Block: $STARKNET_BLOCKS_BEHIND"
19+
# Echo the current and highest block numbers for verification
20+
echo "Current Block: $STARKNET_CURRENT_BLOCK"
21+
echo "Highest Block: $STARKNET_HIGHEST_BLOCK"
22+
echo "STARKNET_BLOCKS_BEHIND Block: $STARKNET_BLOCKS_BEHIND"
2523

2624
# Sending data to CloudWatch
2725
INSTANCE_ID=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s http://169.254.169.254/latest/meta-data/instance-id)

lib/starknet/lib/assets/user-data/node.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ else
109109
fi
110110

111111
mkfs -t ext4 $DATA_VOLUME_ID
112-
sleep 10
112+
echo "waiting for volume to get UUID"
113+
OUTPUT=0;
114+
while [ "$OUTPUT" = 0 ]; do
115+
DATA_VOLUME_UUID=$(lsblk -fn -o UUID $DATA_VOLUME_ID)
116+
OUTPUT=$(echo $DATA_VOLUME_UUID | grep -c - $2)
117+
echo $OUTPUT
118+
done
113119
DATA_VOLUME_UUID=$(lsblk -fn -o UUID $DATA_VOLUME_ID)
114120
DATA_VOLUME_FSTAB_CONF="UUID=$DATA_VOLUME_UUID /data ext4 defaults 0 2"
115121
echo "DATA_VOLUME_ID="$DATA_VOLUME_ID
@@ -208,5 +214,5 @@ sudo mv /opt/sync-checker/syncchecker-starknet.sh /opt/syncchecker.sh
208214
sudo chmod +x /opt/syncchecker.sh
209215

210216
echo "*/5 * * * * /opt/syncchecker.sh" | crontab
211-
crontab -l
212-
echo "All done!"
217+
crontab -l
218+
echo "All done!"

lib/starknet/lib/config/starknetConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const baseConfig: configTypes.StarknetBaseConfig = {
2323
region: process.env.AWS_REGION || "us-east-1",
2424
}
2525

26-
export const baseNodeConfig: configTypes.StarknetBaseNodeConfig = {
26+
export const baseNodeConfig: configTypes.StarknetBaseNodeConfig = {
2727
ambEntereumNodeNetworkId: <configTypes.AMBEthereumNodeNetworkId> process.env.AMB_ENTEREUM_NODE_NETWORK_ID || "mainnet",
2828
ambEntereumNodeInstanceType: process.env.AMB_ETHEREUM_NODE_INSTANCE_TYPE || "bc.m5.xlarge",
2929
instanceType: new ec2.InstanceType(process.env.STARKNET_INSTANCE_TYPE ? process.env.STARKNET_INSTANCE_TYPE : "m6a.2xlarge"),

0 commit comments

Comments
 (0)