- Integrated Zod validation schemas across various API routes to ensure input integrity and improve error handling. - Updated `mapping-service`, `orchestrator`, `packet-service`, and `webhook-service` to utilize validation middleware for request parameters and bodies. - Improved error handling in webhook management, packet generation, and compliance routes to provide clearer feedback on request failures. - Added new validation schemas for various endpoints, enhancing overall API robustness and maintainability. - Updated dependencies in `package.json` to include the new validation library.
48 lines
1.4 KiB
Bash
Executable File
48 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
||
# Storage Layout Validation Script for eMoneyToken Upgrades
|
||
|
||
set -e
|
||
|
||
echo "🔍 Validating storage layout for eMoneyToken upgrade..."
|
||
|
||
# Check if forge is installed
|
||
if ! command -v forge &> /dev/null; then
|
||
echo "❌ Error: forge not found. Please install Foundry."
|
||
exit 1
|
||
fi
|
||
|
||
# Build contracts
|
||
echo "📦 Building contracts..."
|
||
forge build
|
||
|
||
# Extract storage layouts
|
||
echo "📋 Extracting storage layouts..."
|
||
STORAGE_LAYOUT=$(forge inspect eMoneyToken storage-layout --pretty)
|
||
|
||
if [ -z "$STORAGE_LAYOUT" ]; then
|
||
echo "❌ Error: Could not extract storage layout"
|
||
exit 1
|
||
fi
|
||
|
||
echo "$STORAGE_LAYOUT" > storage-layout-current.txt
|
||
echo "✅ Storage layout saved to storage-layout-current.txt"
|
||
|
||
# If reference layout exists, compare
|
||
if [ -f "storage-layout-reference.txt" ]; then
|
||
echo "🔬 Comparing with reference layout..."
|
||
if diff -u storage-layout-reference.txt storage-layout-current.txt > storage-layout-diff.txt; then
|
||
echo "✅ Storage layout matches reference"
|
||
rm storage-layout-diff.txt
|
||
else
|
||
echo "⚠️ Storage layout differs from reference. See storage-layout-diff.txt"
|
||
cat storage-layout-diff.txt
|
||
exit 1
|
||
fi
|
||
else
|
||
echo "ℹ️ No reference layout found. Saving current layout as reference..."
|
||
cp storage-layout-current.txt storage-layout-reference.txt
|
||
fi
|
||
|
||
echo "✅ Validation complete"
|
||
|