datahaven/contracts/test/MessageEncoding.t.sol
Ahmad Kaouk 5db1f4ee74
refactor: cleanup obsolete test folder (#166)
### Summary
Removes the obsolete `operator/test` folder that was no longer being
used and contained outdated test scripts.

### Changes
-  Deleted `operator/test/` directory and all contents
-  Moved `test_message_encoding.sh` script to `operator/scripts/` for
proper organization
-  Updated comment reference in `contracts/test/MessageEncoding.t.sol`
to point to new script location

### Impact
- **No breaking changes** - All legitimate test files remain properly
organized within their respective pallets
- **Cleaner codebase** - Removes unused/obsolete code
2025-09-17 14:21:55 +02:00

28 lines
1.3 KiB
Solidity

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.27;
import {Test} from "forge-std/Test.sol";
import {console} from "forge-std/console.sol";
import {DataHavenSnowbridgeMessages} from "../src/libraries/DataHavenSnowbridgeMessages.sol";
import {TestUtils} from "./utils/TestUtils.sol";
// This test is used to encode the receive validators message and print the hex string.
// Run forge test --match-test testEncodeReceiveValidatorsMessage -vvv to see the hex encoded bytes.
// Use the helper script in operator/scripts/test_message_encoding.sh to test the encoding/decoding full cycle.
contract MessageEncodingTest is Test {
function testEncodeReceiveValidatorsMessage() public pure {
// Use the utility function for consistency
address[] memory mockValidators = TestUtils.generateMockValidatorsAddresses(3);
DataHavenSnowbridgeMessages.NewValidatorSetPayload memory payload =
DataHavenSnowbridgeMessages.NewValidatorSetPayload({validators: mockValidators});
DataHavenSnowbridgeMessages.NewValidatorSet memory newValidatorSetMessage =
DataHavenSnowbridgeMessages.NewValidatorSet({payload: payload});
bytes memory encodedMessage =
DataHavenSnowbridgeMessages.scaleEncodeNewValidatorSetMessage(newValidatorSetMessage);
console.logBytes(encodedMessage);
}
}