#!/bin/bash # This script is used to test the message encoding for the snowbridge message processor. # You can pass the -v flag to run the test with a more verbose output. set -e echo "๐Ÿš€ Starting message encoding test..." cd ../../../ echo "๐Ÿ“ Changed to contracts directory" cd contracts echo "๐Ÿ”จ Compiling contracts with forge..." forge build --force echo "โœ… Contracts compiled successfully" mkdir -p ../operator/primitives/bridge/test_data echo "๐Ÿ“‚ Create test_data directory if doesn't exist" echo "๐Ÿ”ง Running forge test to generate ReceiveValidators encoded message..." forge test --match-test testEncodeReceiveValidatorsMessage -vvv | grep -A 10 "Logs:" | grep -E "0x[a-fA-F0-9]+" | tail -n 1 | sed 's/0x//' | xxd -r -p > ../operator/primitives/bridge/test_data/receive_validators_message.bin echo "๐Ÿ’พ Generated receive_validators_message.bin file" cd ../operator echo "๐Ÿ“ Changed to operator directory" echo "๐Ÿงช Running cargo test for snowbridge message processor..." cargo test --test snowbridge_message_processor ${1:+-v -- --nocapture} echo "โœ… Cargo test completed successfully!"