Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to update ISM on testnets? #408

Open
frank0528 opened this issue Dec 3, 2024 · 2 comments
Open

How to update ISM on testnets? #408

frank0528 opened this issue Dec 3, 2024 · 2 comments

Comments

@frank0528
Copy link
Contributor

frank0528 commented Dec 3, 2024

When I try to transfer token from deepbrainchaintestnet[#400] to bsctestnet, I got the error No ISM found for origin: 19850818 on bsctestnet.

  1. How to update deepbrainchaintestnet chain information on bsctestnet?
  2. If I have assets from other chains to deepbrainchaintestnet, how should I update the ISM on deepbrainchaintestnet?
@guy93354
Copy link
Contributor

guy93354 commented Dec 3, 2024

@xeno097, can you please help @frank0528 with his error message and questions?

@Mantas-M
Copy link

Mantas-M commented Dec 9, 2024

Usually on the recipient of EVM testnets the ISM is set to be a domain routing ISM, which would explain your no ism found error when sending the message.

If you want to send a message from your chain to bsctestnet you can deploy a test recipient on bsc and send to that address, having a custom ISM set on the recipient, which auto approves the message (or does any other logic you want)

I personally use these contracts for testing:

// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.8.0;

interface IMessageRecipient {
    function handle(
        uint32 _origin,
        bytes32 _sender,
        bytes calldata _message
    ) external payable;
}

interface IInterchainSecurityModule {
    enum Types {
        UNUSED,
        ROUTING,
        AGGREGATION,
        LEGACY_MULTISIG,
        MERKLE_ROOT_MULTISIG,
        MESSAGE_ID_MULTISIG,
        NULL, // used with relayer carrying no metadata
        CCIP_READ,
        ARB_L2_TO_L1,
        WEIGHTED_MERKLE_ROOT_MULTISIG,
        WEIGHTED_MESSAGE_ID_MULTISIG,
        OP_L2_TO_L1
    }

    /**
     * @notice Returns an enum that represents the type of security model
     * encoded by this ISM.
     * @dev Relayers infer how to fetch and format metadata.
     */
    function moduleType() external view returns (uint8);

    /**
     * @notice Defines a security model responsible for verifying interchain
     * messages based on the provided metadata.
     * @param _metadata Off-chain metadata provided by a relayer, specific to
     * the security model encoded by the module (e.g. validator signatures)
     * @param _message Hyperlane encoded interchain message
     * @return True if the message was verified
     */
    function verify(
        bytes calldata _metadata,
        bytes calldata _message
    ) external returns (bool);
}

interface ISpecifiesInterchainSecurityModule {
    function interchainSecurityModule()
        external
        view
        returns (IInterchainSecurityModule);
}

contract TestISM is IInterchainSecurityModule {
    function moduleType() external pure returns (uint8) {
        return 6;
    }

    function verify(
        bytes calldata,
        bytes calldata 
    ) external pure returns (bool) {
        return true;
    }

}

contract TestRecipient is
    IMessageRecipient,
    ISpecifiesInterchainSecurityModule
{
    IInterchainSecurityModule public interchainSecurityModule;
    bytes32 public lastSender;
    bytes public lastData;

    address public lastCaller;
    string public lastCallMessage;

    event ReceivedMessage(
        uint32 indexed origin,
        bytes32 indexed sender,
        uint256 indexed value,
        string message
    );

    event ReceivedCall(address indexed caller, uint256 amount, string message);

    function handle(
        uint32 _origin,
        bytes32 _sender,
        bytes calldata _data
    ) external payable virtual override {
        emit ReceivedMessage(_origin, _sender, msg.value, string(_data));
        lastSender = _sender;
        lastData = _data;
    }

    function fooBar(uint256 amount, string calldata message) external {
        emit ReceivedCall(msg.sender, amount, message);
        lastCaller = msg.sender;
        lastCallMessage = message;
    }

    function setInterchainSecurityModule(address _ism) external {
        interchainSecurityModule = IInterchainSecurityModule(_ism);
    }

    receive() external payable {}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants