From f0bdc1b1015d998a2417fd6c537cd33333e81d4e Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 27 Oct 2023 19:26:42 +0000 Subject: [PATCH 01/29] update READMEs --- README.md | 86 ++++++++++++------- .../ERC20Bridge/README.md | 4 +- .../src/CrossChainApplications/README.md | 57 +++++------- .../VerifiedBlockHash/README.md | 4 +- contracts/src/Teleporter/README.md | 18 +++- utils/contract-deployment/README.md | 4 +- 6 files changed, 99 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 54d6e7477..23455a2cd 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,26 @@ -# Overview +## Overview Teleporter is an EVM compatible cross-subnet communication protocol built on top of [Avalanche Warp Messaging (AWM)](https://docs.avax.network/learn/avalanche/awm), and implemented as a Solidity smart contract. It provides a mechanism to asynchronously invoke smart contract functions on other EVM blockchains within Avalanche. Teleporter provides a handful of useful features on top of AWM, such as specifying relayer incentives for message delivery, replay protection, message delivery and execution retries, and a standard interface for sending and receiving messages within a dApp deployed across multiple subnets. It's important to understand the distinction between Avalanche Warp Messaging and Teleporter. AWM allows subnets to communicate with each other via authenticated messages by providing signing and verification primitives in Avalanchego. These are used by the blockchain VMs to sign outgoing messages and verify incoming messages. -The Teleporter protocol, on the other hand, is implemented at the smart contract level, and is a user-friendly interface to AWM, aimed at dApp developers. All of the message signing and verification is abstracted away from developers. Instead, developers simply call `sendCrossChainMessage` on the `TeleporterMessenger` contract to send a message invoking a smart contract on another subnet, and implement the `ITeleporterReceiver` interface to receive messages on the destination subnet. Teleporter handles all of the message signing and verification, as well as the message delivery and execution. - -**Note:** Teleporter and Avalanche Warp Messaging are under active development and may cease to function at any time. This repository is intended to be used for testing and development purposes only and should **not** be used in production. +The Teleporter protocol, on the other hand, is implemented at the smart contract level, and is a user-friendly interface to AWM, aimed at dApp developers. All of the message signing and verification is abstracted away from developers. Instead, developers simply call `sendCrossChainMessage` on the `TeleporterMessenger` contract to send a message invoking a smart contract on another subnet, and implement the `ITeleporterReceiver` interface to receive messages on the destination subnet. Teleporter handles all of the Warp message construction and sending, as well as the message delivery and execution. - [Overview](#overview) - - [Setup](#setup) - - [Docker Setup](#docker-setup) - - [General Setup](#general-setup) - - [Structure](#structure) - - [Build + Run + Test](#build--run--test) - - [Run tests on Fuji Testnet](#run-tests-on-fuji-testnet) - - [E2E tests](#e2e-tests) - - [Docs](#docs) - - [Resources](#resources) +- [Setup](#setup) + - [Docker Setup](#docker-setup) + - [General Setup](#general-setup) +- [Structure](#structure) +- [Build + Run + Test](#build--run--test) + - [Run tests on Fuji Testnet](#run-tests-on-fuji-testnet) + - [E2E tests](#e2e-tests) +- [Docs](#docs) +- [Resources](#resources) ## Setup + ### Docker Setup + - Install Docker: ``` @@ -57,28 +57,36 @@ docker run hello-world # This should work without sudo now - Note that as you develop and continuously build Docker images, it will eat up continuously more disk space. Periodically you'll want to remedy this be removing everything Docker has built: `docker system prune --all --volumes --force` ### General Setup + The above steps are sufficient to run the included integration tests inside Docker containers. If you wish to run them outside docker, you'll need to install the following dependencies: - [Foundry](https://book.getfoundry.sh/getting-started/installation) - [Python3](https://www.python.org/downloads/) ## Structure +- `contracts/` is a [Foundry](https://github.com/foundry-rs/foundry) project that includes the implementation of the `TeleporterMessenger` contract and example dApps that demonstrate how to write contracts that interact with Teleporter. +- `abi-bindings/` includes Go ABI bindings for the contracts in `contracts/`. +- `tests/` includes integration tests for the contracts in `contracts/`, written using the [Ginkgo](https://onsi.github.io/ginkgo/) testing framework +- `utils/` includes Go utility functions for interacting with the contracts in `contracts/`. Included are Golang scripts to derive the expected EVM contract address deployed from a given EOA at a specific nonce, and also construct a transaction to deploy provided byte code to the same address on any EVM chain using [Nick's method](https://yamenmerhi.medium.com/nicks-method-ethereum-keyless-execution-168a6659479c#). - `subnet-evm/` is the public subnet-evm repository (included as a submodule) checked out on the `warp-contract` branch with our changes. -- `contract-deployment/` includes Golang scripts to derive the expected EVM contract address deployed from a given EOA at a specific nonce, and also construct a transaction to deploy provided byte code to the same address on any EVM chain using [Nick's method](https://yamenmerhi.medium.com/nicks-method-ethereum-keyless-execution-168a6659479c#). -- `contracts/` is a [foundry](https://github.com/foundry-rs/foundry) project that includes the implementation of the `TeleporterMessenger` contract and other dApps that serve as examples for how to write contracts that interact with Teleporter. -- `scripts/` includes scripts to run Teleporter and integration tests. - - Note that all the scripts should be run from the root of the repository. - - `scripts/local/` includes scripts to run Teleporter in Docker containers and tests in the `scripts/local/integration-tests` locally. +- `scripts/` includes bash scripts for interacting with Teleporter in various environments, as well as utility scripts. All the scripts should be run from the root of the repository. + - `abi_bindings.sh` generates ABI bindings for the contracts in `contracts/` and outputs them to `abi-bindings/` + - `lint.sh` lints the contracts in `contracts/` + - `scripts/local/` includes scripts for running Teleporter in Docker containers and tests in the `scripts/local/integration-tests` locally. - `scripts/local/integration-tests/` includes integration test scripts written in bash. The scripts use `foundry` to deploy smart contracts that use Teleporter, send transactions to interact with the contracts, and check that cross-chain messages have the expected effect on destination chains. - - `scripts/fuji/` includes scripts to interact with a live Teleporter deployment on Fuji subnets. - - `scripts/fuji/example-workflows/` includes example workflows that send transactions to interact with Teleporter contracts on Fuji subnets. -- `docker/` includes containerized setup for running a local setup of Teleporter, as well as a script to run each of the integration tests against the local network. + - *Note* These tests will be deprecated in favor of the end to end tests in `tests/`, written using the [Ginkgo](https://onsi.github.io/ginkgo/) testing framework + - `scripts/fuji/` includes scripts to interact with a live Teleporter deployment on Fuji subnets. + - `scripts/fuji/example-workflows/` includes example workflows that send transactions to interact with Teleporter contracts on Fuji subnets. +- `docker/` includes a containerized setup for running a local setup of Teleporter -## Build + Run + Test +## Run the Docker integration tests - Get all submodules: `git submodule update --init --recursive` - Install Docker as described in the setup section of the README in the root of this repository. -- If we are using a local version of the `awm-relayer` image, build it using `./scripts/build_local_image.sh` from the root of `awm-relayer` repository. +- If we are using a local version of the `awm-relayer` image, build it using `./scripts/build_local_image.sh` from the root of the `awm-relayer` repository. + +### Start up the local testnet + - Run `./scripts/local/run.sh` to run the local testnet in Docker containers with the ability to interact with the nodes directly. - `./scripts/local/run.sh` usage is as follows: ``` @@ -93,7 +101,7 @@ cast send --private-key 0x56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5c cast balance --rpc-url http://127.0.0.1:9652/ext/bc/C/rpc 0x333d17d3b42bf7930dbc6e852ca7bcf560a69003 ``` -- After calling `./scripts/local/run.sh`, you can directly send messages between the deployed subnets (in comparison, calling `./scripts/local/test.sh` runs the same setup steps, then runs the tests in `./scripts/integration-tests/` automatically). As an example, `./scripts/integration-tests/basic_send_receive.sh` can be run manually like so: +- After calling `./scripts/local/run.sh`, you can directly send messages between the deployed subnets . As an example, `./scripts/integration-tests/basic_send_receive.sh` can be run manually like so: ``` # Open a shell in the container @@ -121,13 +129,29 @@ source vars.sh ./run_stop.sh # stop the running containers and preserve the network for subsequent runs ./run_stop.sh -c # stop the running containers and clean the network ``` -- Additional Notes: - - Both the `./scripts/local/run.sh` and `./scripts/local/test.sh` scripts run local five node networks, with each of the nodes validating the primary network and three subnets (Subnet A, Subnet B, and Subnet C). - - Logs from the subnets on one of the five nodes are printed to stdout when run using either script. - - These logs can also be found at `~/.avalanche-cli/runs/network-runner-root-data__/node{1,5]/logs/.log`, or at `/var/lib/docker/overlay2//merged/root/.avalanche-cli/....` on your local machine. You will need to be the root user to access the logs under `/var/lib`. + +### Run the integration tests in Docker containers + +- Run `./scripts/local/test.sh` to run the integration tests in Docker containers. + - `./scripts/local/test.sh` usage is as follows: + ``` + -t, --test Run a specific test. If empty, runs all tests in the ./scripts/local/integration-tests/ + -t, --test "test1 test2" Run multiple tests. Test names must be space delimited and enclosed in quotes + -l, --local-relayer-image Use a local AWM Relayer image instead of pulling from dockerhub + -h, --help Print this help message + ``` + - Note that if `-l, --local` is not set, then the latest published `awm-relayer` image will be pulled from Dockerhub. +- This script performs the same setup steps as `scripts/local/run.sh` (described above), and then runs the tests in `./scripts/integration-tests/` automatically + +### Additional notes + +- Both the `./scripts/local/run.sh` and `./scripts/local/test.sh` scripts run local five node networks, with each of the nodes validating the primary network and three subnets (Subnet A, Subnet B, and Subnet C). +- Logs from the subnets on one of the five nodes are printed to stdout when run using either script. +- These logs can also be found at `~/.avalanche-cli/runs/network-runner-root-data__/node{1,5]/logs/.log`, or at `/var/lib/docker/overlay2//merged/root/.avalanche-cli/....` on your local machine. You will need to be the root user to access the logs under `/var/lib`. ### Run tests on Fuji Testnet -The following steps will allow you to run integration tests and example workflows against three Fuji subnets that have AWM enabled. These workflows send transaction on each of these subnets, so you will need to fund your account with some native tokens to pay for gas fees. The three subnets are called [Amplify](https://subnets-test.avax.network/amplify), [Bulletin](https://subnets-test.avax.network/bulletin), and [Conduit](https://subnets-test.avax.network/conduit). + +The following steps will allow you to run the integration tests described above and example workflows against three Fuji subnets that have AWM enabled. These workflows send transaction on each of these subnets, so you will need to fund your account with some native tokens to pay for gas fees. The three subnets are called [Amplify](https://subnets-test.avax.network/amplify), [Bulletin](https://subnets-test.avax.network/bulletin), and [Conduit](https://subnets-test.avax.network/conduit). The configuration for all the subnets is in `.env.testnet`. If needed, you can change the subnet IDs, the chain IDs, urls and teleporter contract address to match your setup. @@ -160,7 +184,7 @@ source .env.testnet source .env ``` -### E2E tests +## E2E tests E2E tests are ran as part of CI, but can also be ran locally with the `--local` flag. To run the E2E tests locally, you'll need to install Gingko following the intructions [here](https://onsi.github.io/ginkgo/#installing-ginkgo) @@ -169,7 +193,7 @@ Next, provide the path to the `subnet-evm` repository and the path to a writeabl ./scripts/local/e2e_test.sh --local --subnet-evm ./subnet-evm --data-dir ~/tmp/e2e-test ``` -### ABI Bindings +## ABI Bindings To generate Golang ABI bindings for the Solidity smart contracts, run: ```bash diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/README.md b/contracts/src/CrossChainApplications/ERC20Bridge/README.md index 8f37bd658..bee16cc21 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/README.md +++ b/contracts/src/CrossChainApplications/ERC20Bridge/README.md @@ -13,7 +13,7 @@ The generic ERC20 bridge is implemented using two primary contracts. - Bridge contract that uses Teleporter to facilitate the bridging operations of adding new supported tokens and moving tokens between chains. - The bridge contract tracks the balances of each token sent to other bridge instances, and only allows those bridge instances to redeem up to the amount of tokens that has been previously sent to them. - Primary functions include: - - `submitCreateBridgeToken`: Called on the origin subnet to add support for an ERC20 native to the chain to a bridge instance on a different chain. Submits a Teleporter message that invokes `createBridgeToken` on the destination chain. + - `submitCreateBridgeToken`: Called on the origin chain to add support for an ERC20 native to the chain to a bridge instance on a different chain. Submits a Teleporter message that invokes `createBridgeToken` on the destination chain. - `createBridgeToken`: Called by cross-chain messages to add support for a new bridge token from another chain. Assuming the token is not already supported, deploys a new `BridgeToken` contract instance to represent the tokens on this chain. - `bridgeTokens`: Called to move supported tokens from one chain to another. This includes both "wrapping" of tokens native to the chain and also "unwrapping" of bridge tokens on the chain to other chains. In the case of unwrapping or moving of a bridge token, if the destination chain ID is the native chain for the given token, the original token is sent to the recipient on the destination. If the destination chain ID is another non-native chain for the underlying token, a Teleporter message is first sent to the native chain, which then subsequently updates its accounting of balances and sends a Teleporter message on the destination chain to re-wrap the given tokens. This multi-hop flow is illustrated below. - `mintBridgeTokens`: Called by cross-chain messages in the event of new bridge transfers of tokens from their native chains. @@ -25,7 +25,7 @@ The generic ERC20 bridge is implemented using two primary contracts. ## Integration Test -An integration test demostrating the use of the generic ERC20 token bridge contracts can be found from the root of this repository in `integration-tests/erc20_bridge_multihop.sh`. This test implements the following flow and checks that each step is successful: +An integration test demostrating the use of the generic ERC20 token bridge contracts can be found from the root of this repository in `scripts/local/integration-tests/erc20_bridge_multihop.sh`. This test implements the following flow and checks that each step is successful: 1. An example "native" ERC20 token is deployed on subnet A 1. The `ERC20Bridge` contract is deployed on subnets A, B, and C. 1. Teleporter messages are sent from subnet A to B and subnet A to C to add the example ERC20 deployed in step 1 to the bridge instances on the other chains. diff --git a/contracts/src/CrossChainApplications/README.md b/contracts/src/CrossChainApplications/README.md index b6f040df6..c461775a9 100644 --- a/contracts/src/CrossChainApplications/README.md +++ b/contracts/src/CrossChainApplications/README.md @@ -1,6 +1,6 @@ # Teleporter Cross Chain Applications -This directory includes cross chain applications that are built on top of the [Teleporter Messenger Protocol](../Teleporter/README.md). +This directory includes cross-chain applications that are built on top of the [Teleporter Messenger Protocol](../Teleporter/README.md). - [Teleporter Cross Chain Applications](#teleporter-cross-chain-applications) - [Applications](#applications) @@ -18,18 +18,13 @@ This directory includes cross chain applications that are built on top of the [T - `ExampleMessenger` a simple cross chain messenger that demonstrates Teleporter application sending arbitrary string data. - `VerifiedBlockHash` publishes the latest block hash of one chain to a destination chain that receives the hash and verifies the sender. Includes `BlockHashPublisher` and `BlockHashReceiver`. More details found [here](./VerifiedBlockHash/README.md) -## Get Started +## Getting started with an example application -We are going to walk through how to build a cross chain application on top of the Teleporter Messenger protocol, creating an `ExampleCrossChainMessenger` that sends arbitrary string data cross chain. +This section walks through how to build a cross-chain application on top of the Teleporter Messenger protocol, recreating the `ExampleCrossChainMessenger` contract that sends arbitrary string data from one chain to another. ### Step 1: Create Initial Contract -Create a new file called `ExampleCrossChainMessenger.sol` in the directory that will hold the application. In our case, under [ExampleMessenger](./ExampleMessenger/). - -```bash -cd -touch ExampleCrossChainMessenger.sol -``` +Create a new file called `MyExampleCrossChainMessenger.sol` in the directory that will hold the application. At the top of the file define the Solidity version to work with, and import the `ITeleporterMessenger` and `ITeleporterReceiver` interfaces. @@ -39,17 +34,17 @@ pragma solidity 0.8.18; import "../../Teleporter/ITeleporterMessenger.sol"; ``` -Next we are going to define the initial empty contract. +Next, define the initial empty contract. ```solidity -contract ExampleCrossChainMessenger {} +contract MyExampleCrossChainMessenger {} ``` ### Step 2: Integrating Teleporter Messenger -Now that we have our initial empty `ExampleCrossChainMessenger`, it's time to add our `ITeleporterMessenger` that will provide the functionality to deliver cross chain messages. +Now that the initial empty `MyExampleCrossChainMessenger` is defined, it's time to integrate the `ITeleporterMessenger` that will provide the functionality to deliver cross chain messages. -Create a state variable of `ITeleporterMessenger` type called `teleporterMessenger`. Then we'll create a constructor for our contract that takes in an address where the Teleporter messenger would be deployed on this chain, and set our state variable with it. +Create a state variable of `ITeleporterMessenger` type called `teleporterMessenger`. Then create a constructor for our contract that takes in an address where the Teleporter messenger would be deployed on this chain, and set our state variable with it. ```solidity contract ExampleCrossChainMessenger { @@ -63,9 +58,9 @@ contract ExampleCrossChainMessenger { ### Step 3: Send and Receive -Now that our `ExampleCrossChainMessenger` has an instantiation of `ITeleporterMessenger`, we can add in functionality of sending and receiving arbitrary string data between chains. +Now that `MyExampleCrossChainMessenger` has an instantiation of `ITeleporterMessenger`, the next step is to add in functionality of sending and receiving arbitrary string data between chains. -To start, we create the function declarations for `sendMessage`, which will send string data cross chain to the specified destination address' receiver. This function allows callers to specify the destination chain ID, destination address to send to, relayer fees, required gas limit for message execution on destination address, and the actual message data. +To start, create the function declarations for `sendMessage`, which will send string data cross-chain to the specified destination address' receiver. This function allows callers to specify the destination chain ID, destination address to send to, relayer fees, required gas limit for message execution on destination address, and the actual message data. ```solidity // Send a new message to another chain. @@ -79,7 +74,7 @@ function sendMessage( ) external returns (uint256 messageID) {} ``` -We also need to implement `ITeleporterReceiver` by adding the method `receiveTeleporterMessage` that receives the cross chain messages from Teleporter. +`MyExampleCrossChainMessenger` also needs to implement `ITeleporterReceiver` by adding the method `receiveTeleporterMessage` that receives the cross-chain messages from Teleporter. ```solidity // Receive a new message from another chain. @@ -90,11 +85,7 @@ function receiveTeleporterMessage( ) external { ``` -Now that the function declarations are set up, we can move on to implementation. - -> To incentivize relayers to deliver our cross chain messages from source to destination, we will need to support `ERC20` fees. Relayer fees aren't needed when running your own relayers to deliver your own messages and pay costs out of pocket. - -Import OpenZeppelin's `IERC20` contract, then in our `sendMessage` we will check whether `feeAmount` is greater than zero. If it is, we transfer and approve the amount of IERC20 asset at `feeContractAddress` to the teleporter messenger saved as a state variable. +Now it's time to implement the methods, starting with `sendMessage`. First, import OpenZeppelin's `IERC20` contract, then in `sendMessage` check whether `feeAmount` is greater than zero. If it is, transfer and approve the amount of IERC20 asset at `feeContractAddress` to the teleporter messenger saved as a state variable. ```solidity // For non-zero fee amounts, transfer the fee into the control of this contract first, and then @@ -112,9 +103,7 @@ if (feeAmount > 0) { } ``` -Next we are going to tell the Teleporter messenger the message data to be executed when delivered to the destination address. We need to call the destination `receiveTeleporterMessage` function to receive our message, which in our case will directly store the message in the contract. - -With the above message data, as well as other inputs to form a `TeleporterMessageInput`, we now call `sendCrossChainMessage` on our Teleporter instance to start the cross chain messaging process. +Next, add the call to the `TeleporterMessenger` contract with the message data to be executed when delivered to the destination address. In `sendMessage`, form a `TeleporterMessageInput` and call `sendCrossChainMessage` on the `TeleporterMessenger` instance to start the cross chain messaging process. > `allowedRelayerAddresses` is empty in this example, meaning any relayer can try to deliver this cross chain message. Specific relayer addresses can be specified to ensure only those relayers can deliver the message. > The `message` must be ABI encoded so that it can be properly decoded on the receiving end. @@ -136,7 +125,7 @@ return ); ``` -With the sending complete, we move on to implementing the receiver. The receiver in our example will just receive the arbitrary string data, and check that the message is sent through Teleporter. +With the sending side complete, the next step is to implement `receiveTeleporterMessage`. The receiver in this example will just receive the arbitrary string data, and check that the message is sent through Teleporter. ```solidity // Receive a new message from another chain. @@ -153,11 +142,11 @@ function receiveTeleporterMessage( } ``` -The base of sending and receiving messages cross chain is complete. Now, we can add functionality that saves the received messages, and allows users to query for the latest message received from a specified chain. +The base of sending and receiving messages cross chain is complete. `MyExampleCrossChainMessenger` can now be expanded with functionality that saves the received messages, and allows users to query for the latest message received from a specified chain. ### Step 4: Storing the Message -We start by defining the `struct` for how we want to save our messages. In this case, we want to just save the string message itself and the address of the sender. +Start by defining the `struct` for how to save our messages. It saves the string message itself and the address of the sender. A map will also be added where the key is the `originChainID`, and the value is the latest `message` sent from that chain. @@ -171,7 +160,7 @@ struct Message { mapping(bytes32 => Message) messages; ``` -Our previous `receiveTeleporterMessage` is updated to save the message into our mapping after we receive and verify that it's sent from Teleporter. We ABI decode the `message` bytes into a string. +Next, update `receiveTeleporterMessage` to save the message into our mapping after we receive and verify that it's sent from Teleporter. ABI decode the `message` bytes into a string. ```solidity // Receive a new message from another chain. @@ -189,7 +178,7 @@ function receiveTeleporterMessage( } ``` -Let's add a function called `getCurrentMessage` that allows users or contracts to easily query our contract for the latest message sent by a specified chain. +Next, add a function called `getCurrentMessage` that allows users or contracts to easily query our contract for the latest message sent by a specified chain. ```solidity // Check the current message from another chain. @@ -205,12 +194,12 @@ There we have it, a simple cross chain messenger built on top of Teleporter! Ful ### Step 5: Testing -For testing we have a `test.sh` script that sets up a local avalanche network with three subnets deployed with Teleporter, and a relayer to deliver Teleporter messages. To add an integration test simply add a new test script under `integration-tests`. In this case we already have our `example_messenger.sh`, which performs the following steps: +For testing, `scripts/local/test.sh` sets up a local Avalanche network with three subnets deployed with Teleporter, and a relayer to deliver Teleporter messages. To add an integration test simply add a new test script under `integration-tests`. An integration test for `ExampleCrossChainMessenger` is already included (`scripts/local/integration_tests/example_messenger.sh`), which performs the following steps: -1. Deploys our [ExampleERC20](../Mocks/ExampleERC20.sol) token to subnet A. -2. Deploy the above `ExampleCrossChainMessenger` to both subnets A and B. -3. Approve the cross chain messenger on subnet A to spend erc20 from the default address. -4. Send `"hello world"` from subnet A to subnet B's cross chain messenger to receive. +1. Deploy the [ExampleERC20](../Mocks/ExampleERC20.sol) token to subnet A. +2. Deploy `ExampleCrossChainMessenger` to both subnets A and B. +3. Approve the cross-chain messenger on subnet A to spend ERC20 tokens from the default address. +4. Send `"hello world"` from subnet A to subnet B's cross-chain messenger to receive. 5. Call `getCurrentMessage` on subnet B to make sure the right message and sender are received. Running `./test.sh example_messenger` at the root of the repo should yield at the end of the test: diff --git a/contracts/src/CrossChainApplications/VerifiedBlockHash/README.md b/contracts/src/CrossChainApplications/VerifiedBlockHash/README.md index c2ed72914..7daf45f40 100644 --- a/contracts/src/CrossChainApplications/VerifiedBlockHash/README.md +++ b/contracts/src/CrossChainApplications/VerifiedBlockHash/README.md @@ -9,8 +9,8 @@ A sample cross-chain application built on top of Teleporter that publishes the b - Does not currently include fees to incentivize a relayer to deliver the cross-chain message. It is assumed the relayers will want to deliver the message even without a monetary incentive, but the contract could be easily extended to support providing message fees. - `BlockHashReceiver`: - Must be deployed on the destination chain after `BlockHashPublisher` is deployed on the origin such that the `BlockHashPublisher` contract address can be provided in the contract constructor. - - `receiveBlockHash` is the method invoked by cross-chain messages sent by the publisher contract. + - `receiveTeleporterMessage` is the method invoked by cross-chain messages sent by the publisher contract. - Anyone can view the latest block hashes received from other chains using `getLatestBlockInfo`. ## Integration Test -An integration test demostrating the use of these contracts can be found from the root of this repository in `integration-tests/block_hash_publish_receive.sh`. This test deploys the contracts on two different chains in the required order, and then checks that it can publish the block hash from one subnet to another. \ No newline at end of file +An integration test demostrating the use of these contracts can be found from the root of this repository in `integration-tests/block_hash_publish_receive.sh`. This test deploys the contracts on two different chains in the required order, and then checks that it can publish the block hash from one chain to another. \ No newline at end of file diff --git a/contracts/src/Teleporter/README.md b/contracts/src/Teleporter/README.md index 14d4d5c44..277cd40fb 100644 --- a/contracts/src/Teleporter/README.md +++ b/contracts/src/Teleporter/README.md @@ -34,10 +34,22 @@ Teleporter provides a handful of useful properties to cross-chain applications t 5. Message execution: Teleporter enables cross-chain messages to have direct effect on their destination chain by using `evm.Call()` to invoke the `receiveTeleporterMessage` function of destination contracts that implement the `ITeleporterReceiver` interface. ## Fees -Fees can be paid on a per message basis by specifing the ERC20 asset and amount to be used to incentivize a relayer to deliver the message in the call to `sendCrossChainMessage`. The fee amount is transferred into the control of the Teleporter contract (i.e. locked) before the Warp message is sent. The Teleporter contract tracks the fee amount for each message ID it creates. When it subsquently receives a message back from the destination chain of the original message, the new message will have a list of receipts identifying the relayer that delivered the given message ID. At this point, the fee amount originally locked by Teleporter for the given message will be redeemable by the relayer identified in the receipt. If the initial fee amount was not sufficient to incentivize a relayer, it can be added to by using `AddFeeAmount`. +Fees can be paid on a per message basis by specifing the ERC20 asset and amount to be used to incentivize a relayer to deliver the message in the call to `sendCrossChainMessage`. The fee amount is transferred into the control of the Teleporter contract (i.e. locked) before the Warp message is sent. The Teleporter contract tracks the fee amount for each message ID it creates. When it subsquently receives a message back from the destination chain of the original message, the new message will have a list of receipts identifying the relayer that delivered the given message ID. At this point, the fee amount originally locked by Teleporter for the given message will be redeemable by the relayer identified in the receipt. If the initial fee amount was not sufficient to incentivize a relayer, it can be increased by calling `addFeeAmount`. + + ### Message Receipts and Fee Redemption +In order to confirm delivery of a Teleporter message from one chain to another, a receipt is included in the next Teleporter message sent in the opposite direction. This receipt contains the message ID of the original message, as well as the address of the relayer that delivered it. That address is then able to redeem the reward on the original chain by calling `redeemRelayerRewards`. The following example illustrates this flow: +- A Teleporter message is sent from Chain A to Chain B, with a relayer incentive of `10` `USDC`. This message is assigned the ID `1` by the Teleporter contract on Chain A. + - On Chain A, this is done by calling `sendCrossChainMessage`, and providing the `USDC` contract address and amount in the function call. +- A relayer delivers the message on Chain B by calling `receiveCrossChainMessage` and providing its address, `0x123...` +- The Teleporter contract on Chain B stores the relayer address in a receipt for the message ID. +- Some time later, a separate Teleporter message is sent from Chain B to Chain A. The Teleporter contract on Chain B includes the receipt for the original message in this new message. +- When this new message is delivered on Chain A, the Teleporter contract on Chain A reads the receipt and marks the original message (message ID `1`) as delivered by address `0x123...`. +- Address `0x123...` may now call `redeemRelayerRewards` on Chain A, which transfers the `10` `USDC` to its address. If it tries to do this before the receipt is received on Chain A, the call will fail. + +It is possible for receipts to get "stuck" on the destination chain in the event that Teleporter traffic between two chains is skewed in one direction. In such a scenario, incoming messages on one chain may cause the rate at which receipts are generated to outpace the rate at which they are sent back to the other chain. To mitigate this, the method `retryReceipts` can be called to immediately send the receipts associated with the given message IDs back to the original chain. ## Required Interface -Teleporter messages are delivered by calling the `receiveTeleporterMessage` function defined by the `ITeleporterReceiver` interface. Contracts must implement this interface in order to be able to receive messages. The first two paramaters of `receiveTeleporterMessage` identify the original sender of the given message on the origin chain and are set by the `TeleporterMessenger`. The third parameter to `receiveTeleporterMessage`, is the raw message payload. Applications using Teleporter are responsible for defining the exact format of this payload in a way that can be decoded on the receiving end. For example, applications may encode and action enum value along with the target method parameters on the sending side, then decode this data and route to the target method within `receiveTeleporterMessage`. See `ERC20Bridge.sol` for an example of this approach. +Teleporter messages are delivered by calling the `receiveTeleporterMessage` function defined by the `ITeleporterReceiver` interface. Contracts must implement this interface in order to be able to receive messages. The first two paramaters of `receiveTeleporterMessage` identify the original sender of the given message on the origin chain and are set by the `TeleporterMessenger`. The third parameter to `receiveTeleporterMessage`, is the raw message payload. Applications using Teleporter are responsible for defining the exact format of this payload in a way that can be decoded on the receiving end. For example, applications may encode an action enum value along with the target method parameters on the sending side, then decode this data and route to the target method within `receiveTeleporterMessage`. See `ERC20Bridge.sol` for an example of this approach. ## Message Delivery and Execution -Teleporter is able to ensure that messages are considered delivered even if their execution fails (i.e. reverts) by using `evm.Call()` with a pre-defined gas limit to execute the message payload. This gas limit is specified by each message in the call to `sendCrossChainMessage`. Relayers must provide at least enough gas for the sub-call in addition to the standard gas used by a call to `receiveCrossChainMessage`. In the event that a message exeuction runs out of gas or reverts for any other reason, the hash of the message payload is stored by the receiving Teleporter contract instance. This allows for the message execution to be retried in the future, with possibly a higher gas limit. Importantly, a message is still considered delivered on its destination chain even if its execution fails. This allows the relayer of the message to redeem their reward for deliverying the message, because they have no control on whether or not its execution will succeed or not so long as they provide sufficient gas to meet the specified `requiredGasLimit`. +Teleporter is able to ensure that messages are considered delivered even if their execution fails (i.e. reverts) by using `evm.Call()` with a pre-defined gas limit to execute the message payload. This gas limit is specified by each message in the call to `sendCrossChainMessage`. Relayers must provide at least enough gas for the sub-call in addition to the standard gas used by a call to `receiveCrossChainMessage`. In the event that a message exeuction runs out of gas or reverts for any other reason, the hash of the message payload is stored by the receiving Teleporter contract instance. This allows for the message execution to be retried in the future, with possibly a higher gas limit by calling `retryMessageExecution`. Importantly, a message is still considered delivered on its destination chain even if its execution fails. This allows the relayer of the message to redeem their reward for deliverying the message, because they have no control on whether or not its execution will succeed or not so long as they provide sufficient gas to meet the specified `requiredGasLimit`. diff --git a/utils/contract-deployment/README.md b/utils/contract-deployment/README.md index 0c9259ee3..fad74d7ff 100644 --- a/utils/contract-deployment/README.md +++ b/utils/contract-deployment/README.md @@ -1,6 +1,6 @@ ### Contract Deployment -The Teleporter contract is designed to only send and receive Avalanche Warp messages to and from its own address on different chains. We ensure that the contract can be deployed to the same address on every EVM based chain by using [Nick's Method](https://yamenmerhi.medium.com/nicks-method-ethereum-keyless-execution-168a6659479c). Only allowing messages to be sent to and received from the same address guarantees that all messages use the same Teleporter message format because only the same exact contract bytecode could have been deployed to the same address. +The `TeleporterMessenger` contract is designed to only send and receive Avalanche Warp messages to and from its own address on different chains. We ensure that the contract can be deployed to the same address on every EVM based chain by using [Nick's Method](https://yamenmerhi.medium.com/nicks-method-ethereum-keyless-execution-168a6659479c). Only allowing messages to be sent and received by the same address guarantees that all messages use the same Teleporter message format because only the same exact contract bytecode could have been deployed to the same address. This directory contains scripts written in Golang to construct a raw transaction using Nick's method that deploys the Teleporter contract, and determine the keyless address that must be prefunded in order for the transaction to be sent. @@ -17,4 +17,4 @@ OR `go run contract-deployment/contractDeploymentTools.go deriveContractAddress 0x38545c4b331D8BFb3bee94C62D77a6735b5eF8c0 1` ## Results -The resulting raw transaction and universal deployer address are written to standard output, as well as to `UniversalTeleporterDeployerTransaction.txt` and `UniversalTeleporterDeployerAddress.txt` respectively. \ No newline at end of file +The resulting raw transaction, `TeleporterMessenger` contract address, and universal deployer address are written to standard output, as well as to `UniversalTeleporterDeployerTransaction.txt`, `UniversalTeleporterMessengerContractAddress.txt`, and `UniversalTeleporterDeployerAddress.txt` respectively. \ No newline at end of file From 16ff0f76fb67bc001ec1193608f7082aef11c64a Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 27 Oct 2023 19:30:20 +0000 Subject: [PATCH 02/29] move scripts --- .github/workflows/linter.yml | 2 +- scripts/{local => }/constants.sh | 2 +- scripts/{local => }/lint.sh | 2 +- scripts/local/e2e_test.sh | 4 ++-- scripts/{local => }/versions.sh | 0 5 files changed, 5 insertions(+), 5 deletions(-) rename scripts/{local => }/constants.sh (96%) rename scripts/{local => }/lint.sh (94%) rename scripts/{local => }/versions.sh (100%) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 3b4ecdbce..f7e5d5c50 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -24,4 +24,4 @@ jobs: # in subdirectories. The former only checks sol files in the current directory and directories one level down. - name: Run Lint run: | - ./scripts/local/lint.sh + ./scripts/lint.sh diff --git a/scripts/local/constants.sh b/scripts/constants.sh similarity index 96% rename from scripts/local/constants.sh rename to scripts/constants.sh index 7c995d821..ba8697a48 100755 --- a/scripts/local/constants.sh +++ b/scripts/constants.sh @@ -7,7 +7,7 @@ TELEPORTER_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" - cd ../.. && pwd + cd .. && pwd ) # Set the PATHS diff --git a/scripts/local/lint.sh b/scripts/lint.sh similarity index 94% rename from scripts/local/lint.sh rename to scripts/lint.sh index 92f38c272..298b6ed95 100755 --- a/scripts/local/lint.sh +++ b/scripts/lint.sh @@ -6,7 +6,7 @@ set -e TELEPORTER_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" - cd ../.. && pwd + cd .. && pwd ) cd $TELEPORTER_PATH/contracts/src diff --git a/scripts/local/e2e_test.sh b/scripts/local/e2e_test.sh index 038ffd0d6..bc9690b01 100755 --- a/scripts/local/e2e_test.sh +++ b/scripts/local/e2e_test.sh @@ -54,9 +54,9 @@ TELEPORTER_PATH=$( cd ../.. && pwd ) -source "$TELEPORTER_PATH"/scripts/local/constants.sh +source "$TELEPORTER_PATH"/scripts/constants.sh -source "$TELEPORTER_PATH"/scripts/local/versions.sh +source "$TELEPORTER_PATH"/scripts/versions.sh # Build the teleporter and cross chain apps smart contracts cwd=$(pwd) diff --git a/scripts/local/versions.sh b/scripts/versions.sh similarity index 100% rename from scripts/local/versions.sh rename to scripts/versions.sh From 5de6c90c1198d9a11b31a83e44bd60fbdb314f72 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Mon, 30 Oct 2023 18:59:05 +0000 Subject: [PATCH 03/29] clean up comments --- .../src/Teleporter/ITeleporterMessenger.sol | 20 +++---- contracts/src/Teleporter/ReceiptQueue.sol | 4 +- .../src/Teleporter/TeleporterMessenger.sol | 60 +++++++++---------- 3 files changed, 39 insertions(+), 45 deletions(-) diff --git a/contracts/src/Teleporter/ITeleporterMessenger.sol b/contracts/src/Teleporter/ITeleporterMessenger.sol index 13776dbb5..b2f32880e 100644 --- a/contracts/src/Teleporter/ITeleporterMessenger.sol +++ b/contracts/src/Teleporter/ITeleporterMessenger.sol @@ -35,11 +35,11 @@ struct TeleporterFeeInfo { } /** - * @dev Interface that describes functionalities for a cross chain messenger. + * @dev Interface that describes functionalities for a cross-chain messenger implementing the Teleporter protcol. */ interface ITeleporterMessenger { /** - * @dev Emitted when sending a Teleporter message cross chain. + * @dev Emitted when sending a Teleporter message cross-chain. */ event SendCrossChainMessage( bytes32 indexed destinationChainID, @@ -50,7 +50,7 @@ interface ITeleporterMessenger { /** * @dev Emitted when an additional fee amount is added to a Teleporter message that had previously - * been sent, but receipt not yet received. + * been sent, but not yet delivered to the destination chain. */ event AddFeeAmount( bytes32 indexed destinationChainID, @@ -59,7 +59,7 @@ interface ITeleporterMessenger { ); /** - * @dev Emitted when Teleporter message is being delivered on destination chain and address, + * @dev Emitted when a Teleporter message is being delivered on the destination chain to an address, * but message execution fails. Failed messages can then be retried. */ event FailedMessageExecution( @@ -99,19 +99,19 @@ interface ITeleporterMessenger { ); /** - * @dev Called by transactions to initiate the sending of a cross subnet message. + * @dev Called by transactions to initiate the sending of a cross-chain message. */ function sendCrossChainMessage( TeleporterMessageInput calldata messageInput ) external returns (uint256 messageID); /** - * @dev Called by transactions to retry the sending of a cross subnet message. + * @dev Called by transactions to retry the sending of a cross-chain message. * * Retriggers the sending of a message previously emitted by sendCrossChainMessage that has not yet been acknowledged * with a receipt from the destination chain. This may be necessary in the unlikely event that less than the required * threshold of stake weight successfully inserted the message in their messages DB at the time of the first submission. - * The message is checked to have already been previously submitted by comparing it's message hash against those kept in + * The message is checked to have already been previously submitted by comparing its message hash against those kept in * state until a receipt is received for the message. */ function retrySendCrossChainMessage( @@ -121,7 +121,7 @@ interface ITeleporterMessenger { /** * @dev Adds the additional fee amount to the amount to be paid to the relayer that delivers - * the given message ID to the destination subnet. + * the given message ID to the destination chain. * * The fee contract address must be the same asset type as the fee asset specified in the original * call to sendCrossChainMessage. Returns a failure if the message doesn't exist or there is already @@ -135,7 +135,7 @@ interface ITeleporterMessenger { ) external; /** - * @dev Receives a cross chain message, and marks the `relayerRewardAddress` for fee reward for a successful delivery. + * @dev Receives a cross-chain message, and marks the `relayerRewardAddress` for fee reward for a successful delivery. * * The message specified by `messageIndex` must be provided at that index in the access list storage slots of the transaction, * and is verified in the precompile predicate. @@ -193,7 +193,7 @@ interface ITeleporterMessenger { ) external view returns (bool delivered); /** - * @dev Returns the address the relayer reward should be sent to on the origin subnet + * @dev Returns the address the relayer reward should be sent to on the origin chain * for a given message, assuming that the message has already been delivered. */ function getRelayerRewardAddress( diff --git a/contracts/src/Teleporter/ReceiptQueue.sol b/contracts/src/Teleporter/ReceiptQueue.sol index 7dcdc452c..75c10b4f5 100644 --- a/contracts/src/Teleporter/ReceiptQueue.sol +++ b/contracts/src/Teleporter/ReceiptQueue.sol @@ -33,7 +33,7 @@ library ReceiptQueue { } /** - * @dev Removes the oldest open receipt from the queue. + * @dev Removes the oldest outstanding receipt from the queue. * * Requirements: * - The queue must be non-empty. @@ -73,7 +73,7 @@ library ReceiptQueue { } /** - * @dev Returns the number of open receipts in the queue. + * @dev Returns the number of outstanding receipts in the queue. */ function size( TeleporterMessageReceiptQueue storage queue diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index 01620bbb4..1530413ee 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -17,7 +17,7 @@ import "./ReentrancyGuards.sol"; /** * @dev Implementation of the {ITeleporterMessenger} interface. * - * This implementation is used to send messages cross chain using the WarpMessenger precompile, + * This implementation is used to send messages cross-chain using the WarpMessenger precompile, * and to receive messages sent from other chains. Teleporter contracts should be deployed through Nick's method * of universal deployer, such that the same contract is deployed at the same address on all chains. */ @@ -33,34 +33,34 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { WarpMessenger public constant WARP_MESSENGER = WarpMessenger(0x0200000000000000000000000000000000000005); - // Tracks the latest message ID used for a given destination subnet. - // Key is the destination subnet ID, and the value is the last message ID used for that subnet. - // Note that the first message ID used for each subnet will be 1 (not 0). + // Tracks the latest message ID used for a given destination chain. + // Key is the destination chain ID, and the value is the last message ID used for that chain. + // Note that the first message ID used for each chain will be 1 (not 0). mapping(bytes32 => uint256) public latestMessageIDs; - // Tracks the outstanding receipts to send back to a given subnet in subsequent messages sent to it. - // Key is the subnet ID of the other subnet, and the value is a queue of pending receipts for messages - // we have received from that subnet. + // Tracks the outstanding receipts to send back to a given chain in subsequent messages sent to it. + // Key is the other chain ID, and the value is a queue of pending receipts for messages + // we have received from that chain. mapping(bytes32 => ReceiptQueue.TeleporterMessageReceiptQueue) public outstandingReceipts; // Tracks the message hash and fee information for each message sent that we have not yet received - // a receipt for. The messages are tracked per subnet and keyed by message ID. - // The first key is the subnet ID, the second key is the message ID, and the value is the info + // a receipt for. The messages are tracked per chain and keyed by message ID. + // The first key is the chain ID, the second key is the message ID, and the value is the info // for the uniquely identified message. mapping(bytes32 => mapping(uint256 => SentMessageInfo)) public sentMessageInfo; - // Tracks the relayer reward address for each message delivered from a given subnet. + // Tracks the relayer reward address for each message delivered from a given chain. // Note that these values are also used to determine if a given message has been delivered or not. - // The first key is the subnet ID, the second key is the message ID, and the value is the reward address + // The first key is the chain ID, the second key is the message ID, and the value is the reward address // provided by the deliverer of the uniquely identified message. mapping(bytes32 => mapping(uint256 => address)) public relayerRewardAddresses; // Tracks the hash of messages that have been received but whose execution has never succeeded. // Enables retrying of failed messages with higher gas limits. Message execution is guaranteed to - // succeed at most once. The first key is the subnet ID, the second key is the message ID, and + // succeed at most once. The first key is the chain ID, the second key is the message ID, and // the value is the hash of the uniquely identified message whose execution failed. mapping(bytes32 => mapping(uint256 => bytes32)) public receivedFailedMessageHashes; @@ -70,17 +70,11 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // and the value is the amount of the asset owed to the relayer. mapping(address => mapping(address => uint256)) public relayerRewardAmounts; - // Teleporter delivers message by invoking functions of the form: funcName(bytes32 originChainID, address originSenderAddress, ...) - // where "..." can represent arbitrary additional parameters. Accounting for the 4 byte function selector and two 32 byte parameters, - // there is a minimum valid message length of 68 bytes. - uint256 public constant REQUIRED_ORIGIN_CHAIN_ID_START_INDEX = 4; - uint256 public constant MINIMUM_REQUIRED_CALL_DATA_LENGTH = 68; - - // The blockchain ID of the chain the contract is deployed on. Determined by warp messenger precompile. + // The blockchain ID of the chain the contract is deployed on. Determined by the Warp Messenger precompile. bytes32 public immutable blockchainID; /** - * @dev Sets the value of `blockchainID` to the value determined by the warp messenger precompile. + * @dev Sets the value of `blockchainID` to the value determined by the Warp Messenger precompile. */ constructor() { blockchainID = WARP_MESSENGER.getBlockchainID(); @@ -89,8 +83,8 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { /** * @dev See {ITeleporterMessenger-sendCrossChainMessage} * - * When executed, it will kick off an asynchronous event to have the validators of the chain create an - * aggregate BLS signature of the message. + * When executed, a relayer may kick off an asynchronous event to have the validators of the + * chain create an aggregate BLS signature of the message. * * Emits a {SendCrossChainMessage} event when message successfully gets sent. */ @@ -98,7 +92,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { TeleporterMessageInput calldata messageInput ) external senderNonReentrant returns (uint256 messageID) { // Get the outstanding receipts for messages that have been previously received - // from the destination subnet but not yet acknowledged, and attach the receipts + // from the destination chain but not yet acknowledged, and attach the receipts // to the Teleporter message to be sent. return _sendTeleporterMessage({ @@ -116,10 +110,10 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { /** * @dev See {ITeleporterMessenger-retrySendCrossChainMessage} * - * Emits {SendCrossChainMessage} event. + * Emits a {SendCrossChainMessage} event. * Requirements: * - * - `message` must have been previously sent to the given destination chain ID. + * - `message` must have been previously sent to the given `destinationChainID`. * - `message` encoding mush match previously sent message. */ function retrySendCrossChainMessage( @@ -164,12 +158,12 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { /** * @dev See {ITeleporterMessenger-addFeeAmount} * - * Emits {AddFeeAmount} event. + * Emits a {AddFeeAmount} event. * Requirements: * * - `additionalFeeAmount` must be non-zero. - * - message must exist and not have been delivered yet. - * - `feeContractAddress` must match the fee asset contract address used in the original call to sendCrossChainMessage. + * - `message` must exist and not have been delivered yet. + * - `feeContractAddress` must match the fee asset contract address used in the original call to `sendCrossChainMessage`. */ function addFeeAmount( bytes32 destinationChainID, @@ -231,7 +225,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { /** * @dev See {ITeleporterMessenger-receiveCrossChainMessage} * - * Emits {ReceiveCrossChainMessage} event. + * Emits a {ReceiveCrossChainMessage} event. * Re-entrancy is explicitly disallowed between receiving functions. One message is not able to receive another message. * Requirements: * @@ -356,7 +350,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { /** * @dev See {ITeleporterMessenger-retryMessageExecution} * - * Reverts if the message execution fails again on specified message. + * Reverts if the message execution fails again on a specified message. * Requirements: * * - `message` must have previously failed to execute, and matches the hash of the failed message. @@ -580,7 +574,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { /** * @dev Helper function for sending a teleporter message cross chain. - * Constructs the teleporter message and sends it through the warp messenger precompile, + * Constructs the Teleporter message and sends it through the Warp Messenger precompile, * and performs fee transfer if necessary. * * Emits a {SendCrossChainMessage} event. @@ -662,7 +656,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { } /** - * @dev Marks the receipt of a message from the given destination chain ID with the given message ID. + * @dev Marks the receipt of a message from the given `destinationChainID` with the given `messageID`. * * It is possible that the receipt was already received for this message, in which case we return early. * If existing message is found and not yet delivered, we delete it from state and increment the fee/reward @@ -770,7 +764,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { } /** - * @dev Returns the next message ID to be used to send a message to the given chain ID. + * @dev Returns the next message ID to be used to send a message to the given `chainID`. */ function _getNextMessageID( bytes32 chainID From a3e8bb7ebe9465d615721ffa5992e43f2198ce77 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Mon, 30 Oct 2023 19:01:17 +0000 Subject: [PATCH 04/29] update abi --- .../TeleporterMessenger.go | 64 +------------------ 1 file changed, 1 insertion(+), 63 deletions(-) diff --git a/abi-bindings/go/Teleporter/TeleporterMessenger/TeleporterMessenger.go b/abi-bindings/go/Teleporter/TeleporterMessenger/TeleporterMessenger.go index 548986f2a..b33324390 100644 --- a/abi-bindings/go/Teleporter/TeleporterMessenger/TeleporterMessenger.go +++ b/abi-bindings/go/Teleporter/TeleporterMessenger/TeleporterMessenger.go @@ -64,7 +64,7 @@ type TeleporterMessageReceipt struct { // TeleporterMessengerMetaData contains all meta data concerning the TeleporterMessenger contract. var TeleporterMessengerMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"updatedFeeInfo\",\"type\":\"tuple\"}],\"name\":\"AddFeeAmount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"MessageExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"MessageExecutionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"deliverer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"rewardRedeemer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"ReceiveCrossChainMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RelayerRewardsRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"}],\"name\":\"SendCrossChainMessage\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINIMUM_REQUIRED_CALL_DATA_LENGTH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REQUIRED_ORIGIN_CHAIN_ID_START_INDEX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"additionalFeeAmount\",\"type\":\"uint256\"}],\"name\":\"addFeeAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"blockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delivererAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayers\",\"type\":\"address[]\"}],\"name\":\"checkIsAllowedRelayer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"checkRelayerRewardAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getFeeInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getMessageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getNextMessageID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getReceiptAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getReceiptQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getRelayerRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"latestMessageIDs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"messageReceived\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"delivered\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"outstandingReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"first\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"last\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"name\":\"receiveCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"receivedFailedMessageHashes\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"redeemRelayerRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"relayerRewardAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"relayerRewardAmounts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retryMessageExecution\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"messageIDs\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"retryReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retrySendCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessageInput\",\"name\":\"messageInput\",\"type\":\"tuple\"}],\"name\":\"sendCrossChainMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"sentMessageInfo\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"updatedFeeInfo\",\"type\":\"tuple\"}],\"name\":\"AddFeeAmount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"MessageExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"MessageExecutionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"deliverer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"rewardRedeemer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"ReceiveCrossChainMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RelayerRewardsRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"}],\"name\":\"SendCrossChainMessage\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"additionalFeeAmount\",\"type\":\"uint256\"}],\"name\":\"addFeeAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"blockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delivererAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayers\",\"type\":\"address[]\"}],\"name\":\"checkIsAllowedRelayer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"checkRelayerRewardAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getFeeInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getMessageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getNextMessageID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getReceiptAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getReceiptQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getRelayerRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"latestMessageIDs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"messageReceived\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"delivered\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"outstandingReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"first\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"last\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"name\":\"receiveCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"receivedFailedMessageHashes\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"redeemRelayerRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"relayerRewardAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"relayerRewardAmounts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retryMessageExecution\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"messageIDs\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"retryReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retrySendCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessageInput\",\"name\":\"messageInput\",\"type\":\"tuple\"}],\"name\":\"sendCrossChainMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"sentMessageInfo\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // TeleporterMessengerABI is the input ABI used to generate the binding from. @@ -213,68 +213,6 @@ func (_TeleporterMessenger *TeleporterMessengerTransactorRaw) Transact(opts *bin return _TeleporterMessenger.Contract.contract.Transact(opts, method, params...) } -// MINIMUMREQUIREDCALLDATALENGTH is a free data retrieval call binding the contract method 0x8f12376f. -// -// Solidity: function MINIMUM_REQUIRED_CALL_DATA_LENGTH() view returns(uint256) -func (_TeleporterMessenger *TeleporterMessengerCaller) MINIMUMREQUIREDCALLDATALENGTH(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _TeleporterMessenger.contract.Call(opts, &out, "MINIMUM_REQUIRED_CALL_DATA_LENGTH") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// MINIMUMREQUIREDCALLDATALENGTH is a free data retrieval call binding the contract method 0x8f12376f. -// -// Solidity: function MINIMUM_REQUIRED_CALL_DATA_LENGTH() view returns(uint256) -func (_TeleporterMessenger *TeleporterMessengerSession) MINIMUMREQUIREDCALLDATALENGTH() (*big.Int, error) { - return _TeleporterMessenger.Contract.MINIMUMREQUIREDCALLDATALENGTH(&_TeleporterMessenger.CallOpts) -} - -// MINIMUMREQUIREDCALLDATALENGTH is a free data retrieval call binding the contract method 0x8f12376f. -// -// Solidity: function MINIMUM_REQUIRED_CALL_DATA_LENGTH() view returns(uint256) -func (_TeleporterMessenger *TeleporterMessengerCallerSession) MINIMUMREQUIREDCALLDATALENGTH() (*big.Int, error) { - return _TeleporterMessenger.Contract.MINIMUMREQUIREDCALLDATALENGTH(&_TeleporterMessenger.CallOpts) -} - -// REQUIREDORIGINCHAINIDSTARTINDEX is a free data retrieval call binding the contract method 0x5bf91119. -// -// Solidity: function REQUIRED_ORIGIN_CHAIN_ID_START_INDEX() view returns(uint256) -func (_TeleporterMessenger *TeleporterMessengerCaller) REQUIREDORIGINCHAINIDSTARTINDEX(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _TeleporterMessenger.contract.Call(opts, &out, "REQUIRED_ORIGIN_CHAIN_ID_START_INDEX") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// REQUIREDORIGINCHAINIDSTARTINDEX is a free data retrieval call binding the contract method 0x5bf91119. -// -// Solidity: function REQUIRED_ORIGIN_CHAIN_ID_START_INDEX() view returns(uint256) -func (_TeleporterMessenger *TeleporterMessengerSession) REQUIREDORIGINCHAINIDSTARTINDEX() (*big.Int, error) { - return _TeleporterMessenger.Contract.REQUIREDORIGINCHAINIDSTARTINDEX(&_TeleporterMessenger.CallOpts) -} - -// REQUIREDORIGINCHAINIDSTARTINDEX is a free data retrieval call binding the contract method 0x5bf91119. -// -// Solidity: function REQUIRED_ORIGIN_CHAIN_ID_START_INDEX() view returns(uint256) -func (_TeleporterMessenger *TeleporterMessengerCallerSession) REQUIREDORIGINCHAINIDSTARTINDEX() (*big.Int, error) { - return _TeleporterMessenger.Contract.REQUIREDORIGINCHAINIDSTARTINDEX(&_TeleporterMessenger.CallOpts) -} - // WARPMESSENGER is a free data retrieval call binding the contract method 0xb771b3bc. // // Solidity: function WARP_MESSENGER() view returns(address) From 67c607b60065908b9d47f0a0e596912d0661fcaa Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Mon, 30 Oct 2023 19:14:24 +0000 Subject: [PATCH 05/29] remove inaccurate comment --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 23455a2cd..2b6f3d36f 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ The above steps are sufficient to run the included integration tests inside Dock - `tests/` includes integration tests for the contracts in `contracts/`, written using the [Ginkgo](https://onsi.github.io/ginkgo/) testing framework - `utils/` includes Go utility functions for interacting with the contracts in `contracts/`. Included are Golang scripts to derive the expected EVM contract address deployed from a given EOA at a specific nonce, and also construct a transaction to deploy provided byte code to the same address on any EVM chain using [Nick's method](https://yamenmerhi.medium.com/nicks-method-ethereum-keyless-execution-168a6659479c#). - `subnet-evm/` is the public subnet-evm repository (included as a submodule) checked out on the `warp-contract` branch with our changes. -- `scripts/` includes bash scripts for interacting with Teleporter in various environments, as well as utility scripts. All the scripts should be run from the root of the repository. +- `scripts/` includes bash scripts for interacting with Teleporter in various environments, as well as utility scripts. - `abi_bindings.sh` generates ABI bindings for the contracts in `contracts/` and outputs them to `abi-bindings/` - `lint.sh` lints the contracts in `contracts/` - `scripts/local/` includes scripts for running Teleporter in Docker containers and tests in the `scripts/local/integration-tests` locally. From 9811ffa9a811dcd7beedf79c224779566c3621cb Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Tue, 31 Oct 2023 19:36:54 +0000 Subject: [PATCH 06/29] check in forge docs --- contracts/docs/.gitignore | 1 + contracts/docs/book.css | 13 + contracts/docs/book.toml | 12 + contracts/docs/solidity.min.js | 74 ++++ contracts/docs/src/README.md | 9 + contracts/docs/src/SUMMARY.md | 63 +++ .../BridgeToken.sol/contract.BridgeToken.md | 78 ++++ .../ERC20Bridge.sol/contract.ERC20Bridge.md | 301 ++++++++++++++ .../interface.IERC20Bridge.md | 103 +++++ .../ERC20Bridge/README.md | 7 + .../contract.ERC20BridgeTest.md | 301 ++++++++++++++ .../ERC20Bridge/tests/README.md | 4 + .../contract.ExampleCrossChainMessenger.md | 110 ++++++ .../ExampleMessenger/README.md | 4 + .../src/src/CrossChainApplications/README.md | 6 + .../contract.BlockHashPublisher.md | 54 +++ .../contract.BlockHashReceiver.md | 95 +++++ .../VerifiedBlockHash/README.md | 5 + .../ExampleERC20.sol/contract.ExampleERC20.md | 44 +++ contracts/docs/src/src/Mocks/README.md | 5 + .../contract.UnitTestMockERC20.md | 41 ++ contracts/docs/src/src/README.md | 8 + .../interface.ITeleporterMessenger.md | 239 ++++++++++++ .../struct.TeleporterFeeInfo.md | 11 + .../struct.TeleporterMessage.md | 16 + .../struct.TeleporterMessageInput.md | 15 + .../struct.TeleporterMessageReceipt.md | 11 + .../interface.ITeleporterReceiver.md | 25 ++ contracts/docs/src/src/Teleporter/README.md | 15 + .../ReceiptQueue.sol/library.ReceiptQueue.md | 82 ++++ .../abstract.ReentrancyGuards.md | 61 +++ .../library.SafeERC20TransferFrom.md | 19 + .../contract.TeleporterMessenger.md | 367 ++++++++++++++++++ .../contract.AddFeeAmountTest.md | 64 +++ .../contract.CheckIsAllowedRelayerTest.md | 36 ++ .../contract.GetFeeInfoTest.md | 43 ++ .../contract.GetMessageHashTest.md | 36 ++ .../contract.GetNextMessageIDTest.md | 36 ++ ...ntract.GetOutstandingReceiptsToSendTest.md | 29 ++ .../contract.GetRelayerRewardAddressTest.md | 22 ++ ...tract.HandleInitialMessageExecutionTest.md | 51 +++ .../contract.SampleMessageReceiver.md | 67 ++++ .../enum.SampleMessageReceiverAction.md | 11 + .../contract.MarkReceiptTest.md | 46 +++ .../contract.MessageReceivedTest.md | 29 ++ .../docs/src/src/Teleporter/tests/README.md | 27 ++ .../contract.ReceiptQueueTest.md | 79 ++++ .../contract.ReceiveCrossChainMessagedTest.md | 87 +++++ .../contract.RedeemRelayerRewardsTest.md | 53 +++ .../contract.ReentrancyGuardsTests.md | 79 ++++ .../contract.SampleMessenger.md | 65 ++++ .../contract.FlakyMessageReceiver.md | 66 ++++ .../contract.RetryMessageExecutionTest.md | 93 +++++ .../enum.FlakyMessageReceiverAction.md | 11 + .../contract.RetryReceiptTest.md | 52 +++ ...contract.RetrySendCrossChainMessageTest.md | 36 ++ .../contract.SendCrossChainMessageTest.md | 50 +++ .../contract.TeleporterMessengerTest.md | 212 ++++++++++ .../src/src/Teleporter/upgrades/README.md | 6 + .../contract.TeleporterRegistry.md | 38 ++ .../abstract.TeleporterUpgradeable.md | 66 ++++ .../src/Teleporter/upgrades/tests/README.md | 6 + .../contract.TeleporterRegistryTest.md | 138 +++++++ .../contract.ExampleUpgradeableApp.md | 29 ++ .../contract.TeleporterUpgradeableTest.md | 65 ++++ .../abstract.WarpProtocolRegistry.md | 154 ++++++++ .../struct.ProtocolRegistryEntry.md | 13 + 67 files changed, 4094 insertions(+) create mode 100644 contracts/docs/.gitignore create mode 100644 contracts/docs/book.css create mode 100644 contracts/docs/book.toml create mode 100644 contracts/docs/solidity.min.js create mode 100644 contracts/docs/src/README.md create mode 100644 contracts/docs/src/SUMMARY.md create mode 100644 contracts/docs/src/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol/contract.BridgeToken.md create mode 100644 contracts/docs/src/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol/contract.ERC20Bridge.md create mode 100644 contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md create mode 100644 contracts/docs/src/src/CrossChainApplications/ERC20Bridge/README.md create mode 100644 contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md create mode 100644 contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/README.md create mode 100644 contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md create mode 100644 contracts/docs/src/src/CrossChainApplications/ExampleMessenger/README.md create mode 100644 contracts/docs/src/src/CrossChainApplications/README.md create mode 100644 contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md create mode 100644 contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md create mode 100644 contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/README.md create mode 100644 contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md create mode 100644 contracts/docs/src/src/Mocks/README.md create mode 100644 contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md create mode 100644 contracts/docs/src/src/README.md create mode 100644 contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md create mode 100644 contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md create mode 100644 contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md create mode 100644 contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md create mode 100644 contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md create mode 100644 contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md create mode 100644 contracts/docs/src/src/Teleporter/README.md create mode 100644 contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md create mode 100644 contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md create mode 100644 contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md create mode 100644 contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md create mode 100644 contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md create mode 100644 contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md create mode 100644 contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/README.md create mode 100644 contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md create mode 100644 contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md create mode 100644 contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md create mode 100644 contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md create mode 100644 contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md create mode 100644 contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md create mode 100644 contracts/docs/src/src/Teleporter/upgrades/README.md create mode 100644 contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md create mode 100644 contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md create mode 100644 contracts/docs/src/src/Teleporter/upgrades/tests/README.md create mode 100644 contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md create mode 100644 contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md create mode 100644 contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md create mode 100644 contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md create mode 100644 contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md diff --git a/contracts/docs/.gitignore b/contracts/docs/.gitignore new file mode 100644 index 000000000..4e42a1bcd --- /dev/null +++ b/contracts/docs/.gitignore @@ -0,0 +1 @@ +book/ \ No newline at end of file diff --git a/contracts/docs/book.css b/contracts/docs/book.css new file mode 100644 index 000000000..b5ce903f9 --- /dev/null +++ b/contracts/docs/book.css @@ -0,0 +1,13 @@ +table { + margin: 0 auto; + border-collapse: collapse; + width: 100%; +} + +table td:first-child { + width: 15%; +} + +table td:nth-child(2) { + width: 25%; +} \ No newline at end of file diff --git a/contracts/docs/book.toml b/contracts/docs/book.toml new file mode 100644 index 000000000..03d5666ca --- /dev/null +++ b/contracts/docs/book.toml @@ -0,0 +1,12 @@ +[book] +src = "src" +title = "" + +[output.html] +additional-css = ["book.css"] +additional-js = ["solidity.min.js"] +git-repository-url = "https://github.com/ava-labs/teleporter" +no-section-label = true + +[output.html.fold] +enable = true diff --git a/contracts/docs/solidity.min.js b/contracts/docs/solidity.min.js new file mode 100644 index 000000000..192493291 --- /dev/null +++ b/contracts/docs/solidity.min.js @@ -0,0 +1,74 @@ +hljs.registerLanguage("solidity",(()=>{"use strict";function e(){try{return!0 +}catch(e){return!1}} +var a=/-?(\b0[xX]([a-fA-F0-9]_?)*[a-fA-F0-9]|(\b[1-9](_?\d)*(\.((\d_?)*\d)?)?|\.\d(_?\d)*)([eE][-+]?\d(_?\d)*)?|\b0)(?!\w|\$)/ +;e()&&(a=a.source.replace(/\\b/g,"(?{ +var a=r(e),o=l(e),c=/[A-Za-z_$][A-Za-z_$0-9.]*/,d=e.inherit(e.TITLE_MODE,{ +begin:/[A-Za-z$_][0-9A-Za-z$_]*/,lexemes:c,keywords:n}),u={className:"params", +begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,lexemes:c,keywords:n, +contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a,o,s]},_={ +className:"operator",begin:/:=|->/};return{keywords:n,lexemes:c, +contains:[a,o,i,t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s,_,{ +className:"function",lexemes:c,beginKeywords:"function",end:"{",excludeEnd:!0, +contains:[d,u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,_]}]}}, +solAposStringMode:r,solQuoteStringMode:l,HEX_APOS_STRING_MODE:i, +HEX_QUOTE_STRING_MODE:t,SOL_NUMBER:s,isNegativeLookbehindAvailable:e} +;const{baseAssembly:c,solAposStringMode:d,solQuoteStringMode:u,HEX_APOS_STRING_MODE:_,HEX_QUOTE_STRING_MODE:m,SOL_NUMBER:b,isNegativeLookbehindAvailable:E}=o +;return e=>{for(var a=d(e),s=u(e),n=[],i=0;i<32;i++)n[i]=i+1 +;var t=n.map((e=>8*e)),r=[];for(i=0;i<=80;i++)r[i]=i +;var l=n.map((e=>"bytes"+e)).join(" ")+" ",o=t.map((e=>"uint"+e)).join(" ")+" ",g=t.map((e=>"int"+e)).join(" ")+" ",M=[].concat.apply([],t.map((e=>r.map((a=>e+"x"+a))))),p={ +keyword:"var bool string int uint "+g+o+"byte bytes "+l+"fixed ufixed "+M.map((e=>"fixed"+e)).join(" ")+" "+M.map((e=>"ufixed"+e)).join(" ")+" enum struct mapping address new delete if else for while continue break return throw emit try catch revert unchecked _ function modifier event constructor fallback receive error virtual override constant immutable anonymous indexed storage memory calldata external public internal payable pure view private returns import from as using pragma contract interface library is abstract type assembly", +literal:"true false wei gwei szabo finney ether seconds minutes hours days weeks years", +built_in:"self this super selfdestruct suicide now msg block tx abi blockhash gasleft assert require Error Panic sha3 sha256 keccak256 ripemd160 ecrecover addmod mulmod log0 log1 log2 log3 log4" +},O={className:"operator",begin:/[+\-!~*\/%<>&^|=]/ +},C=/[A-Za-z_$][A-Za-z_$0-9]*/,N={className:"params",begin:/\(/,end:/\)/, +excludeBegin:!0,excludeEnd:!0,lexemes:C,keywords:p, +contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a,s,b,"self"]},f={ +begin:/\.\s*/,end:/[^A-Za-z0-9$_\.]/,excludeBegin:!0,excludeEnd:!0,keywords:{ +built_in:"gas value selector address length push pop send transfer call callcode delegatecall staticcall balance code codehash wrap unwrap name creationCode runtimeCode interfaceId min max" +},relevance:2},y=e.inherit(e.TITLE_MODE,{begin:/[A-Za-z$_][0-9A-Za-z$_]*/, +lexemes:C,keywords:p}),w={className:"built_in", +begin:(E()?"(? mapping(address => mapping(address => bool))) public submittedBridgeTokenCreations; +``` + + +### bridgedBalances + +```solidity +mapping(bytes32 => mapping(address => mapping(address => uint256))) public bridgedBalances; +``` + + +### wrappedTokenContracts + +```solidity +mapping(address => bool) public wrappedTokenContracts; +``` + + +### nativeToWrappedTokens + +```solidity +mapping(bytes32 => mapping(address => mapping(address => address))) public nativeToWrappedTokens; +``` + + +### CREATE_BRIDGE_TOKENS_REQUIRED_GAS + +```solidity +uint256 public constant CREATE_BRIDGE_TOKENS_REQUIRED_GAS = 2_000_000; +``` + + +### MINT_BRIDGE_TOKENS_REQUIRED_GAS + +```solidity +uint256 public constant MINT_BRIDGE_TOKENS_REQUIRED_GAS = 200_000; +``` + + +### TRANSFER_BRIDGE_TOKENS_REQUIRED_GAS + +```solidity +uint256 public constant TRANSFER_BRIDGE_TOKENS_REQUIRED_GAS = 300_000; +``` + + +## Functions +### constructor + +*Initializes the Teleporter messenger used for sending and receiving messages, +and initializes the current chain ID.* + + +```solidity +constructor(address teleporterRegistryAddress) TeleporterUpgradeable(teleporterRegistryAddress); +``` + +### bridgeTokens + +*See {IERC20Bridge-bridgeTokens}. +Requirements: +- `destinationChainID` cannot be the same as the current chain ID. +- For wrapped tokens, `totalAmount` must be greater than the sum of the primary and secondary fee amounts. +- For native tokens, `adjustedAmount` after safe transfer must be greater than the primary fee amount.* + + +```solidity +function bridgeTokens( + bytes32 destinationChainID, + address destinationBridgeAddress, + address tokenContractAddress, + address recipient, + uint256 totalAmount, + uint256 primaryFeeAmount, + uint256 secondaryFeeAmount +) external nonReentrant; +``` + +### submitCreateBridgeToken + +*See {IERC20Bridge-submitCreateBridgeToken}. +We allow for `submitCreateBridgeToken` to be called multiple times with the same bridge and token +information because a previous message may have been dropped or otherwise selectively not delivered. +If the bridge token already exists on the destination, we are sending a message that will +simply have no effect on the destination. +Emits a {SubmitCreateBridgeToken} event.* + + +```solidity +function submitCreateBridgeToken( + bytes32 destinationChainID, + address destinationBridgeAddress, + ERC20 nativeToken, + address messageFeeAsset, + uint256 messageFeeAmount +) external nonReentrant; +``` + +### receiveTeleporterMessage + +*See {ITeleporterReceiver-receiveTeleporterMessage}. +Receives a Teleporter message and routes to the appropriate internal function call.* + + +```solidity +function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes calldata message) + external + onlyAllowedTeleporter; +``` + +### updateMinTeleporterVersion + +*See {TeleporterUpgradeable-updateMinTeleporterVersion} +Updates the minimum Teleporter version allowed for receiving on this contract +to the latest version registered in the {TeleporterRegistry}. +Restricted to only owners of the contract. +Emits a {MinTeleporterVersionUpdated} event.* + + +```solidity +function updateMinTeleporterVersion() external override onlyOwner; +``` + +### encodeCreateBridgeTokenData + +*Encodes the parameters for the Create action to be decoded and executed on the destination.* + + +```solidity +function encodeCreateBridgeTokenData( + address nativeContractAddress, + string memory nativeName, + string memory nativeSymbol, + uint8 nativeDecimals +) public pure returns (bytes memory); +``` + +### encodeMintBridgeTokensData + +*Encodes the parameters for the Mint action to be decoded and executed on the destination.* + + +```solidity +function encodeMintBridgeTokensData(address nativeContractAddress, address recipient, uint256 bridgeAmount) + public + pure + returns (bytes memory); +``` + +### encodeTransferBridgeTokensData + +*Encodes the parameters for the Transfer action to be decoded and executed on the destination.* + + +```solidity +function encodeTransferBridgeTokensData( + bytes32 destinationChainID, + address destinationBridgeAddress, + address nativeContractAddress, + address recipient, + uint256 amount, + uint256 feeAmount +) public pure returns (bytes memory); +``` + +### _createBridgeToken + +*Teleporter message receiver for creating a new bridge token on this chain. +Emits a {CreateBridgeToken} event. +Note: This function is only called within `receiveTeleporterMessage`, which can only be +called by the Teleporter messenger.* + + +```solidity +function _createBridgeToken( + bytes32 nativeChainID, + address nativeBridgeAddress, + address nativeContractAddress, + string memory nativeName, + string memory nativeSymbol, + uint8 nativeDecimals +) private; +``` + +### _mintBridgeTokens + +*Teleporter message receiver for minting of an existing bridge token on this chain. +Emits a {MintBridgeTokens} event. +Note: This function is only called within `receiveTeleporterMessage`, which can only be +called by the Teleporter messenger.* + + +```solidity +function _mintBridgeTokens( + bytes32 nativeChainID, + address nativeBridgeAddress, + address nativeContractAddress, + address recipient, + uint256 amount +) private nonReentrant; +``` + +### _transferBridgeTokens + +*Teleporter message receiver for handling bridge tokens transfers back from another chain +and optionally routing them to a different third chain. +Note: This function is only called within `receiveTeleporterMessage`, which can only be +called by the Teleporter messenger.* + + +```solidity +function _transferBridgeTokens( + bytes32 sourceChainID, + address sourceBridgeAddress, + bytes32 destinationChainID, + address destinationBridgeAddress, + address nativeContractAddress, + address recipient, + uint256 totalAmount, + uint256 secondaryFeeAmount +) private nonReentrant; +``` + +### _processNativeTokenTransfer + +*Increments the balance of the native tokens bridged to the specified bridge instance and +sends a Teleporter message to have the destination bridge mint the new tokens. The tokens to be +bridge must already be locked in this contract before calling. +Emits a {BridgeTokens} event. +Requirements: +- `destinationChainID` cannot be the same as the current chain ID. +- can not do nested bridging of wrapped tokens.* + + +```solidity +function _processNativeTokenTransfer( + bytes32 destinationChainID, + address destinationBridgeAddress, + address nativeContractAddress, + address recipient, + uint256 totalAmount, + uint256 feeAmount +) private; +``` + +### _processWrappedTokenTransfer + +*Processes a wrapped token transfer by burning the tokens and sending a Teleporter message +to the native chain and bridge of the wrapped asset that was burned. +It is the caller's responsibility to ensure that the wrapped token contract is supported by this bridge instance. +Emits a {BridgeTokens} event.* + + +```solidity +function _processWrappedTokenTransfer(WrappedTokenTransferInfo memory wrappedTransferInfo) private; +``` + +## Structs +### WrappedTokenTransferInfo + +```solidity +struct WrappedTokenTransferInfo { + bytes32 destinationChainID; + address destinationBridgeAddress; + address wrappedContractAddress; + address recipient; + uint256 totalAmount; + uint256 primaryFeeAmount; + uint256 secondaryFeeAmount; +} +``` + diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md new file mode 100644 index 000000000..87e3bd43b --- /dev/null +++ b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md @@ -0,0 +1,103 @@ +# IERC20Bridge +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol) + +*Interface that describes functionalities for a cross-chain ERC20 bridge.* + + +## Functions +### bridgeTokens + +*Transfers ERC20 tokens to another chain. +This can be wrapping, unwrapping, and transferring a wrapped token between two non-native chains.* + + +```solidity +function bridgeTokens( + bytes32 destinationChainID, + address destinationBridgeAddress, + address tokenContractAddress, + address recipient, + uint256 totalAmount, + uint256 primaryFeeAmount, + uint256 secondaryFeeAmount +) external; +``` + +### submitCreateBridgeToken + +*Creates a new bridge token on another chain.* + + +```solidity +function submitCreateBridgeToken( + bytes32 destinationChainID, + address destinationBridgeAddress, + ERC20 nativeToken, + address messageFeeAsset, + uint256 messageFeeAmount +) external; +``` + +## Events +### BridgeTokens +*Emitted when tokens are locked in this bridge contract to be bridged to another chain.* + + +```solidity +event BridgeTokens( + address indexed tokenContractAddress, + bytes32 indexed destinationChainID, + uint256 indexed teleporterMessageID, + address destinationBridgeAddress, + address recipient, + uint256 amount +); +``` + +### SubmitCreateBridgeToken +*Emitted when submitting a request to create a new bridge token on another chain.* + + +```solidity +event SubmitCreateBridgeToken( + bytes32 indexed destinationChainID, + address indexed destinationBridgeAddress, + address indexed nativeContractAddress, + uint256 teleporterMessageID +); +``` + +### CreateBridgeToken +*Emitted when creating a new bridge token.* + + +```solidity +event CreateBridgeToken( + bytes32 indexed nativeChainID, + address indexed nativeBridgeAddress, + address indexed nativeContractAddress, + address bridgeTokenAddress +); +``` + +### MintBridgeTokens +*Emitted when minting bridge tokens.* + + +```solidity +event MintBridgeTokens(address indexed contractAddress, address recipient, uint256 amount); +``` + +## Enums +### BridgeAction +*Enum representing the action to take on receiving a Teleporter message.* + + +```solidity +enum BridgeAction { + Create, + Mint, + Transfer +} +``` + diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/README.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/README.md new file mode 100644 index 000000000..605e5b88d --- /dev/null +++ b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/README.md @@ -0,0 +1,7 @@ + + +# Contents +- [tests](/src/CrossChainApplications/ERC20Bridge/tests) +- [BridgeToken](BridgeToken.sol/contract.BridgeToken.md) +- [ERC20Bridge](ERC20Bridge.sol/contract.ERC20Bridge.md) +- [IERC20Bridge](IERC20Bridge.sol/interface.IERC20Bridge.md) diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md new file mode 100644 index 000000000..629255f71 --- /dev/null +++ b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md @@ -0,0 +1,301 @@ +# ERC20BridgeTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol) + +**Inherits:** +Test + + +## State Variables +### MOCK_TELEPORTER_MESSENGER_ADDRESS + +```solidity +address public constant MOCK_TELEPORTER_MESSENGER_ADDRESS = 0x644E5b7c5D4Bc8073732CEa72c66e0BB90dFC00f; +``` + + +### MOCK_TELEPORTER_REGISTRY_ADDRESS + +```solidity +address public constant MOCK_TELEPORTER_REGISTRY_ADDRESS = 0xf9FA4a0c696b659328DDaaBCB46Ae4eBFC9e68e4; +``` + + +### WARP_PRECOMPILE_ADDRESS + +```solidity +address public constant WARP_PRECOMPILE_ADDRESS = address(0x0200000000000000000000000000000000000005); +``` + + +### _MOCK_BLOCKCHAIN_ID + +```solidity +bytes32 private constant _MOCK_BLOCKCHAIN_ID = bytes32(uint256(123456)); +``` + + +### _DEFAULT_OTHER_CHAIN_ID + +```solidity +bytes32 private constant _DEFAULT_OTHER_CHAIN_ID = + bytes32(hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd"); +``` + + +### _DEFAULT_OTHER_BRIDGE_ADDRESS + +```solidity +address private constant _DEFAULT_OTHER_BRIDGE_ADDRESS = 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; +``` + + +### _DEFAULT_TOKEN_NAME + +```solidity +string private constant _DEFAULT_TOKEN_NAME = "Test Token"; +``` + + +### _DEFAULT_SYMBOL + +```solidity +string private constant _DEFAULT_SYMBOL = "TSTTK"; +``` + + +### _DEFAULT_DECIMALS + +```solidity +uint8 private constant _DEFAULT_DECIMALS = 18; +``` + + +### _DEFAULT_RECIPIENT + +```solidity +address private constant _DEFAULT_RECIPIENT = 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; +``` + + +### erc20Bridge + +```solidity +ERC20Bridge public erc20Bridge; +``` + + +### mockERC20 + +```solidity +UnitTestMockERC20 public mockERC20; +``` + + +## Functions +### setUp + + +```solidity +function setUp() public virtual; +``` + +### testSameChainID + + +```solidity +function testSameChainID() public; +``` + +### testInvalidFeeAmountsNativeTransfer + + +```solidity +function testInvalidFeeAmountsNativeTransfer() public; +``` + +### testInvalidFeeAmountsWrappedTransfer + + +```solidity +function testInvalidFeeAmountsWrappedTransfer() public; +``` + +### testNativeTokenTransferFailure + + +```solidity +function testNativeTokenTransferFailure() public; +``` + +### testBridgeNativeTokensNoFee + + +```solidity +function testBridgeNativeTokensNoFee() public; +``` + +### testFeeApprovalFails + + +```solidity +function testFeeApprovalFails() public; +``` + +### testBridgeNativeTokensWithFee + + +```solidity +function testBridgeNativeTokensWithFee() public; +``` + +### testBridgeNativeFeeOnTransferTokens + + +```solidity +function testBridgeNativeFeeOnTransferTokens() public; +``` + +### testBridgeNativeFeeOnTransferAmountTooHigh + + +```solidity +function testBridgeNativeFeeOnTransferAmountTooHigh() public; +``` + +### testNewBridgeTokenMint + + +```solidity +function testNewBridgeTokenMint() public; +``` + +### testMintExistingBridgeToken + + +```solidity +function testMintExistingBridgeToken() public; +``` + +### testZeroTeleporterRegistryAddress + + +```solidity +function testZeroTeleporterRegistryAddress() public; +``` + +### testUpdateMinTeleporterVersion + + +```solidity +function testUpdateMinTeleporterVersion() public; +``` + +### _initMockTeleporterRegistry + + +```solidity +function _initMockTeleporterRegistry() internal; +``` + +### _setUpExpectedTransferFromCall + + +```solidity +function _setUpExpectedTransferFromCall(address tokenContract, uint256 amount) private; +``` + +### _submitCreateBridgeToken + + +```solidity +function _submitCreateBridgeToken( + bytes32 destinationChainID, + address destinationBridgeAddress, + address nativeContractAddress +) private; +``` + +### _setUpBridgeToken + + +```solidity +function _setUpBridgeToken( + bytes32 nativeChainID, + address nativeBridgeAddress, + address nativeContractAddress, + string memory nativeName, + string memory nativeSymbol, + uint8 nativeDecimals, + uint8 contractNonce +) private returns (address); +``` + +### _setUpMockERC20ContractValues + + +```solidity +function _setUpMockERC20ContractValues(address tokenContract) private; +``` + +### _deriveExpectedContractAddress + + +```solidity +function _deriveExpectedContractAddress(address creator, uint8 nonce) private pure returns (address); +``` + +### _formatERC20BridgeErrorMessage + + +```solidity +function _formatERC20BridgeErrorMessage(string memory errorMessage) private pure returns (bytes memory); +``` + +## Events +### BridgeTokens + +```solidity +event BridgeTokens( + address indexed tokenContractAddress, + bytes32 indexed destinationChainID, + uint256 indexed teleporterMessageID, + address destinationBridgeAddress, + address recipient, + uint256 amount +); +``` + +### SubmitCreateBridgeToken + +```solidity +event SubmitCreateBridgeToken( + bytes32 indexed destinationChainID, + address indexed destinationBridgeAddress, + address indexed nativeContractAddress, + uint256 teleporterMessageID +); +``` + +### CreateBridgeToken + +```solidity +event CreateBridgeToken( + bytes32 indexed nativeChainID, + address indexed nativeBridgeAddress, + address indexed nativeContractAddress, + address bridgeTokenAddress +); +``` + +### MintBridgeTokens + +```solidity +event MintBridgeTokens(address indexed contractAddress, address recipient, uint256 amount); +``` + +### MinTeleporterVersionUpdated + +```solidity +event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion); +``` + diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/README.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/README.md new file mode 100644 index 000000000..62b129ecf --- /dev/null +++ b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/README.md @@ -0,0 +1,4 @@ + + +# Contents +- [ERC20BridgeTest](ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md) diff --git a/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md b/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md new file mode 100644 index 000000000..474444b06 --- /dev/null +++ b/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md @@ -0,0 +1,110 @@ +# ExampleCrossChainMessenger +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol) + +**Inherits:** +[ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md), ReentrancyGuard, [TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md), Ownable + +*ExampleCrossChainMessenger is an example contract that demonstrates how to send and receive +messages cross chain.* + + +## State Variables +### _messages + +```solidity +mapping(bytes32 => Message) private _messages; +``` + + +## Functions +### constructor + + +```solidity +constructor(address teleporterRegistryAddress) TeleporterUpgradeable(teleporterRegistryAddress); +``` + +### receiveTeleporterMessage + +*See {ITeleporterReceiver-receiveTeleporterMessage}. +Receives a message from another chain.* + + +```solidity +function receiveTeleporterMessage(bytes32 originChainID, address originSenderAddress, bytes calldata message) + external + onlyAllowedTeleporter; +``` + +### sendMessage + +*Sends a message to another chain.* + + +```solidity +function sendMessage( + bytes32 destinationChainID, + address destinationAddress, + address feeContractAddress, + uint256 feeAmount, + uint256 requiredGasLimit, + string calldata message +) external nonReentrant returns (uint256 messageID); +``` + +### updateMinTeleporterVersion + +*See {TeleporterUpgradeable-updateMinTeleporterVersion} +Updates the minimum Teleporter version allowed for receiving on this contract +to the latest version registered in the {TeleporterRegistry}. Also restricts this function to +the owner of this contract. +Emits a {MinTeleporterVersionUpdated} event.* + + +```solidity +function updateMinTeleporterVersion() external override onlyOwner; +``` + +### getCurrentMessage + +*Returns the current message from another chain.* + + +```solidity +function getCurrentMessage(bytes32 originChainID) external view returns (address sender, string memory message); +``` + +## Events +### SendMessage +*Emitted when a message is submited to be sent.* + + +```solidity +event SendMessage( + bytes32 indexed destinationChainID, + address indexed destinationAddress, + address feeAsset, + uint256 feeAmount, + uint256 requiredGasLimit, + string message +); +``` + +### ReceiveMessage +*Emitted when a new message is received from a given chain ID.* + + +```solidity +event ReceiveMessage(bytes32 indexed originChainID, address indexed originSenderAddress, string message); +``` + +## Structs +### Message + +```solidity +struct Message { + address sender; + string message; +} +``` + diff --git a/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/README.md b/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/README.md new file mode 100644 index 000000000..404ea72bb --- /dev/null +++ b/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/README.md @@ -0,0 +1,4 @@ + + +# Contents +- [ExampleCrossChainMessenger](ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md) diff --git a/contracts/docs/src/src/CrossChainApplications/README.md b/contracts/docs/src/src/CrossChainApplications/README.md new file mode 100644 index 000000000..38856eedb --- /dev/null +++ b/contracts/docs/src/src/CrossChainApplications/README.md @@ -0,0 +1,6 @@ + + +# Contents +- [ERC20Bridge](/src/CrossChainApplications/ERC20Bridge) +- [ExampleMessenger](/src/CrossChainApplications/ExampleMessenger) +- [VerifiedBlockHash](/src/CrossChainApplications/VerifiedBlockHash) diff --git a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md new file mode 100644 index 000000000..829652eaa --- /dev/null +++ b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md @@ -0,0 +1,54 @@ +# BlockHashPublisher +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol) + +Contract that publishes the latest block hash of current chain to another chain. + + +## State Variables +### RECEIVE_BLOCK_HASH_REQUIRED_GAS_LIMIT + +```solidity +uint256 public constant RECEIVE_BLOCK_HASH_REQUIRED_GAS_LIMIT = 1.5e5; +``` + + +### teleporterRegistry + +```solidity +TeleporterRegistry public immutable teleporterRegistry; +``` + + +## Functions +### constructor + + +```solidity +constructor(address teleporterRegistryAddress); +``` + +### publishLatestBlockHash + +*Publishes the latest block hash to another chain.* + + +```solidity +function publishLatestBlockHash(bytes32 destinationChainID, address destinationAddress) + external + returns (uint256 messageID); +``` + +## Events +### PublishBlockHash +*Emitted when a block hash is submitted to be published to another chain.* + + +```solidity +event PublishBlockHash( + bytes32 indexed destinationChainID, + address indexed destinationAddress, + uint256 indexed blockHeight, + bytes32 blockHash +); +``` + diff --git a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md new file mode 100644 index 000000000..b3be7c352 --- /dev/null +++ b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md @@ -0,0 +1,95 @@ +# BlockHashReceiver +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol) + +**Inherits:** +[ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md), [TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md), Ownable + +Contract for receiving latest block hashes from another chain. + + +## State Variables +### sourceChainID + +```solidity +bytes32 public immutable sourceChainID; +``` + + +### sourcePublisherContractAddress + +```solidity +address public immutable sourcePublisherContractAddress; +``` + + +### latestBlockHeight + +```solidity +uint256 public latestBlockHeight; +``` + + +### latestBlockHash + +```solidity +bytes32 public latestBlockHash; +``` + + +## Functions +### constructor + + +```solidity +constructor(address teleporterRegistryAddress, bytes32 publisherChainID, address publisherContractAddress) + TeleporterUpgradeable(teleporterRegistryAddress); +``` + +### receiveTeleporterMessage + +*See {ITeleporterReceiver-receiveTeleporterMessage}. +Receives the latest block hash from another chain +Requirements: +- Sender must be the Teleporter contract. +- Origin sender address must be the source publisher contract address that initiated the BlockHashReceiver.* + + +```solidity +function receiveTeleporterMessage(bytes32 originChainID, address originSenderAddress, bytes calldata message) + external + onlyAllowedTeleporter; +``` + +### updateMinTeleporterVersion + +*See {TeleporterUpgradeable-updateMinTeleporterVersion} +Updates the minimum Teleporter version allowed for receiving on this contract +to the latest version registered in the {TeleporterRegistry}. +Restricted to only owners of the contract. +Emits a {MinTeleporterVersionUpdated} event.* + + +```solidity +function updateMinTeleporterVersion() external override onlyOwner; +``` + +### getLatestBlockInfo + +*Returns the latest block information.* + + +```solidity +function getLatestBlockInfo() public view returns (uint256 height, bytes32 hash); +``` + +## Events +### ReceiveBlockHash +*Emitted when a new block hash is received from a given origin chain ID.* + + +```solidity +event ReceiveBlockHash( + bytes32 indexed originChainID, address indexed originSenderAddress, uint256 indexed blockHeight, bytes32 blockHash +); +``` + diff --git a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/README.md b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/README.md new file mode 100644 index 000000000..2949021c3 --- /dev/null +++ b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/README.md @@ -0,0 +1,5 @@ + + +# Contents +- [BlockHashPublisher](BlockHashPublisher.sol/contract.BlockHashPublisher.md) +- [BlockHashReceiver](BlockHashReceiver.sol/contract.BlockHashReceiver.md) diff --git a/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md b/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md new file mode 100644 index 000000000..f69c09100 --- /dev/null +++ b/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md @@ -0,0 +1,44 @@ +# ExampleERC20 +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Mocks/ExampleERC20.sol) + +**Inherits:** +ERC20Burnable + + +## State Variables +### _TOKEN_NAME + +```solidity +string private constant _TOKEN_NAME = "Mock Token"; +``` + + +### _TOKEN_SYMBOL + +```solidity +string private constant _TOKEN_SYMBOL = "EXMP"; +``` + + +### _MAX_MINT + +```solidity +uint256 private constant _MAX_MINT = 10_000_000_000_000_000; +``` + + +## Functions +### constructor + + +```solidity +constructor() ERC20(_TOKEN_NAME, _TOKEN_SYMBOL); +``` + +### mint + + +```solidity +function mint(uint256 amount) public; +``` + diff --git a/contracts/docs/src/src/Mocks/README.md b/contracts/docs/src/src/Mocks/README.md new file mode 100644 index 000000000..f64417a8c --- /dev/null +++ b/contracts/docs/src/src/Mocks/README.md @@ -0,0 +1,5 @@ + + +# Contents +- [ExampleERC20](ExampleERC20.sol/contract.ExampleERC20.md) +- [UnitTestMockERC20](UnitTestMockERC20.sol/contract.UnitTestMockERC20.md) diff --git a/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md b/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md new file mode 100644 index 000000000..6f7728d2d --- /dev/null +++ b/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md @@ -0,0 +1,41 @@ +# UnitTestMockERC20 +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Mocks/UnitTestMockERC20.sol) + + +## State Variables +### mockBalances + +```solidity +mapping(address => uint256) public mockBalances; +``` + + +### feeOnTransferSenders + +```solidity +mapping(address => uint256) public feeOnTransferSenders; +``` + + +## Functions +### setFeeOnTransferSender + + +```solidity +function setFeeOnTransferSender(address sender, uint256 feeAmount) public; +``` + +### transferFrom + + +```solidity +function transferFrom(address from, address to, uint256 amount) public returns (bool); +``` + +### balanceOf + + +```solidity +function balanceOf(address account) public view returns (uint256); +``` + diff --git a/contracts/docs/src/src/README.md b/contracts/docs/src/src/README.md new file mode 100644 index 000000000..2ed2a1a36 --- /dev/null +++ b/contracts/docs/src/src/README.md @@ -0,0 +1,8 @@ + + +# Contents +- [CrossChainApplications](/src/CrossChainApplications) +- [Mocks](/src/Mocks) +- [Teleporter](/src/Teleporter) +- [ProtocolRegistryEntry](WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md) +- [WarpProtocolRegistry](WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md) diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md new file mode 100644 index 000000000..c70206c3c --- /dev/null +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md @@ -0,0 +1,239 @@ +# ITeleporterMessenger +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ITeleporterMessenger.sol) + +*Interface that describes functionalities for a cross-chain messenger implementing the Teleporter protcol.* + + +## Functions +### sendCrossChainMessage + +*Called by transactions to initiate the sending of a cross-chain message.* + + +```solidity +function sendCrossChainMessage(TeleporterMessageInput calldata messageInput) external returns (uint256 messageID); +``` + +### retrySendCrossChainMessage + +*Called by transactions to retry the sending of a cross-chain message. +Retriggers the sending of a message previously emitted by sendCrossChainMessage that has not yet been acknowledged +with a receipt from the destination chain. This may be necessary in the unlikely event that less than the required +threshold of stake weight successfully inserted the message in their messages DB at the time of the first submission. +The message is checked to have already been previously submitted by comparing its message hash against those kept in +state until a receipt is received for the message.* + + +```solidity +function retrySendCrossChainMessage(bytes32 destinationChainID, TeleporterMessage calldata message) external; +``` + +### addFeeAmount + +*Adds the additional fee amount to the amount to be paid to the relayer that delivers +the given message ID to the destination chain. +The fee contract address must be the same asset type as the fee asset specified in the original +call to sendCrossChainMessage. Returns a failure if the message doesn't exist or there is already +receipt of delivery of the message.* + + +```solidity +function addFeeAmount( + bytes32 destinationChainID, + uint256 messageID, + address feeContractAddress, + uint256 additionalFeeAmount +) external; +``` + +### receiveCrossChainMessage + +*Receives a cross-chain message, and marks the `relayerRewardAddress` for fee reward for a successful delivery. +The message specified by `messageIndex` must be provided at that index in the access list storage slots of the transaction, +and is verified in the precompile predicate.* + + +```solidity +function receiveCrossChainMessage(uint32 messageIndex, address relayerRewardAddress) external; +``` + +### retryMessageExecution + +*Retries the execution of a previously delivered message by verifying the payload matches +the hash of the payload originally delivered, and calling the destination address again. +Intended to be used if the original required gas limit was not sufficient for the message +execution. Messages are ensured to be successfully executed at most once.* + + +```solidity +function retryMessageExecution(bytes32 originChainID, TeleporterMessage calldata message) external; +``` + +### retryReceipts + +*Retries the sending of receipts for the given `messageIDs`. +Sends the specified message receipts in a new message (with an empty payload) back to the origin chain. +This is intended to be used if the message receipts were originally included in messages that were dropped +or otherwise not delivered in a timely manner.* + + +```solidity +function retryReceipts( + bytes32 originChainID, + uint256[] calldata messageIDs, + TeleporterFeeInfo calldata feeInfo, + address[] calldata allowedRelayerAddresses +) external returns (uint256 messageID); +``` + +### redeemRelayerRewards + +*Sends any fee amount rewards for the given fee asset out to the caller.* + + +```solidity +function redeemRelayerRewards(address feeAsset) external; +``` + +### getMessageHash + +*Gets the hash of a given message stored in the EVM state, if the message exists.* + + +```solidity +function getMessageHash(bytes32 destinationChainID, uint256 messageID) external view returns (bytes32 messageHash); +``` + +### messageReceived + +*Checks whether or not the given message has been received by this chain.* + + +```solidity +function messageReceived(bytes32 originChainID, uint256 messageID) external view returns (bool delivered); +``` + +### getRelayerRewardAddress + +*Returns the address the relayer reward should be sent to on the origin chain +for a given message, assuming that the message has already been delivered.* + + +```solidity +function getRelayerRewardAddress(bytes32 originChainID, uint256 messageID) + external + view + returns (address relayerRewardAddress); +``` + +### checkRelayerRewardAmount + +Gets the current reward amount of a given fee asset that is redeemable by the given relayer. + + +```solidity +function checkRelayerRewardAmount(address relayer, address feeAsset) external view returns (uint256); +``` + +### getFeeInfo + +*Gets the fee asset and amount for a given message.* + + +```solidity +function getFeeInfo(bytes32 destinationChainID, uint256 messageID) + external + view + returns (address feeAsset, uint256 feeAmount); +``` + +### getReceiptQueueSize + +*Gets the number of receipts that have been sent to the given destination chain ID.* + + +```solidity +function getReceiptQueueSize(bytes32 chainID) external view returns (uint256 size); +``` + +### getReceiptAtIndex + +*Gets the receipt at the given index in the queue for the given chain ID.* + + +```solidity +function getReceiptAtIndex(bytes32 chainID, uint256 index) + external + view + returns (TeleporterMessageReceipt memory receipt); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`chainID`|`bytes32`|The chain ID to get the receipt queue for.| +|`index`|`uint256`|The index of the receipt to get, starting from 0.| + + +## Events +### SendCrossChainMessage +*Emitted when sending a Teleporter message cross-chain.* + + +```solidity +event SendCrossChainMessage( + bytes32 indexed destinationChainID, uint256 indexed messageID, TeleporterMessage message, TeleporterFeeInfo feeInfo +); +``` + +### AddFeeAmount +*Emitted when an additional fee amount is added to a Teleporter message that had previously +been sent, but not yet delivered to the destination chain.* + + +```solidity +event AddFeeAmount(bytes32 indexed destinationChainID, uint256 indexed messageID, TeleporterFeeInfo updatedFeeInfo); +``` + +### MessageExecutionFailed +*Emitted when a Teleporter message is being delivered on the destination chain to an address, +but message execution fails. Failed messages can then be retried.* + + +```solidity +event MessageExecutionFailed(bytes32 indexed originChainID, uint256 indexed messageID, TeleporterMessage message); +``` + +### MessageExecuted +*Emitted when a Teleporter message is successfully executed with the +specified destination address and message call data. This can occur either when +the message is initially received, or on a retry attempt. +Each message received can be executed successfully at most once.* + + +```solidity +event MessageExecuted(bytes32 indexed originChainID, uint256 indexed messageID); +``` + +### ReceiveCrossChainMessage +*Emitted when a TeleporterMessage is successfully received.* + + +```solidity +event ReceiveCrossChainMessage( + bytes32 indexed originChainID, + uint256 indexed messageID, + address indexed deliverer, + address rewardRedeemer, + TeleporterMessage message +); +``` + +### RelayerRewardsRedeemed +*Emitted when an account redeems accumulated relayer rewards.* + + +```solidity +event RelayerRewardsRedeemed(address indexed redeemer, address indexed asset, uint256 amount); +``` + diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md new file mode 100644 index 000000000..b98ef073b --- /dev/null +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md @@ -0,0 +1,11 @@ +# TeleporterFeeInfo +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ITeleporterMessenger.sol) + + +```solidity +struct TeleporterFeeInfo { + address contractAddress; + uint256 amount; +} +``` + diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md new file mode 100644 index 000000000..cfe4f48b1 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md @@ -0,0 +1,16 @@ +# TeleporterMessage +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ITeleporterMessenger.sol) + + +```solidity +struct TeleporterMessage { + uint256 messageID; + address senderAddress; + address destinationAddress; + uint256 requiredGasLimit; + address[] allowedRelayerAddresses; + TeleporterMessageReceipt[] receipts; + bytes message; +} +``` + diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md new file mode 100644 index 000000000..bf70ae7b4 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md @@ -0,0 +1,15 @@ +# TeleporterMessageInput +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ITeleporterMessenger.sol) + + +```solidity +struct TeleporterMessageInput { + bytes32 destinationChainID; + address destinationAddress; + TeleporterFeeInfo feeInfo; + uint256 requiredGasLimit; + address[] allowedRelayerAddresses; + bytes message; +} +``` + diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md new file mode 100644 index 000000000..3bb2923d1 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md @@ -0,0 +1,11 @@ +# TeleporterMessageReceipt +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ITeleporterMessenger.sol) + + +```solidity +struct TeleporterMessageReceipt { + uint256 receivedMessageID; + address relayerRewardAddress; +} +``` + diff --git a/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md b/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md new file mode 100644 index 000000000..e16065452 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md @@ -0,0 +1,25 @@ +# ITeleporterReceiver +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ITeleporterReceiver.sol) + +*Interface that cross-chain applications must implement to receive messages from Teleporter.* + + +## Functions +### receiveTeleporterMessage + +*Called by TeleporterMessenger on the receiving chain.* + + +```solidity +function receiveTeleporterMessage(bytes32 originChainID, address originSenderAddress, bytes calldata message) + external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`originChainID`|`bytes32`|is provided by the TeleporterMessenger contract.| +|`originSenderAddress`|`address`|is provided by the TeleporterMessenger contract.| +|`message`|`bytes`|is the TeleporterMessage payload set by the sender.| + + diff --git a/contracts/docs/src/src/Teleporter/README.md b/contracts/docs/src/src/Teleporter/README.md new file mode 100644 index 000000000..9034ea0fc --- /dev/null +++ b/contracts/docs/src/src/Teleporter/README.md @@ -0,0 +1,15 @@ + + +# Contents +- [tests](/src/Teleporter/tests) +- [upgrades](/src/Teleporter/upgrades) +- [TeleporterMessageReceipt](ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md) +- [TeleporterMessageInput](ITeleporterMessenger.sol/struct.TeleporterMessageInput.md) +- [TeleporterMessage](ITeleporterMessenger.sol/struct.TeleporterMessage.md) +- [TeleporterFeeInfo](ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md) +- [ITeleporterMessenger](ITeleporterMessenger.sol/interface.ITeleporterMessenger.md) +- [ITeleporterReceiver](ITeleporterReceiver.sol/interface.ITeleporterReceiver.md) +- [ReceiptQueue](ReceiptQueue.sol/library.ReceiptQueue.md) +- [ReentrancyGuards](ReentrancyGuards.sol/abstract.ReentrancyGuards.md) +- [SafeERC20TransferFrom](SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md) +- [TeleporterMessenger](TeleporterMessenger.sol/contract.TeleporterMessenger.md) diff --git a/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md b/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md new file mode 100644 index 000000000..390f3fd1a --- /dev/null +++ b/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md @@ -0,0 +1,82 @@ +# ReceiptQueue +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ReceiptQueue.sol) + +*ReceiptQueue is a convenience library that creates a queue-like interface of +TeleporterMessageReceipt structs. It provides FIFO properties. +Note: All functions in this library are internal so that the library is not deployed as a contract.* + + +## State Variables +### _MAXIMUM_RECEIPT_COUNT + +```solidity +uint256 private constant _MAXIMUM_RECEIPT_COUNT = 5; +``` + + +## Functions +### enqueue + +*Adds a receipt to the queue.* + + +```solidity +function enqueue(TeleporterMessageReceiptQueue storage queue, TeleporterMessageReceipt memory receipt) internal; +``` + +### dequeue + +*Removes the oldest outstanding receipt from the queue. +Requirements: +- The queue must be non-empty.* + + +```solidity +function dequeue(TeleporterMessageReceiptQueue storage queue) + internal + returns (TeleporterMessageReceipt memory result); +``` + +### getOutstandingReceiptsToSend + +*Returns the outstanding receipts for the given chain ID that should be included in the next message sent.* + + +```solidity +function getOutstandingReceiptsToSend(TeleporterMessageReceiptQueue storage queue) + internal + returns (TeleporterMessageReceipt[] memory result); +``` + +### size + +*Returns the number of outstanding receipts in the queue.* + + +```solidity +function size(TeleporterMessageReceiptQueue storage queue) internal view returns (uint256); +``` + +### getReceiptAtIndex + +*Returns the receipt at the given index in the queue.* + + +```solidity +function getReceiptAtIndex(TeleporterMessageReceiptQueue storage queue, uint256 index) + internal + view + returns (TeleporterMessageReceipt memory); +``` + +## Structs +### TeleporterMessageReceiptQueue + +```solidity +struct TeleporterMessageReceiptQueue { + uint256 first; + uint256 last; + mapping(uint256 index => TeleporterMessageReceipt) data; +} +``` + diff --git a/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md b/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md new file mode 100644 index 000000000..c4fa6d3d1 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md @@ -0,0 +1,61 @@ +# ReentrancyGuards +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ReentrancyGuards.sol) + +*Abstract contract that helps implement reentrancy guards between functions for sending and receiving. +Consecutive calls for sending functions should work together, same for receive functions, but recursive calls +should be detected as a reentrancy and revert. +Calls between send and receive functions should also be allowed, but not in the case it ends up being a recursive +send or receive call. For example the following should fail: send -> receive -> send.* + + +## State Variables +### _NOT_ENTERED + +```solidity +uint256 internal constant _NOT_ENTERED = 1; +``` + + +### _ENTERED + +```solidity +uint256 internal constant _ENTERED = 2; +``` + + +### _sendEntered + +```solidity +uint256 internal _sendEntered; +``` + + +### _receiveEntered + +```solidity +uint256 internal _receiveEntered; +``` + + +## Functions +### senderNonReentrant + + +```solidity +modifier senderNonReentrant(); +``` + +### receiverNonReentrant + + +```solidity +modifier receiverNonReentrant(); +``` + +### constructor + + +```solidity +constructor(); +``` + diff --git a/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md b/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md new file mode 100644 index 000000000..6c1f8e28a --- /dev/null +++ b/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md @@ -0,0 +1,19 @@ +# SafeERC20TransferFrom +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/SafeERC20TransferFrom.sol) + +*Provides a wrapper used for calling an ERC20 transferFrom method +to receive tokens to a contract from msg.sender. +Checks the balance of the recipient before and after the call to transferFrom, and +returns balance increase. Designed for safely handling ERC20 "fee on transfer" and "burn on transfer" implementations. +Note: A reentrancy guard must always be used when calling token.safeTransferFrom in order to +prevent against possible "before-after" pattern vulnerabilities.* + + +## Functions +### safeTransferFrom + + +```solidity +function safeTransferFrom(IERC20 erc20, uint256 amount) internal returns (uint256); +``` + diff --git a/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md b/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md new file mode 100644 index 000000000..de47c6d1f --- /dev/null +++ b/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md @@ -0,0 +1,367 @@ +# TeleporterMessenger +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/TeleporterMessenger.sol) + +**Inherits:** +[ITeleporterMessenger](/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md), [ReentrancyGuards](/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md) + +*Implementation of the {ITeleporterMessenger} interface. +This implementation is used to send messages cross-chain using the WarpMessenger precompile, +and to receive messages sent from other chains. Teleporter contracts should be deployed through Nick's method +of universal deployer, such that the same contract is deployed at the same address on all chains.* + + +## State Variables +### WARP_MESSENGER + +```solidity +WarpMessenger public constant WARP_MESSENGER = WarpMessenger(0x0200000000000000000000000000000000000005); +``` + + +### latestMessageIDs + +```solidity +mapping(bytes32 => uint256) public latestMessageIDs; +``` + + +### outstandingReceipts + +```solidity +mapping(bytes32 => ReceiptQueue.TeleporterMessageReceiptQueue) public outstandingReceipts; +``` + + +### sentMessageInfo + +```solidity +mapping(bytes32 => mapping(uint256 => SentMessageInfo)) public sentMessageInfo; +``` + + +### relayerRewardAddresses + +```solidity +mapping(bytes32 => mapping(uint256 => address)) public relayerRewardAddresses; +``` + + +### receivedFailedMessageHashes + +```solidity +mapping(bytes32 => mapping(uint256 => bytes32)) public receivedFailedMessageHashes; +``` + + +### relayerRewardAmounts + +```solidity +mapping(address => mapping(address => uint256)) public relayerRewardAmounts; +``` + + +### blockchainID + +```solidity +bytes32 public blockchainID; +``` + + +## Functions +### sendCrossChainMessage + +*See {ITeleporterMessenger-sendCrossChainMessage} +When executed, a relayer may kick off an asynchronous event to have the validators of the +chain create an aggregate BLS signature of the message. +Emits a {SendCrossChainMessage} event when message successfully gets sent.* + + +```solidity +function sendCrossChainMessage(TeleporterMessageInput calldata messageInput) + external + senderNonReentrant + returns (uint256 messageID); +``` + +### retrySendCrossChainMessage + +*See {ITeleporterMessenger-retrySendCrossChainMessage} +Emits a {SendCrossChainMessage} event. +Requirements: +- `message` must have been previously sent to the given `destinationChainID`. +- `message` encoding mush match previously sent message.* + + +```solidity +function retrySendCrossChainMessage(bytes32 destinationChainID, TeleporterMessage calldata message) + external + senderNonReentrant; +``` + +### addFeeAmount + +*See {ITeleporterMessenger-addFeeAmount} +Emits a {AddFeeAmount} event. +Requirements: +- `additionalFeeAmount` must be non-zero. +- `message` must exist and not have been delivered yet. +- `feeContractAddress` must match the fee asset contract address used in the original call to `sendCrossChainMessage`.* + + +```solidity +function addFeeAmount( + bytes32 destinationChainID, + uint256 messageID, + address feeContractAddress, + uint256 additionalFeeAmount +) external senderNonReentrant; +``` + +### receiveCrossChainMessage + +*See {ITeleporterMessenger-receiveCrossChainMessage} +Emits a {ReceiveCrossChainMessage} event. +Re-entrancy is explicitly disallowed between receiving functions. One message is not able to receive another message. +Requirements: +- `relayerRewardAddress` must not be the zero address. +- `messageIndex` must specify a valid warp message in the transaction's storage slots. +- Valid warp message provided in storage slots, and sender address matches the address of this contract. +- Warp message `destinationChainID` must match the `blockchainID` of this contract. +- Warp message `destinationAddress` must match the address of this contract. +- Teleporter message was not previously delivered. +- Transaction was sent by an allowed relayer for corresponding teleporter message.* + + +```solidity +function receiveCrossChainMessage(uint32 messageIndex, address relayerRewardAddress) external receiverNonReentrant; +``` + +### retryMessageExecution + +*See {ITeleporterMessenger-retryMessageExecution} +Reverts if the message execution fails again on the specified message. +Emits a {MessageExecuted} event if the retry is successful. +Requirements: +- `message` must have previously failed to execute, and matches the hash of the failed message.* + + +```solidity +function retryMessageExecution(bytes32 originChainID, TeleporterMessage calldata message) + external + receiverNonReentrant; +``` + +### retryReceipts + +*See {ITeleporterMessenger-retryReceipts} +There is no explicit limit to the number of receipts able to be retried in a single message because +this method is intended to be used by relayers themselves to ensure their receipts get returned. +There is no fee associated with the empty message, and the same relayer is expected to relay it +themselves in order to claim their rewards, so it is their responsibility to ensure that the necessary +gas is provided for however many receipts are being retried. +When receipts are retried, they are not removed from their corresponding receipt queue because there +is no efficient way to remove a specific receipt from an arbitrary position in the queue, and it is +harmless for receipts to be sent multiple times within the protocol. +Emits {SendCrossChainMessage} event. +Requirements: +- `messageIDs` must all be valid and have existing receipts.* + + +```solidity +function retryReceipts( + bytes32 originChainID, + uint256[] calldata messageIDs, + TeleporterFeeInfo calldata feeInfo, + address[] calldata allowedRelayerAddresses +) external senderNonReentrant returns (uint256 messageID); +``` + +### redeemRelayerRewards + +*See {ITeleporterMessenger-redeemRelayerRewards} +Requirements: +- `rewardAmount` must be non-zero.* + + +```solidity +function redeemRelayerRewards(address feeAsset) external; +``` + +### getMessageHash + +See {ITeleporterMessenger-getMessageHash} + + +```solidity +function getMessageHash(bytes32 destinationChainID, uint256 messageID) external view returns (bytes32 messageHash); +``` + +### messageReceived + +*See {ITeleporterMessenger-messageReceived}* + + +```solidity +function messageReceived(bytes32 originChainID, uint256 messageID) external view returns (bool delivered); +``` + +### getRelayerRewardAddress + +*See {ITeleporterMessenger-getRelayerRewardAddress}* + + +```solidity +function getRelayerRewardAddress(bytes32 originChainID, uint256 messageID) + external + view + returns (address relayerRewardAddress); +``` + +### checkRelayerRewardAmount + +*See {ITeleporterMessenger-checkRelayerRewardAmount}* + + +```solidity +function checkRelayerRewardAmount(address relayer, address feeAsset) external view returns (uint256); +``` + +### getFeeInfo + +*See {ITeleporterMessenger-getFeeInfo}* + + +```solidity +function getFeeInfo(bytes32 destinationChainID, uint256 messageID) + external + view + returns (address feeAsset, uint256 feeAmount); +``` + +### getNextMessageID + +*Returns the next message ID to be used to send a message to the given chain ID.* + + +```solidity +function getNextMessageID(bytes32 chainID) external view returns (uint256 messageID); +``` + +### getReceiptQueueSize + +*See {ITeleporterMessenger-getReceiptQueueSize}* + + +```solidity +function getReceiptQueueSize(bytes32 chainID) external view returns (uint256); +``` + +### getReceiptAtIndex + +*See {ITeleporterMessenger-getReceiptAtIndex}* + + +```solidity +function getReceiptAtIndex(bytes32 chainID, uint256 index) external view returns (TeleporterMessageReceipt memory); +``` + +### checkIsAllowedRelayer + +*Checks whether `delivererAddress` is allowed to deliver the message.* + + +```solidity +function checkIsAllowedRelayer(address delivererAddress, address[] calldata allowedRelayers) + external + pure + returns (bool); +``` + +### _sendTeleporterMessage + +*Helper function for sending a teleporter message cross chain. +Constructs the Teleporter message and sends it through the Warp Messenger precompile, +and performs fee transfer if necessary. +Emits a {SendCrossChainMessage} event.* + + +```solidity +function _sendTeleporterMessage( + bytes32 destinationChainID, + address destinationAddress, + TeleporterFeeInfo calldata feeInfo, + uint256 requiredGasLimit, + address[] calldata allowedRelayerAddresses, + bytes memory message, + TeleporterMessageReceipt[] memory receipts +) private returns (uint256 messageID); +``` + +### _markReceipt + +*Marks the receipt of a message from the given `destinationChainID` with the given `messageID`. +It is possible that the receipt was already received for this message, in which case we return early. +If existing message is found and not yet delivered, we delete it from state and increment the fee/reward* + + +```solidity +function _markReceipt(bytes32 destinationChainID, uint256 messageID, address relayerRewardAddress) private; +``` + +### _handleInitialMessageExecution + +*Attempts to execute the newly delivered message. +Only revert in the event that the message deliverer (relayer) did not provide enough gas to handle the execution +(including possibly storing a failed message in state). All execution specific errors (i.e. invalid call data, etc) +that are not in the relayers control are caught and handled properly. +Emits a {MessageExecuted} event if the call on destination address is successful. +Emits a {MessageExecutionFailed} event if the call on destination address fails with formatted call data. +Requirements: +- There is enough gas left to cover `message.requiredGasLimit`.* + + +```solidity +function _handleInitialMessageExecution(bytes32 originChainID, TeleporterMessage memory message) private; +``` + +### _storeFailedMessageExecution + +*Stores the hash of a message that has been successfully delivered but fails to execute properly +such that the message execution can be retried by anyone in the future.* + + +```solidity +function _storeFailedMessageExecution(bytes32 originChainID, TeleporterMessage memory message) private; +``` + +### _getNextMessageID + +*Returns the next message ID to be used to send a message to the given `chainID`.* + + +```solidity +function _getNextMessageID(bytes32 chainID) private view returns (uint256 messageID); +``` + +### _checkIsAllowedRelayer + +*Checks whether `delivererAddress` is allowed to deliver the message.* + + +```solidity +function _checkIsAllowedRelayer(address delivererAddress, address[] memory allowedRelayers) + private + pure + returns (bool); +``` + +## Structs +### SentMessageInfo + +```solidity +struct SentMessageInfo { + bytes32 messageHash; + TeleporterFeeInfo feeInfo; +} +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md b/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md new file mode 100644 index 000000000..e5550380c --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md @@ -0,0 +1,64 @@ +# AddFeeAmountTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/AddFeeAmountTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testSuccess + + +```solidity +function testSuccess() public; +``` + +### testInvalidMessage + + +```solidity +function testInvalidMessage() public; +``` + +### testMessageAlreadyDelivered + + +```solidity +function testMessageAlreadyDelivered() public; +``` + +### testInvalidAmount + + +```solidity +function testInvalidAmount() public; +``` + +### testMismatchFeeAsset + + +```solidity +function testMismatchFeeAsset() public; +``` + +### testInvalidFeeAsset + + +```solidity +function testInvalidFeeAsset() public; +``` + +### testInsufficientBalance + + +```solidity +function testInsufficientBalance() public; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md b/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md new file mode 100644 index 000000000..298666aa5 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md @@ -0,0 +1,36 @@ +# CheckIsAllowedRelayerTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testIsSpecifiedAllowedRelayer + + +```solidity +function testIsSpecifiedAllowedRelayer() public; +``` + +### testAnyRelayerIsAllowed + + +```solidity +function testAnyRelayerIsAllowed() public; +``` + +### testUnauthorizedRelayer + + +```solidity +function testUnauthorizedRelayer() public; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md b/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md new file mode 100644 index 000000000..3743999b0 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md @@ -0,0 +1,43 @@ +# GetFeeInfoTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/GetFeeInfoTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testSuccess + + +```solidity +function testSuccess() public; +``` + +### testFeeOnTransferTokenUsed + + +```solidity +function testFeeOnTransferTokenUsed() public; +``` + +### testAfterReceipt + + +```solidity +function testAfterReceipt() public; +``` + +### testInvalidMessage + + +```solidity +function testInvalidMessage() public; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md b/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md new file mode 100644 index 000000000..700e23ea5 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md @@ -0,0 +1,36 @@ +# GetMessageHashTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/GetMessageHashTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testSuccess + + +```solidity +function testSuccess() public; +``` + +### testMessageDoesNotExist + + +```solidity +function testMessageDoesNotExist() public; +``` + +### testMessageAlreadyReceived + + +```solidity +function testMessageAlreadyReceived() public; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md b/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md new file mode 100644 index 000000000..5e2b6a5f2 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md @@ -0,0 +1,36 @@ +# GetNextMessageIDTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/GetNextMessageIdTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testFirstMessageID + + +```solidity +function testFirstMessageID() public; +``` + +### testSecondMessageID + + +```solidity +function testSecondMessageID() public; +``` + +### testOtherDestinationSubnetID + + +```solidity +function testOtherDestinationSubnetID() public; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md b/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md new file mode 100644 index 000000000..64617f572 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md @@ -0,0 +1,29 @@ +# GetOutstandingReceiptsToSendTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testSuccess + + +```solidity +function testSuccess() public; +``` + +### testExceedsLimit + + +```solidity +function testExceedsLimit() public; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md b/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md new file mode 100644 index 000000000..ee6aa2249 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md @@ -0,0 +1,22 @@ +# GetRelayerRewardAddressTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testSuccess + + +```solidity +function testSuccess() public; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md new file mode 100644 index 000000000..e1faed90b --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md @@ -0,0 +1,51 @@ +# HandleInitialMessageExecutionTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## State Variables +### destinationContract + +```solidity +SampleMessageReceiver public destinationContract; +``` + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testSuccess + + +```solidity +function testSuccess() public; +``` + +### testInsufficientGasProvided + + +```solidity +function testInsufficientGasProvided() public; +``` + +### testCannotReceiveMessageRecursively + + +```solidity +function testCannotReceiveMessageRecursively() public; +``` + +### testStoreHashOfFailedMessageExecution + + +```solidity +function testStoreHashOfFailedMessageExecution() public; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md new file mode 100644 index 000000000..52e5b3006 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md @@ -0,0 +1,67 @@ +# SampleMessageReceiver +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) + +**Inherits:** +[ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md) + + +## State Variables +### teleporterContract + +```solidity +address public immutable teleporterContract; +``` + + +### latestMessage + +```solidity +string public latestMessage; +``` + + +### latestMessageSenderSubnetID + +```solidity +bytes32 public latestMessageSenderSubnetID; +``` + + +### latestMessageSenderAddress + +```solidity +address public latestMessageSenderAddress; +``` + + +## Functions +### constructor + + +```solidity +constructor(address teleporterContractAddress); +``` + +### receiveTeleporterMessage + + +```solidity +function receiveTeleporterMessage(bytes32 originChainID, address originSenderAddress, bytes calldata message) + external; +``` + +### _receiveMessage + + +```solidity +function _receiveMessage(bytes32 originChainID, address originSenderAddress, string memory message, bool succeed) + internal; +``` + +### _receiveMessageRecursive + + +```solidity +function _receiveMessageRecursive(bytes32 originChainID, address originSenderAddress, string memory message) internal; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md new file mode 100644 index 000000000..26ad03c32 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md @@ -0,0 +1,11 @@ +# SampleMessageReceiverAction +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) + + +```solidity +enum SampleMessageReceiverAction { + Receive, + ReceiveRecursive +} +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md b/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md new file mode 100644 index 000000000..0c203e7de --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md @@ -0,0 +1,46 @@ +# MarkReceiptTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/MarkReceiptTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testCheckRelayersUponReceipt + + +```solidity +function testCheckRelayersUponReceipt() public; +``` + +### testReceiptForNoFeeMessage + + +```solidity +function testReceiptForNoFeeMessage() public; +``` + +### testDuplicateReceiptAllowed + + +```solidity +function testDuplicateReceiptAllowed() public; +``` + +## Structs +### FeeRewardInfo + +```solidity +struct FeeRewardInfo { + uint256 feeAmount; + address relayerRewardAddress; +} +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md b/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md new file mode 100644 index 000000000..15de43f9b --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md @@ -0,0 +1,29 @@ +# MessageReceivedTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/MessageReceivedTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testReceivedMessage + + +```solidity +function testReceivedMessage() public; +``` + +### testUnreceivedMessage + + +```solidity +function testUnreceivedMessage() public; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/README.md b/contracts/docs/src/src/Teleporter/tests/README.md new file mode 100644 index 000000000..3bcf143ce --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/README.md @@ -0,0 +1,27 @@ + + +# Contents +- [AddFeeAmountTest](AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md) +- [CheckIsAllowedRelayerTest](CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md) +- [GetFeeInfoTest](GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md) +- [GetMessageHashTest](GetMessageHashTests.t.sol/contract.GetMessageHashTest.md) +- [GetNextMessageIDTest](GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md) +- [GetOutstandingReceiptsToSendTest](GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md) +- [GetRelayerRewardAddressTest](GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md) +- [SampleMessageReceiverAction](HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md) +- [SampleMessageReceiver](HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md) +- [HandleInitialMessageExecutionTest](HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md) +- [MarkReceiptTest](MarkReceiptTests.t.sol/contract.MarkReceiptTest.md) +- [MessageReceivedTest](MessageReceivedTests.t.sol/contract.MessageReceivedTest.md) +- [ReceiptQueueTest](ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md) +- [ReceiveCrossChainMessagedTest](ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md) +- [RedeemRelayerRewardsTest](RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md) +- [ReentrancyGuardsTests](ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md) +- [SampleMessenger](ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md) +- [FlakyMessageReceiverAction](RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md) +- [FlakyMessageReceiver](RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md) +- [RetryMessageExecutionTest](RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md) +- [RetryReceiptTest](RetryReceiptTests.t.sol/contract.RetryReceiptTest.md) +- [RetrySendCrossChainMessageTest](RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md) +- [SendCrossChainMessageTest](SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md) +- [TeleporterMessengerTest](TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md b/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md new file mode 100644 index 000000000..4b3359ada --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md @@ -0,0 +1,79 @@ +# ReceiptQueueTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/ReceiptsQueueTests.t.sol) + +**Inherits:** +Test + + +## State Variables +### _queue + +```solidity +ReceiptQueue.TeleporterMessageReceiptQueue private _queue; +``` + + +### _receipt1 + +```solidity +TeleporterMessageReceipt private _receipt1 = + TeleporterMessageReceipt({receivedMessageID: 543, relayerRewardAddress: 0x10eB43ef5982628728E3E4bb9F78834f67Fbb40b}); +``` + + +### _receipt2 + +```solidity +TeleporterMessageReceipt private _receipt2 = TeleporterMessageReceipt({ + receivedMessageID: 684384, + relayerRewardAddress: 0x10eB43ef5982628728E3E4bb9F78834f67Fbb40b +}); +``` + + +### _receipt3 + +```solidity +TeleporterMessageReceipt private _receipt3 = TeleporterMessageReceipt({ + receivedMessageID: 654351, + relayerRewardAddress: 0xcC8E718045817AebA89592C72Ae1C9917f5D0894 +}); +``` + + +## Functions +### testEnqueueDequeueSuccess + + +```solidity +function testEnqueueDequeueSuccess() public; +``` + +### testDequeueRevertIfEmptyQueue + + +```solidity +function testDequeueRevertIfEmptyQueue() public; +``` + +### testGetReceiptAtIndex + + +```solidity +function testGetReceiptAtIndex() public; +``` + +### testGetReceiptAtIndexWithEmptyQueue + + +```solidity +function testGetReceiptAtIndexWithEmptyQueue() public; +``` + +### _formatReceiptQueueErrorMessage + + +```solidity +function _formatReceiptQueueErrorMessage(string memory errorMessage) private pure returns (bytes memory); +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md b/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md new file mode 100644 index 000000000..d884b0d15 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md @@ -0,0 +1,87 @@ +# ReceiveCrossChainMessagedTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## State Variables +### DEFAULT_MESSAGE_PAYLOAD + +```solidity +bytes public constant DEFAULT_MESSAGE_PAYLOAD = + hex"cafebabe11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff11223344556677889900aabbccddeeffdeadbeef"; +``` + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testSuccess + + +```solidity +function testSuccess() public; +``` + +### testNoValidMessage + + +```solidity +function testNoValidMessage() public; +``` + +### testInvalidOriginSenderAddress + + +```solidity +function testInvalidOriginSenderAddress() public; +``` + +### testInvalidDestinationChainID + + +```solidity +function testInvalidDestinationChainID() public; +``` + +### testInvalidDestinationAddress + + +```solidity +function testInvalidDestinationAddress() public; +``` + +### testInvalidRelayerAddress + + +```solidity +function testInvalidRelayerAddress() public; +``` + +### testMessageAlreadyReceived + + +```solidity +function testMessageAlreadyReceived() public; +``` + +### testUnauthorizedRelayer + + +```solidity +function testUnauthorizedRelayer() public; +``` + +### testMessageSentToEOADoesNotExecute + + +```solidity +function testMessageSentToEOADoesNotExecute() public; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md b/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md new file mode 100644 index 000000000..ee7c1a352 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md @@ -0,0 +1,53 @@ +# RedeemRelayerRewardsTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testZeroRewardBalance + + +```solidity +function testZeroRewardBalance() public; +``` + +### testRedemptionFails + + +```solidity +function testRedemptionFails() public; +``` + +### testRedemptionSucceeds + + +```solidity +function testRedemptionSucceeds() public; +``` + +### _setUpRelayerRewards + + +```solidity +function _setUpRelayerRewards(FeeRewardInfo memory feeRewardInfo) private; +``` + +## Structs +### FeeRewardInfo + +```solidity +struct FeeRewardInfo { + uint256 feeAmount; + address relayerRewardAddress; +} +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md new file mode 100644 index 000000000..82a2d8b88 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md @@ -0,0 +1,79 @@ +# ReentrancyGuardsTests +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/ReentrancyGuardsTests.t.sol) + +**Inherits:** +Test + + +## State Variables +### _sampleMessenger + +```solidity +SampleMessenger internal _sampleMessenger; +``` + + +## Functions +### setUp + + +```solidity +function setUp() public virtual; +``` + +### testConsecutiveSendSuccess + + +```solidity +function testConsecutiveSendSuccess() public; +``` + +### testConsecutiveReceiveSuccess + + +```solidity +function testConsecutiveReceiveSuccess() public; +``` + +### testRecursiveSendFails + + +```solidity +function testRecursiveSendFails() public; +``` + +### testRecursiveReceiveFails + + +```solidity +function testRecursiveReceiveFails() public; +``` + +### testSendCallsReceiveSuccess + + +```solidity +function testSendCallsReceiveSuccess() public; +``` + +### testReceiveCallsSendSuccess + + +```solidity +function testReceiveCallsSendSuccess() public; +``` + +### testRecursiveDirectSendFails + + +```solidity +function testRecursiveDirectSendFails() public; +``` + +### testRecursiveDirectReceiveFails + + +```solidity +function testRecursiveDirectReceiveFails() public; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md new file mode 100644 index 000000000..95a1ef8f4 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md @@ -0,0 +1,65 @@ +# SampleMessenger +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/ReentrancyGuardsTests.t.sol) + +**Inherits:** +[ReentrancyGuards](/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md) + + +## State Variables +### nonce + +```solidity +uint256 public nonce; +``` + + +## Functions +### constructor + + +```solidity +constructor(); +``` + +### sendAndCall + + +```solidity +function sendAndCall(bytes memory message) public senderNonReentrant; +``` + +### sendMessage + + +```solidity +function sendMessage() public senderNonReentrant; +``` + +### sendRecursive + + +```solidity +function sendRecursive() public senderNonReentrant; +``` + +### receiveAndCall + + +```solidity +function receiveAndCall(bytes memory message) public receiverNonReentrant; +``` + +### receiveMessage + + +```solidity +function receiveMessage() public receiverNonReentrant; +``` + +### receiveRecursive + + +```solidity +function receiveRecursive() public receiverNonReentrant; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md new file mode 100644 index 000000000..03796d759 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md @@ -0,0 +1,66 @@ +# FlakyMessageReceiver +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) + +**Inherits:** +[ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md) + + +## State Variables +### teleporterContract + +```solidity +address public immutable teleporterContract; +``` + + +### latestMessage + +```solidity +string public latestMessage; +``` + + +### latestMessageSenderSubnetID + +```solidity +bytes32 public latestMessageSenderSubnetID; +``` + + +### latestMessageSenderAddress + +```solidity +address public latestMessageSenderAddress; +``` + + +## Functions +### constructor + + +```solidity +constructor(address teleporterContractAddress); +``` + +### receiveTeleporterMessage + + +```solidity +function receiveTeleporterMessage(bytes32 originChainID, address originSenderAddress, bytes calldata messageBytes) + external; +``` + +### _receiveMessage + + +```solidity +function _receiveMessage(bytes32 originChainID, address originSenderAddress, string memory message) internal; +``` + +### _retryReceive + + +```solidity +function _retryReceive(bytes32 originChainID, address originSenderAddress, string memory message) internal; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md new file mode 100644 index 000000000..6bdcfe204 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md @@ -0,0 +1,93 @@ +# RetryMessageExecutionTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## State Variables +### destinationContract + +```solidity +FlakyMessageReceiver public destinationContract; +``` + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testSuccess + + +```solidity +function testSuccess() public; +``` + +### testExecutionFailsAgain + + +```solidity +function testExecutionFailsAgain() public; +``` + +### testMessageHashNotFound + + +```solidity +function testMessageHashNotFound() public; +``` + +### testInvalidMessageHash + + +```solidity +function testInvalidMessageHash() public; +``` + +### testCanNotRetryAgainAfterSuccess + + +```solidity +function testCanNotRetryAgainAfterSuccess() public; +``` + +### testCanNotReceiveMessageWhileRetrying + + +```solidity +function testCanNotReceiveMessageWhileRetrying() public; +``` + +### testEOAFailsThenRetrySucceeds + + +```solidity +function testEOAFailsThenRetrySucceeds() public; +``` + +### testEOAFailsAgainOnRetry + + +```solidity +function testEOAFailsAgainOnRetry() public; +``` + +### _receiveFailedMessage + + +```solidity +function _receiveFailedMessage(bool retryReceive) internal returns (bytes32, TeleporterMessage memory, string memory); +``` + +### _successfullyRetryMessage + + +```solidity +function _successfullyRetryMessage() internal returns (bytes32, TeleporterMessage memory); +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md new file mode 100644 index 000000000..46ba729a2 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md @@ -0,0 +1,11 @@ +# FlakyMessageReceiverAction +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) + + +```solidity +enum FlakyMessageReceiverAction { + ReceiveMessage, + RetryReceive +} +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md b/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md new file mode 100644 index 000000000..02ce56f82 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md @@ -0,0 +1,52 @@ +# RetryReceiptTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/RetryReceiptTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testSuccess + + +```solidity +function testSuccess() public; +``` + +### testDuplicateAllowed + + +```solidity +function testDuplicateAllowed() public; +``` + +### testMissingMessage + + +```solidity +function testMissingMessage() public; +``` + +### _retryTestReceiptsWithFee + + +```solidity +function _retryTestReceiptsWithFee(bytes32 chainID, uint256[] memory messageIDs, address feeAddress, uint256 feeAmount) + private + returns (uint256); +``` + +### _retryTestReceiptsWithNoFee + + +```solidity +function _retryTestReceiptsWithNoFee(bytes32 chainID, uint256[] memory messageIDs) private returns (uint256); +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md b/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md new file mode 100644 index 000000000..371bf0241 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md @@ -0,0 +1,36 @@ +# RetrySendCrossChainMessageTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testSuccess + + +```solidity +function testSuccess() public; +``` + +### testMessageNotFound + + +```solidity +function testMessageNotFound() public; +``` + +### testInvalidMessageHash + + +```solidity +function testInvalidMessageHash() public; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md b/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md new file mode 100644 index 000000000..7bba92858 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md @@ -0,0 +1,50 @@ +# SendCrossChainMessageTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/SendCrossChainMessageTests.t.sol) + +**Inherits:** +[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) + + +## Functions +### setUp + + +```solidity +function setUp() public virtual override; +``` + +### testSendMessageNoFee + + +```solidity +function testSendMessageNoFee() public; +``` + +### testSendMessageWithFee + + +```solidity +function testSendMessageWithFee() public; +``` + +### testFeeAssetDoesNotExist + + +```solidity +function testFeeAssetDoesNotExist() public; +``` + +### testFeeTransferFailure + + +```solidity +function testFeeTransferFailure() public; +``` + +### testInvalidFeeAssetFailure + + +```solidity +function testInvalidFeeAssetFailure() public; +``` + diff --git a/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md b/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md new file mode 100644 index 000000000..7e54f8271 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md @@ -0,0 +1,212 @@ +# TeleporterMessengerTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/TeleporterMessengerTest.t.sol) + +**Inherits:** +Test + + +## State Variables +### teleporterMessenger + +```solidity +TeleporterMessenger public teleporterMessenger; +``` + + +### MOCK_BLOCK_CHAIN_ID + +```solidity +bytes32 public constant MOCK_BLOCK_CHAIN_ID = bytes32(uint256(123456)); +``` + + +### DEFAULT_ORIGIN_CHAIN_ID + +```solidity +bytes32 public constant DEFAULT_ORIGIN_CHAIN_ID = + bytes32(hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd"); +``` + + +### DEFAULT_DESTINATION_CHAIN_ID + +```solidity +bytes32 public constant DEFAULT_DESTINATION_CHAIN_ID = + bytes32(hex"1234567812345678123456781234567812345678123456781234567812345678"); +``` + + +### DEFAULT_DESTINATION_ADDRESS + +```solidity +address public constant DEFAULT_DESTINATION_ADDRESS = 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; +``` + + +### DEFAULT_REQUIRED_GAS_LIMIT + +```solidity +uint256 public constant DEFAULT_REQUIRED_GAS_LIMIT = 1e6; +``` + + +### WARP_PRECOMPILE_ADDRESS + +```solidity +address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; +``` + + +### DEFAULT_RELAYER_REWARD_ADDRESS + +```solidity +address public constant DEFAULT_RELAYER_REWARD_ADDRESS = 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; +``` + + +### _mockFeeAsset + +```solidity +UnitTestMockERC20 internal _mockFeeAsset; +``` + + +## Functions +### setUp + + +```solidity +function setUp() public virtual; +``` + +### testEmptyReceiptQueue + + +```solidity +function testEmptyReceiptQueue() public; +``` + +### _sendTestMessageWithFee + + +```solidity +function _sendTestMessageWithFee(bytes32 chainID, uint256 feeAmount) internal returns (uint256); +``` + +### _sendTestMessageWithNoFee + + +```solidity +function _sendTestMessageWithNoFee(bytes32 chainID) internal returns (uint256); +``` + +### _setUpSuccessGetVerifiedWarpMessageMock + + +```solidity +function _setUpSuccessGetVerifiedWarpMessageMock(uint32 index, WarpMessage memory warpMessage) internal; +``` + +### _receiveTestMessage + + +```solidity +function _receiveTestMessage( + bytes32 originChainID, + uint256 messageID, + address relayerRewardAddress, + TeleporterMessageReceipt[] memory receipts +) internal; +``` + +### _receiveMessageSentToEOA + + +```solidity +function _receiveMessageSentToEOA() internal returns (bytes32, address, TeleporterMessage memory); +``` + +### _createMockTeleporterMessage + + +```solidity +function _createMockTeleporterMessage(uint256 messageID, bytes memory message) + internal + view + returns (TeleporterMessage memory); +``` + +### _createDefaultWarpMessage + + +```solidity +function _createDefaultWarpMessage(bytes32 originChainID, bytes memory payload) + internal + view + returns (WarpMessage memory); +``` + +### _formatTeleporterErrorMessage + + +```solidity +function _formatTeleporterErrorMessage(string memory errorMessage) internal pure returns (bytes memory); +``` + +## Events +### SendCrossChainMessage + +```solidity +event SendCrossChainMessage( + bytes32 indexed destinationChainID, uint256 indexed messageID, TeleporterMessage message, TeleporterFeeInfo feeInfo +); +``` + +### AddFeeAmount + +```solidity +event AddFeeAmount(bytes32 indexed destinationChainID, uint256 indexed messageID, TeleporterFeeInfo updatedFeeInfo); +``` + +### ReceiveCrossChainMessage + +```solidity +event ReceiveCrossChainMessage( + bytes32 indexed originChainID, + uint256 indexed messageID, + address indexed deliverer, + address rewardRedeemer, + TeleporterMessage message +); +``` + +### MessageExecutionFailed + +```solidity +event MessageExecutionFailed(bytes32 indexed originChainID, uint256 indexed messageID, TeleporterMessage message); +``` + +### MessageExecuted + +```solidity +event MessageExecuted(bytes32 indexed originChainID, uint256 indexed messageID); +``` + +### FailedFeePayment + +```solidity +event FailedFeePayment( + bytes32 indexed destinationChainID, + uint256 indexed messageID, + address indexed feeAsset, + uint256 feeAmount, + address relayerRewardAddress +); +``` + +### RelayerRewardsRedeemed + +```solidity +event RelayerRewardsRedeemed(address indexed redeemer, address indexed asset, uint256 amount); +``` + diff --git a/contracts/docs/src/src/Teleporter/upgrades/README.md b/contracts/docs/src/src/Teleporter/upgrades/README.md new file mode 100644 index 000000000..a04ea1ca6 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/upgrades/README.md @@ -0,0 +1,6 @@ + + +# Contents +- [tests](/src/Teleporter/upgrades/tests) +- [TeleporterRegistry](TeleporterRegistry.sol/contract.TeleporterRegistry.md) +- [TeleporterUpgradeable](TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md) diff --git a/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md b/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md new file mode 100644 index 000000000..e4b215773 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md @@ -0,0 +1,38 @@ +# TeleporterRegistry +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/upgrades/TeleporterRegistry.sol) + +**Inherits:** +[WarpProtocolRegistry](/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md) + +*TeleporterRegistry contract is a {WarpProtocolRegistry} and provides an upgrade +mechanism for {ITeleporterMessenger} contracts.* + + +## Functions +### constructor + + +```solidity +constructor(ProtocolRegistryEntry[] memory initialEntries) WarpProtocolRegistry(initialEntries); +``` + +### getTeleporterFromVersion + +*Gets the {ITeleporterMessenger} contract of the given `version`. +Requirements: +- `version` must be a valid version, i.e. greater than 0 and not greater than the latest version.* + + +```solidity +function getTeleporterFromVersion(uint256 version) external view returns (ITeleporterMessenger); +``` + +### getLatestTeleporter + +*Gets the latest {ITeleporterMessenger} contract.* + + +```solidity +function getLatestTeleporter() external view returns (ITeleporterMessenger); +``` + diff --git a/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md b/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md new file mode 100644 index 000000000..42fef21ae --- /dev/null +++ b/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md @@ -0,0 +1,66 @@ +# TeleporterUpgradeable +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/upgrades/TeleporterUpgradeable.sol) + +*TeleporterUpgradeable provides upgrade utility for applications built on top +of the Teleporter protocol by integrating with the {TeleporterRegistry}. +This contract is intended to be inherited by other contracts that wish to use the +upgrade mechanism. It provides a modifier that restricts access to only Teleporter +versions that are greater than or equal to `minTeleporterVersion`.* + + +## State Variables +### teleporterRegistry + +```solidity +TeleporterRegistry public immutable teleporterRegistry; +``` + + +### minTeleporterVersion + +```solidity +uint256 public minTeleporterVersion; +``` + + +## Functions +### onlyAllowedTeleporter + +*Throws if called by a `msg.sender` that is not an allowed Teleporter version. +Checks that `msg.sender` matches a Teleporter version greater than or equal to `minTeleporterVersion`.* + + +```solidity +modifier onlyAllowedTeleporter(); +``` + +### constructor + +*Initializes the {TeleporterUpgradeable} contract by getting `teleporterRegistry` +instance and setting `_minTeleporterVersion`.* + + +```solidity +constructor(address teleporterRegistryAddress); +``` + +### updateMinTeleporterVersion + +*This is a virtual function that should be overridden to update the `minTeleporterVersion` +allowed for modifier `onlyAllowedTeleporter`, and emit {MinTeleporterVersionUpdated} event after. +Note: To prevent anyone from being able to call this function, which would disallow messages +from old Teleporter versions from being received, this function should be safeguarded with access +controls. For example, if the derived contract has an owner/admin, only they can call this function.* + + +```solidity +function updateMinTeleporterVersion() external virtual; +``` + +## Events +### MinTeleporterVersionUpdated + +```solidity +event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion); +``` + diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/README.md b/contracts/docs/src/src/Teleporter/upgrades/tests/README.md new file mode 100644 index 000000000..621d5d555 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/upgrades/tests/README.md @@ -0,0 +1,6 @@ + + +# Contents +- [TeleporterRegistryTest](TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md) +- [ExampleUpgradeableApp](TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md) +- [TeleporterUpgradeableTest](TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md) diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md new file mode 100644 index 000000000..c625a279a --- /dev/null +++ b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md @@ -0,0 +1,138 @@ +# TeleporterRegistryTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol) + +**Inherits:** +Test + + +## State Variables +### teleporterRegistry + +```solidity +TeleporterRegistry public teleporterRegistry; +``` + + +### teleporterAddress + +```solidity +address public teleporterAddress; +``` + + +### MOCK_BLOCK_CHAIN_ID + +```solidity +bytes32 public constant MOCK_BLOCK_CHAIN_ID = bytes32(uint256(123456)); +``` + + +### WARP_PRECOMPILE_ADDRESS + +```solidity +address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; +``` + + +## Functions +### setUp + + +```solidity +function setUp() public; +``` + +### testAddProtocolVersionBasic + + +```solidity +function testAddProtocolVersionBasic() public; +``` + +### testAddNonContractAddress + + +```solidity +function testAddNonContractAddress() public; +``` + +### testAddOldVersion + + +```solidity +function testAddOldVersion() public; +``` + +### testAddExistingVersion + + +```solidity +function testAddExistingVersion() public; +``` + +### testAddZeroProtocolAddress + + +```solidity +function testAddZeroProtocolAddress() public; +``` + +### testAddZeroVersion + + +```solidity +function testAddZeroVersion() public; +``` + +### testGetAddressFromVersion + + +```solidity +function testGetAddressFromVersion() public; +``` + +### testGetVersionFromAddress + + +```solidity +function testGetVersionFromAddress() public; +``` + +### testInvalidWarpMessage + + +```solidity +function testInvalidWarpMessage() public; +``` + +### _addProtocolVersion + + +```solidity +function _addProtocolVersion(TeleporterRegistry registry) internal; +``` + +### _createWarpOutofBandMessage + + +```solidity +function _createWarpOutofBandMessage(uint256 version, address protocolAddress, address registryAddress) + internal + view + returns (WarpMessage memory); +``` + +### _formatErrorMessage + + +```solidity +function _formatErrorMessage(string memory errorMessage) private pure returns (bytes memory); +``` + +## Events +### AddProtocolVersion + +```solidity +event AddProtocolVersion(uint256 indexed version, address indexed protocolAddress); +``` + diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md new file mode 100644 index 000000000..e03792664 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md @@ -0,0 +1,29 @@ +# ExampleUpgradeableApp +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol) + +**Inherits:** +[TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md) + + +## Functions +### constructor + + +```solidity +constructor(address teleporterRegistryAddress) TeleporterUpgradeable(teleporterRegistryAddress); +``` + +### updateMinTeleporterVersion + + +```solidity +function updateMinTeleporterVersion() external override; +``` + +### teleporterCall + + +```solidity +function teleporterCall() public onlyAllowedTeleporter; +``` + diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md new file mode 100644 index 000000000..519ad0496 --- /dev/null +++ b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md @@ -0,0 +1,65 @@ +# TeleporterUpgradeableTest +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol) + +**Inherits:** +Test + + +## State Variables +### MOCK_TELEPORTER_REGISTRY_ADDRESS + +```solidity +address public constant MOCK_TELEPORTER_REGISTRY_ADDRESS = 0xf9FA4a0c696b659328DDaaBCB46Ae4eBFC9e68e4; +``` + + +### MOCK_TELEPORTER_MESSENGER_ADDRESS + +```solidity +address public constant MOCK_TELEPORTER_MESSENGER_ADDRESS = 0x644E5b7c5D4Bc8073732CEa72c66e0BB90dFC00f; +``` + + +## Functions +### setUp + + +```solidity +function setUp() public; +``` + +### testInvalidRegistryAddress + + +```solidity +function testInvalidRegistryAddress() public; +``` + +### testOnlyAllowedTeleporter + + +```solidity +function testOnlyAllowedTeleporter() public; +``` + +### testUpdateMinTeleporterVersion + + +```solidity +function testUpdateMinTeleporterVersion() public; +``` + +### _formatTeleporterUpgradeableErrorMessage + + +```solidity +function _formatTeleporterUpgradeableErrorMessage(string memory errorMessage) private pure returns (bytes memory); +``` + +## Events +### MinTeleporterVersionUpdated + +```solidity +event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion); +``` + diff --git a/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md b/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md new file mode 100644 index 000000000..947f81428 --- /dev/null +++ b/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md @@ -0,0 +1,154 @@ +# WarpProtocolRegistry +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/WarpProtocolRegistry.sol) + +*Implementation of an abstract `WarpProtocolRegistry` contract. +This implementation is a contract that can be used as a base contract for protocols that are +built on top of Warp. It allows the protocol to be upgraded through a Warp out-of-band message.* + + +## State Variables +### VALIDATORS_SOURCE_ADDRESS + +```solidity +address public constant VALIDATORS_SOURCE_ADDRESS = address(0); +``` + + +### WARP_MESSENGER + +```solidity +WarpMessenger public constant WARP_MESSENGER = WarpMessenger(0x0200000000000000000000000000000000000005); +``` + + +### _blockchainID + +```solidity +bytes32 internal immutable _blockchainID; +``` + + +### _latestVersion + +```solidity +uint256 internal _latestVersion; +``` + + +### _versionToAddress + +```solidity +mapping(uint256 => address) internal _versionToAddress; +``` + + +### _addressToVersion + +```solidity +mapping(address => uint256) internal _addressToVersion; +``` + + +## Functions +### constructor + +*Initializes the contract by setting `_blockchainID` and `_latestVersion`. +Also adds the initial protocol versions to the registry.* + + +```solidity +constructor(ProtocolRegistryEntry[] memory initialEntries); +``` + +### addProtocolVersion + +*Gets and verifies a warp out-of-band message, and adds the new protocol version +address to the registry. +If a version is greater than the current latest version, it will be set as the latest version. +If a version is less than the current latest version, it is added to the registry, but +doesn't change the latest version. +Emits a {AddProtocolVersion} event when successful. +Requirements: +- a valid Warp out-of-band message must be provided. +- source chain ID must be the same as the blockchain ID of the registry. +- origin sender address must be the same as the `VALIDATORS_SOURCE_ADDRESS`. +- destination chain ID must be the same as the blockchain ID of the registry. +- destination address must be the same as the address of the registry. +- version must not be zero. +- version must not already be registered. +- protocol address must not be zero address.* + + +```solidity +function addProtocolVersion(uint32 messageIndex) external virtual; +``` + +### getAddressFromVersion + +*Gets the address of a protocol version. +Requirements: +- the version must be a valid version.* + + +```solidity +function getAddressFromVersion(uint256 version) external view virtual returns (address); +``` + +### getVersionFromAddress + +*Gets the version of the given `protocolAddress`. +If `protocolAddress` is not a registered protocol address, returns 0, which is an invalid version.* + + +```solidity +function getVersionFromAddress(address protocolAddress) external view virtual returns (uint256); +``` + +### getLatestVersion + +*Gets the latest protocol version. +If the registry has no versions, we return 0, which is an invalid version.* + + +```solidity +function getLatestVersion() external view virtual returns (uint256); +``` + +### _addToRegistry + +*Adds the new protocol version address to the registry. +Updates latest version if the version is greater than the current latest version. +Emits a {AddProtocolVersion} event when successful. +Note: `protocolAddress` doesn't have to be a contract address, this is primarily +to support the case we want to register a new protocol address meant for a security patch +before the contract is deployed, to prevent the vulnerabilitiy from being exposed before registry update. +Requirements: +- `version` is not zero +- `version` is not already registered +- `protocolAddress` is not zero address* + + +```solidity +function _addToRegistry(ProtocolRegistryEntry memory entry) internal virtual; +``` + +### _getAddressFromVersion + +*Gets the address of a protocol version. +Requirements: +- `version` must be a valid version, i.e. greater than 0 and not greater than the latest version.* + + +```solidity +function _getAddressFromVersion(uint256 version) internal view virtual returns (address); +``` + +## Events +### AddProtocolVersion +*Emitted when a new protocol version is added to the registry.* + + +```solidity +event AddProtocolVersion(uint256 indexed version, address indexed protocolAddress); +``` + diff --git a/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md b/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md new file mode 100644 index 000000000..afb16748d --- /dev/null +++ b/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md @@ -0,0 +1,13 @@ +# ProtocolRegistryEntry +[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/WarpProtocolRegistry.sol) + +*Registry entry that represents a mapping between protocolAddress and version.* + + +```solidity +struct ProtocolRegistryEntry { + uint256 version; + address protocolAddress; +} +``` + From 439b8dabfa81aea905e8b9f8020a157c873c8710 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Tue, 31 Oct 2023 19:43:52 +0000 Subject: [PATCH 07/29] docs checker job --- .github/workflows/docs_checker.yml | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/docs_checker.yml diff --git a/.github/workflows/docs_checker.yml b/.github/workflows/docs_checker.yml new file mode 100644 index 000000000..6f211cdc6 --- /dev/null +++ b/.github/workflows/docs_checker.yml @@ -0,0 +1,39 @@ +name: Forge docs checker + +on: + push: + branches: + - main + pull_request: + branches: + - "*" + +env: + GO_VERSION: "1.20.8" + +jobs: + docs_checker: + name: docs_checker + runs-on: ubuntu-20.04 + + steps: + - name: Checkout Teleporter repository + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Generate forge docs + run: | + cd contracts + forge docs --build + + - name: Print diff + run: git --no-pager diff -- contracts/docs/ + + - name: Fail if diff exists + run: git --no-pager diff --quiet -- contracts/docs/ \ No newline at end of file From 975ada1150c07c3402590cfd7bd04c2682a38d0d Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Tue, 31 Oct 2023 20:13:19 +0000 Subject: [PATCH 08/29] cleanup comments --- .../ERC20Bridge/ERC20Bridge.sol | 12 ++++++------ .../src/CrossChainApplications/ERC20Bridge/README.md | 2 +- contracts/src/CrossChainApplications/README.md | 6 +++--- contracts/src/Teleporter/ITeleporterMessenger.sol | 8 +++++--- contracts/src/Teleporter/README.md | 4 ++-- contracts/src/Teleporter/TeleporterMessenger.sol | 6 ++++++ 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index c180ca71f..7267b061e 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -74,7 +74,7 @@ contract ERC20Bridge is uint256 public constant TRANSFER_BRIDGE_TOKENS_REQUIRED_GAS = 300_000; /** - * @dev Initializes the Teleporter messenger used for sending and receiving messages, + * @dev Initializes the Teleporter Messenger used for sending and receiving messages, * and initializes the current chain ID. */ constructor( @@ -410,7 +410,7 @@ contract ERC20Bridge is * Emits a {CreateBridgeToken} event. * * Note: This function is only called within `receiveTeleporterMessage`, which can only be - * called by the Teleporter messenger. + * called by the Teleporter Messenger. */ function _createBridgeToken( bytes32 nativeChainID, @@ -458,7 +458,7 @@ contract ERC20Bridge is * Emits a {MintBridgeTokens} event. * * Note: This function is only called within `receiveTeleporterMessage`, which can only be - * called by the Teleporter messenger. + * called by the Teleporter Messenger. */ function _mintBridgeTokens( bytes32 nativeChainID, @@ -492,7 +492,7 @@ contract ERC20Bridge is * and optionally routing them to a different third chain. * * Note: This function is only called within `receiveTeleporterMessage`, which can only be - * called by the Teleporter messenger. + * called by the Teleporter Messenger. */ function _transferBridgeTokens( bytes32 sourceChainID, @@ -591,7 +591,7 @@ contract ERC20Bridge is ITeleporterMessenger teleporterMessenger = teleporterRegistry .getLatestTeleporter(); - // Allow the Teleporter messenger to spend the fee amount. + // Allow the Teleporter Messenger to spend the fee amount. if (feeAmount > 0) { IERC20(nativeContractAddress).safeIncreaseAllowance( address(teleporterMessenger), @@ -650,7 +650,7 @@ contract ERC20Bridge is .getLatestTeleporter(); // If necessary, transfer the primary fee amount to this contract and approve the - // Teleporter messenger to spend it when the first message back to the native subnet + // Teleporter Messenger to spend it when the first message back to the native subnet // is submitted. The secondary fee amount is then handled by the native subnet when // submitting a message to the destination chain, if applicable. uint256 adjustedPrimaryFeeAmount = 0; diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/README.md b/contracts/src/CrossChainApplications/ERC20Bridge/README.md index bee16cc21..584e3b44d 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/README.md +++ b/contracts/src/CrossChainApplications/ERC20Bridge/README.md @@ -13,7 +13,7 @@ The generic ERC20 bridge is implemented using two primary contracts. - Bridge contract that uses Teleporter to facilitate the bridging operations of adding new supported tokens and moving tokens between chains. - The bridge contract tracks the balances of each token sent to other bridge instances, and only allows those bridge instances to redeem up to the amount of tokens that has been previously sent to them. - Primary functions include: - - `submitCreateBridgeToken`: Called on the origin chain to add support for an ERC20 native to the chain to a bridge instance on a different chain. Submits a Teleporter message that invokes `createBridgeToken` on the destination chain. + - `submitCreateBridgeToken`: Called on the origin chain to add support for an ERC20 on a different chain's bridge instance. Submits a Teleporter message that invokes `createBridgeToken` on the destination chain. - `createBridgeToken`: Called by cross-chain messages to add support for a new bridge token from another chain. Assuming the token is not already supported, deploys a new `BridgeToken` contract instance to represent the tokens on this chain. - `bridgeTokens`: Called to move supported tokens from one chain to another. This includes both "wrapping" of tokens native to the chain and also "unwrapping" of bridge tokens on the chain to other chains. In the case of unwrapping or moving of a bridge token, if the destination chain ID is the native chain for the given token, the original token is sent to the recipient on the destination. If the destination chain ID is another non-native chain for the underlying token, a Teleporter message is first sent to the native chain, which then subsequently updates its accounting of balances and sends a Teleporter message on the destination chain to re-wrap the given tokens. This multi-hop flow is illustrated below. - `mintBridgeTokens`: Called by cross-chain messages in the event of new bridge transfers of tokens from their native chains. diff --git a/contracts/src/CrossChainApplications/README.md b/contracts/src/CrossChainApplications/README.md index c461775a9..793b116b4 100644 --- a/contracts/src/CrossChainApplications/README.md +++ b/contracts/src/CrossChainApplications/README.md @@ -44,7 +44,7 @@ contract MyExampleCrossChainMessenger {} Now that the initial empty `MyExampleCrossChainMessenger` is defined, it's time to integrate the `ITeleporterMessenger` that will provide the functionality to deliver cross chain messages. -Create a state variable of `ITeleporterMessenger` type called `teleporterMessenger`. Then create a constructor for our contract that takes in an address where the Teleporter messenger would be deployed on this chain, and set our state variable with it. +Create a state variable of `ITeleporterMessenger` type called `teleporterMessenger`. Then create a constructor for our contract that takes in an address where the Teleporter Messenger would be deployed on this chain, and set our state variable with it. ```solidity contract ExampleCrossChainMessenger { @@ -85,7 +85,7 @@ function receiveTeleporterMessage( ) external { ``` -Now it's time to implement the methods, starting with `sendMessage`. First, import OpenZeppelin's `IERC20` contract, then in `sendMessage` check whether `feeAmount` is greater than zero. If it is, transfer and approve the amount of IERC20 asset at `feeContractAddress` to the teleporter messenger saved as a state variable. +Now it's time to implement the methods, starting with `sendMessage`. First, import OpenZeppelin's `IERC20` contract, then in `sendMessage` check whether `feeAmount` is greater than zero. If it is, transfer and approve the amount of IERC20 asset at `feeContractAddress` to the Teleporter Messenger saved as a state variable. Relayer fees are an optional way to incentive relayers to deliver a Teleporter message to its destination. They are not strictly necessary, and may be omitted if relaying is guaranteed, such as with a self-hosted relayer. ```solidity // For non-zero fee amounts, transfer the fee into the control of this contract first, and then @@ -125,7 +125,7 @@ return ); ``` -With the sending side complete, the next step is to implement `receiveTeleporterMessage`. The receiver in this example will just receive the arbitrary string data, and check that the message is sent through Teleporter. +With the sending side complete, the next step is to implement `ITeleporterReceiver.receiveTeleporterMessage`. The receiver in this example will just receive the arbitrary string data, and check that the message is sent through Teleporter. ```solidity // Receive a new message from another chain. diff --git a/contracts/src/Teleporter/ITeleporterMessenger.sol b/contracts/src/Teleporter/ITeleporterMessenger.sol index 7a4b9a5fc..c2bfce3a0 100644 --- a/contracts/src/Teleporter/ITeleporterMessenger.sol +++ b/contracts/src/Teleporter/ITeleporterMessenger.sol @@ -60,7 +60,7 @@ interface ITeleporterMessenger { /** * @dev Emitted when a Teleporter message is being delivered on the destination chain to an address, - * but message execution fails. Failed messages can then be retried. + * but message execution fails. Failed messages can then be retried with `retryMessageExecution` */ event MessageExecutionFailed( bytes32 indexed originChainID, @@ -151,8 +151,10 @@ interface ITeleporterMessenger { * @dev Retries the execution of a previously delivered message by verifying the payload matches * the hash of the payload originally delivered, and calling the destination address again. * - * Intended to be used if the original required gas limit was not sufficient for the message - * execution. Messages are ensured to be successfully executed at most once. + * Intended to be used if message excution failed on initial delivery of the Teleporter message. + * For example, this may occur if the original required gas limit was not sufficient for the message + * execution, or if the destination address did not contain a contract, but a compatible contract + * was later deployed to that address. Messages are ensured to be successfully executed at most once. */ function retryMessageExecution( bytes32 originChainID, diff --git a/contracts/src/Teleporter/README.md b/contracts/src/Teleporter/README.md index d09562f1b..bac17523b 100644 --- a/contracts/src/Teleporter/README.md +++ b/contracts/src/Teleporter/README.md @@ -37,7 +37,7 @@ Teleporter provides a handful of useful properties to cross-chain applications t Fees can be paid on a per message basis by specifing the ERC20 asset and amount to be used to incentivize a relayer to deliver the message in the call to `sendCrossChainMessage`. The fee amount is transferred into the control of the Teleporter contract (i.e. locked) before the Warp message is sent. The Teleporter contract tracks the fee amount for each message ID it creates. When it subsquently receives a message back from the destination chain of the original message, the new message will have a list of receipts identifying the relayer that delivered the given message ID. At this point, the fee amount originally locked by Teleporter for the given message will be redeemable by the relayer identified in the receipt. If the initial fee amount was not sufficient to incentivize a relayer, it can be increased by calling `addFeeAmount`. ### Message Receipts and Fee Redemption -In order to confirm delivery of a Teleporter message from one chain to another, a receipt is included in the next Teleporter message sent in the opposite direction. This receipt contains the message ID of the original message, as well as the address of the relayer that delivered it. That address is then able to redeem the reward on the original chain by calling `redeemRelayerRewards`. The following example illustrates this flow: +In order to confirm delivery of a Teleporter message from a source chain to a destination chain, a receipt is included in the next Teleporter message sent in the opposite direction, from the destination chain back to the source chain. This receipt contains the message ID of the original message, as well as the reward address that the delivering relayer specified. That reward address is then able to redeem the corresponding reward on the original chain by calling `redeemRelayerRewards`. The following example illustrates this flow: - A Teleporter message is sent from Chain A to Chain B, with a relayer incentive of `10` `USDC`. This message is assigned the ID `1` by the Teleporter contract on Chain A. - On Chain A, this is done by calling `sendCrossChainMessage`, and providing the `USDC` contract address and amount in the function call. - A relayer delivers the message on Chain B by calling `receiveCrossChainMessage` and providing its address, `0x123...` @@ -49,7 +49,7 @@ In order to confirm delivery of a Teleporter message from one chain to another, It is possible for receipts to get "stuck" on the destination chain in the event that Teleporter traffic between two chains is skewed in one direction. In such a scenario, incoming messages on one chain may cause the rate at which receipts are generated to outpace the rate at which they are sent back to the other chain. To mitigate this, the method `retryReceipts` can be called to immediately send the receipts associated with the given message IDs back to the original chain. ## Required Interface -Teleporter messages are delivered by calling the `receiveTeleporterMessage` function defined by the `ITeleporterReceiver` interface. Contracts must implement this interface in order to be able to receive messages. The first two paramaters of `receiveTeleporterMessage` identify the original sender of the given message on the origin chain and are set by the `TeleporterMessenger`. The third parameter to `receiveTeleporterMessage`, is the raw message payload. Applications using Teleporter are responsible for defining the exact format of this payload in a way that can be decoded on the receiving end. For example, applications may encode an action enum value along with the target method parameters on the sending side, then decode this data and route to the target method within `receiveTeleporterMessage`. See `ERC20Bridge.sol` for an example of this approach. +Teleporter messages are delivered by calling the `receiveTeleporterMessage` function defined by the `ITeleporterReceiver` interface. Contracts must implement this interface in order to be able to receive messages. The first two parameters of `receiveTeleporterMessage` identify the original sender of the given message on the origin chain and are set by the `TeleporterMessenger`. The third parameter to `receiveTeleporterMessage`, is the raw message payload. Applications using Teleporter are responsible for defining the exact format of this payload in a way that can be decoded on the receiving end. For example, applications may encode an action enum value along with the target method parameters on the sending side, then decode this data and route to the target method within `receiveTeleporterMessage`. See `ERC20Bridge.sol` for an example of this approach. ## Teleporter Contract Deployment The `TeleporterMessenger` contract must be deployed to the same contract address on every chain. This is acheived using Nick's keyless transaction method as described [here](../../../utils/contract-deployment/README.md). As a result, Warp messages sent from the resulting contract address are ensured to have the same payload format as defined by the contract itself. diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index 2d7e58593..78f88ead0 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -349,6 +349,12 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { /** * @dev See {ITeleporterMessenger-retryMessageExecution} * + * A Teleporter message has an associated `requiredGasLimit` that is used to execute the message. + * If the `requiredGasLimit` is too low, then the message execution will fail. This method allows + * for retrying the execution of a message with a higher gas limit. Contrary to `receiveCrossChainMessage`, + * which will only use `requiredGasLimit` in the sub-call to execute the message, this method may + * use all of the gas available in the transaction. + * * Reverts if the message execution fails again on the specified message. * Emits a {MessageExecuted} event if the retry is successful. * Requirements: From dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Tue, 31 Oct 2023 20:14:32 +0000 Subject: [PATCH 09/29] fix typo in job --- .github/workflows/docs_checker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs_checker.yml b/.github/workflows/docs_checker.yml index 6f211cdc6..c0d0f044e 100644 --- a/.github/workflows/docs_checker.yml +++ b/.github/workflows/docs_checker.yml @@ -30,7 +30,7 @@ jobs: - name: Generate forge docs run: | cd contracts - forge docs --build + forge doc --build - name: Print diff run: git --no-pager diff -- contracts/docs/ From 4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Tue, 31 Oct 2023 20:16:09 +0000 Subject: [PATCH 10/29] update docs --- contracts/docs/book.toml | 4 ++-- .../BridgeToken.sol/contract.BridgeToken.md | 2 +- .../ERC20Bridge.sol/contract.ERC20Bridge.md | 10 +++++----- .../IERC20Bridge.sol/interface.IERC20Bridge.md | 2 +- .../ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md | 2 +- .../contract.ExampleCrossChainMessenger.md | 2 +- .../contract.BlockHashPublisher.md | 2 +- .../contract.BlockHashReceiver.md | 2 +- .../Mocks/ExampleERC20.sol/contract.ExampleERC20.md | 2 +- .../contract.UnitTestMockERC20.md | 2 +- .../interface.ITeleporterMessenger.md | 10 ++++++---- .../struct.TeleporterFeeInfo.md | 2 +- .../struct.TeleporterMessage.md | 2 +- .../struct.TeleporterMessageInput.md | 2 +- .../struct.TeleporterMessageReceipt.md | 2 +- .../interface.ITeleporterReceiver.md | 2 +- .../ReceiptQueue.sol/library.ReceiptQueue.md | 2 +- .../ReentrancyGuards.sol/abstract.ReentrancyGuards.md | 2 +- .../library.SafeERC20TransferFrom.md | 2 +- .../contract.TeleporterMessenger.md | 7 ++++++- .../contract.AddFeeAmountTest.md | 2 +- .../contract.CheckIsAllowedRelayerTest.md | 2 +- .../GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md | 2 +- .../contract.GetMessageHashTest.md | 2 +- .../contract.GetNextMessageIDTest.md | 2 +- .../contract.GetOutstandingReceiptsToSendTest.md | 2 +- .../contract.GetRelayerRewardAddressTest.md | 2 +- .../contract.HandleInitialMessageExecutionTest.md | 2 +- .../contract.SampleMessageReceiver.md | 2 +- .../enum.SampleMessageReceiverAction.md | 2 +- .../MarkReceiptTests.t.sol/contract.MarkReceiptTest.md | 2 +- .../contract.MessageReceivedTest.md | 2 +- .../contract.ReceiptQueueTest.md | 2 +- .../contract.ReceiveCrossChainMessagedTest.md | 2 +- .../contract.RedeemRelayerRewardsTest.md | 2 +- .../contract.ReentrancyGuardsTests.md | 2 +- .../contract.SampleMessenger.md | 2 +- .../contract.FlakyMessageReceiver.md | 2 +- .../contract.RetryMessageExecutionTest.md | 2 +- .../enum.FlakyMessageReceiverAction.md | 2 +- .../contract.RetryReceiptTest.md | 2 +- .../contract.RetrySendCrossChainMessageTest.md | 2 +- .../contract.SendCrossChainMessageTest.md | 2 +- .../contract.TeleporterMessengerTest.md | 2 +- .../contract.TeleporterRegistry.md | 2 +- .../abstract.TeleporterUpgradeable.md | 2 +- .../contract.TeleporterRegistryTest.md | 2 +- .../contract.ExampleUpgradeableApp.md | 2 +- .../contract.TeleporterUpgradeableTest.md | 2 +- .../abstract.WarpProtocolRegistry.md | 2 +- .../struct.ProtocolRegistryEntry.md | 2 +- 51 files changed, 66 insertions(+), 59 deletions(-) diff --git a/contracts/docs/book.toml b/contracts/docs/book.toml index 03d5666ca..547ed5add 100644 --- a/contracts/docs/book.toml +++ b/contracts/docs/book.toml @@ -3,10 +3,10 @@ src = "src" title = "" [output.html] -additional-css = ["book.css"] +no-section-label = true additional-js = ["solidity.min.js"] +additional-css = ["book.css"] git-repository-url = "https://github.com/ava-labs/teleporter" -no-section-label = true [output.html.fold] enable = true diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol/contract.BridgeToken.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol/contract.BridgeToken.md index 65490a7c8..9af0c9aa5 100644 --- a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol/contract.BridgeToken.md +++ b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol/contract.BridgeToken.md @@ -1,5 +1,5 @@ # BridgeToken -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol) **Inherits:** ERC20Burnable diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol/contract.ERC20Bridge.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol/contract.ERC20Bridge.md index 198f1d8aa..edf47baa1 100644 --- a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol/contract.ERC20Bridge.md +++ b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol/contract.ERC20Bridge.md @@ -1,5 +1,5 @@ # ERC20Bridge -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol) **Inherits:** [IERC20Bridge](/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md), [ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md), ReentrancyGuard, [TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md), Ownable @@ -76,7 +76,7 @@ uint256 public constant TRANSFER_BRIDGE_TOKENS_REQUIRED_GAS = 300_000; ## Functions ### constructor -*Initializes the Teleporter messenger used for sending and receiving messages, +*Initializes the Teleporter Messenger used for sending and receiving messages, and initializes the current chain ID.* @@ -197,7 +197,7 @@ function encodeTransferBridgeTokensData( *Teleporter message receiver for creating a new bridge token on this chain. Emits a {CreateBridgeToken} event. Note: This function is only called within `receiveTeleporterMessage`, which can only be -called by the Teleporter messenger.* +called by the Teleporter Messenger.* ```solidity @@ -216,7 +216,7 @@ function _createBridgeToken( *Teleporter message receiver for minting of an existing bridge token on this chain. Emits a {MintBridgeTokens} event. Note: This function is only called within `receiveTeleporterMessage`, which can only be -called by the Teleporter messenger.* +called by the Teleporter Messenger.* ```solidity @@ -234,7 +234,7 @@ function _mintBridgeTokens( *Teleporter message receiver for handling bridge tokens transfers back from another chain and optionally routing them to a different third chain. Note: This function is only called within `receiveTeleporterMessage`, which can only be -called by the Teleporter messenger.* +called by the Teleporter Messenger.* ```solidity diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md index 87e3bd43b..b5d812c7c 100644 --- a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md +++ b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md @@ -1,5 +1,5 @@ # IERC20Bridge -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol) *Interface that describes functionalities for a cross-chain ERC20 bridge.* diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md index 629255f71..1deaa36cb 100644 --- a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md +++ b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md @@ -1,5 +1,5 @@ # ERC20BridgeTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol) **Inherits:** Test diff --git a/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md b/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md index 474444b06..f29925053 100644 --- a/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md +++ b/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md @@ -1,5 +1,5 @@ # ExampleCrossChainMessenger -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol) **Inherits:** [ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md), ReentrancyGuard, [TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md), Ownable diff --git a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md index 829652eaa..1627927d7 100644 --- a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md +++ b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md @@ -1,5 +1,5 @@ # BlockHashPublisher -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol) Contract that publishes the latest block hash of current chain to another chain. diff --git a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md index b3be7c352..09b3622d3 100644 --- a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md +++ b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md @@ -1,5 +1,5 @@ # BlockHashReceiver -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol) **Inherits:** [ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md), [TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md), Ownable diff --git a/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md b/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md index f69c09100..19c2fb5c3 100644 --- a/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md +++ b/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md @@ -1,5 +1,5 @@ # ExampleERC20 -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Mocks/ExampleERC20.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Mocks/ExampleERC20.sol) **Inherits:** ERC20Burnable diff --git a/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md b/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md index 6f7728d2d..41974b5f2 100644 --- a/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md +++ b/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md @@ -1,5 +1,5 @@ # UnitTestMockERC20 -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Mocks/UnitTestMockERC20.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Mocks/UnitTestMockERC20.sol) ## State Variables diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md index c70206c3c..22e8b0ff8 100644 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md @@ -1,5 +1,5 @@ # ITeleporterMessenger -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ITeleporterMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ITeleporterMessenger.sol) *Interface that describes functionalities for a cross-chain messenger implementing the Teleporter protcol.* @@ -61,8 +61,10 @@ function receiveCrossChainMessage(uint32 messageIndex, address relayerRewardAddr *Retries the execution of a previously delivered message by verifying the payload matches the hash of the payload originally delivered, and calling the destination address again. -Intended to be used if the original required gas limit was not sufficient for the message -execution. Messages are ensured to be successfully executed at most once.* +Intended to be used if message excution failed on initial delivery of the Teleporter message. +For example, this may occur if the original required gas limit was not sufficient for the message +execution, or if the destination address did not contain a contract, but a compatible contract +was later deployed to that address. Messages are ensured to be successfully executed at most once.* ```solidity @@ -197,7 +199,7 @@ event AddFeeAmount(bytes32 indexed destinationChainID, uint256 indexed messageID ### MessageExecutionFailed *Emitted when a Teleporter message is being delivered on the destination chain to an address, -but message execution fails. Failed messages can then be retried.* +but message execution fails. Failed messages can then be retried with `retryMessageExecution`* ```solidity diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md index b98ef073b..51b6e5a19 100644 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md @@ -1,5 +1,5 @@ # TeleporterFeeInfo -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ITeleporterMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ITeleporterMessenger.sol) ```solidity diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md index cfe4f48b1..b4804dd23 100644 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md @@ -1,5 +1,5 @@ # TeleporterMessage -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ITeleporterMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ITeleporterMessenger.sol) ```solidity diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md index bf70ae7b4..958dfc0ee 100644 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md @@ -1,5 +1,5 @@ # TeleporterMessageInput -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ITeleporterMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ITeleporterMessenger.sol) ```solidity diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md index 3bb2923d1..0ee642e50 100644 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md @@ -1,5 +1,5 @@ # TeleporterMessageReceipt -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ITeleporterMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ITeleporterMessenger.sol) ```solidity diff --git a/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md b/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md index e16065452..571fbf2cf 100644 --- a/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md +++ b/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md @@ -1,5 +1,5 @@ # ITeleporterReceiver -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ITeleporterReceiver.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ITeleporterReceiver.sol) *Interface that cross-chain applications must implement to receive messages from Teleporter.* diff --git a/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md b/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md index 390f3fd1a..95154a6a9 100644 --- a/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md +++ b/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md @@ -1,5 +1,5 @@ # ReceiptQueue -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ReceiptQueue.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ReceiptQueue.sol) *ReceiptQueue is a convenience library that creates a queue-like interface of TeleporterMessageReceipt structs. It provides FIFO properties. diff --git a/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md b/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md index c4fa6d3d1..c699cb8fd 100644 --- a/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md +++ b/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md @@ -1,5 +1,5 @@ # ReentrancyGuards -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/ReentrancyGuards.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ReentrancyGuards.sol) *Abstract contract that helps implement reentrancy guards between functions for sending and receiving. Consecutive calls for sending functions should work together, same for receive functions, but recursive calls diff --git a/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md b/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md index 6c1f8e28a..4889715f3 100644 --- a/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md +++ b/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md @@ -1,5 +1,5 @@ # SafeERC20TransferFrom -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/SafeERC20TransferFrom.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/SafeERC20TransferFrom.sol) *Provides a wrapper used for calling an ERC20 transferFrom method to receive tokens to a contract from msg.sender. diff --git a/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md b/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md index de47c6d1f..43eed3f63 100644 --- a/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md +++ b/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md @@ -1,5 +1,5 @@ # TeleporterMessenger -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/TeleporterMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/TeleporterMessenger.sol) **Inherits:** [ITeleporterMessenger](/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md), [ReentrancyGuards](/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md) @@ -139,6 +139,11 @@ function receiveCrossChainMessage(uint32 messageIndex, address relayerRewardAddr ### retryMessageExecution *See {ITeleporterMessenger-retryMessageExecution} +A Teleporter message has an associated `requiredGasLimit` that is used to execute the message. +If the `requiredGasLimit` is too low, then the message execution will fail. This method allows +for retrying the execution of a message with a higher gas limit. Contrary to `receiveCrossChainMessage`, +which will only use `requiredGasLimit` in the sub-call to execute the message, this method may +use all of the gas available in the transaction. Reverts if the message execution fails again on the specified message. Emits a {MessageExecuted} event if the retry is successful. Requirements: diff --git a/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md b/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md index e5550380c..e65b5d365 100644 --- a/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md +++ b/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md @@ -1,5 +1,5 @@ # AddFeeAmountTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/AddFeeAmountTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/AddFeeAmountTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md b/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md index 298666aa5..7163ba02b 100644 --- a/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md +++ b/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md @@ -1,5 +1,5 @@ # CheckIsAllowedRelayerTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md b/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md index 3743999b0..28f41b63d 100644 --- a/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md +++ b/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md @@ -1,5 +1,5 @@ # GetFeeInfoTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/GetFeeInfoTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/GetFeeInfoTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md b/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md index 700e23ea5..e8c8c3fc2 100644 --- a/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md +++ b/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md @@ -1,5 +1,5 @@ # GetMessageHashTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/GetMessageHashTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/GetMessageHashTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md b/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md index 5e2b6a5f2..bc52d9739 100644 --- a/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md +++ b/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md @@ -1,5 +1,5 @@ # GetNextMessageIDTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/GetNextMessageIdTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/GetNextMessageIdTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md b/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md index 64617f572..948ef35e3 100644 --- a/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md +++ b/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md @@ -1,5 +1,5 @@ # GetOutstandingReceiptsToSendTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md b/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md index ee6aa2249..f28d74aa0 100644 --- a/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md +++ b/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md @@ -1,5 +1,5 @@ # GetRelayerRewardAddressTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md index e1faed90b..f3f7e9a7e 100644 --- a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md +++ b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md @@ -1,5 +1,5 @@ # HandleInitialMessageExecutionTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md index 52e5b3006..81f0a7a8f 100644 --- a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md +++ b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md @@ -1,5 +1,5 @@ # SampleMessageReceiver -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) **Inherits:** [ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md) diff --git a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md index 26ad03c32..1031f9373 100644 --- a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md +++ b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md @@ -1,5 +1,5 @@ # SampleMessageReceiverAction -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) ```solidity diff --git a/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md b/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md index 0c203e7de..0b9a0422f 100644 --- a/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md +++ b/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md @@ -1,5 +1,5 @@ # MarkReceiptTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/MarkReceiptTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/MarkReceiptTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md b/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md index 15de43f9b..e14d90561 100644 --- a/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md +++ b/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md @@ -1,5 +1,5 @@ # MessageReceivedTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/MessageReceivedTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/MessageReceivedTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md b/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md index 4b3359ada..e02ce67a6 100644 --- a/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md +++ b/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md @@ -1,5 +1,5 @@ # ReceiptQueueTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/ReceiptsQueueTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/ReceiptsQueueTests.t.sol) **Inherits:** Test diff --git a/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md b/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md index d884b0d15..f9f5d9e5b 100644 --- a/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md +++ b/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md @@ -1,5 +1,5 @@ # ReceiveCrossChainMessagedTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md b/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md index ee7c1a352..2c537edac 100644 --- a/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md +++ b/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md @@ -1,5 +1,5 @@ # RedeemRelayerRewardsTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md index 82a2d8b88..3b7665208 100644 --- a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md +++ b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md @@ -1,5 +1,5 @@ # ReentrancyGuardsTests -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/ReentrancyGuardsTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/ReentrancyGuardsTests.t.sol) **Inherits:** Test diff --git a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md index 95a1ef8f4..7cbb1e154 100644 --- a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md +++ b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md @@ -1,5 +1,5 @@ # SampleMessenger -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/ReentrancyGuardsTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/ReentrancyGuardsTests.t.sol) **Inherits:** [ReentrancyGuards](/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md) diff --git a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md index 03796d759..aa6fee507 100644 --- a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md +++ b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md @@ -1,5 +1,5 @@ # FlakyMessageReceiver -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) **Inherits:** [ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md) diff --git a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md index 6bdcfe204..c1085f2b8 100644 --- a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md +++ b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md @@ -1,5 +1,5 @@ # RetryMessageExecutionTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md index 46ba729a2..62c56488f 100644 --- a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md +++ b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md @@ -1,5 +1,5 @@ # FlakyMessageReceiverAction -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) ```solidity diff --git a/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md b/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md index 02ce56f82..986b8b290 100644 --- a/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md +++ b/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md @@ -1,5 +1,5 @@ # RetryReceiptTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/RetryReceiptTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/RetryReceiptTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md b/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md index 371bf0241..afd93e60b 100644 --- a/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md +++ b/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md @@ -1,5 +1,5 @@ # RetrySendCrossChainMessageTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md b/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md index 7bba92858..5359cfbe9 100644 --- a/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md +++ b/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md @@ -1,5 +1,5 @@ # SendCrossChainMessageTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/SendCrossChainMessageTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/SendCrossChainMessageTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md b/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md index 7e54f8271..24e5b6525 100644 --- a/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md +++ b/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md @@ -1,5 +1,5 @@ # TeleporterMessengerTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/tests/TeleporterMessengerTest.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/TeleporterMessengerTest.t.sol) **Inherits:** Test diff --git a/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md b/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md index e4b215773..8175386f4 100644 --- a/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md +++ b/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md @@ -1,5 +1,5 @@ # TeleporterRegistry -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/upgrades/TeleporterRegistry.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/upgrades/TeleporterRegistry.sol) **Inherits:** [WarpProtocolRegistry](/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md) diff --git a/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md b/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md index 42fef21ae..29ed6c015 100644 --- a/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md +++ b/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md @@ -1,5 +1,5 @@ # TeleporterUpgradeable -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/upgrades/TeleporterUpgradeable.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/upgrades/TeleporterUpgradeable.sol) *TeleporterUpgradeable provides upgrade utility for applications built on top of the Teleporter protocol by integrating with the {TeleporterRegistry}. diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md index c625a279a..ae1509b25 100644 --- a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md +++ b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md @@ -1,5 +1,5 @@ # TeleporterRegistryTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol) **Inherits:** Test diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md index e03792664..959ee689f 100644 --- a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md +++ b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md @@ -1,5 +1,5 @@ # ExampleUpgradeableApp -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol) **Inherits:** [TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md) diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md index 519ad0496..c25c28dbf 100644 --- a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md +++ b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md @@ -1,5 +1,5 @@ # TeleporterUpgradeableTest -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol) **Inherits:** Test diff --git a/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md b/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md index 947f81428..242f89ffd 100644 --- a/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md +++ b/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md @@ -1,5 +1,5 @@ # WarpProtocolRegistry -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/WarpProtocolRegistry.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/WarpProtocolRegistry.sol) *Implementation of an abstract `WarpProtocolRegistry` contract. This implementation is a contract that can be used as a base contract for protocols that are diff --git a/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md b/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md index afb16748d..8c3dc55c4 100644 --- a/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md +++ b/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md @@ -1,5 +1,5 @@ # ProtocolRegistryEntry -[Git Source](https://github.com/ava-labs/teleporter/blob/cadc1420fd95195b094eea855b7496cc71b5be2a/src/WarpProtocolRegistry.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/WarpProtocolRegistry.sol) *Registry entry that represents a mapping between protocolAddress and version.* From 8efe96f7892cddbec1f6e40954fbceeae90e68a8 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Tue, 31 Oct 2023 20:33:20 +0000 Subject: [PATCH 11/29] remove forge docs from repo --- .github/workflows/docs_checker.yml | 39 ------------------- .gitignore | 3 ++ contracts/README.md | 3 ++ .../BridgeToken.sol/contract.BridgeToken.md | 2 +- .../ERC20Bridge.sol/contract.ERC20Bridge.md | 2 +- .../interface.IERC20Bridge.md | 2 +- .../contract.ERC20BridgeTest.md | 2 +- .../contract.ExampleCrossChainMessenger.md | 2 +- .../contract.BlockHashPublisher.md | 2 +- .../contract.BlockHashReceiver.md | 2 +- .../ExampleERC20.sol/contract.ExampleERC20.md | 2 +- .../contract.UnitTestMockERC20.md | 2 +- .../interface.ITeleporterMessenger.md | 2 +- .../struct.TeleporterFeeInfo.md | 2 +- .../struct.TeleporterMessage.md | 2 +- .../struct.TeleporterMessageInput.md | 2 +- .../struct.TeleporterMessageReceipt.md | 2 +- .../interface.ITeleporterReceiver.md | 2 +- .../ReceiptQueue.sol/library.ReceiptQueue.md | 2 +- .../abstract.ReentrancyGuards.md | 2 +- .../library.SafeERC20TransferFrom.md | 2 +- .../contract.TeleporterMessenger.md | 2 +- .../contract.AddFeeAmountTest.md | 2 +- .../contract.CheckIsAllowedRelayerTest.md | 2 +- .../contract.GetFeeInfoTest.md | 2 +- .../contract.GetMessageHashTest.md | 2 +- .../contract.GetNextMessageIDTest.md | 2 +- ...ntract.GetOutstandingReceiptsToSendTest.md | 2 +- .../contract.GetRelayerRewardAddressTest.md | 2 +- ...tract.HandleInitialMessageExecutionTest.md | 2 +- .../contract.SampleMessageReceiver.md | 2 +- .../enum.SampleMessageReceiverAction.md | 2 +- .../contract.MarkReceiptTest.md | 2 +- .../contract.MessageReceivedTest.md | 2 +- .../contract.ReceiptQueueTest.md | 2 +- .../contract.ReceiveCrossChainMessagedTest.md | 2 +- .../contract.RedeemRelayerRewardsTest.md | 2 +- .../contract.ReentrancyGuardsTests.md | 2 +- .../contract.SampleMessenger.md | 2 +- .../contract.FlakyMessageReceiver.md | 2 +- .../contract.RetryMessageExecutionTest.md | 2 +- .../enum.FlakyMessageReceiverAction.md | 2 +- .../contract.RetryReceiptTest.md | 2 +- ...contract.RetrySendCrossChainMessageTest.md | 2 +- .../contract.SendCrossChainMessageTest.md | 2 +- .../contract.TeleporterMessengerTest.md | 2 +- .../contract.TeleporterRegistry.md | 2 +- .../abstract.TeleporterUpgradeable.md | 2 +- .../contract.TeleporterRegistryTest.md | 2 +- .../contract.ExampleUpgradeableApp.md | 2 +- .../contract.TeleporterUpgradeableTest.md | 2 +- .../abstract.WarpProtocolRegistry.md | 2 +- .../struct.ProtocolRegistryEntry.md | 2 +- 53 files changed, 56 insertions(+), 89 deletions(-) delete mode 100644 .github/workflows/docs_checker.yml diff --git a/.github/workflows/docs_checker.yml b/.github/workflows/docs_checker.yml deleted file mode 100644 index c0d0f044e..000000000 --- a/.github/workflows/docs_checker.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Forge docs checker - -on: - push: - branches: - - main - pull_request: - branches: - - "*" - -env: - GO_VERSION: "1.20.8" - -jobs: - docs_checker: - name: docs_checker - runs-on: ubuntu-20.04 - - steps: - - name: Checkout Teleporter repository - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: nightly - - - name: Generate forge docs - run: | - cd contracts - forge doc --build - - - name: Print diff - run: git --no-pager diff -- contracts/docs/ - - - name: Fail if diff exists - run: git --no-pager diff --quiet -- contracts/docs/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 649082785..fc932e387 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,6 @@ docker-compose-run-local.yml main.log server.log tests.test + +# Forge documentation +contracts/docs/ diff --git a/contracts/README.md b/contracts/README.md index 334a47125..57d3dd8ed 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -7,3 +7,6 @@ This directory is set up as a [Foundry](https://github.com/foundry-rs/foundry) p - To compile the contracts run `forge build` from this directory. - Similarly, to run unit tests, run `forge test`. - See additional testing and deployment options [here](https://book.getfoundry.sh/forge/). + +## Generate documentation +- Documentation can be generated by running `forge doc --build` from this repository. By default, this will generate documentation to `contracts/docs/`, and an HTML book to `contracts/docs/book/`. It's also possible to serve this book locally by running `forge doc --serve `. \ No newline at end of file diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol/contract.BridgeToken.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol/contract.BridgeToken.md index 9af0c9aa5..83ef72c39 100644 --- a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol/contract.BridgeToken.md +++ b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol/contract.BridgeToken.md @@ -1,5 +1,5 @@ # BridgeToken -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol) **Inherits:** ERC20Burnable diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol/contract.ERC20Bridge.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol/contract.ERC20Bridge.md index edf47baa1..ef90acb34 100644 --- a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol/contract.ERC20Bridge.md +++ b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol/contract.ERC20Bridge.md @@ -1,5 +1,5 @@ # ERC20Bridge -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol) **Inherits:** [IERC20Bridge](/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md), [ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md), ReentrancyGuard, [TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md), Ownable diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md index b5d812c7c..62e8509fb 100644 --- a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md +++ b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md @@ -1,5 +1,5 @@ # IERC20Bridge -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol) *Interface that describes functionalities for a cross-chain ERC20 bridge.* diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md index 1deaa36cb..a7b30048c 100644 --- a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md +++ b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md @@ -1,5 +1,5 @@ # ERC20BridgeTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol) **Inherits:** Test diff --git a/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md b/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md index f29925053..745afb0a5 100644 --- a/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md +++ b/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md @@ -1,5 +1,5 @@ # ExampleCrossChainMessenger -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol) **Inherits:** [ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md), ReentrancyGuard, [TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md), Ownable diff --git a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md index 1627927d7..2a9dd2e4f 100644 --- a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md +++ b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md @@ -1,5 +1,5 @@ # BlockHashPublisher -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol) Contract that publishes the latest block hash of current chain to another chain. diff --git a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md index 09b3622d3..923a47137 100644 --- a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md +++ b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md @@ -1,5 +1,5 @@ # BlockHashReceiver -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol) **Inherits:** [ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md), [TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md), Ownable diff --git a/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md b/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md index 19c2fb5c3..f06849ef5 100644 --- a/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md +++ b/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md @@ -1,5 +1,5 @@ # ExampleERC20 -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Mocks/ExampleERC20.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Mocks/ExampleERC20.sol) **Inherits:** ERC20Burnable diff --git a/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md b/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md index 41974b5f2..bfda54fb1 100644 --- a/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md +++ b/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md @@ -1,5 +1,5 @@ # UnitTestMockERC20 -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Mocks/UnitTestMockERC20.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Mocks/UnitTestMockERC20.sol) ## State Variables diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md index 22e8b0ff8..cfdc1168e 100644 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md @@ -1,5 +1,5 @@ # ITeleporterMessenger -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ITeleporterMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ITeleporterMessenger.sol) *Interface that describes functionalities for a cross-chain messenger implementing the Teleporter protcol.* diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md index 51b6e5a19..57032094b 100644 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md @@ -1,5 +1,5 @@ # TeleporterFeeInfo -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ITeleporterMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ITeleporterMessenger.sol) ```solidity diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md index b4804dd23..e7282c5dd 100644 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md @@ -1,5 +1,5 @@ # TeleporterMessage -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ITeleporterMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ITeleporterMessenger.sol) ```solidity diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md index 958dfc0ee..1c738af19 100644 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md @@ -1,5 +1,5 @@ # TeleporterMessageInput -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ITeleporterMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ITeleporterMessenger.sol) ```solidity diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md index 0ee642e50..f421fa1c1 100644 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md +++ b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md @@ -1,5 +1,5 @@ # TeleporterMessageReceipt -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ITeleporterMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ITeleporterMessenger.sol) ```solidity diff --git a/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md b/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md index 571fbf2cf..320f06889 100644 --- a/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md +++ b/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md @@ -1,5 +1,5 @@ # ITeleporterReceiver -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ITeleporterReceiver.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ITeleporterReceiver.sol) *Interface that cross-chain applications must implement to receive messages from Teleporter.* diff --git a/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md b/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md index 95154a6a9..c7143a53c 100644 --- a/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md +++ b/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md @@ -1,5 +1,5 @@ # ReceiptQueue -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ReceiptQueue.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ReceiptQueue.sol) *ReceiptQueue is a convenience library that creates a queue-like interface of TeleporterMessageReceipt structs. It provides FIFO properties. diff --git a/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md b/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md index c699cb8fd..e6dd3856d 100644 --- a/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md +++ b/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md @@ -1,5 +1,5 @@ # ReentrancyGuards -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/ReentrancyGuards.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ReentrancyGuards.sol) *Abstract contract that helps implement reentrancy guards between functions for sending and receiving. Consecutive calls for sending functions should work together, same for receive functions, but recursive calls diff --git a/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md b/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md index 4889715f3..eb7761ce6 100644 --- a/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md +++ b/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md @@ -1,5 +1,5 @@ # SafeERC20TransferFrom -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/SafeERC20TransferFrom.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/SafeERC20TransferFrom.sol) *Provides a wrapper used for calling an ERC20 transferFrom method to receive tokens to a contract from msg.sender. diff --git a/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md b/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md index 43eed3f63..bb348c318 100644 --- a/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md +++ b/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md @@ -1,5 +1,5 @@ # TeleporterMessenger -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/TeleporterMessenger.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/TeleporterMessenger.sol) **Inherits:** [ITeleporterMessenger](/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md), [ReentrancyGuards](/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md) diff --git a/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md b/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md index e65b5d365..c63bfb7cc 100644 --- a/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md +++ b/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md @@ -1,5 +1,5 @@ # AddFeeAmountTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/AddFeeAmountTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/AddFeeAmountTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md b/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md index 7163ba02b..9be74f4cc 100644 --- a/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md +++ b/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md @@ -1,5 +1,5 @@ # CheckIsAllowedRelayerTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md b/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md index 28f41b63d..7365825fe 100644 --- a/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md +++ b/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md @@ -1,5 +1,5 @@ # GetFeeInfoTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/GetFeeInfoTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/GetFeeInfoTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md b/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md index e8c8c3fc2..c10b9fdd4 100644 --- a/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md +++ b/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md @@ -1,5 +1,5 @@ # GetMessageHashTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/GetMessageHashTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/GetMessageHashTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md b/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md index bc52d9739..e0148f05e 100644 --- a/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md +++ b/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md @@ -1,5 +1,5 @@ # GetNextMessageIDTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/GetNextMessageIdTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/GetNextMessageIdTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md b/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md index 948ef35e3..817be7c6b 100644 --- a/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md +++ b/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md @@ -1,5 +1,5 @@ # GetOutstandingReceiptsToSendTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md b/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md index f28d74aa0..8ef966741 100644 --- a/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md +++ b/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md @@ -1,5 +1,5 @@ # GetRelayerRewardAddressTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md index f3f7e9a7e..e61358890 100644 --- a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md +++ b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md @@ -1,5 +1,5 @@ # HandleInitialMessageExecutionTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md index 81f0a7a8f..62c90f915 100644 --- a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md +++ b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md @@ -1,5 +1,5 @@ # SampleMessageReceiver -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) **Inherits:** [ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md) diff --git a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md index 1031f9373..9a96059c1 100644 --- a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md +++ b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md @@ -1,5 +1,5 @@ # SampleMessageReceiverAction -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) ```solidity diff --git a/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md b/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md index 0b9a0422f..118500a1e 100644 --- a/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md +++ b/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md @@ -1,5 +1,5 @@ # MarkReceiptTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/MarkReceiptTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/MarkReceiptTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md b/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md index e14d90561..c31ab32ea 100644 --- a/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md +++ b/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md @@ -1,5 +1,5 @@ # MessageReceivedTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/MessageReceivedTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/MessageReceivedTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md b/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md index e02ce67a6..46d2cb0e3 100644 --- a/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md +++ b/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md @@ -1,5 +1,5 @@ # ReceiptQueueTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/ReceiptsQueueTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/ReceiptsQueueTests.t.sol) **Inherits:** Test diff --git a/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md b/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md index f9f5d9e5b..3c82aa1c0 100644 --- a/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md +++ b/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md @@ -1,5 +1,5 @@ # ReceiveCrossChainMessagedTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md b/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md index 2c537edac..eaae5faa4 100644 --- a/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md +++ b/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md @@ -1,5 +1,5 @@ # RedeemRelayerRewardsTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md index 3b7665208..b5df9bf8f 100644 --- a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md +++ b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md @@ -1,5 +1,5 @@ # ReentrancyGuardsTests -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/ReentrancyGuardsTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/ReentrancyGuardsTests.t.sol) **Inherits:** Test diff --git a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md index 7cbb1e154..4724d1b05 100644 --- a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md +++ b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md @@ -1,5 +1,5 @@ # SampleMessenger -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/ReentrancyGuardsTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/ReentrancyGuardsTests.t.sol) **Inherits:** [ReentrancyGuards](/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md) diff --git a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md index aa6fee507..c18e1b0f2 100644 --- a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md +++ b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md @@ -1,5 +1,5 @@ # FlakyMessageReceiver -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) **Inherits:** [ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md) diff --git a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md index c1085f2b8..d45e6db96 100644 --- a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md +++ b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md @@ -1,5 +1,5 @@ # RetryMessageExecutionTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md index 62c56488f..81fdcfde6 100644 --- a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md +++ b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md @@ -1,5 +1,5 @@ # FlakyMessageReceiverAction -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) ```solidity diff --git a/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md b/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md index 986b8b290..b3a64b4d5 100644 --- a/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md +++ b/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md @@ -1,5 +1,5 @@ # RetryReceiptTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/RetryReceiptTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/RetryReceiptTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md b/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md index afd93e60b..0a253047b 100644 --- a/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md +++ b/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md @@ -1,5 +1,5 @@ # RetrySendCrossChainMessageTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md b/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md index 5359cfbe9..7d25ed7c8 100644 --- a/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md +++ b/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md @@ -1,5 +1,5 @@ # SendCrossChainMessageTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/SendCrossChainMessageTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/SendCrossChainMessageTests.t.sol) **Inherits:** [TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md b/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md index 24e5b6525..0ad8f362e 100644 --- a/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md +++ b/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md @@ -1,5 +1,5 @@ # TeleporterMessengerTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/tests/TeleporterMessengerTest.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/TeleporterMessengerTest.t.sol) **Inherits:** Test diff --git a/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md b/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md index 8175386f4..78ec98c5e 100644 --- a/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md +++ b/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md @@ -1,5 +1,5 @@ # TeleporterRegistry -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/upgrades/TeleporterRegistry.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/upgrades/TeleporterRegistry.sol) **Inherits:** [WarpProtocolRegistry](/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md) diff --git a/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md b/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md index 29ed6c015..a2d998150 100644 --- a/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md +++ b/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md @@ -1,5 +1,5 @@ # TeleporterUpgradeable -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/upgrades/TeleporterUpgradeable.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/upgrades/TeleporterUpgradeable.sol) *TeleporterUpgradeable provides upgrade utility for applications built on top of the Teleporter protocol by integrating with the {TeleporterRegistry}. diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md index ae1509b25..6c01e04a0 100644 --- a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md +++ b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md @@ -1,5 +1,5 @@ # TeleporterRegistryTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol) **Inherits:** Test diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md index 959ee689f..494ce2b33 100644 --- a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md +++ b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md @@ -1,5 +1,5 @@ # ExampleUpgradeableApp -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol) **Inherits:** [TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md) diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md index c25c28dbf..0f1216332 100644 --- a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md +++ b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md @@ -1,5 +1,5 @@ # TeleporterUpgradeableTest -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol) **Inherits:** Test diff --git a/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md b/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md index 242f89ffd..034275dab 100644 --- a/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md +++ b/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md @@ -1,5 +1,5 @@ # WarpProtocolRegistry -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/WarpProtocolRegistry.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/WarpProtocolRegistry.sol) *Implementation of an abstract `WarpProtocolRegistry` contract. This implementation is a contract that can be used as a base contract for protocols that are diff --git a/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md b/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md index 8c3dc55c4..11cc22367 100644 --- a/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md +++ b/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md @@ -1,5 +1,5 @@ # ProtocolRegistryEntry -[Git Source](https://github.com/ava-labs/teleporter/blob/dde09fbf56cc395da6bfd76c7f894a3cf5b2cd9e/src/WarpProtocolRegistry.sol) +[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/WarpProtocolRegistry.sol) *Registry entry that represents a mapping between protocolAddress and version.* From d2a4affbf1967ffe981eff42e7e51e6ec973b215 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Wed, 1 Nov 2023 14:01:12 +0000 Subject: [PATCH 12/29] consistent naming --- contracts/src/CrossChainApplications/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/contracts/src/CrossChainApplications/README.md b/contracts/src/CrossChainApplications/README.md index 793b116b4..e9cfa8ac1 100644 --- a/contracts/src/CrossChainApplications/README.md +++ b/contracts/src/CrossChainApplications/README.md @@ -1,6 +1,6 @@ # Teleporter Cross Chain Applications -This directory includes cross-chain applications that are built on top of the [Teleporter Messenger Protocol](../Teleporter/README.md). +This directory includes cross-chain applications that are built on top of the [Teleporter protocol](../Teleporter/README.md). - [Teleporter Cross Chain Applications](#teleporter-cross-chain-applications) - [Applications](#applications) @@ -20,7 +20,7 @@ This directory includes cross-chain applications that are built on top of the [T ## Getting started with an example application -This section walks through how to build a cross-chain application on top of the Teleporter Messenger protocol, recreating the `ExampleCrossChainMessenger` contract that sends arbitrary string data from one chain to another. +This section walks through how to build a cross-chain application on top of the Teleporter protocol, recreating the `ExampleCrossChainMessenger` contract that sends arbitrary string data from one chain to another. ### Step 1: Create Initial Contract @@ -196,11 +196,11 @@ There we have it, a simple cross chain messenger built on top of Teleporter! Ful For testing, `scripts/local/test.sh` sets up a local Avalanche network with three subnets deployed with Teleporter, and a relayer to deliver Teleporter messages. To add an integration test simply add a new test script under `integration-tests`. An integration test for `ExampleCrossChainMessenger` is already included (`scripts/local/integration_tests/example_messenger.sh`), which performs the following steps: -1. Deploy the [ExampleERC20](../Mocks/ExampleERC20.sol) token to subnet A. -2. Deploy `ExampleCrossChainMessenger` to both subnets A and B. -3. Approve the cross-chain messenger on subnet A to spend ERC20 tokens from the default address. -4. Send `"hello world"` from subnet A to subnet B's cross-chain messenger to receive. -5. Call `getCurrentMessage` on subnet B to make sure the right message and sender are received. +1. Deploys the [ExampleERC20](../Mocks/ExampleERC20.sol) token to subnet A. +2. Deploys `ExampleCrossChainMessenger` to both subnets A and B. +3. Approves the cross-chain messenger on subnet A to spend ERC20 tokens from the default address. +4. Sends `"hello world"` from subnet A to subnet B's cross-chain messenger to receive. +5. Calls `getCurrentMessage` on subnet B to make sure the right message and sender are received. Running `./test.sh example_messenger` at the root of the repo should yield at the end of the test: From e1b9cb02ffb49896741b56a207c89e8e88c48a94 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Mon, 6 Nov 2023 16:47:46 +0000 Subject: [PATCH 13/29] remove generated docs --- contracts/docs/.gitignore | 1 - contracts/docs/book.css | 13 - contracts/docs/book.toml | 12 - contracts/docs/solidity.min.js | 74 ---- contracts/docs/src/README.md | 9 - contracts/docs/src/SUMMARY.md | 63 --- .../BridgeToken.sol/contract.BridgeToken.md | 78 ---- .../ERC20Bridge.sol/contract.ERC20Bridge.md | 301 -------------- .../interface.IERC20Bridge.md | 103 ----- .../ERC20Bridge/README.md | 7 - .../contract.ERC20BridgeTest.md | 301 -------------- .../ERC20Bridge/tests/README.md | 4 - .../contract.ExampleCrossChainMessenger.md | 110 ------ .../ExampleMessenger/README.md | 4 - .../src/src/CrossChainApplications/README.md | 6 - .../contract.BlockHashPublisher.md | 54 --- .../contract.BlockHashReceiver.md | 95 ----- .../VerifiedBlockHash/README.md | 5 - .../ExampleERC20.sol/contract.ExampleERC20.md | 44 --- contracts/docs/src/src/Mocks/README.md | 5 - .../contract.UnitTestMockERC20.md | 41 -- contracts/docs/src/src/README.md | 8 - .../interface.ITeleporterMessenger.md | 241 ------------ .../struct.TeleporterFeeInfo.md | 11 - .../struct.TeleporterMessage.md | 16 - .../struct.TeleporterMessageInput.md | 15 - .../struct.TeleporterMessageReceipt.md | 11 - .../interface.ITeleporterReceiver.md | 25 -- contracts/docs/src/src/Teleporter/README.md | 15 - .../ReceiptQueue.sol/library.ReceiptQueue.md | 82 ---- .../abstract.ReentrancyGuards.md | 61 --- .../library.SafeERC20TransferFrom.md | 19 - .../contract.TeleporterMessenger.md | 372 ------------------ .../contract.AddFeeAmountTest.md | 64 --- .../contract.CheckIsAllowedRelayerTest.md | 36 -- .../contract.GetFeeInfoTest.md | 43 -- .../contract.GetMessageHashTest.md | 36 -- .../contract.GetNextMessageIDTest.md | 36 -- ...ntract.GetOutstandingReceiptsToSendTest.md | 29 -- .../contract.GetRelayerRewardAddressTest.md | 22 -- ...tract.HandleInitialMessageExecutionTest.md | 51 --- .../contract.SampleMessageReceiver.md | 67 ---- .../enum.SampleMessageReceiverAction.md | 11 - .../contract.MarkReceiptTest.md | 46 --- .../contract.MessageReceivedTest.md | 29 -- .../docs/src/src/Teleporter/tests/README.md | 27 -- .../contract.ReceiptQueueTest.md | 79 ---- .../contract.ReceiveCrossChainMessagedTest.md | 87 ---- .../contract.RedeemRelayerRewardsTest.md | 53 --- .../contract.ReentrancyGuardsTests.md | 79 ---- .../contract.SampleMessenger.md | 65 --- .../contract.FlakyMessageReceiver.md | 66 ---- .../contract.RetryMessageExecutionTest.md | 93 ----- .../enum.FlakyMessageReceiverAction.md | 11 - .../contract.RetryReceiptTest.md | 52 --- ...contract.RetrySendCrossChainMessageTest.md | 36 -- .../contract.SendCrossChainMessageTest.md | 50 --- .../contract.TeleporterMessengerTest.md | 212 ---------- .../src/src/Teleporter/upgrades/README.md | 6 - .../contract.TeleporterRegistry.md | 38 -- .../abstract.TeleporterUpgradeable.md | 66 ---- .../src/Teleporter/upgrades/tests/README.md | 6 - .../contract.TeleporterRegistryTest.md | 138 ------- .../contract.ExampleUpgradeableApp.md | 29 -- .../contract.TeleporterUpgradeableTest.md | 65 --- .../abstract.WarpProtocolRegistry.md | 154 -------- .../struct.ProtocolRegistryEntry.md | 13 - 67 files changed, 4101 deletions(-) delete mode 100644 contracts/docs/.gitignore delete mode 100644 contracts/docs/book.css delete mode 100644 contracts/docs/book.toml delete mode 100644 contracts/docs/solidity.min.js delete mode 100644 contracts/docs/src/README.md delete mode 100644 contracts/docs/src/SUMMARY.md delete mode 100644 contracts/docs/src/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol/contract.BridgeToken.md delete mode 100644 contracts/docs/src/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol/contract.ERC20Bridge.md delete mode 100644 contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md delete mode 100644 contracts/docs/src/src/CrossChainApplications/ERC20Bridge/README.md delete mode 100644 contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md delete mode 100644 contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/README.md delete mode 100644 contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md delete mode 100644 contracts/docs/src/src/CrossChainApplications/ExampleMessenger/README.md delete mode 100644 contracts/docs/src/src/CrossChainApplications/README.md delete mode 100644 contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md delete mode 100644 contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md delete mode 100644 contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/README.md delete mode 100644 contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md delete mode 100644 contracts/docs/src/src/Mocks/README.md delete mode 100644 contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md delete mode 100644 contracts/docs/src/src/README.md delete mode 100644 contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md delete mode 100644 contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md delete mode 100644 contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md delete mode 100644 contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md delete mode 100644 contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md delete mode 100644 contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md delete mode 100644 contracts/docs/src/src/Teleporter/README.md delete mode 100644 contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md delete mode 100644 contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md delete mode 100644 contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md delete mode 100644 contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/README.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md delete mode 100644 contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md delete mode 100644 contracts/docs/src/src/Teleporter/upgrades/README.md delete mode 100644 contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md delete mode 100644 contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md delete mode 100644 contracts/docs/src/src/Teleporter/upgrades/tests/README.md delete mode 100644 contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md delete mode 100644 contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md delete mode 100644 contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md delete mode 100644 contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md delete mode 100644 contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md diff --git a/contracts/docs/.gitignore b/contracts/docs/.gitignore deleted file mode 100644 index 4e42a1bcd..000000000 --- a/contracts/docs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -book/ \ No newline at end of file diff --git a/contracts/docs/book.css b/contracts/docs/book.css deleted file mode 100644 index b5ce903f9..000000000 --- a/contracts/docs/book.css +++ /dev/null @@ -1,13 +0,0 @@ -table { - margin: 0 auto; - border-collapse: collapse; - width: 100%; -} - -table td:first-child { - width: 15%; -} - -table td:nth-child(2) { - width: 25%; -} \ No newline at end of file diff --git a/contracts/docs/book.toml b/contracts/docs/book.toml deleted file mode 100644 index 547ed5add..000000000 --- a/contracts/docs/book.toml +++ /dev/null @@ -1,12 +0,0 @@ -[book] -src = "src" -title = "" - -[output.html] -no-section-label = true -additional-js = ["solidity.min.js"] -additional-css = ["book.css"] -git-repository-url = "https://github.com/ava-labs/teleporter" - -[output.html.fold] -enable = true diff --git a/contracts/docs/solidity.min.js b/contracts/docs/solidity.min.js deleted file mode 100644 index 192493291..000000000 --- a/contracts/docs/solidity.min.js +++ /dev/null @@ -1,74 +0,0 @@ -hljs.registerLanguage("solidity",(()=>{"use strict";function e(){try{return!0 -}catch(e){return!1}} -var a=/-?(\b0[xX]([a-fA-F0-9]_?)*[a-fA-F0-9]|(\b[1-9](_?\d)*(\.((\d_?)*\d)?)?|\.\d(_?\d)*)([eE][-+]?\d(_?\d)*)?|\b0)(?!\w|\$)/ -;e()&&(a=a.source.replace(/\\b/g,"(?{ -var a=r(e),o=l(e),c=/[A-Za-z_$][A-Za-z_$0-9.]*/,d=e.inherit(e.TITLE_MODE,{ -begin:/[A-Za-z$_][0-9A-Za-z$_]*/,lexemes:c,keywords:n}),u={className:"params", -begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,lexemes:c,keywords:n, -contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a,o,s]},_={ -className:"operator",begin:/:=|->/};return{keywords:n,lexemes:c, -contains:[a,o,i,t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s,_,{ -className:"function",lexemes:c,beginKeywords:"function",end:"{",excludeEnd:!0, -contains:[d,u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,_]}]}}, -solAposStringMode:r,solQuoteStringMode:l,HEX_APOS_STRING_MODE:i, -HEX_QUOTE_STRING_MODE:t,SOL_NUMBER:s,isNegativeLookbehindAvailable:e} -;const{baseAssembly:c,solAposStringMode:d,solQuoteStringMode:u,HEX_APOS_STRING_MODE:_,HEX_QUOTE_STRING_MODE:m,SOL_NUMBER:b,isNegativeLookbehindAvailable:E}=o -;return e=>{for(var a=d(e),s=u(e),n=[],i=0;i<32;i++)n[i]=i+1 -;var t=n.map((e=>8*e)),r=[];for(i=0;i<=80;i++)r[i]=i -;var l=n.map((e=>"bytes"+e)).join(" ")+" ",o=t.map((e=>"uint"+e)).join(" ")+" ",g=t.map((e=>"int"+e)).join(" ")+" ",M=[].concat.apply([],t.map((e=>r.map((a=>e+"x"+a))))),p={ -keyword:"var bool string int uint "+g+o+"byte bytes "+l+"fixed ufixed "+M.map((e=>"fixed"+e)).join(" ")+" "+M.map((e=>"ufixed"+e)).join(" ")+" enum struct mapping address new delete if else for while continue break return throw emit try catch revert unchecked _ function modifier event constructor fallback receive error virtual override constant immutable anonymous indexed storage memory calldata external public internal payable pure view private returns import from as using pragma contract interface library is abstract type assembly", -literal:"true false wei gwei szabo finney ether seconds minutes hours days weeks years", -built_in:"self this super selfdestruct suicide now msg block tx abi blockhash gasleft assert require Error Panic sha3 sha256 keccak256 ripemd160 ecrecover addmod mulmod log0 log1 log2 log3 log4" -},O={className:"operator",begin:/[+\-!~*\/%<>&^|=]/ -},C=/[A-Za-z_$][A-Za-z_$0-9]*/,N={className:"params",begin:/\(/,end:/\)/, -excludeBegin:!0,excludeEnd:!0,lexemes:C,keywords:p, -contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a,s,b,"self"]},f={ -begin:/\.\s*/,end:/[^A-Za-z0-9$_\.]/,excludeBegin:!0,excludeEnd:!0,keywords:{ -built_in:"gas value selector address length push pop send transfer call callcode delegatecall staticcall balance code codehash wrap unwrap name creationCode runtimeCode interfaceId min max" -},relevance:2},y=e.inherit(e.TITLE_MODE,{begin:/[A-Za-z$_][0-9A-Za-z$_]*/, -lexemes:C,keywords:p}),w={className:"built_in", -begin:(E()?"(? mapping(address => mapping(address => bool))) public submittedBridgeTokenCreations; -``` - - -### bridgedBalances - -```solidity -mapping(bytes32 => mapping(address => mapping(address => uint256))) public bridgedBalances; -``` - - -### wrappedTokenContracts - -```solidity -mapping(address => bool) public wrappedTokenContracts; -``` - - -### nativeToWrappedTokens - -```solidity -mapping(bytes32 => mapping(address => mapping(address => address))) public nativeToWrappedTokens; -``` - - -### CREATE_BRIDGE_TOKENS_REQUIRED_GAS - -```solidity -uint256 public constant CREATE_BRIDGE_TOKENS_REQUIRED_GAS = 2_000_000; -``` - - -### MINT_BRIDGE_TOKENS_REQUIRED_GAS - -```solidity -uint256 public constant MINT_BRIDGE_TOKENS_REQUIRED_GAS = 200_000; -``` - - -### TRANSFER_BRIDGE_TOKENS_REQUIRED_GAS - -```solidity -uint256 public constant TRANSFER_BRIDGE_TOKENS_REQUIRED_GAS = 300_000; -``` - - -## Functions -### constructor - -*Initializes the Teleporter Messenger used for sending and receiving messages, -and initializes the current chain ID.* - - -```solidity -constructor(address teleporterRegistryAddress) TeleporterUpgradeable(teleporterRegistryAddress); -``` - -### bridgeTokens - -*See {IERC20Bridge-bridgeTokens}. -Requirements: -- `destinationChainID` cannot be the same as the current chain ID. -- For wrapped tokens, `totalAmount` must be greater than the sum of the primary and secondary fee amounts. -- For native tokens, `adjustedAmount` after safe transfer must be greater than the primary fee amount.* - - -```solidity -function bridgeTokens( - bytes32 destinationChainID, - address destinationBridgeAddress, - address tokenContractAddress, - address recipient, - uint256 totalAmount, - uint256 primaryFeeAmount, - uint256 secondaryFeeAmount -) external nonReentrant; -``` - -### submitCreateBridgeToken - -*See {IERC20Bridge-submitCreateBridgeToken}. -We allow for `submitCreateBridgeToken` to be called multiple times with the same bridge and token -information because a previous message may have been dropped or otherwise selectively not delivered. -If the bridge token already exists on the destination, we are sending a message that will -simply have no effect on the destination. -Emits a {SubmitCreateBridgeToken} event.* - - -```solidity -function submitCreateBridgeToken( - bytes32 destinationChainID, - address destinationBridgeAddress, - ERC20 nativeToken, - address messageFeeAsset, - uint256 messageFeeAmount -) external nonReentrant; -``` - -### receiveTeleporterMessage - -*See {ITeleporterReceiver-receiveTeleporterMessage}. -Receives a Teleporter message and routes to the appropriate internal function call.* - - -```solidity -function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes calldata message) - external - onlyAllowedTeleporter; -``` - -### updateMinTeleporterVersion - -*See {TeleporterUpgradeable-updateMinTeleporterVersion} -Updates the minimum Teleporter version allowed for receiving on this contract -to the latest version registered in the {TeleporterRegistry}. -Restricted to only owners of the contract. -Emits a {MinTeleporterVersionUpdated} event.* - - -```solidity -function updateMinTeleporterVersion() external override onlyOwner; -``` - -### encodeCreateBridgeTokenData - -*Encodes the parameters for the Create action to be decoded and executed on the destination.* - - -```solidity -function encodeCreateBridgeTokenData( - address nativeContractAddress, - string memory nativeName, - string memory nativeSymbol, - uint8 nativeDecimals -) public pure returns (bytes memory); -``` - -### encodeMintBridgeTokensData - -*Encodes the parameters for the Mint action to be decoded and executed on the destination.* - - -```solidity -function encodeMintBridgeTokensData(address nativeContractAddress, address recipient, uint256 bridgeAmount) - public - pure - returns (bytes memory); -``` - -### encodeTransferBridgeTokensData - -*Encodes the parameters for the Transfer action to be decoded and executed on the destination.* - - -```solidity -function encodeTransferBridgeTokensData( - bytes32 destinationChainID, - address destinationBridgeAddress, - address nativeContractAddress, - address recipient, - uint256 amount, - uint256 feeAmount -) public pure returns (bytes memory); -``` - -### _createBridgeToken - -*Teleporter message receiver for creating a new bridge token on this chain. -Emits a {CreateBridgeToken} event. -Note: This function is only called within `receiveTeleporterMessage`, which can only be -called by the Teleporter Messenger.* - - -```solidity -function _createBridgeToken( - bytes32 nativeChainID, - address nativeBridgeAddress, - address nativeContractAddress, - string memory nativeName, - string memory nativeSymbol, - uint8 nativeDecimals -) private; -``` - -### _mintBridgeTokens - -*Teleporter message receiver for minting of an existing bridge token on this chain. -Emits a {MintBridgeTokens} event. -Note: This function is only called within `receiveTeleporterMessage`, which can only be -called by the Teleporter Messenger.* - - -```solidity -function _mintBridgeTokens( - bytes32 nativeChainID, - address nativeBridgeAddress, - address nativeContractAddress, - address recipient, - uint256 amount -) private nonReentrant; -``` - -### _transferBridgeTokens - -*Teleporter message receiver for handling bridge tokens transfers back from another chain -and optionally routing them to a different third chain. -Note: This function is only called within `receiveTeleporterMessage`, which can only be -called by the Teleporter Messenger.* - - -```solidity -function _transferBridgeTokens( - bytes32 sourceChainID, - address sourceBridgeAddress, - bytes32 destinationChainID, - address destinationBridgeAddress, - address nativeContractAddress, - address recipient, - uint256 totalAmount, - uint256 secondaryFeeAmount -) private nonReentrant; -``` - -### _processNativeTokenTransfer - -*Increments the balance of the native tokens bridged to the specified bridge instance and -sends a Teleporter message to have the destination bridge mint the new tokens. The tokens to be -bridge must already be locked in this contract before calling. -Emits a {BridgeTokens} event. -Requirements: -- `destinationChainID` cannot be the same as the current chain ID. -- can not do nested bridging of wrapped tokens.* - - -```solidity -function _processNativeTokenTransfer( - bytes32 destinationChainID, - address destinationBridgeAddress, - address nativeContractAddress, - address recipient, - uint256 totalAmount, - uint256 feeAmount -) private; -``` - -### _processWrappedTokenTransfer - -*Processes a wrapped token transfer by burning the tokens and sending a Teleporter message -to the native chain and bridge of the wrapped asset that was burned. -It is the caller's responsibility to ensure that the wrapped token contract is supported by this bridge instance. -Emits a {BridgeTokens} event.* - - -```solidity -function _processWrappedTokenTransfer(WrappedTokenTransferInfo memory wrappedTransferInfo) private; -``` - -## Structs -### WrappedTokenTransferInfo - -```solidity -struct WrappedTokenTransferInfo { - bytes32 destinationChainID; - address destinationBridgeAddress; - address wrappedContractAddress; - address recipient; - uint256 totalAmount; - uint256 primaryFeeAmount; - uint256 secondaryFeeAmount; -} -``` - diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md deleted file mode 100644 index 62e8509fb..000000000 --- a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol/interface.IERC20Bridge.md +++ /dev/null @@ -1,103 +0,0 @@ -# IERC20Bridge -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol) - -*Interface that describes functionalities for a cross-chain ERC20 bridge.* - - -## Functions -### bridgeTokens - -*Transfers ERC20 tokens to another chain. -This can be wrapping, unwrapping, and transferring a wrapped token between two non-native chains.* - - -```solidity -function bridgeTokens( - bytes32 destinationChainID, - address destinationBridgeAddress, - address tokenContractAddress, - address recipient, - uint256 totalAmount, - uint256 primaryFeeAmount, - uint256 secondaryFeeAmount -) external; -``` - -### submitCreateBridgeToken - -*Creates a new bridge token on another chain.* - - -```solidity -function submitCreateBridgeToken( - bytes32 destinationChainID, - address destinationBridgeAddress, - ERC20 nativeToken, - address messageFeeAsset, - uint256 messageFeeAmount -) external; -``` - -## Events -### BridgeTokens -*Emitted when tokens are locked in this bridge contract to be bridged to another chain.* - - -```solidity -event BridgeTokens( - address indexed tokenContractAddress, - bytes32 indexed destinationChainID, - uint256 indexed teleporterMessageID, - address destinationBridgeAddress, - address recipient, - uint256 amount -); -``` - -### SubmitCreateBridgeToken -*Emitted when submitting a request to create a new bridge token on another chain.* - - -```solidity -event SubmitCreateBridgeToken( - bytes32 indexed destinationChainID, - address indexed destinationBridgeAddress, - address indexed nativeContractAddress, - uint256 teleporterMessageID -); -``` - -### CreateBridgeToken -*Emitted when creating a new bridge token.* - - -```solidity -event CreateBridgeToken( - bytes32 indexed nativeChainID, - address indexed nativeBridgeAddress, - address indexed nativeContractAddress, - address bridgeTokenAddress -); -``` - -### MintBridgeTokens -*Emitted when minting bridge tokens.* - - -```solidity -event MintBridgeTokens(address indexed contractAddress, address recipient, uint256 amount); -``` - -## Enums -### BridgeAction -*Enum representing the action to take on receiving a Teleporter message.* - - -```solidity -enum BridgeAction { - Create, - Mint, - Transfer -} -``` - diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/README.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/README.md deleted file mode 100644 index 605e5b88d..000000000 --- a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/README.md +++ /dev/null @@ -1,7 +0,0 @@ - - -# Contents -- [tests](/src/CrossChainApplications/ERC20Bridge/tests) -- [BridgeToken](BridgeToken.sol/contract.BridgeToken.md) -- [ERC20Bridge](ERC20Bridge.sol/contract.ERC20Bridge.md) -- [IERC20Bridge](IERC20Bridge.sol/interface.IERC20Bridge.md) diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md deleted file mode 100644 index a7b30048c..000000000 --- a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md +++ /dev/null @@ -1,301 +0,0 @@ -# ERC20BridgeTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol) - -**Inherits:** -Test - - -## State Variables -### MOCK_TELEPORTER_MESSENGER_ADDRESS - -```solidity -address public constant MOCK_TELEPORTER_MESSENGER_ADDRESS = 0x644E5b7c5D4Bc8073732CEa72c66e0BB90dFC00f; -``` - - -### MOCK_TELEPORTER_REGISTRY_ADDRESS - -```solidity -address public constant MOCK_TELEPORTER_REGISTRY_ADDRESS = 0xf9FA4a0c696b659328DDaaBCB46Ae4eBFC9e68e4; -``` - - -### WARP_PRECOMPILE_ADDRESS - -```solidity -address public constant WARP_PRECOMPILE_ADDRESS = address(0x0200000000000000000000000000000000000005); -``` - - -### _MOCK_BLOCKCHAIN_ID - -```solidity -bytes32 private constant _MOCK_BLOCKCHAIN_ID = bytes32(uint256(123456)); -``` - - -### _DEFAULT_OTHER_CHAIN_ID - -```solidity -bytes32 private constant _DEFAULT_OTHER_CHAIN_ID = - bytes32(hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd"); -``` - - -### _DEFAULT_OTHER_BRIDGE_ADDRESS - -```solidity -address private constant _DEFAULT_OTHER_BRIDGE_ADDRESS = 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; -``` - - -### _DEFAULT_TOKEN_NAME - -```solidity -string private constant _DEFAULT_TOKEN_NAME = "Test Token"; -``` - - -### _DEFAULT_SYMBOL - -```solidity -string private constant _DEFAULT_SYMBOL = "TSTTK"; -``` - - -### _DEFAULT_DECIMALS - -```solidity -uint8 private constant _DEFAULT_DECIMALS = 18; -``` - - -### _DEFAULT_RECIPIENT - -```solidity -address private constant _DEFAULT_RECIPIENT = 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; -``` - - -### erc20Bridge - -```solidity -ERC20Bridge public erc20Bridge; -``` - - -### mockERC20 - -```solidity -UnitTestMockERC20 public mockERC20; -``` - - -## Functions -### setUp - - -```solidity -function setUp() public virtual; -``` - -### testSameChainID - - -```solidity -function testSameChainID() public; -``` - -### testInvalidFeeAmountsNativeTransfer - - -```solidity -function testInvalidFeeAmountsNativeTransfer() public; -``` - -### testInvalidFeeAmountsWrappedTransfer - - -```solidity -function testInvalidFeeAmountsWrappedTransfer() public; -``` - -### testNativeTokenTransferFailure - - -```solidity -function testNativeTokenTransferFailure() public; -``` - -### testBridgeNativeTokensNoFee - - -```solidity -function testBridgeNativeTokensNoFee() public; -``` - -### testFeeApprovalFails - - -```solidity -function testFeeApprovalFails() public; -``` - -### testBridgeNativeTokensWithFee - - -```solidity -function testBridgeNativeTokensWithFee() public; -``` - -### testBridgeNativeFeeOnTransferTokens - - -```solidity -function testBridgeNativeFeeOnTransferTokens() public; -``` - -### testBridgeNativeFeeOnTransferAmountTooHigh - - -```solidity -function testBridgeNativeFeeOnTransferAmountTooHigh() public; -``` - -### testNewBridgeTokenMint - - -```solidity -function testNewBridgeTokenMint() public; -``` - -### testMintExistingBridgeToken - - -```solidity -function testMintExistingBridgeToken() public; -``` - -### testZeroTeleporterRegistryAddress - - -```solidity -function testZeroTeleporterRegistryAddress() public; -``` - -### testUpdateMinTeleporterVersion - - -```solidity -function testUpdateMinTeleporterVersion() public; -``` - -### _initMockTeleporterRegistry - - -```solidity -function _initMockTeleporterRegistry() internal; -``` - -### _setUpExpectedTransferFromCall - - -```solidity -function _setUpExpectedTransferFromCall(address tokenContract, uint256 amount) private; -``` - -### _submitCreateBridgeToken - - -```solidity -function _submitCreateBridgeToken( - bytes32 destinationChainID, - address destinationBridgeAddress, - address nativeContractAddress -) private; -``` - -### _setUpBridgeToken - - -```solidity -function _setUpBridgeToken( - bytes32 nativeChainID, - address nativeBridgeAddress, - address nativeContractAddress, - string memory nativeName, - string memory nativeSymbol, - uint8 nativeDecimals, - uint8 contractNonce -) private returns (address); -``` - -### _setUpMockERC20ContractValues - - -```solidity -function _setUpMockERC20ContractValues(address tokenContract) private; -``` - -### _deriveExpectedContractAddress - - -```solidity -function _deriveExpectedContractAddress(address creator, uint8 nonce) private pure returns (address); -``` - -### _formatERC20BridgeErrorMessage - - -```solidity -function _formatERC20BridgeErrorMessage(string memory errorMessage) private pure returns (bytes memory); -``` - -## Events -### BridgeTokens - -```solidity -event BridgeTokens( - address indexed tokenContractAddress, - bytes32 indexed destinationChainID, - uint256 indexed teleporterMessageID, - address destinationBridgeAddress, - address recipient, - uint256 amount -); -``` - -### SubmitCreateBridgeToken - -```solidity -event SubmitCreateBridgeToken( - bytes32 indexed destinationChainID, - address indexed destinationBridgeAddress, - address indexed nativeContractAddress, - uint256 teleporterMessageID -); -``` - -### CreateBridgeToken - -```solidity -event CreateBridgeToken( - bytes32 indexed nativeChainID, - address indexed nativeBridgeAddress, - address indexed nativeContractAddress, - address bridgeTokenAddress -); -``` - -### MintBridgeTokens - -```solidity -event MintBridgeTokens(address indexed contractAddress, address recipient, uint256 amount); -``` - -### MinTeleporterVersionUpdated - -```solidity -event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion); -``` - diff --git a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/README.md b/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/README.md deleted file mode 100644 index 62b129ecf..000000000 --- a/contracts/docs/src/src/CrossChainApplications/ERC20Bridge/tests/README.md +++ /dev/null @@ -1,4 +0,0 @@ - - -# Contents -- [ERC20BridgeTest](ERC20BridgeTests.t.sol/contract.ERC20BridgeTest.md) diff --git a/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md b/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md deleted file mode 100644 index 745afb0a5..000000000 --- a/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md +++ /dev/null @@ -1,110 +0,0 @@ -# ExampleCrossChainMessenger -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol) - -**Inherits:** -[ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md), ReentrancyGuard, [TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md), Ownable - -*ExampleCrossChainMessenger is an example contract that demonstrates how to send and receive -messages cross chain.* - - -## State Variables -### _messages - -```solidity -mapping(bytes32 => Message) private _messages; -``` - - -## Functions -### constructor - - -```solidity -constructor(address teleporterRegistryAddress) TeleporterUpgradeable(teleporterRegistryAddress); -``` - -### receiveTeleporterMessage - -*See {ITeleporterReceiver-receiveTeleporterMessage}. -Receives a message from another chain.* - - -```solidity -function receiveTeleporterMessage(bytes32 originChainID, address originSenderAddress, bytes calldata message) - external - onlyAllowedTeleporter; -``` - -### sendMessage - -*Sends a message to another chain.* - - -```solidity -function sendMessage( - bytes32 destinationChainID, - address destinationAddress, - address feeContractAddress, - uint256 feeAmount, - uint256 requiredGasLimit, - string calldata message -) external nonReentrant returns (uint256 messageID); -``` - -### updateMinTeleporterVersion - -*See {TeleporterUpgradeable-updateMinTeleporterVersion} -Updates the minimum Teleporter version allowed for receiving on this contract -to the latest version registered in the {TeleporterRegistry}. Also restricts this function to -the owner of this contract. -Emits a {MinTeleporterVersionUpdated} event.* - - -```solidity -function updateMinTeleporterVersion() external override onlyOwner; -``` - -### getCurrentMessage - -*Returns the current message from another chain.* - - -```solidity -function getCurrentMessage(bytes32 originChainID) external view returns (address sender, string memory message); -``` - -## Events -### SendMessage -*Emitted when a message is submited to be sent.* - - -```solidity -event SendMessage( - bytes32 indexed destinationChainID, - address indexed destinationAddress, - address feeAsset, - uint256 feeAmount, - uint256 requiredGasLimit, - string message -); -``` - -### ReceiveMessage -*Emitted when a new message is received from a given chain ID.* - - -```solidity -event ReceiveMessage(bytes32 indexed originChainID, address indexed originSenderAddress, string message); -``` - -## Structs -### Message - -```solidity -struct Message { - address sender; - string message; -} -``` - diff --git a/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/README.md b/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/README.md deleted file mode 100644 index 404ea72bb..000000000 --- a/contracts/docs/src/src/CrossChainApplications/ExampleMessenger/README.md +++ /dev/null @@ -1,4 +0,0 @@ - - -# Contents -- [ExampleCrossChainMessenger](ExampleCrossChainMessenger.sol/contract.ExampleCrossChainMessenger.md) diff --git a/contracts/docs/src/src/CrossChainApplications/README.md b/contracts/docs/src/src/CrossChainApplications/README.md deleted file mode 100644 index 38856eedb..000000000 --- a/contracts/docs/src/src/CrossChainApplications/README.md +++ /dev/null @@ -1,6 +0,0 @@ - - -# Contents -- [ERC20Bridge](/src/CrossChainApplications/ERC20Bridge) -- [ExampleMessenger](/src/CrossChainApplications/ExampleMessenger) -- [VerifiedBlockHash](/src/CrossChainApplications/VerifiedBlockHash) diff --git a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md deleted file mode 100644 index 2a9dd2e4f..000000000 --- a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol/contract.BlockHashPublisher.md +++ /dev/null @@ -1,54 +0,0 @@ -# BlockHashPublisher -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol) - -Contract that publishes the latest block hash of current chain to another chain. - - -## State Variables -### RECEIVE_BLOCK_HASH_REQUIRED_GAS_LIMIT - -```solidity -uint256 public constant RECEIVE_BLOCK_HASH_REQUIRED_GAS_LIMIT = 1.5e5; -``` - - -### teleporterRegistry - -```solidity -TeleporterRegistry public immutable teleporterRegistry; -``` - - -## Functions -### constructor - - -```solidity -constructor(address teleporterRegistryAddress); -``` - -### publishLatestBlockHash - -*Publishes the latest block hash to another chain.* - - -```solidity -function publishLatestBlockHash(bytes32 destinationChainID, address destinationAddress) - external - returns (uint256 messageID); -``` - -## Events -### PublishBlockHash -*Emitted when a block hash is submitted to be published to another chain.* - - -```solidity -event PublishBlockHash( - bytes32 indexed destinationChainID, - address indexed destinationAddress, - uint256 indexed blockHeight, - bytes32 blockHash -); -``` - diff --git a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md deleted file mode 100644 index 923a47137..000000000 --- a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol/contract.BlockHashReceiver.md +++ /dev/null @@ -1,95 +0,0 @@ -# BlockHashReceiver -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol) - -**Inherits:** -[ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md), [TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md), Ownable - -Contract for receiving latest block hashes from another chain. - - -## State Variables -### sourceChainID - -```solidity -bytes32 public immutable sourceChainID; -``` - - -### sourcePublisherContractAddress - -```solidity -address public immutable sourcePublisherContractAddress; -``` - - -### latestBlockHeight - -```solidity -uint256 public latestBlockHeight; -``` - - -### latestBlockHash - -```solidity -bytes32 public latestBlockHash; -``` - - -## Functions -### constructor - - -```solidity -constructor(address teleporterRegistryAddress, bytes32 publisherChainID, address publisherContractAddress) - TeleporterUpgradeable(teleporterRegistryAddress); -``` - -### receiveTeleporterMessage - -*See {ITeleporterReceiver-receiveTeleporterMessage}. -Receives the latest block hash from another chain -Requirements: -- Sender must be the Teleporter contract. -- Origin sender address must be the source publisher contract address that initiated the BlockHashReceiver.* - - -```solidity -function receiveTeleporterMessage(bytes32 originChainID, address originSenderAddress, bytes calldata message) - external - onlyAllowedTeleporter; -``` - -### updateMinTeleporterVersion - -*See {TeleporterUpgradeable-updateMinTeleporterVersion} -Updates the minimum Teleporter version allowed for receiving on this contract -to the latest version registered in the {TeleporterRegistry}. -Restricted to only owners of the contract. -Emits a {MinTeleporterVersionUpdated} event.* - - -```solidity -function updateMinTeleporterVersion() external override onlyOwner; -``` - -### getLatestBlockInfo - -*Returns the latest block information.* - - -```solidity -function getLatestBlockInfo() public view returns (uint256 height, bytes32 hash); -``` - -## Events -### ReceiveBlockHash -*Emitted when a new block hash is received from a given origin chain ID.* - - -```solidity -event ReceiveBlockHash( - bytes32 indexed originChainID, address indexed originSenderAddress, uint256 indexed blockHeight, bytes32 blockHash -); -``` - diff --git a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/README.md b/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/README.md deleted file mode 100644 index 2949021c3..000000000 --- a/contracts/docs/src/src/CrossChainApplications/VerifiedBlockHash/README.md +++ /dev/null @@ -1,5 +0,0 @@ - - -# Contents -- [BlockHashPublisher](BlockHashPublisher.sol/contract.BlockHashPublisher.md) -- [BlockHashReceiver](BlockHashReceiver.sol/contract.BlockHashReceiver.md) diff --git a/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md b/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md deleted file mode 100644 index f06849ef5..000000000 --- a/contracts/docs/src/src/Mocks/ExampleERC20.sol/contract.ExampleERC20.md +++ /dev/null @@ -1,44 +0,0 @@ -# ExampleERC20 -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Mocks/ExampleERC20.sol) - -**Inherits:** -ERC20Burnable - - -## State Variables -### _TOKEN_NAME - -```solidity -string private constant _TOKEN_NAME = "Mock Token"; -``` - - -### _TOKEN_SYMBOL - -```solidity -string private constant _TOKEN_SYMBOL = "EXMP"; -``` - - -### _MAX_MINT - -```solidity -uint256 private constant _MAX_MINT = 10_000_000_000_000_000; -``` - - -## Functions -### constructor - - -```solidity -constructor() ERC20(_TOKEN_NAME, _TOKEN_SYMBOL); -``` - -### mint - - -```solidity -function mint(uint256 amount) public; -``` - diff --git a/contracts/docs/src/src/Mocks/README.md b/contracts/docs/src/src/Mocks/README.md deleted file mode 100644 index f64417a8c..000000000 --- a/contracts/docs/src/src/Mocks/README.md +++ /dev/null @@ -1,5 +0,0 @@ - - -# Contents -- [ExampleERC20](ExampleERC20.sol/contract.ExampleERC20.md) -- [UnitTestMockERC20](UnitTestMockERC20.sol/contract.UnitTestMockERC20.md) diff --git a/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md b/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md deleted file mode 100644 index bfda54fb1..000000000 --- a/contracts/docs/src/src/Mocks/UnitTestMockERC20.sol/contract.UnitTestMockERC20.md +++ /dev/null @@ -1,41 +0,0 @@ -# UnitTestMockERC20 -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Mocks/UnitTestMockERC20.sol) - - -## State Variables -### mockBalances - -```solidity -mapping(address => uint256) public mockBalances; -``` - - -### feeOnTransferSenders - -```solidity -mapping(address => uint256) public feeOnTransferSenders; -``` - - -## Functions -### setFeeOnTransferSender - - -```solidity -function setFeeOnTransferSender(address sender, uint256 feeAmount) public; -``` - -### transferFrom - - -```solidity -function transferFrom(address from, address to, uint256 amount) public returns (bool); -``` - -### balanceOf - - -```solidity -function balanceOf(address account) public view returns (uint256); -``` - diff --git a/contracts/docs/src/src/README.md b/contracts/docs/src/src/README.md deleted file mode 100644 index 2ed2a1a36..000000000 --- a/contracts/docs/src/src/README.md +++ /dev/null @@ -1,8 +0,0 @@ - - -# Contents -- [CrossChainApplications](/src/CrossChainApplications) -- [Mocks](/src/Mocks) -- [Teleporter](/src/Teleporter) -- [ProtocolRegistryEntry](WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md) -- [WarpProtocolRegistry](WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md) diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md deleted file mode 100644 index cfdc1168e..000000000 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md +++ /dev/null @@ -1,241 +0,0 @@ -# ITeleporterMessenger -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ITeleporterMessenger.sol) - -*Interface that describes functionalities for a cross-chain messenger implementing the Teleporter protcol.* - - -## Functions -### sendCrossChainMessage - -*Called by transactions to initiate the sending of a cross-chain message.* - - -```solidity -function sendCrossChainMessage(TeleporterMessageInput calldata messageInput) external returns (uint256 messageID); -``` - -### retrySendCrossChainMessage - -*Called by transactions to retry the sending of a cross-chain message. -Retriggers the sending of a message previously emitted by sendCrossChainMessage that has not yet been acknowledged -with a receipt from the destination chain. This may be necessary in the unlikely event that less than the required -threshold of stake weight successfully inserted the message in their messages DB at the time of the first submission. -The message is checked to have already been previously submitted by comparing its message hash against those kept in -state until a receipt is received for the message.* - - -```solidity -function retrySendCrossChainMessage(bytes32 destinationChainID, TeleporterMessage calldata message) external; -``` - -### addFeeAmount - -*Adds the additional fee amount to the amount to be paid to the relayer that delivers -the given message ID to the destination chain. -The fee contract address must be the same asset type as the fee asset specified in the original -call to sendCrossChainMessage. Returns a failure if the message doesn't exist or there is already -receipt of delivery of the message.* - - -```solidity -function addFeeAmount( - bytes32 destinationChainID, - uint256 messageID, - address feeContractAddress, - uint256 additionalFeeAmount -) external; -``` - -### receiveCrossChainMessage - -*Receives a cross-chain message, and marks the `relayerRewardAddress` for fee reward for a successful delivery. -The message specified by `messageIndex` must be provided at that index in the access list storage slots of the transaction, -and is verified in the precompile predicate.* - - -```solidity -function receiveCrossChainMessage(uint32 messageIndex, address relayerRewardAddress) external; -``` - -### retryMessageExecution - -*Retries the execution of a previously delivered message by verifying the payload matches -the hash of the payload originally delivered, and calling the destination address again. -Intended to be used if message excution failed on initial delivery of the Teleporter message. -For example, this may occur if the original required gas limit was not sufficient for the message -execution, or if the destination address did not contain a contract, but a compatible contract -was later deployed to that address. Messages are ensured to be successfully executed at most once.* - - -```solidity -function retryMessageExecution(bytes32 originChainID, TeleporterMessage calldata message) external; -``` - -### retryReceipts - -*Retries the sending of receipts for the given `messageIDs`. -Sends the specified message receipts in a new message (with an empty payload) back to the origin chain. -This is intended to be used if the message receipts were originally included in messages that were dropped -or otherwise not delivered in a timely manner.* - - -```solidity -function retryReceipts( - bytes32 originChainID, - uint256[] calldata messageIDs, - TeleporterFeeInfo calldata feeInfo, - address[] calldata allowedRelayerAddresses -) external returns (uint256 messageID); -``` - -### redeemRelayerRewards - -*Sends any fee amount rewards for the given fee asset out to the caller.* - - -```solidity -function redeemRelayerRewards(address feeAsset) external; -``` - -### getMessageHash - -*Gets the hash of a given message stored in the EVM state, if the message exists.* - - -```solidity -function getMessageHash(bytes32 destinationChainID, uint256 messageID) external view returns (bytes32 messageHash); -``` - -### messageReceived - -*Checks whether or not the given message has been received by this chain.* - - -```solidity -function messageReceived(bytes32 originChainID, uint256 messageID) external view returns (bool delivered); -``` - -### getRelayerRewardAddress - -*Returns the address the relayer reward should be sent to on the origin chain -for a given message, assuming that the message has already been delivered.* - - -```solidity -function getRelayerRewardAddress(bytes32 originChainID, uint256 messageID) - external - view - returns (address relayerRewardAddress); -``` - -### checkRelayerRewardAmount - -Gets the current reward amount of a given fee asset that is redeemable by the given relayer. - - -```solidity -function checkRelayerRewardAmount(address relayer, address feeAsset) external view returns (uint256); -``` - -### getFeeInfo - -*Gets the fee asset and amount for a given message.* - - -```solidity -function getFeeInfo(bytes32 destinationChainID, uint256 messageID) - external - view - returns (address feeAsset, uint256 feeAmount); -``` - -### getReceiptQueueSize - -*Gets the number of receipts that have been sent to the given destination chain ID.* - - -```solidity -function getReceiptQueueSize(bytes32 chainID) external view returns (uint256 size); -``` - -### getReceiptAtIndex - -*Gets the receipt at the given index in the queue for the given chain ID.* - - -```solidity -function getReceiptAtIndex(bytes32 chainID, uint256 index) - external - view - returns (TeleporterMessageReceipt memory receipt); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`chainID`|`bytes32`|The chain ID to get the receipt queue for.| -|`index`|`uint256`|The index of the receipt to get, starting from 0.| - - -## Events -### SendCrossChainMessage -*Emitted when sending a Teleporter message cross-chain.* - - -```solidity -event SendCrossChainMessage( - bytes32 indexed destinationChainID, uint256 indexed messageID, TeleporterMessage message, TeleporterFeeInfo feeInfo -); -``` - -### AddFeeAmount -*Emitted when an additional fee amount is added to a Teleporter message that had previously -been sent, but not yet delivered to the destination chain.* - - -```solidity -event AddFeeAmount(bytes32 indexed destinationChainID, uint256 indexed messageID, TeleporterFeeInfo updatedFeeInfo); -``` - -### MessageExecutionFailed -*Emitted when a Teleporter message is being delivered on the destination chain to an address, -but message execution fails. Failed messages can then be retried with `retryMessageExecution`* - - -```solidity -event MessageExecutionFailed(bytes32 indexed originChainID, uint256 indexed messageID, TeleporterMessage message); -``` - -### MessageExecuted -*Emitted when a Teleporter message is successfully executed with the -specified destination address and message call data. This can occur either when -the message is initially received, or on a retry attempt. -Each message received can be executed successfully at most once.* - - -```solidity -event MessageExecuted(bytes32 indexed originChainID, uint256 indexed messageID); -``` - -### ReceiveCrossChainMessage -*Emitted when a TeleporterMessage is successfully received.* - - -```solidity -event ReceiveCrossChainMessage( - bytes32 indexed originChainID, - uint256 indexed messageID, - address indexed deliverer, - address rewardRedeemer, - TeleporterMessage message -); -``` - -### RelayerRewardsRedeemed -*Emitted when an account redeems accumulated relayer rewards.* - - -```solidity -event RelayerRewardsRedeemed(address indexed redeemer, address indexed asset, uint256 amount); -``` - diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md deleted file mode 100644 index 57032094b..000000000 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md +++ /dev/null @@ -1,11 +0,0 @@ -# TeleporterFeeInfo -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ITeleporterMessenger.sol) - - -```solidity -struct TeleporterFeeInfo { - address contractAddress; - uint256 amount; -} -``` - diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md deleted file mode 100644 index e7282c5dd..000000000 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessage.md +++ /dev/null @@ -1,16 +0,0 @@ -# TeleporterMessage -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ITeleporterMessenger.sol) - - -```solidity -struct TeleporterMessage { - uint256 messageID; - address senderAddress; - address destinationAddress; - uint256 requiredGasLimit; - address[] allowedRelayerAddresses; - TeleporterMessageReceipt[] receipts; - bytes message; -} -``` - diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md deleted file mode 100644 index 1c738af19..000000000 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageInput.md +++ /dev/null @@ -1,15 +0,0 @@ -# TeleporterMessageInput -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ITeleporterMessenger.sol) - - -```solidity -struct TeleporterMessageInput { - bytes32 destinationChainID; - address destinationAddress; - TeleporterFeeInfo feeInfo; - uint256 requiredGasLimit; - address[] allowedRelayerAddresses; - bytes message; -} -``` - diff --git a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md b/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md deleted file mode 100644 index f421fa1c1..000000000 --- a/contracts/docs/src/src/Teleporter/ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md +++ /dev/null @@ -1,11 +0,0 @@ -# TeleporterMessageReceipt -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ITeleporterMessenger.sol) - - -```solidity -struct TeleporterMessageReceipt { - uint256 receivedMessageID; - address relayerRewardAddress; -} -``` - diff --git a/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md b/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md deleted file mode 100644 index 320f06889..000000000 --- a/contracts/docs/src/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md +++ /dev/null @@ -1,25 +0,0 @@ -# ITeleporterReceiver -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ITeleporterReceiver.sol) - -*Interface that cross-chain applications must implement to receive messages from Teleporter.* - - -## Functions -### receiveTeleporterMessage - -*Called by TeleporterMessenger on the receiving chain.* - - -```solidity -function receiveTeleporterMessage(bytes32 originChainID, address originSenderAddress, bytes calldata message) - external; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`originChainID`|`bytes32`|is provided by the TeleporterMessenger contract.| -|`originSenderAddress`|`address`|is provided by the TeleporterMessenger contract.| -|`message`|`bytes`|is the TeleporterMessage payload set by the sender.| - - diff --git a/contracts/docs/src/src/Teleporter/README.md b/contracts/docs/src/src/Teleporter/README.md deleted file mode 100644 index 9034ea0fc..000000000 --- a/contracts/docs/src/src/Teleporter/README.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# Contents -- [tests](/src/Teleporter/tests) -- [upgrades](/src/Teleporter/upgrades) -- [TeleporterMessageReceipt](ITeleporterMessenger.sol/struct.TeleporterMessageReceipt.md) -- [TeleporterMessageInput](ITeleporterMessenger.sol/struct.TeleporterMessageInput.md) -- [TeleporterMessage](ITeleporterMessenger.sol/struct.TeleporterMessage.md) -- [TeleporterFeeInfo](ITeleporterMessenger.sol/struct.TeleporterFeeInfo.md) -- [ITeleporterMessenger](ITeleporterMessenger.sol/interface.ITeleporterMessenger.md) -- [ITeleporterReceiver](ITeleporterReceiver.sol/interface.ITeleporterReceiver.md) -- [ReceiptQueue](ReceiptQueue.sol/library.ReceiptQueue.md) -- [ReentrancyGuards](ReentrancyGuards.sol/abstract.ReentrancyGuards.md) -- [SafeERC20TransferFrom](SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md) -- [TeleporterMessenger](TeleporterMessenger.sol/contract.TeleporterMessenger.md) diff --git a/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md b/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md deleted file mode 100644 index c7143a53c..000000000 --- a/contracts/docs/src/src/Teleporter/ReceiptQueue.sol/library.ReceiptQueue.md +++ /dev/null @@ -1,82 +0,0 @@ -# ReceiptQueue -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ReceiptQueue.sol) - -*ReceiptQueue is a convenience library that creates a queue-like interface of -TeleporterMessageReceipt structs. It provides FIFO properties. -Note: All functions in this library are internal so that the library is not deployed as a contract.* - - -## State Variables -### _MAXIMUM_RECEIPT_COUNT - -```solidity -uint256 private constant _MAXIMUM_RECEIPT_COUNT = 5; -``` - - -## Functions -### enqueue - -*Adds a receipt to the queue.* - - -```solidity -function enqueue(TeleporterMessageReceiptQueue storage queue, TeleporterMessageReceipt memory receipt) internal; -``` - -### dequeue - -*Removes the oldest outstanding receipt from the queue. -Requirements: -- The queue must be non-empty.* - - -```solidity -function dequeue(TeleporterMessageReceiptQueue storage queue) - internal - returns (TeleporterMessageReceipt memory result); -``` - -### getOutstandingReceiptsToSend - -*Returns the outstanding receipts for the given chain ID that should be included in the next message sent.* - - -```solidity -function getOutstandingReceiptsToSend(TeleporterMessageReceiptQueue storage queue) - internal - returns (TeleporterMessageReceipt[] memory result); -``` - -### size - -*Returns the number of outstanding receipts in the queue.* - - -```solidity -function size(TeleporterMessageReceiptQueue storage queue) internal view returns (uint256); -``` - -### getReceiptAtIndex - -*Returns the receipt at the given index in the queue.* - - -```solidity -function getReceiptAtIndex(TeleporterMessageReceiptQueue storage queue, uint256 index) - internal - view - returns (TeleporterMessageReceipt memory); -``` - -## Structs -### TeleporterMessageReceiptQueue - -```solidity -struct TeleporterMessageReceiptQueue { - uint256 first; - uint256 last; - mapping(uint256 index => TeleporterMessageReceipt) data; -} -``` - diff --git a/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md b/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md deleted file mode 100644 index e6dd3856d..000000000 --- a/contracts/docs/src/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md +++ /dev/null @@ -1,61 +0,0 @@ -# ReentrancyGuards -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/ReentrancyGuards.sol) - -*Abstract contract that helps implement reentrancy guards between functions for sending and receiving. -Consecutive calls for sending functions should work together, same for receive functions, but recursive calls -should be detected as a reentrancy and revert. -Calls between send and receive functions should also be allowed, but not in the case it ends up being a recursive -send or receive call. For example the following should fail: send -> receive -> send.* - - -## State Variables -### _NOT_ENTERED - -```solidity -uint256 internal constant _NOT_ENTERED = 1; -``` - - -### _ENTERED - -```solidity -uint256 internal constant _ENTERED = 2; -``` - - -### _sendEntered - -```solidity -uint256 internal _sendEntered; -``` - - -### _receiveEntered - -```solidity -uint256 internal _receiveEntered; -``` - - -## Functions -### senderNonReentrant - - -```solidity -modifier senderNonReentrant(); -``` - -### receiverNonReentrant - - -```solidity -modifier receiverNonReentrant(); -``` - -### constructor - - -```solidity -constructor(); -``` - diff --git a/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md b/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md deleted file mode 100644 index eb7761ce6..000000000 --- a/contracts/docs/src/src/Teleporter/SafeERC20TransferFrom.sol/library.SafeERC20TransferFrom.md +++ /dev/null @@ -1,19 +0,0 @@ -# SafeERC20TransferFrom -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/SafeERC20TransferFrom.sol) - -*Provides a wrapper used for calling an ERC20 transferFrom method -to receive tokens to a contract from msg.sender. -Checks the balance of the recipient before and after the call to transferFrom, and -returns balance increase. Designed for safely handling ERC20 "fee on transfer" and "burn on transfer" implementations. -Note: A reentrancy guard must always be used when calling token.safeTransferFrom in order to -prevent against possible "before-after" pattern vulnerabilities.* - - -## Functions -### safeTransferFrom - - -```solidity -function safeTransferFrom(IERC20 erc20, uint256 amount) internal returns (uint256); -``` - diff --git a/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md b/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md deleted file mode 100644 index bb348c318..000000000 --- a/contracts/docs/src/src/Teleporter/TeleporterMessenger.sol/contract.TeleporterMessenger.md +++ /dev/null @@ -1,372 +0,0 @@ -# TeleporterMessenger -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/TeleporterMessenger.sol) - -**Inherits:** -[ITeleporterMessenger](/src/Teleporter/ITeleporterMessenger.sol/interface.ITeleporterMessenger.md), [ReentrancyGuards](/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md) - -*Implementation of the {ITeleporterMessenger} interface. -This implementation is used to send messages cross-chain using the WarpMessenger precompile, -and to receive messages sent from other chains. Teleporter contracts should be deployed through Nick's method -of universal deployer, such that the same contract is deployed at the same address on all chains.* - - -## State Variables -### WARP_MESSENGER - -```solidity -WarpMessenger public constant WARP_MESSENGER = WarpMessenger(0x0200000000000000000000000000000000000005); -``` - - -### latestMessageIDs - -```solidity -mapping(bytes32 => uint256) public latestMessageIDs; -``` - - -### outstandingReceipts - -```solidity -mapping(bytes32 => ReceiptQueue.TeleporterMessageReceiptQueue) public outstandingReceipts; -``` - - -### sentMessageInfo - -```solidity -mapping(bytes32 => mapping(uint256 => SentMessageInfo)) public sentMessageInfo; -``` - - -### relayerRewardAddresses - -```solidity -mapping(bytes32 => mapping(uint256 => address)) public relayerRewardAddresses; -``` - - -### receivedFailedMessageHashes - -```solidity -mapping(bytes32 => mapping(uint256 => bytes32)) public receivedFailedMessageHashes; -``` - - -### relayerRewardAmounts - -```solidity -mapping(address => mapping(address => uint256)) public relayerRewardAmounts; -``` - - -### blockchainID - -```solidity -bytes32 public blockchainID; -``` - - -## Functions -### sendCrossChainMessage - -*See {ITeleporterMessenger-sendCrossChainMessage} -When executed, a relayer may kick off an asynchronous event to have the validators of the -chain create an aggregate BLS signature of the message. -Emits a {SendCrossChainMessage} event when message successfully gets sent.* - - -```solidity -function sendCrossChainMessage(TeleporterMessageInput calldata messageInput) - external - senderNonReentrant - returns (uint256 messageID); -``` - -### retrySendCrossChainMessage - -*See {ITeleporterMessenger-retrySendCrossChainMessage} -Emits a {SendCrossChainMessage} event. -Requirements: -- `message` must have been previously sent to the given `destinationChainID`. -- `message` encoding mush match previously sent message.* - - -```solidity -function retrySendCrossChainMessage(bytes32 destinationChainID, TeleporterMessage calldata message) - external - senderNonReentrant; -``` - -### addFeeAmount - -*See {ITeleporterMessenger-addFeeAmount} -Emits a {AddFeeAmount} event. -Requirements: -- `additionalFeeAmount` must be non-zero. -- `message` must exist and not have been delivered yet. -- `feeContractAddress` must match the fee asset contract address used in the original call to `sendCrossChainMessage`.* - - -```solidity -function addFeeAmount( - bytes32 destinationChainID, - uint256 messageID, - address feeContractAddress, - uint256 additionalFeeAmount -) external senderNonReentrant; -``` - -### receiveCrossChainMessage - -*See {ITeleporterMessenger-receiveCrossChainMessage} -Emits a {ReceiveCrossChainMessage} event. -Re-entrancy is explicitly disallowed between receiving functions. One message is not able to receive another message. -Requirements: -- `relayerRewardAddress` must not be the zero address. -- `messageIndex` must specify a valid warp message in the transaction's storage slots. -- Valid warp message provided in storage slots, and sender address matches the address of this contract. -- Warp message `destinationChainID` must match the `blockchainID` of this contract. -- Warp message `destinationAddress` must match the address of this contract. -- Teleporter message was not previously delivered. -- Transaction was sent by an allowed relayer for corresponding teleporter message.* - - -```solidity -function receiveCrossChainMessage(uint32 messageIndex, address relayerRewardAddress) external receiverNonReentrant; -``` - -### retryMessageExecution - -*See {ITeleporterMessenger-retryMessageExecution} -A Teleporter message has an associated `requiredGasLimit` that is used to execute the message. -If the `requiredGasLimit` is too low, then the message execution will fail. This method allows -for retrying the execution of a message with a higher gas limit. Contrary to `receiveCrossChainMessage`, -which will only use `requiredGasLimit` in the sub-call to execute the message, this method may -use all of the gas available in the transaction. -Reverts if the message execution fails again on the specified message. -Emits a {MessageExecuted} event if the retry is successful. -Requirements: -- `message` must have previously failed to execute, and matches the hash of the failed message.* - - -```solidity -function retryMessageExecution(bytes32 originChainID, TeleporterMessage calldata message) - external - receiverNonReentrant; -``` - -### retryReceipts - -*See {ITeleporterMessenger-retryReceipts} -There is no explicit limit to the number of receipts able to be retried in a single message because -this method is intended to be used by relayers themselves to ensure their receipts get returned. -There is no fee associated with the empty message, and the same relayer is expected to relay it -themselves in order to claim their rewards, so it is their responsibility to ensure that the necessary -gas is provided for however many receipts are being retried. -When receipts are retried, they are not removed from their corresponding receipt queue because there -is no efficient way to remove a specific receipt from an arbitrary position in the queue, and it is -harmless for receipts to be sent multiple times within the protocol. -Emits {SendCrossChainMessage} event. -Requirements: -- `messageIDs` must all be valid and have existing receipts.* - - -```solidity -function retryReceipts( - bytes32 originChainID, - uint256[] calldata messageIDs, - TeleporterFeeInfo calldata feeInfo, - address[] calldata allowedRelayerAddresses -) external senderNonReentrant returns (uint256 messageID); -``` - -### redeemRelayerRewards - -*See {ITeleporterMessenger-redeemRelayerRewards} -Requirements: -- `rewardAmount` must be non-zero.* - - -```solidity -function redeemRelayerRewards(address feeAsset) external; -``` - -### getMessageHash - -See {ITeleporterMessenger-getMessageHash} - - -```solidity -function getMessageHash(bytes32 destinationChainID, uint256 messageID) external view returns (bytes32 messageHash); -``` - -### messageReceived - -*See {ITeleporterMessenger-messageReceived}* - - -```solidity -function messageReceived(bytes32 originChainID, uint256 messageID) external view returns (bool delivered); -``` - -### getRelayerRewardAddress - -*See {ITeleporterMessenger-getRelayerRewardAddress}* - - -```solidity -function getRelayerRewardAddress(bytes32 originChainID, uint256 messageID) - external - view - returns (address relayerRewardAddress); -``` - -### checkRelayerRewardAmount - -*See {ITeleporterMessenger-checkRelayerRewardAmount}* - - -```solidity -function checkRelayerRewardAmount(address relayer, address feeAsset) external view returns (uint256); -``` - -### getFeeInfo - -*See {ITeleporterMessenger-getFeeInfo}* - - -```solidity -function getFeeInfo(bytes32 destinationChainID, uint256 messageID) - external - view - returns (address feeAsset, uint256 feeAmount); -``` - -### getNextMessageID - -*Returns the next message ID to be used to send a message to the given chain ID.* - - -```solidity -function getNextMessageID(bytes32 chainID) external view returns (uint256 messageID); -``` - -### getReceiptQueueSize - -*See {ITeleporterMessenger-getReceiptQueueSize}* - - -```solidity -function getReceiptQueueSize(bytes32 chainID) external view returns (uint256); -``` - -### getReceiptAtIndex - -*See {ITeleporterMessenger-getReceiptAtIndex}* - - -```solidity -function getReceiptAtIndex(bytes32 chainID, uint256 index) external view returns (TeleporterMessageReceipt memory); -``` - -### checkIsAllowedRelayer - -*Checks whether `delivererAddress` is allowed to deliver the message.* - - -```solidity -function checkIsAllowedRelayer(address delivererAddress, address[] calldata allowedRelayers) - external - pure - returns (bool); -``` - -### _sendTeleporterMessage - -*Helper function for sending a teleporter message cross chain. -Constructs the Teleporter message and sends it through the Warp Messenger precompile, -and performs fee transfer if necessary. -Emits a {SendCrossChainMessage} event.* - - -```solidity -function _sendTeleporterMessage( - bytes32 destinationChainID, - address destinationAddress, - TeleporterFeeInfo calldata feeInfo, - uint256 requiredGasLimit, - address[] calldata allowedRelayerAddresses, - bytes memory message, - TeleporterMessageReceipt[] memory receipts -) private returns (uint256 messageID); -``` - -### _markReceipt - -*Marks the receipt of a message from the given `destinationChainID` with the given `messageID`. -It is possible that the receipt was already received for this message, in which case we return early. -If existing message is found and not yet delivered, we delete it from state and increment the fee/reward* - - -```solidity -function _markReceipt(bytes32 destinationChainID, uint256 messageID, address relayerRewardAddress) private; -``` - -### _handleInitialMessageExecution - -*Attempts to execute the newly delivered message. -Only revert in the event that the message deliverer (relayer) did not provide enough gas to handle the execution -(including possibly storing a failed message in state). All execution specific errors (i.e. invalid call data, etc) -that are not in the relayers control are caught and handled properly. -Emits a {MessageExecuted} event if the call on destination address is successful. -Emits a {MessageExecutionFailed} event if the call on destination address fails with formatted call data. -Requirements: -- There is enough gas left to cover `message.requiredGasLimit`.* - - -```solidity -function _handleInitialMessageExecution(bytes32 originChainID, TeleporterMessage memory message) private; -``` - -### _storeFailedMessageExecution - -*Stores the hash of a message that has been successfully delivered but fails to execute properly -such that the message execution can be retried by anyone in the future.* - - -```solidity -function _storeFailedMessageExecution(bytes32 originChainID, TeleporterMessage memory message) private; -``` - -### _getNextMessageID - -*Returns the next message ID to be used to send a message to the given `chainID`.* - - -```solidity -function _getNextMessageID(bytes32 chainID) private view returns (uint256 messageID); -``` - -### _checkIsAllowedRelayer - -*Checks whether `delivererAddress` is allowed to deliver the message.* - - -```solidity -function _checkIsAllowedRelayer(address delivererAddress, address[] memory allowedRelayers) - private - pure - returns (bool); -``` - -## Structs -### SentMessageInfo - -```solidity -struct SentMessageInfo { - bytes32 messageHash; - TeleporterFeeInfo feeInfo; -} -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md b/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md deleted file mode 100644 index c63bfb7cc..000000000 --- a/contracts/docs/src/src/Teleporter/tests/AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md +++ /dev/null @@ -1,64 +0,0 @@ -# AddFeeAmountTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/AddFeeAmountTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testSuccess - - -```solidity -function testSuccess() public; -``` - -### testInvalidMessage - - -```solidity -function testInvalidMessage() public; -``` - -### testMessageAlreadyDelivered - - -```solidity -function testMessageAlreadyDelivered() public; -``` - -### testInvalidAmount - - -```solidity -function testInvalidAmount() public; -``` - -### testMismatchFeeAsset - - -```solidity -function testMismatchFeeAsset() public; -``` - -### testInvalidFeeAsset - - -```solidity -function testInvalidFeeAsset() public; -``` - -### testInsufficientBalance - - -```solidity -function testInsufficientBalance() public; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md b/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md deleted file mode 100644 index 9be74f4cc..000000000 --- a/contracts/docs/src/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md +++ /dev/null @@ -1,36 +0,0 @@ -# CheckIsAllowedRelayerTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testIsSpecifiedAllowedRelayer - - -```solidity -function testIsSpecifiedAllowedRelayer() public; -``` - -### testAnyRelayerIsAllowed - - -```solidity -function testAnyRelayerIsAllowed() public; -``` - -### testUnauthorizedRelayer - - -```solidity -function testUnauthorizedRelayer() public; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md b/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md deleted file mode 100644 index 7365825fe..000000000 --- a/contracts/docs/src/src/Teleporter/tests/GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md +++ /dev/null @@ -1,43 +0,0 @@ -# GetFeeInfoTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/GetFeeInfoTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testSuccess - - -```solidity -function testSuccess() public; -``` - -### testFeeOnTransferTokenUsed - - -```solidity -function testFeeOnTransferTokenUsed() public; -``` - -### testAfterReceipt - - -```solidity -function testAfterReceipt() public; -``` - -### testInvalidMessage - - -```solidity -function testInvalidMessage() public; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md b/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md deleted file mode 100644 index c10b9fdd4..000000000 --- a/contracts/docs/src/src/Teleporter/tests/GetMessageHashTests.t.sol/contract.GetMessageHashTest.md +++ /dev/null @@ -1,36 +0,0 @@ -# GetMessageHashTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/GetMessageHashTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testSuccess - - -```solidity -function testSuccess() public; -``` - -### testMessageDoesNotExist - - -```solidity -function testMessageDoesNotExist() public; -``` - -### testMessageAlreadyReceived - - -```solidity -function testMessageAlreadyReceived() public; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md b/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md deleted file mode 100644 index e0148f05e..000000000 --- a/contracts/docs/src/src/Teleporter/tests/GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md +++ /dev/null @@ -1,36 +0,0 @@ -# GetNextMessageIDTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/GetNextMessageIdTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testFirstMessageID - - -```solidity -function testFirstMessageID() public; -``` - -### testSecondMessageID - - -```solidity -function testSecondMessageID() public; -``` - -### testOtherDestinationSubnetID - - -```solidity -function testOtherDestinationSubnetID() public; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md b/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md deleted file mode 100644 index 817be7c6b..000000000 --- a/contracts/docs/src/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md +++ /dev/null @@ -1,29 +0,0 @@ -# GetOutstandingReceiptsToSendTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testSuccess - - -```solidity -function testSuccess() public; -``` - -### testExceedsLimit - - -```solidity -function testExceedsLimit() public; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md b/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md deleted file mode 100644 index 8ef966741..000000000 --- a/contracts/docs/src/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md +++ /dev/null @@ -1,22 +0,0 @@ -# GetRelayerRewardAddressTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testSuccess - - -```solidity -function testSuccess() public; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md deleted file mode 100644 index e61358890..000000000 --- a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md +++ /dev/null @@ -1,51 +0,0 @@ -# HandleInitialMessageExecutionTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## State Variables -### destinationContract - -```solidity -SampleMessageReceiver public destinationContract; -``` - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testSuccess - - -```solidity -function testSuccess() public; -``` - -### testInsufficientGasProvided - - -```solidity -function testInsufficientGasProvided() public; -``` - -### testCannotReceiveMessageRecursively - - -```solidity -function testCannotReceiveMessageRecursively() public; -``` - -### testStoreHashOfFailedMessageExecution - - -```solidity -function testStoreHashOfFailedMessageExecution() public; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md deleted file mode 100644 index 62c90f915..000000000 --- a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md +++ /dev/null @@ -1,67 +0,0 @@ -# SampleMessageReceiver -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) - -**Inherits:** -[ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md) - - -## State Variables -### teleporterContract - -```solidity -address public immutable teleporterContract; -``` - - -### latestMessage - -```solidity -string public latestMessage; -``` - - -### latestMessageSenderSubnetID - -```solidity -bytes32 public latestMessageSenderSubnetID; -``` - - -### latestMessageSenderAddress - -```solidity -address public latestMessageSenderAddress; -``` - - -## Functions -### constructor - - -```solidity -constructor(address teleporterContractAddress); -``` - -### receiveTeleporterMessage - - -```solidity -function receiveTeleporterMessage(bytes32 originChainID, address originSenderAddress, bytes calldata message) - external; -``` - -### _receiveMessage - - -```solidity -function _receiveMessage(bytes32 originChainID, address originSenderAddress, string memory message, bool succeed) - internal; -``` - -### _receiveMessageRecursive - - -```solidity -function _receiveMessageRecursive(bytes32 originChainID, address originSenderAddress, string memory message) internal; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md b/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md deleted file mode 100644 index 9a96059c1..000000000 --- a/contracts/docs/src/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md +++ /dev/null @@ -1,11 +0,0 @@ -# SampleMessageReceiverAction -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol) - - -```solidity -enum SampleMessageReceiverAction { - Receive, - ReceiveRecursive -} -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md b/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md deleted file mode 100644 index 118500a1e..000000000 --- a/contracts/docs/src/src/Teleporter/tests/MarkReceiptTests.t.sol/contract.MarkReceiptTest.md +++ /dev/null @@ -1,46 +0,0 @@ -# MarkReceiptTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/MarkReceiptTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testCheckRelayersUponReceipt - - -```solidity -function testCheckRelayersUponReceipt() public; -``` - -### testReceiptForNoFeeMessage - - -```solidity -function testReceiptForNoFeeMessage() public; -``` - -### testDuplicateReceiptAllowed - - -```solidity -function testDuplicateReceiptAllowed() public; -``` - -## Structs -### FeeRewardInfo - -```solidity -struct FeeRewardInfo { - uint256 feeAmount; - address relayerRewardAddress; -} -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md b/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md deleted file mode 100644 index c31ab32ea..000000000 --- a/contracts/docs/src/src/Teleporter/tests/MessageReceivedTests.t.sol/contract.MessageReceivedTest.md +++ /dev/null @@ -1,29 +0,0 @@ -# MessageReceivedTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/MessageReceivedTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testReceivedMessage - - -```solidity -function testReceivedMessage() public; -``` - -### testUnreceivedMessage - - -```solidity -function testUnreceivedMessage() public; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/README.md b/contracts/docs/src/src/Teleporter/tests/README.md deleted file mode 100644 index 3bcf143ce..000000000 --- a/contracts/docs/src/src/Teleporter/tests/README.md +++ /dev/null @@ -1,27 +0,0 @@ - - -# Contents -- [AddFeeAmountTest](AddFeeAmountTests.t.sol/contract.AddFeeAmountTest.md) -- [CheckIsAllowedRelayerTest](CheckAllowedRelayerTests.t.sol/contract.CheckIsAllowedRelayerTest.md) -- [GetFeeInfoTest](GetFeeInfoTests.t.sol/contract.GetFeeInfoTest.md) -- [GetMessageHashTest](GetMessageHashTests.t.sol/contract.GetMessageHashTest.md) -- [GetNextMessageIDTest](GetNextMessageIdTests.t.sol/contract.GetNextMessageIDTest.md) -- [GetOutstandingReceiptsToSendTest](GetOutstandingReceiptsToSendTests.t.sol/contract.GetOutstandingReceiptsToSendTest.md) -- [GetRelayerRewardAddressTest](GetRelayerRewardAddressTests.t.sol/contract.GetRelayerRewardAddressTest.md) -- [SampleMessageReceiverAction](HandleInitialMessageExecutionTests.t.sol/enum.SampleMessageReceiverAction.md) -- [SampleMessageReceiver](HandleInitialMessageExecutionTests.t.sol/contract.SampleMessageReceiver.md) -- [HandleInitialMessageExecutionTest](HandleInitialMessageExecutionTests.t.sol/contract.HandleInitialMessageExecutionTest.md) -- [MarkReceiptTest](MarkReceiptTests.t.sol/contract.MarkReceiptTest.md) -- [MessageReceivedTest](MessageReceivedTests.t.sol/contract.MessageReceivedTest.md) -- [ReceiptQueueTest](ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md) -- [ReceiveCrossChainMessagedTest](ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md) -- [RedeemRelayerRewardsTest](RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md) -- [ReentrancyGuardsTests](ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md) -- [SampleMessenger](ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md) -- [FlakyMessageReceiverAction](RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md) -- [FlakyMessageReceiver](RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md) -- [RetryMessageExecutionTest](RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md) -- [RetryReceiptTest](RetryReceiptTests.t.sol/contract.RetryReceiptTest.md) -- [RetrySendCrossChainMessageTest](RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md) -- [SendCrossChainMessageTest](SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md) -- [TeleporterMessengerTest](TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) diff --git a/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md b/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md deleted file mode 100644 index 46d2cb0e3..000000000 --- a/contracts/docs/src/src/Teleporter/tests/ReceiptsQueueTests.t.sol/contract.ReceiptQueueTest.md +++ /dev/null @@ -1,79 +0,0 @@ -# ReceiptQueueTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/ReceiptsQueueTests.t.sol) - -**Inherits:** -Test - - -## State Variables -### _queue - -```solidity -ReceiptQueue.TeleporterMessageReceiptQueue private _queue; -``` - - -### _receipt1 - -```solidity -TeleporterMessageReceipt private _receipt1 = - TeleporterMessageReceipt({receivedMessageID: 543, relayerRewardAddress: 0x10eB43ef5982628728E3E4bb9F78834f67Fbb40b}); -``` - - -### _receipt2 - -```solidity -TeleporterMessageReceipt private _receipt2 = TeleporterMessageReceipt({ - receivedMessageID: 684384, - relayerRewardAddress: 0x10eB43ef5982628728E3E4bb9F78834f67Fbb40b -}); -``` - - -### _receipt3 - -```solidity -TeleporterMessageReceipt private _receipt3 = TeleporterMessageReceipt({ - receivedMessageID: 654351, - relayerRewardAddress: 0xcC8E718045817AebA89592C72Ae1C9917f5D0894 -}); -``` - - -## Functions -### testEnqueueDequeueSuccess - - -```solidity -function testEnqueueDequeueSuccess() public; -``` - -### testDequeueRevertIfEmptyQueue - - -```solidity -function testDequeueRevertIfEmptyQueue() public; -``` - -### testGetReceiptAtIndex - - -```solidity -function testGetReceiptAtIndex() public; -``` - -### testGetReceiptAtIndexWithEmptyQueue - - -```solidity -function testGetReceiptAtIndexWithEmptyQueue() public; -``` - -### _formatReceiptQueueErrorMessage - - -```solidity -function _formatReceiptQueueErrorMessage(string memory errorMessage) private pure returns (bytes memory); -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md b/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md deleted file mode 100644 index 3c82aa1c0..000000000 --- a/contracts/docs/src/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol/contract.ReceiveCrossChainMessagedTest.md +++ /dev/null @@ -1,87 +0,0 @@ -# ReceiveCrossChainMessagedTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## State Variables -### DEFAULT_MESSAGE_PAYLOAD - -```solidity -bytes public constant DEFAULT_MESSAGE_PAYLOAD = - hex"cafebabe11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff11223344556677889900aabbccddeeffdeadbeef"; -``` - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testSuccess - - -```solidity -function testSuccess() public; -``` - -### testNoValidMessage - - -```solidity -function testNoValidMessage() public; -``` - -### testInvalidOriginSenderAddress - - -```solidity -function testInvalidOriginSenderAddress() public; -``` - -### testInvalidDestinationChainID - - -```solidity -function testInvalidDestinationChainID() public; -``` - -### testInvalidDestinationAddress - - -```solidity -function testInvalidDestinationAddress() public; -``` - -### testInvalidRelayerAddress - - -```solidity -function testInvalidRelayerAddress() public; -``` - -### testMessageAlreadyReceived - - -```solidity -function testMessageAlreadyReceived() public; -``` - -### testUnauthorizedRelayer - - -```solidity -function testUnauthorizedRelayer() public; -``` - -### testMessageSentToEOADoesNotExecute - - -```solidity -function testMessageSentToEOADoesNotExecute() public; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md b/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md deleted file mode 100644 index eaae5faa4..000000000 --- a/contracts/docs/src/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol/contract.RedeemRelayerRewardsTest.md +++ /dev/null @@ -1,53 +0,0 @@ -# RedeemRelayerRewardsTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testZeroRewardBalance - - -```solidity -function testZeroRewardBalance() public; -``` - -### testRedemptionFails - - -```solidity -function testRedemptionFails() public; -``` - -### testRedemptionSucceeds - - -```solidity -function testRedemptionSucceeds() public; -``` - -### _setUpRelayerRewards - - -```solidity -function _setUpRelayerRewards(FeeRewardInfo memory feeRewardInfo) private; -``` - -## Structs -### FeeRewardInfo - -```solidity -struct FeeRewardInfo { - uint256 feeAmount; - address relayerRewardAddress; -} -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md deleted file mode 100644 index b5df9bf8f..000000000 --- a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.ReentrancyGuardsTests.md +++ /dev/null @@ -1,79 +0,0 @@ -# ReentrancyGuardsTests -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/ReentrancyGuardsTests.t.sol) - -**Inherits:** -Test - - -## State Variables -### _sampleMessenger - -```solidity -SampleMessenger internal _sampleMessenger; -``` - - -## Functions -### setUp - - -```solidity -function setUp() public virtual; -``` - -### testConsecutiveSendSuccess - - -```solidity -function testConsecutiveSendSuccess() public; -``` - -### testConsecutiveReceiveSuccess - - -```solidity -function testConsecutiveReceiveSuccess() public; -``` - -### testRecursiveSendFails - - -```solidity -function testRecursiveSendFails() public; -``` - -### testRecursiveReceiveFails - - -```solidity -function testRecursiveReceiveFails() public; -``` - -### testSendCallsReceiveSuccess - - -```solidity -function testSendCallsReceiveSuccess() public; -``` - -### testReceiveCallsSendSuccess - - -```solidity -function testReceiveCallsSendSuccess() public; -``` - -### testRecursiveDirectSendFails - - -```solidity -function testRecursiveDirectSendFails() public; -``` - -### testRecursiveDirectReceiveFails - - -```solidity -function testRecursiveDirectReceiveFails() public; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md b/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md deleted file mode 100644 index 4724d1b05..000000000 --- a/contracts/docs/src/src/Teleporter/tests/ReentrancyGuardsTests.t.sol/contract.SampleMessenger.md +++ /dev/null @@ -1,65 +0,0 @@ -# SampleMessenger -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/ReentrancyGuardsTests.t.sol) - -**Inherits:** -[ReentrancyGuards](/src/Teleporter/ReentrancyGuards.sol/abstract.ReentrancyGuards.md) - - -## State Variables -### nonce - -```solidity -uint256 public nonce; -``` - - -## Functions -### constructor - - -```solidity -constructor(); -``` - -### sendAndCall - - -```solidity -function sendAndCall(bytes memory message) public senderNonReentrant; -``` - -### sendMessage - - -```solidity -function sendMessage() public senderNonReentrant; -``` - -### sendRecursive - - -```solidity -function sendRecursive() public senderNonReentrant; -``` - -### receiveAndCall - - -```solidity -function receiveAndCall(bytes memory message) public receiverNonReentrant; -``` - -### receiveMessage - - -```solidity -function receiveMessage() public receiverNonReentrant; -``` - -### receiveRecursive - - -```solidity -function receiveRecursive() public receiverNonReentrant; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md deleted file mode 100644 index c18e1b0f2..000000000 --- a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.FlakyMessageReceiver.md +++ /dev/null @@ -1,66 +0,0 @@ -# FlakyMessageReceiver -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) - -**Inherits:** -[ITeleporterReceiver](/src/Teleporter/ITeleporterReceiver.sol/interface.ITeleporterReceiver.md) - - -## State Variables -### teleporterContract - -```solidity -address public immutable teleporterContract; -``` - - -### latestMessage - -```solidity -string public latestMessage; -``` - - -### latestMessageSenderSubnetID - -```solidity -bytes32 public latestMessageSenderSubnetID; -``` - - -### latestMessageSenderAddress - -```solidity -address public latestMessageSenderAddress; -``` - - -## Functions -### constructor - - -```solidity -constructor(address teleporterContractAddress); -``` - -### receiveTeleporterMessage - - -```solidity -function receiveTeleporterMessage(bytes32 originChainID, address originSenderAddress, bytes calldata messageBytes) - external; -``` - -### _receiveMessage - - -```solidity -function _receiveMessage(bytes32 originChainID, address originSenderAddress, string memory message) internal; -``` - -### _retryReceive - - -```solidity -function _retryReceive(bytes32 originChainID, address originSenderAddress, string memory message) internal; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md deleted file mode 100644 index d45e6db96..000000000 --- a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/contract.RetryMessageExecutionTest.md +++ /dev/null @@ -1,93 +0,0 @@ -# RetryMessageExecutionTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## State Variables -### destinationContract - -```solidity -FlakyMessageReceiver public destinationContract; -``` - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testSuccess - - -```solidity -function testSuccess() public; -``` - -### testExecutionFailsAgain - - -```solidity -function testExecutionFailsAgain() public; -``` - -### testMessageHashNotFound - - -```solidity -function testMessageHashNotFound() public; -``` - -### testInvalidMessageHash - - -```solidity -function testInvalidMessageHash() public; -``` - -### testCanNotRetryAgainAfterSuccess - - -```solidity -function testCanNotRetryAgainAfterSuccess() public; -``` - -### testCanNotReceiveMessageWhileRetrying - - -```solidity -function testCanNotReceiveMessageWhileRetrying() public; -``` - -### testEOAFailsThenRetrySucceeds - - -```solidity -function testEOAFailsThenRetrySucceeds() public; -``` - -### testEOAFailsAgainOnRetry - - -```solidity -function testEOAFailsAgainOnRetry() public; -``` - -### _receiveFailedMessage - - -```solidity -function _receiveFailedMessage(bool retryReceive) internal returns (bytes32, TeleporterMessage memory, string memory); -``` - -### _successfullyRetryMessage - - -```solidity -function _successfullyRetryMessage() internal returns (bytes32, TeleporterMessage memory); -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md b/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md deleted file mode 100644 index 81fdcfde6..000000000 --- a/contracts/docs/src/src/Teleporter/tests/RetryMessageExecutionTests.t.sol/enum.FlakyMessageReceiverAction.md +++ /dev/null @@ -1,11 +0,0 @@ -# FlakyMessageReceiverAction -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/RetryMessageExecutionTests.t.sol) - - -```solidity -enum FlakyMessageReceiverAction { - ReceiveMessage, - RetryReceive -} -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md b/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md deleted file mode 100644 index b3a64b4d5..000000000 --- a/contracts/docs/src/src/Teleporter/tests/RetryReceiptTests.t.sol/contract.RetryReceiptTest.md +++ /dev/null @@ -1,52 +0,0 @@ -# RetryReceiptTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/RetryReceiptTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testSuccess - - -```solidity -function testSuccess() public; -``` - -### testDuplicateAllowed - - -```solidity -function testDuplicateAllowed() public; -``` - -### testMissingMessage - - -```solidity -function testMissingMessage() public; -``` - -### _retryTestReceiptsWithFee - - -```solidity -function _retryTestReceiptsWithFee(bytes32 chainID, uint256[] memory messageIDs, address feeAddress, uint256 feeAmount) - private - returns (uint256); -``` - -### _retryTestReceiptsWithNoFee - - -```solidity -function _retryTestReceiptsWithNoFee(bytes32 chainID, uint256[] memory messageIDs) private returns (uint256); -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md b/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md deleted file mode 100644 index 0a253047b..000000000 --- a/contracts/docs/src/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol/contract.RetrySendCrossChainMessageTest.md +++ /dev/null @@ -1,36 +0,0 @@ -# RetrySendCrossChainMessageTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testSuccess - - -```solidity -function testSuccess() public; -``` - -### testMessageNotFound - - -```solidity -function testMessageNotFound() public; -``` - -### testInvalidMessageHash - - -```solidity -function testInvalidMessageHash() public; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md b/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md deleted file mode 100644 index 7d25ed7c8..000000000 --- a/contracts/docs/src/src/Teleporter/tests/SendCrossChainMessageTests.t.sol/contract.SendCrossChainMessageTest.md +++ /dev/null @@ -1,50 +0,0 @@ -# SendCrossChainMessageTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/SendCrossChainMessageTests.t.sol) - -**Inherits:** -[TeleporterMessengerTest](/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md) - - -## Functions -### setUp - - -```solidity -function setUp() public virtual override; -``` - -### testSendMessageNoFee - - -```solidity -function testSendMessageNoFee() public; -``` - -### testSendMessageWithFee - - -```solidity -function testSendMessageWithFee() public; -``` - -### testFeeAssetDoesNotExist - - -```solidity -function testFeeAssetDoesNotExist() public; -``` - -### testFeeTransferFailure - - -```solidity -function testFeeTransferFailure() public; -``` - -### testInvalidFeeAssetFailure - - -```solidity -function testInvalidFeeAssetFailure() public; -``` - diff --git a/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md b/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md deleted file mode 100644 index 0ad8f362e..000000000 --- a/contracts/docs/src/src/Teleporter/tests/TeleporterMessengerTest.t.sol/contract.TeleporterMessengerTest.md +++ /dev/null @@ -1,212 +0,0 @@ -# TeleporterMessengerTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/tests/TeleporterMessengerTest.t.sol) - -**Inherits:** -Test - - -## State Variables -### teleporterMessenger - -```solidity -TeleporterMessenger public teleporterMessenger; -``` - - -### MOCK_BLOCK_CHAIN_ID - -```solidity -bytes32 public constant MOCK_BLOCK_CHAIN_ID = bytes32(uint256(123456)); -``` - - -### DEFAULT_ORIGIN_CHAIN_ID - -```solidity -bytes32 public constant DEFAULT_ORIGIN_CHAIN_ID = - bytes32(hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd"); -``` - - -### DEFAULT_DESTINATION_CHAIN_ID - -```solidity -bytes32 public constant DEFAULT_DESTINATION_CHAIN_ID = - bytes32(hex"1234567812345678123456781234567812345678123456781234567812345678"); -``` - - -### DEFAULT_DESTINATION_ADDRESS - -```solidity -address public constant DEFAULT_DESTINATION_ADDRESS = 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; -``` - - -### DEFAULT_REQUIRED_GAS_LIMIT - -```solidity -uint256 public constant DEFAULT_REQUIRED_GAS_LIMIT = 1e6; -``` - - -### WARP_PRECOMPILE_ADDRESS - -```solidity -address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; -``` - - -### DEFAULT_RELAYER_REWARD_ADDRESS - -```solidity -address public constant DEFAULT_RELAYER_REWARD_ADDRESS = 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; -``` - - -### _mockFeeAsset - -```solidity -UnitTestMockERC20 internal _mockFeeAsset; -``` - - -## Functions -### setUp - - -```solidity -function setUp() public virtual; -``` - -### testEmptyReceiptQueue - - -```solidity -function testEmptyReceiptQueue() public; -``` - -### _sendTestMessageWithFee - - -```solidity -function _sendTestMessageWithFee(bytes32 chainID, uint256 feeAmount) internal returns (uint256); -``` - -### _sendTestMessageWithNoFee - - -```solidity -function _sendTestMessageWithNoFee(bytes32 chainID) internal returns (uint256); -``` - -### _setUpSuccessGetVerifiedWarpMessageMock - - -```solidity -function _setUpSuccessGetVerifiedWarpMessageMock(uint32 index, WarpMessage memory warpMessage) internal; -``` - -### _receiveTestMessage - - -```solidity -function _receiveTestMessage( - bytes32 originChainID, - uint256 messageID, - address relayerRewardAddress, - TeleporterMessageReceipt[] memory receipts -) internal; -``` - -### _receiveMessageSentToEOA - - -```solidity -function _receiveMessageSentToEOA() internal returns (bytes32, address, TeleporterMessage memory); -``` - -### _createMockTeleporterMessage - - -```solidity -function _createMockTeleporterMessage(uint256 messageID, bytes memory message) - internal - view - returns (TeleporterMessage memory); -``` - -### _createDefaultWarpMessage - - -```solidity -function _createDefaultWarpMessage(bytes32 originChainID, bytes memory payload) - internal - view - returns (WarpMessage memory); -``` - -### _formatTeleporterErrorMessage - - -```solidity -function _formatTeleporterErrorMessage(string memory errorMessage) internal pure returns (bytes memory); -``` - -## Events -### SendCrossChainMessage - -```solidity -event SendCrossChainMessage( - bytes32 indexed destinationChainID, uint256 indexed messageID, TeleporterMessage message, TeleporterFeeInfo feeInfo -); -``` - -### AddFeeAmount - -```solidity -event AddFeeAmount(bytes32 indexed destinationChainID, uint256 indexed messageID, TeleporterFeeInfo updatedFeeInfo); -``` - -### ReceiveCrossChainMessage - -```solidity -event ReceiveCrossChainMessage( - bytes32 indexed originChainID, - uint256 indexed messageID, - address indexed deliverer, - address rewardRedeemer, - TeleporterMessage message -); -``` - -### MessageExecutionFailed - -```solidity -event MessageExecutionFailed(bytes32 indexed originChainID, uint256 indexed messageID, TeleporterMessage message); -``` - -### MessageExecuted - -```solidity -event MessageExecuted(bytes32 indexed originChainID, uint256 indexed messageID); -``` - -### FailedFeePayment - -```solidity -event FailedFeePayment( - bytes32 indexed destinationChainID, - uint256 indexed messageID, - address indexed feeAsset, - uint256 feeAmount, - address relayerRewardAddress -); -``` - -### RelayerRewardsRedeemed - -```solidity -event RelayerRewardsRedeemed(address indexed redeemer, address indexed asset, uint256 amount); -``` - diff --git a/contracts/docs/src/src/Teleporter/upgrades/README.md b/contracts/docs/src/src/Teleporter/upgrades/README.md deleted file mode 100644 index a04ea1ca6..000000000 --- a/contracts/docs/src/src/Teleporter/upgrades/README.md +++ /dev/null @@ -1,6 +0,0 @@ - - -# Contents -- [tests](/src/Teleporter/upgrades/tests) -- [TeleporterRegistry](TeleporterRegistry.sol/contract.TeleporterRegistry.md) -- [TeleporterUpgradeable](TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md) diff --git a/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md b/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md deleted file mode 100644 index 78ec98c5e..000000000 --- a/contracts/docs/src/src/Teleporter/upgrades/TeleporterRegistry.sol/contract.TeleporterRegistry.md +++ /dev/null @@ -1,38 +0,0 @@ -# TeleporterRegistry -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/upgrades/TeleporterRegistry.sol) - -**Inherits:** -[WarpProtocolRegistry](/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md) - -*TeleporterRegistry contract is a {WarpProtocolRegistry} and provides an upgrade -mechanism for {ITeleporterMessenger} contracts.* - - -## Functions -### constructor - - -```solidity -constructor(ProtocolRegistryEntry[] memory initialEntries) WarpProtocolRegistry(initialEntries); -``` - -### getTeleporterFromVersion - -*Gets the {ITeleporterMessenger} contract of the given `version`. -Requirements: -- `version` must be a valid version, i.e. greater than 0 and not greater than the latest version.* - - -```solidity -function getTeleporterFromVersion(uint256 version) external view returns (ITeleporterMessenger); -``` - -### getLatestTeleporter - -*Gets the latest {ITeleporterMessenger} contract.* - - -```solidity -function getLatestTeleporter() external view returns (ITeleporterMessenger); -``` - diff --git a/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md b/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md deleted file mode 100644 index a2d998150..000000000 --- a/contracts/docs/src/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md +++ /dev/null @@ -1,66 +0,0 @@ -# TeleporterUpgradeable -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/upgrades/TeleporterUpgradeable.sol) - -*TeleporterUpgradeable provides upgrade utility for applications built on top -of the Teleporter protocol by integrating with the {TeleporterRegistry}. -This contract is intended to be inherited by other contracts that wish to use the -upgrade mechanism. It provides a modifier that restricts access to only Teleporter -versions that are greater than or equal to `minTeleporterVersion`.* - - -## State Variables -### teleporterRegistry - -```solidity -TeleporterRegistry public immutable teleporterRegistry; -``` - - -### minTeleporterVersion - -```solidity -uint256 public minTeleporterVersion; -``` - - -## Functions -### onlyAllowedTeleporter - -*Throws if called by a `msg.sender` that is not an allowed Teleporter version. -Checks that `msg.sender` matches a Teleporter version greater than or equal to `minTeleporterVersion`.* - - -```solidity -modifier onlyAllowedTeleporter(); -``` - -### constructor - -*Initializes the {TeleporterUpgradeable} contract by getting `teleporterRegistry` -instance and setting `_minTeleporterVersion`.* - - -```solidity -constructor(address teleporterRegistryAddress); -``` - -### updateMinTeleporterVersion - -*This is a virtual function that should be overridden to update the `minTeleporterVersion` -allowed for modifier `onlyAllowedTeleporter`, and emit {MinTeleporterVersionUpdated} event after. -Note: To prevent anyone from being able to call this function, which would disallow messages -from old Teleporter versions from being received, this function should be safeguarded with access -controls. For example, if the derived contract has an owner/admin, only they can call this function.* - - -```solidity -function updateMinTeleporterVersion() external virtual; -``` - -## Events -### MinTeleporterVersionUpdated - -```solidity -event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion); -``` - diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/README.md b/contracts/docs/src/src/Teleporter/upgrades/tests/README.md deleted file mode 100644 index 621d5d555..000000000 --- a/contracts/docs/src/src/Teleporter/upgrades/tests/README.md +++ /dev/null @@ -1,6 +0,0 @@ - - -# Contents -- [TeleporterRegistryTest](TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md) -- [ExampleUpgradeableApp](TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md) -- [TeleporterUpgradeableTest](TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md) diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md deleted file mode 100644 index 6c01e04a0..000000000 --- a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol/contract.TeleporterRegistryTest.md +++ /dev/null @@ -1,138 +0,0 @@ -# TeleporterRegistryTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol) - -**Inherits:** -Test - - -## State Variables -### teleporterRegistry - -```solidity -TeleporterRegistry public teleporterRegistry; -``` - - -### teleporterAddress - -```solidity -address public teleporterAddress; -``` - - -### MOCK_BLOCK_CHAIN_ID - -```solidity -bytes32 public constant MOCK_BLOCK_CHAIN_ID = bytes32(uint256(123456)); -``` - - -### WARP_PRECOMPILE_ADDRESS - -```solidity -address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; -``` - - -## Functions -### setUp - - -```solidity -function setUp() public; -``` - -### testAddProtocolVersionBasic - - -```solidity -function testAddProtocolVersionBasic() public; -``` - -### testAddNonContractAddress - - -```solidity -function testAddNonContractAddress() public; -``` - -### testAddOldVersion - - -```solidity -function testAddOldVersion() public; -``` - -### testAddExistingVersion - - -```solidity -function testAddExistingVersion() public; -``` - -### testAddZeroProtocolAddress - - -```solidity -function testAddZeroProtocolAddress() public; -``` - -### testAddZeroVersion - - -```solidity -function testAddZeroVersion() public; -``` - -### testGetAddressFromVersion - - -```solidity -function testGetAddressFromVersion() public; -``` - -### testGetVersionFromAddress - - -```solidity -function testGetVersionFromAddress() public; -``` - -### testInvalidWarpMessage - - -```solidity -function testInvalidWarpMessage() public; -``` - -### _addProtocolVersion - - -```solidity -function _addProtocolVersion(TeleporterRegistry registry) internal; -``` - -### _createWarpOutofBandMessage - - -```solidity -function _createWarpOutofBandMessage(uint256 version, address protocolAddress, address registryAddress) - internal - view - returns (WarpMessage memory); -``` - -### _formatErrorMessage - - -```solidity -function _formatErrorMessage(string memory errorMessage) private pure returns (bytes memory); -``` - -## Events -### AddProtocolVersion - -```solidity -event AddProtocolVersion(uint256 indexed version, address indexed protocolAddress); -``` - diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md deleted file mode 100644 index 494ce2b33..000000000 --- a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.ExampleUpgradeableApp.md +++ /dev/null @@ -1,29 +0,0 @@ -# ExampleUpgradeableApp -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol) - -**Inherits:** -[TeleporterUpgradeable](/src/Teleporter/upgrades/TeleporterUpgradeable.sol/abstract.TeleporterUpgradeable.md) - - -## Functions -### constructor - - -```solidity -constructor(address teleporterRegistryAddress) TeleporterUpgradeable(teleporterRegistryAddress); -``` - -### updateMinTeleporterVersion - - -```solidity -function updateMinTeleporterVersion() external override; -``` - -### teleporterCall - - -```solidity -function teleporterCall() public onlyAllowedTeleporter; -``` - diff --git a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md b/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md deleted file mode 100644 index 0f1216332..000000000 --- a/contracts/docs/src/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol/contract.TeleporterUpgradeableTest.md +++ /dev/null @@ -1,65 +0,0 @@ -# TeleporterUpgradeableTest -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol) - -**Inherits:** -Test - - -## State Variables -### MOCK_TELEPORTER_REGISTRY_ADDRESS - -```solidity -address public constant MOCK_TELEPORTER_REGISTRY_ADDRESS = 0xf9FA4a0c696b659328DDaaBCB46Ae4eBFC9e68e4; -``` - - -### MOCK_TELEPORTER_MESSENGER_ADDRESS - -```solidity -address public constant MOCK_TELEPORTER_MESSENGER_ADDRESS = 0x644E5b7c5D4Bc8073732CEa72c66e0BB90dFC00f; -``` - - -## Functions -### setUp - - -```solidity -function setUp() public; -``` - -### testInvalidRegistryAddress - - -```solidity -function testInvalidRegistryAddress() public; -``` - -### testOnlyAllowedTeleporter - - -```solidity -function testOnlyAllowedTeleporter() public; -``` - -### testUpdateMinTeleporterVersion - - -```solidity -function testUpdateMinTeleporterVersion() public; -``` - -### _formatTeleporterUpgradeableErrorMessage - - -```solidity -function _formatTeleporterUpgradeableErrorMessage(string memory errorMessage) private pure returns (bytes memory); -``` - -## Events -### MinTeleporterVersionUpdated - -```solidity -event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion); -``` - diff --git a/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md b/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md deleted file mode 100644 index 034275dab..000000000 --- a/contracts/docs/src/src/WarpProtocolRegistry.sol/abstract.WarpProtocolRegistry.md +++ /dev/null @@ -1,154 +0,0 @@ -# WarpProtocolRegistry -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/WarpProtocolRegistry.sol) - -*Implementation of an abstract `WarpProtocolRegistry` contract. -This implementation is a contract that can be used as a base contract for protocols that are -built on top of Warp. It allows the protocol to be upgraded through a Warp out-of-band message.* - - -## State Variables -### VALIDATORS_SOURCE_ADDRESS - -```solidity -address public constant VALIDATORS_SOURCE_ADDRESS = address(0); -``` - - -### WARP_MESSENGER - -```solidity -WarpMessenger public constant WARP_MESSENGER = WarpMessenger(0x0200000000000000000000000000000000000005); -``` - - -### _blockchainID - -```solidity -bytes32 internal immutable _blockchainID; -``` - - -### _latestVersion - -```solidity -uint256 internal _latestVersion; -``` - - -### _versionToAddress - -```solidity -mapping(uint256 => address) internal _versionToAddress; -``` - - -### _addressToVersion - -```solidity -mapping(address => uint256) internal _addressToVersion; -``` - - -## Functions -### constructor - -*Initializes the contract by setting `_blockchainID` and `_latestVersion`. -Also adds the initial protocol versions to the registry.* - - -```solidity -constructor(ProtocolRegistryEntry[] memory initialEntries); -``` - -### addProtocolVersion - -*Gets and verifies a warp out-of-band message, and adds the new protocol version -address to the registry. -If a version is greater than the current latest version, it will be set as the latest version. -If a version is less than the current latest version, it is added to the registry, but -doesn't change the latest version. -Emits a {AddProtocolVersion} event when successful. -Requirements: -- a valid Warp out-of-band message must be provided. -- source chain ID must be the same as the blockchain ID of the registry. -- origin sender address must be the same as the `VALIDATORS_SOURCE_ADDRESS`. -- destination chain ID must be the same as the blockchain ID of the registry. -- destination address must be the same as the address of the registry. -- version must not be zero. -- version must not already be registered. -- protocol address must not be zero address.* - - -```solidity -function addProtocolVersion(uint32 messageIndex) external virtual; -``` - -### getAddressFromVersion - -*Gets the address of a protocol version. -Requirements: -- the version must be a valid version.* - - -```solidity -function getAddressFromVersion(uint256 version) external view virtual returns (address); -``` - -### getVersionFromAddress - -*Gets the version of the given `protocolAddress`. -If `protocolAddress` is not a registered protocol address, returns 0, which is an invalid version.* - - -```solidity -function getVersionFromAddress(address protocolAddress) external view virtual returns (uint256); -``` - -### getLatestVersion - -*Gets the latest protocol version. -If the registry has no versions, we return 0, which is an invalid version.* - - -```solidity -function getLatestVersion() external view virtual returns (uint256); -``` - -### _addToRegistry - -*Adds the new protocol version address to the registry. -Updates latest version if the version is greater than the current latest version. -Emits a {AddProtocolVersion} event when successful. -Note: `protocolAddress` doesn't have to be a contract address, this is primarily -to support the case we want to register a new protocol address meant for a security patch -before the contract is deployed, to prevent the vulnerabilitiy from being exposed before registry update. -Requirements: -- `version` is not zero -- `version` is not already registered -- `protocolAddress` is not zero address* - - -```solidity -function _addToRegistry(ProtocolRegistryEntry memory entry) internal virtual; -``` - -### _getAddressFromVersion - -*Gets the address of a protocol version. -Requirements: -- `version` must be a valid version, i.e. greater than 0 and not greater than the latest version.* - - -```solidity -function _getAddressFromVersion(uint256 version) internal view virtual returns (address); -``` - -## Events -### AddProtocolVersion -*Emitted when a new protocol version is added to the registry.* - - -```solidity -event AddProtocolVersion(uint256 indexed version, address indexed protocolAddress); -``` - diff --git a/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md b/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md deleted file mode 100644 index 11cc22367..000000000 --- a/contracts/docs/src/src/WarpProtocolRegistry.sol/struct.ProtocolRegistryEntry.md +++ /dev/null @@ -1,13 +0,0 @@ -# ProtocolRegistryEntry -[Git Source](https://github.com/ava-labs/teleporter/blob/4e46f28c075e9bfc858fb8bbe266f5b4cb45a0be/src/WarpProtocolRegistry.sol) - -*Registry entry that represents a mapping between protocolAddress and version.* - - -```solidity -struct ProtocolRegistryEntry { - uint256 version; - address protocolAddress; -} -``` - From 5b0adf52fbdbabf97631cfb24c2f6d0bc8ccca18 Mon Sep 17 00:00:00 2001 From: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:50:23 -0600 Subject: [PATCH 14/29] Update contracts/src/Teleporter/TeleporterMessenger.sol Co-authored-by: F. Eugene Aumson Signed-off-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> --- contracts/src/Teleporter/TeleporterMessenger.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index 6e61dca94..b44276fdd 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -152,7 +152,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { /** * @dev See {ITeleporterMessenger-addFeeAmount} * - * Emits a {AddFeeAmount} event. + * Emits an {AddFeeAmount} event. * Requirements: * * - `additionalFeeAmount` must be non-zero. From 54734920056e246a52d548938415414672d972c4 Mon Sep 17 00:00:00 2001 From: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:51:25 -0600 Subject: [PATCH 15/29] Update README.md Co-authored-by: F. Eugene Aumson Signed-off-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2b6f3d36f..5054012fa 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ The above steps are sufficient to run the included integration tests inside Dock - *Note* These tests will be deprecated in favor of the end to end tests in `tests/`, written using the [Ginkgo](https://onsi.github.io/ginkgo/) testing framework - `scripts/fuji/` includes scripts to interact with a live Teleporter deployment on Fuji subnets. - `scripts/fuji/example-workflows/` includes example workflows that send transactions to interact with Teleporter contracts on Fuji subnets. -- `docker/` includes a containerized setup for running a local setup of Teleporter +- `docker/` includes configurations for a local, containerized setup of Teleporter. ## Run the Docker integration tests From 298c6b300ed702b3da9cf380e225d1f73ca3d298 Mon Sep 17 00:00:00 2001 From: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:51:38 -0600 Subject: [PATCH 16/29] Update README.md Co-authored-by: F. Eugene Aumson Signed-off-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5054012fa..f9a9fe3e4 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ The above steps are sufficient to run the included integration tests inside Dock - `scripts/` includes bash scripts for interacting with Teleporter in various environments, as well as utility scripts. - `abi_bindings.sh` generates ABI bindings for the contracts in `contracts/` and outputs them to `abi-bindings/` - `lint.sh` lints the contracts in `contracts/` - - `scripts/local/` includes scripts for running Teleporter in Docker containers and tests in the `scripts/local/integration-tests` locally. + - `scripts/local/` includes scripts for running Teleporter in Docker containers and for running the tests in the `scripts/local/integration-tests` locally. - `scripts/local/integration-tests/` includes integration test scripts written in bash. The scripts use `foundry` to deploy smart contracts that use Teleporter, send transactions to interact with the contracts, and check that cross-chain messages have the expected effect on destination chains. - *Note* These tests will be deprecated in favor of the end to end tests in `tests/`, written using the [Ginkgo](https://onsi.github.io/ginkgo/) testing framework - `scripts/fuji/` includes scripts to interact with a live Teleporter deployment on Fuji subnets. From 72fbea7adba253b7fc97be4b0522c62dcf31aea1 Mon Sep 17 00:00:00 2001 From: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:51:51 -0600 Subject: [PATCH 17/29] Update README.md Co-authored-by: F. Eugene Aumson Signed-off-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f9a9fe3e4..c9dad29e1 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ The above steps are sufficient to run the included integration tests inside Dock - `scripts/local/integration-tests/` includes integration test scripts written in bash. The scripts use `foundry` to deploy smart contracts that use Teleporter, send transactions to interact with the contracts, and check that cross-chain messages have the expected effect on destination chains. - *Note* These tests will be deprecated in favor of the end to end tests in `tests/`, written using the [Ginkgo](https://onsi.github.io/ginkgo/) testing framework - `scripts/fuji/` includes scripts to interact with a live Teleporter deployment on Fuji subnets. - - `scripts/fuji/example-workflows/` includes example workflows that send transactions to interact with Teleporter contracts on Fuji subnets. + - `scripts/fuji/example-workflows/` includes example workflows that send transactions to interact with Teleporter contracts on [Fuji](https://docs.avax.network/learn/avalanche/fuji) subnets. - `docker/` includes configurations for a local, containerized setup of Teleporter. ## Run the Docker integration tests From 50d23db70f95e15f0aa62320df1eb3fc55ac912a Mon Sep 17 00:00:00 2001 From: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:52:04 -0600 Subject: [PATCH 18/29] Update README.md Co-authored-by: F. Eugene Aumson Signed-off-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c9dad29e1..5f78ba13b 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ The above steps are sufficient to run the included integration tests inside Dock - `subnet-evm/` is the public subnet-evm repository (included as a submodule) checked out on the `warp-contract` branch with our changes. - `scripts/` includes bash scripts for interacting with Teleporter in various environments, as well as utility scripts. - `abi_bindings.sh` generates ABI bindings for the contracts in `contracts/` and outputs them to `abi-bindings/` - - `lint.sh` lints the contracts in `contracts/` + - `lint.sh` lints the contracts in `contracts/`. - `scripts/local/` includes scripts for running Teleporter in Docker containers and for running the tests in the `scripts/local/integration-tests` locally. - `scripts/local/integration-tests/` includes integration test scripts written in bash. The scripts use `foundry` to deploy smart contracts that use Teleporter, send transactions to interact with the contracts, and check that cross-chain messages have the expected effect on destination chains. - *Note* These tests will be deprecated in favor of the end to end tests in `tests/`, written using the [Ginkgo](https://onsi.github.io/ginkgo/) testing framework From 0e3157c346cf80adafc7e7ca72d5618aad1013ae Mon Sep 17 00:00:00 2001 From: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:52:11 -0600 Subject: [PATCH 19/29] Update README.md Co-authored-by: F. Eugene Aumson Signed-off-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f78ba13b..30c1c820c 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ The above steps are sufficient to run the included integration tests inside Dock - `contracts/` is a [Foundry](https://github.com/foundry-rs/foundry) project that includes the implementation of the `TeleporterMessenger` contract and example dApps that demonstrate how to write contracts that interact with Teleporter. - `abi-bindings/` includes Go ABI bindings for the contracts in `contracts/`. -- `tests/` includes integration tests for the contracts in `contracts/`, written using the [Ginkgo](https://onsi.github.io/ginkgo/) testing framework +- `tests/` includes integration tests for the contracts in `contracts/`, written using the [Ginkgo](https://onsi.github.io/ginkgo/) testing framework. - `utils/` includes Go utility functions for interacting with the contracts in `contracts/`. Included are Golang scripts to derive the expected EVM contract address deployed from a given EOA at a specific nonce, and also construct a transaction to deploy provided byte code to the same address on any EVM chain using [Nick's method](https://yamenmerhi.medium.com/nicks-method-ethereum-keyless-execution-168a6659479c#). - `subnet-evm/` is the public subnet-evm repository (included as a submodule) checked out on the `warp-contract` branch with our changes. - `scripts/` includes bash scripts for interacting with Teleporter in various environments, as well as utility scripts. From eec9825e06dc185acfe635f3399ea4e991090901 Mon Sep 17 00:00:00 2001 From: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:52:22 -0600 Subject: [PATCH 20/29] Update README.md Co-authored-by: F. Eugene Aumson Signed-off-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 30c1c820c..e416b3100 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ cast send --private-key 0x56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5c cast balance --rpc-url http://127.0.0.1:9652/ext/bc/C/rpc 0x333d17d3b42bf7930dbc6e852ca7bcf560a69003 ``` -- After calling `./scripts/local/run.sh`, you can directly send messages between the deployed subnets . As an example, `./scripts/integration-tests/basic_send_receive.sh` can be run manually like so: +- After calling `./scripts/local/run.sh`, you can directly send messages between the deployed subnets. As an example, `./scripts/integration-tests/basic_send_receive.sh` can be run manually like so: ``` # Open a shell in the container From ead950655ae527be2f88ceab9c05effef3e89ce4 Mon Sep 17 00:00:00 2001 From: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:52:47 -0600 Subject: [PATCH 21/29] Update README.md Co-authored-by: F. Eugene Aumson Signed-off-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e416b3100..177bae5f8 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ The above steps are sufficient to run the included integration tests inside Dock - `utils/` includes Go utility functions for interacting with the contracts in `contracts/`. Included are Golang scripts to derive the expected EVM contract address deployed from a given EOA at a specific nonce, and also construct a transaction to deploy provided byte code to the same address on any EVM chain using [Nick's method](https://yamenmerhi.medium.com/nicks-method-ethereum-keyless-execution-168a6659479c#). - `subnet-evm/` is the public subnet-evm repository (included as a submodule) checked out on the `warp-contract` branch with our changes. - `scripts/` includes bash scripts for interacting with Teleporter in various environments, as well as utility scripts. - - `abi_bindings.sh` generates ABI bindings for the contracts in `contracts/` and outputs them to `abi-bindings/` + - `abi_bindings.sh` generates ABI bindings for the contracts in `contracts/` and outputs them to `abi-bindings/`. - `lint.sh` lints the contracts in `contracts/`. - `scripts/local/` includes scripts for running Teleporter in Docker containers and for running the tests in the `scripts/local/integration-tests` locally. - `scripts/local/integration-tests/` includes integration test scripts written in bash. The scripts use `foundry` to deploy smart contracts that use Teleporter, send transactions to interact with the contracts, and check that cross-chain messages have the expected effect on destination chains. From 65a912c49177e8c00a71d5b4aecdd1b4acd78b06 Mon Sep 17 00:00:00 2001 From: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:52:58 -0600 Subject: [PATCH 22/29] Update README.md Co-authored-by: F. Eugene Aumson Signed-off-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 177bae5f8..8e153214c 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ The above steps are sufficient to run the included integration tests inside Dock - `lint.sh` lints the contracts in `contracts/`. - `scripts/local/` includes scripts for running Teleporter in Docker containers and for running the tests in the `scripts/local/integration-tests` locally. - `scripts/local/integration-tests/` includes integration test scripts written in bash. The scripts use `foundry` to deploy smart contracts that use Teleporter, send transactions to interact with the contracts, and check that cross-chain messages have the expected effect on destination chains. - - *Note* These tests will be deprecated in favor of the end to end tests in `tests/`, written using the [Ginkgo](https://onsi.github.io/ginkgo/) testing framework + - *Note* These tests will be deprecated in favor of the end to end tests in `tests/`, written using the [Ginkgo](https://onsi.github.io/ginkgo/) testing framework. - `scripts/fuji/` includes scripts to interact with a live Teleporter deployment on Fuji subnets. - `scripts/fuji/example-workflows/` includes example workflows that send transactions to interact with Teleporter contracts on [Fuji](https://docs.avax.network/learn/avalanche/fuji) subnets. - `docker/` includes configurations for a local, containerized setup of Teleporter. From 80ca25ea1d3cae837e2f266f7cdbcebd28a19f87 Mon Sep 17 00:00:00 2001 From: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:53:33 -0600 Subject: [PATCH 23/29] Update README.md Co-authored-by: F. Eugene Aumson Signed-off-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e153214c..dc2e9b766 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,7 @@ source .env ## E2E tests -E2E tests are ran as part of CI, but can also be ran locally with the `--local` flag. To run the E2E tests locally, you'll need to install Gingko following the intructions [here](https://onsi.github.io/ginkgo/#installing-ginkgo) +E2E tests are run as part of CI, but can also be run locally with the `--local` flag. To run the E2E tests locally, you'll need to install Gingko following the instructions [here](https://onsi.github.io/ginkgo/#installing-ginkgo) Next, provide the path to the `subnet-evm` repository and the path to a writeable data directory (here we use the `subnet-evm` submodule and `~/tmp/e2e-test`) to use for the tests: ```bash From 5510d59bc8236a0c67e2cde4d1258aa3a304177a Mon Sep 17 00:00:00 2001 From: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:54:13 -0600 Subject: [PATCH 24/29] Update README.md Co-authored-by: F. Eugene Aumson Signed-off-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dc2e9b766..dd20a96f9 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ source vars.sh - Both the `./scripts/local/run.sh` and `./scripts/local/test.sh` scripts run local five node networks, with each of the nodes validating the primary network and three subnets (Subnet A, Subnet B, and Subnet C). - Logs from the subnets on one of the five nodes are printed to stdout when run using either script. -- These logs can also be found at `~/.avalanche-cli/runs/network-runner-root-data__/node{1,5]/logs/.log`, or at `/var/lib/docker/overlay2//merged/root/.avalanche-cli/....` on your local machine. You will need to be the root user to access the logs under `/var/lib`. +- These logs can also be found at `~/.avalanche-cli/runs/network-runner-root-data__/node{1,5]/logs/.log` in the `local_network_run` container, or at `/var/lib/docker/overlay2//merged/root/.avalanche-cli/....` on your local machine. You will need to be the root user to access the logs under `/var/lib`. ### Run tests on Fuji Testnet From 765b24d629eea2ad55a2db9fa2099b428fb060f4 Mon Sep 17 00:00:00 2001 From: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Date: Mon, 6 Nov 2023 11:14:31 -0600 Subject: [PATCH 25/29] Update README.md Co-authored-by: F. Eugene Aumson Signed-off-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd20a96f9..d47e44093 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ source vars.sh ### Additional notes -- Both the `./scripts/local/run.sh` and `./scripts/local/test.sh` scripts run local five node networks, with each of the nodes validating the primary network and three subnets (Subnet A, Subnet B, and Subnet C). +- Both the `./scripts/local/run.sh` and `./scripts/local/test.sh` scripts run five local network nodes, with each of the nodes validating the primary network and three subnets (Subnet A, Subnet B, and Subnet C). - Logs from the subnets on one of the five nodes are printed to stdout when run using either script. - These logs can also be found at `~/.avalanche-cli/runs/network-runner-root-data__/node{1,5]/logs/.log` in the `local_network_run` container, or at `/var/lib/docker/overlay2//merged/root/.avalanche-cli/....` on your local machine. You will need to be the root user to access the logs under `/var/lib`. From 5992f196d7826adc5adf9bb6ac411f801454e4d3 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Mon, 6 Nov 2023 17:29:32 +0000 Subject: [PATCH 26/29] remove redundant usage --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index 2b6f3d36f..e39bf601f 100644 --- a/README.md +++ b/README.md @@ -132,15 +132,7 @@ source vars.sh ### Run the integration tests in Docker containers -- Run `./scripts/local/test.sh` to run the integration tests in Docker containers. - - `./scripts/local/test.sh` usage is as follows: - ``` - -t, --test Run a specific test. If empty, runs all tests in the ./scripts/local/integration-tests/ - -t, --test "test1 test2" Run multiple tests. Test names must be space delimited and enclosed in quotes - -l, --local-relayer-image Use a local AWM Relayer image instead of pulling from dockerhub - -h, --help Print this help message - ``` - - Note that if `-l, --local` is not set, then the latest published `awm-relayer` image will be pulled from Dockerhub. +- Run `./scripts/local/test.sh` to run the integration tests in Docker containers. See the section above for usage. - This script performs the same setup steps as `scripts/local/run.sh` (described above), and then runs the tests in `./scripts/integration-tests/` automatically ### Additional notes From 42fbae9c6841990b7da7f47596d3f540754da7b6 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Mon, 6 Nov 2023 18:34:10 +0000 Subject: [PATCH 27/29] default behavior to tear down network --- README.md | 2 ++ scripts/local/run.sh | 5 ++++- scripts/local/run_stop.sh | 1 + scripts/local/test.sh | 7 +++++-- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e39bf601f..09bd3bc55 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ The above steps are sufficient to run the included integration tests inside Dock - `./scripts/local/run.sh` usage is as follows: ``` -l, --local-relayer-image Use a local AWM Relayer image instead of pulling from dockerhub + -p, --pause Pause the network on stop. Will attempt to restart the paused network on subsequent runs -h, --help Print this help message ``` - Note that if `-l, --local` is not set, then the latest published `awm-relayer` image will be pulled from Dockerhub. @@ -120,6 +121,7 @@ source vars.sh -t, --test Run a specific test. If empty, runs all tests in the ./scripts/local/integration-tests/ -t, --test "test1 test2" Run multiple tests. Test names must be space delimited and enclosed in quotes -l, --local-relayer-image Use a local AWM Relayer image instead of pulling from dockerhub + -p, --pause Pause the network on stop. Will attempt to restart the paused network on subsequent runs. -h, --help Print this help message ``` - Note that if `-l, --local` is not set, then the latest published `awm-relayer` image will be pulled from Dockerhub. diff --git a/scripts/local/run.sh b/scripts/local/run.sh index bedb6927d..a7bf8f900 100755 --- a/scripts/local/run.sh +++ b/scripts/local/run.sh @@ -7,10 +7,12 @@ set -e # Stop on first error source ./scripts/utils.sh LOCAL_RELAYER_IMAGE= +RUN_STOP_FLAG="-c" HELP= while [ $# -gt 0 ]; do case "$1" in -l | --local-relayer-image) LOCAL_RELAYER_IMAGE=$2 ;; + -p | --pause) RUN_STOP_FLAG= ;; -h | --help) HELP=true ;; esac shift @@ -22,13 +24,14 @@ if [ "$HELP" = true ]; then echo "" echo "Options:" echo " -l, --local-relayer-image Use a local AWM Relayer image instead of pulling from dockerhub" + echo " -p, --pause Pause the network on stop. Will attempt to restart the paused network on subsequent runs" echo " -h, --help Print this help message" exit 0 fi function cleanup { echo "Shutting down network before exiting..." - ./scripts/local/run_stop.sh + ./scripts/local/run_stop.sh $RUN_STOP_FLAG echo "Network stopped" } diff --git a/scripts/local/run_stop.sh b/scripts/local/run_stop.sh index dbd76d8ff..b9b7f2c4b 100755 --- a/scripts/local/run_stop.sh +++ b/scripts/local/run_stop.sh @@ -28,6 +28,7 @@ done # If clean flag is set we remove network running file to start the network from scratch if $clean then + echo "Cleaning network" rm -f NETWORK_RUNNING fi diff --git a/scripts/local/test.sh b/scripts/local/test.sh index 296f52eb8..7d04e0cf7 100755 --- a/scripts/local/test.sh +++ b/scripts/local/test.sh @@ -8,11 +8,13 @@ source ./scripts/utils.sh TEST_TARGET= LOCAL_RELAYER_IMAGE= TESTNET= +RUN_STOP_FLAG="-c" HELP= while [ $# -gt 0 ]; do case "$1" in -t | --test) export TEST_TARGET=$2 ;; -l | --local-relayer-image) LOCAL_RELAYER_IMAGE=$2 ;; + -p | --pause) RUN_STOP_FLAG= ;; -h | --help) HELP=true ;; esac shift @@ -26,13 +28,14 @@ if [ "$HELP" = true ]; then echo " -t, --test Run a specific test. If empty, runs all tests in the ./scripts/local/integration-tests/" echo " -t, --test "test1 test2" Run multiple tests. Test names must be space delimited and enclosed in quotes" echo " -l, --local-relayer-image Use a local AWM Relayer image instead of pulling from dockerhub" + echo " -p, --pause Pause the network on stop. Will attempt to restart the paused network on subsequent runs" echo " -h, --help Print this help message" exit 0 fi function cleanup { echo "Shutting down network before exiting..." - ./scripts/local/run_stop.sh + ./scripts/local/run_stop.sh $RUN_STOP_FLAG echo "Network stopped" } @@ -76,6 +79,6 @@ do done # Stop the containers gracefully -./scripts/local/run_stop.sh +./scripts/local/run_stop.sh $RUN_STOP_FLAG code=$(docker inspect --format='{{.State.ExitCode}}' test_runner) exit $code From 63c45d9457671017b788c9519271d41338e4f35f Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Mon, 6 Nov 2023 18:35:19 +0000 Subject: [PATCH 28/29] consistent usage punc --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 09bd3bc55..bf0812d4d 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ source vars.sh -t, --test Run a specific test. If empty, runs all tests in the ./scripts/local/integration-tests/ -t, --test "test1 test2" Run multiple tests. Test names must be space delimited and enclosed in quotes -l, --local-relayer-image Use a local AWM Relayer image instead of pulling from dockerhub - -p, --pause Pause the network on stop. Will attempt to restart the paused network on subsequent runs. + -p, --pause Pause the network on stop. Will attempt to restart the paused network on subsequent runs -h, --help Print this help message ``` - Note that if `-l, --local` is not set, then the latest published `awm-relayer` image will be pulled from Dockerhub. From 24dbbcaca63c7468d8b6233ca9e8e5e851bb67c3 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Tue, 7 Nov 2023 14:11:48 +0000 Subject: [PATCH 29/29] correct container in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8aa60e4e6..e6bd9f52d 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ cast balance --rpc-url http://127.0.0.1:9652/ext/bc/C/rpc 0x333d17d3b42bf7930dbc ``` # Open a shell in the container -docker exec -it relayer_run /bin/bash +docker exec -it local_network_run /bin/bash # In the container: set -a # export all variables so child processes can access source vars.sh