mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
## Summary of changes - We decided to remove the topics and nonce from the massage encoding since we don't use them (original commit:ee2a3f2fd4). - Besides, we already have a nonce at the Snowbridge message levelf4ab5c2b2e/operator/primitives/snowbridge/inbound-queue/src/v2/message.rs (L105)- I had to recreate the static test for _encoding_ (happens in [DataHavenSnowbridgeMessages.sol](d12d40634f/contracts/src/libraries/DataHavenSnowbridgeMessages.sol) ) / _decoding_ (happens in [operator/primitives/bridge/src/lib.rs)](f9f9cc65fe/operator/primitives/bridge/src/lib.rs). Now it matches the current structure. The idea is that now we can test that we don't break the decoding in followup refactoring. - Fixes a problem with EigenLayer validator addresses. In all our contracts we were using `bytes32` to refer to a Solochain validator address. But on our Substrate change we actually expect AccountId20, so only 20 bytes. This was causing the decoding to fail. - I opted for the minimal change that would be to take the right-most 20 bytes to send that to our chain. But we might want aswell to limit our EigenLayer contracts to be only 20 bytes long. @ahmadkaouk showcase this [here](92a34c273c) - Adds a bash script to run the static test. The test will compile the contracts, run the encoding test, compile the operator, and run the decoding test. This saves a huge amount of time since we don't need to run the full e2e setup. The way of running it is the following: ```bash cd operator/test/scripts ./test_message_encoding.sh ``` - As a consequence of this PR, the execution relayer now works properly. EDIT: > [!IMPORTANT] **We decided to use 20-byte addresses in our contracts**. So what is stated above is not valid anymore. The change implies that the mapping from Ethereum addresses to bytes32 addresses now it's a mapping as follows:dd3ba99ac0/contracts/src/DataHavenServiceManager.sol (L51-L52)I've updated helper functions, tests, etc to be compliant with this change. The execution relayer and beefy relayer look stable now. --------- Co-authored-by: Ahmad Kaouk <ahmadkaouk.93@gmail.com> Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com>
30 lines
No EOL
1.1 KiB
Bash
Executable file
30 lines
No EOL
1.1 KiB
Bash
Executable file
#!/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!" |