Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
geoff-vball committed Nov 22, 2024
1 parent 4c0937f commit 48c8314
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions contracts/ictt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ A concrete implementation of `TokenHome` and `INativeTokenTransferrer` that hand

## `TokenRemote`

An abstract implementation of `ITokenTransferrer` for a token transfer contract on a "remote" chain that receives transferred assets from a specific `TokenHome` instance. Each `TokenRemote` instance has a single `TokenHome` instance that it receives token transfers from to mint tokens. It also handles sending messages (and correspondingly burning tokens) to route tokens back to other chains (either its `TokenHome`, or other `TokenRemote` instances). Once deployed, a `TokenRemote` instance must be registered with its specified `TokenHome` contract. This is done by calling `registerWithHome` on the remote contract, which will send a ICM message to the home contract with the information to register.
An abstract implementation of `ITokenTransferrer` for a token transfer contract on a "remote" chain that receives transferred assets from a specific `TokenHome` instance. Each `TokenRemote` instance has a single `TokenHome` instance that it receives token transfers from to mint tokens. It also handles sending messages (and correspondingly burning tokens) to route tokens back to other chains (either its `TokenHome`, or other `TokenRemote` instances). Once deployed, a `TokenRemote` instance must be registered with its specified `TokenHome` contract. This is done by calling `registerWithHome` on the remote contract, which will send an ICM message to the home contract with the information to register.

All messages sent by `TokenRemote` instances are sent to the specified `TokenHome` contract, whether they are to redeem the collateral from the `TokenHome` instance or route the tokens to another `TokenRemote` instance. Routing tokens from one `TokenRemote` instance to another is referred to as a "multi-hop", where the tokens are first sent back to their `TokenHome` contract to update its accounting, and then automatically routed on to their intended destination `TokenRemote` instance.

Expand All @@ -74,7 +74,7 @@ To account for the need to bootstrap the chain using a transferred asset as its

1. Create a new blockchain with 100 native tokens allocated in its genesis block, and set the pre-derived `NativeTokenRemote` contract address (based on the deployer nonce) to have the permission to mint native tokens using the native minter precompile. Note that the deployer account will need to be funded in order to deploy the `NativeTokenRemote` contract, and an account used to relay messages into this chain must also be funded to relay the first messages.
2. Deploy the `NativeTokenRemote` contract to the pre-derived address set in the blockchain configuration of step 1. The `initialReserveImbalance` should be 100, matching the number of tokens allocated in the genesis block that were not initially backed by collateral in the `TokenHome` instance.
3. Call the `registerWithHome` function on the `NativeTokenRemote` instance to send a ICM message registering this remote with its `TokenHome`. This message should be relayed and delivered to the `TokenHome` instance.
3. Call the `registerWithHome` function on the `NativeTokenRemote` instance to send an ICM message registering this remote with its `TokenHome`. This message should be relayed and delivered to the `TokenHome` instance.
4. Once registered on the `TokenHome` contract, add 100 tokens as collateral for the new `NativeTokenRemote` instance by calling the `addCollateral` function on the `TokenHome` contract. A `CollateralAdded` event will be emitted by the `TokenHome` contract with a `remaining` amount of 0 once the `NativeTokenRemote` is fully collateralized.
5. Now that the `NativeTokenRemote` contract is fully collateralized, tokens can be moved normally in both directions across the token transfer contracts by calling their `send` functions.

Expand Down
2 changes: 1 addition & 1 deletion contracts/validator-manager/ValidatorManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ abstract contract ValidatorManager is Initializable, ContextUpgradeable, IValida
}

// Validation ID of the initial validators is the sha256 hash of the
// convert L1 to L1 tx ID and the index of the initial validator.
// convert subnet to L1 tx ID and the index of the initial validator.
bytes32 validationID = sha256(abi.encodePacked(conversionData.l1ID, i));

// Save the initial validator as an active validator.
Expand Down
4 changes: 2 additions & 2 deletions tests/flows/teleporter/basic_send_receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func BasicSendReceive(network *localnetwork.LocalNetwork, teleporter utils.Telep
teleporterContractAddress := teleporter.TeleporterMessengerAddress(l1AInfo)
fundedAddress, fundedKey := network.GetFundedAccountInfo()

// Send a transaction to L1 A to issue a ICM Message from the Teleporter contract to L1 B
// Send a transaction to L1 A to issue an ICM Message from the Teleporter contract to L1 B
ctx := context.Background()

// Clear the receipt queue from L1 B -> L1 A to have a clean slate for the test flow.
Expand Down Expand Up @@ -79,7 +79,7 @@ func BasicSendReceive(network *localnetwork.LocalNetwork, teleporter utils.Telep
Expect(err).Should(BeNil())
Expect(delivered).Should(BeTrue())

// Send a transaction to L1 B to issue a ICM Message from the Teleporter contract to L1 A
// Send a transaction to L1 B to issue an ICM Message from the Teleporter contract to L1 A
sendCrossChainMessageInput.DestinationBlockchainID = l1AInfo.BlockchainID
sendCrossChainMessageInput.FeeInfo.Amount = big.NewInt(0)
receipt, teleporterMessageID = utils.SendCrossChainMessageAndWaitForAcceptance(
Expand Down
2 changes: 1 addition & 1 deletion tests/flows/teleporter/relay_message_twice.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func RelayMessageTwice(network *localnetwork.LocalNetwork, teleporter utils.Tele
fundedAddress, fundedKey := network.GetFundedAccountInfo()

//
// Send a transaction to L1 A to issue a ICM Message from the Teleporter contract to L1 B
// Send a transaction to L1 A to issue an ICM Message from the Teleporter contract to L1 B
//
ctx := context.Background()

Expand Down
2 changes: 1 addition & 1 deletion tests/flows/teleporter/resubmit_altered_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func ResubmitAlteredMessage(network *localnetwork.LocalNetwork, teleporter utils
l1BInfo, _ := network.GetTwoL1s()
fundedAddress, fundedKey := network.GetFundedAccountInfo()

// Send a transaction to L1 A to issue a ICM Message from the Teleporter contract to L1 B
// Send a transaction to L1 A to issue an ICM Message from the Teleporter contract to L1 B
ctx := context.Background()

sendCrossChainMessageInput := teleportermessenger.TeleporterMessageInput{
Expand Down
2 changes: 1 addition & 1 deletion tests/flows/teleporter/unallowed_relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func UnallowedRelayer(network *localnetwork.LocalNetwork, teleporter utils.Telep
fundedAddress, fundedKey := network.GetFundedAccountInfo()

//
// Send a transaction to L1 A to issue a ICM Message from the Teleporter contract to L1 B
// Send a transaction to L1 A to issue an ICM Message from the Teleporter contract to L1 B
// The Teleporter message includes an allowed relayer list that does NOT include the relayer
//
ctx := context.Background()
Expand Down

0 comments on commit 48c8314

Please sign in to comment.