Final Contract Cleaning + Renaming (#698)

* Rename Pending to Proven; make case for enums consistent

* Replica docs

* GovernanceRouter docs

* Fix test error message

* XAppConnectionManager docs

* Remove is_owner from rust

* Remove isOwner test

* Rename enqueue => dispatch

* Update tests to remove enqueue

* Rename enqueue in rust

* Fix: disapatch

* Rename sequences => nonces

* Rename sequences => nonces

* fix lint

* Rename current => committedRoot

* Rename leaf => messageHash

* Rename endBlock => recoveryActiveAt

* Fix test gen
buddies-main-deployment
Anna Carroll 3 years ago committed by GitHub
parent ded27f486d
commit 5ba0bed73a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 84
      rust/Cargo.lock
  2. 2
      rust/agents/kathy/src/kathy.rs
  3. 4
      rust/agents/processor/src/processor.rs
  4. 2
      rust/agents/relayer/src/relayer.rs
  5. 10
      rust/agents/updater/src/updater.rs
  6. 30
      rust/agents/watcher/src/watcher.rs
  7. 112
      rust/chains/optics-ethereum/abis/Home.abi.json
  8. 30
      rust/chains/optics-ethereum/abis/Replica.abi.json
  9. 19
      rust/chains/optics-ethereum/abis/XAppConnectionManager.abi.json
  10. 24
      rust/chains/optics-ethereum/src/home.rs
  11. 4
      rust/chains/optics-ethereum/src/replica.rs
  12. 9
      rust/chains/optics-ethereum/src/xapp.rs
  13. 38
      rust/optics-base/src/home.rs
  14. 8
      rust/optics-base/src/replica.rs
  15. 14
      rust/optics-base/src/xapp.rs
  16. 2
      rust/optics-core/bin/utils_test_output.rs
  17. 16
      rust/optics-core/src/models/home.rs
  18. 20
      rust/optics-core/src/test_output.rs
  19. 32
      rust/optics-core/src/traits/home.rs
  20. 6
      rust/optics-core/src/traits/mod.rs
  21. 3
      rust/optics-core/src/traits/xapp.rs
  22. 12
      rust/optics-core/src/types/messages.rs
  23. 10
      rust/optics-core/src/utils.rs
  24. 28
      rust/optics-test/src/mocks/home.rs
  25. 6
      rust/optics-test/src/mocks/replica.rs
  26. 6
      rust/optics-test/src/mocks/xapp.rs
  27. 31
      solidity/optics-core/contracts/Common.sol
  28. 84
      solidity/optics-core/contracts/Home.sol
  29. 235
      solidity/optics-core/contracts/Replica.sol
  30. 137
      solidity/optics-core/contracts/XAppConnectionManager.sol
  31. 199
      solidity/optics-core/contracts/governance/GovernanceRouter.sol
  32. 4
      solidity/optics-core/contracts/test/TestHome.sol
  33. 4
      solidity/optics-core/contracts/test/TestMessage.sol
  34. 6
      solidity/optics-core/contracts/test/TestReplica.sol
  35. 18
      solidity/optics-core/libs/Message.sol
  36. 6
      solidity/optics-xapps/contracts/bridge/BridgeRouter.sol
  37. 20
      solidity/optics-xapps/contracts/bridge/test/MockCore.sol
  38. 10
      solidity/optics-xapps/contracts/ping-pong/PingPongRouter.sol
  39. 6
      solidity/optics-xapps/contracts/xapp-template/RouterTemplate.sol
  40. 2
      typescript/optics-deploy/src/core/index.ts
  41. 8
      typescript/optics-tests/lib/core.ts
  42. 4
      typescript/optics-tests/lib/types.ts
  43. 16405
      typescript/optics-tests/package-lock.json
  44. 34
      typescript/optics-tests/test/cross-chain/governanceRouter.test.ts
  45. 38
      typescript/optics-tests/test/cross-chain/simpleMessage.test.ts
  46. 42
      typescript/optics-tests/test/cross-chain/utils.ts
  47. 118
      typescript/optics-tests/test/home.test.ts
  48. 20
      typescript/optics-tests/test/message.test.ts
  49. 92
      typescript/optics-tests/test/replica.test.ts
  50. 7
      typescript/optics-tests/test/xAppConnectionManager.test.ts
  51. 22
      typescript/typechain/optics-core/Common.d.ts
  52. 4
      typescript/typechain/optics-core/GovernanceRouter.d.ts
  53. 177
      typescript/typechain/optics-core/Home.d.ts
  54. 46
      typescript/typechain/optics-core/Replica.d.ts
  55. 22
      typescript/typechain/optics-core/TestCommon.d.ts
  56. 4
      typescript/typechain/optics-core/TestGovernanceRouter.d.ts
  57. 203
      typescript/typechain/optics-core/TestHome.d.ts
  58. 35
      typescript/typechain/optics-core/TestMessage.d.ts
  59. 62
      typescript/typechain/optics-core/TestReplica.d.ts
  60. 16
      typescript/typechain/optics-core/TestXAppConnectionManager.d.ts
  61. 16
      typescript/typechain/optics-core/XAppConnectionManager.d.ts
  62. 2
      typescript/typechain/optics-core/factories/Common__factory.ts
  63. 4
      typescript/typechain/optics-core/factories/GovernanceRouter__factory.ts
  64. 114
      typescript/typechain/optics-core/factories/Home__factory.ts
  65. 32
      typescript/typechain/optics-core/factories/Replica__factory.ts
  66. 4
      typescript/typechain/optics-core/factories/TestCommon__factory.ts
  67. 4
      typescript/typechain/optics-core/factories/TestGovernanceRouter__factory.ts
  68. 118
      typescript/typechain/optics-core/factories/TestHome__factory.ts
  69. 28
      typescript/typechain/optics-core/factories/TestMessage__factory.ts
  70. 34
      typescript/typechain/optics-core/factories/TestReplica__factory.ts
  71. 21
      typescript/typechain/optics-core/factories/TestXAppConnectionManager__factory.ts
  72. 2
      typescript/typechain/optics-core/factories/UpdaterManager__factory.ts
  73. 21
      typescript/typechain/optics-core/factories/XAppConnectionManager__factory.ts
  74. 22
      typescript/typechain/optics-xapps/Common.d.ts
  75. 177
      typescript/typechain/optics-xapps/Home.d.ts
  76. 61
      typescript/typechain/optics-xapps/MockCore.d.ts
  77. 46
      typescript/typechain/optics-xapps/Replica.d.ts
  78. 16
      typescript/typechain/optics-xapps/XAppConnectionManager.d.ts
  79. 2
      typescript/typechain/optics-xapps/factories/BridgeRouter__factory.ts
  80. 2
      typescript/typechain/optics-xapps/factories/BridgeToken__factory.ts
  81. 2
      typescript/typechain/optics-xapps/factories/Common__factory.ts
  82. 2
      typescript/typechain/optics-xapps/factories/ETHHelper__factory.ts
  83. 114
      typescript/typechain/optics-xapps/factories/Home__factory.ts
  84. 44
      typescript/typechain/optics-xapps/factories/MockCore__factory.ts
  85. 2
      typescript/typechain/optics-xapps/factories/MockWeth__factory.ts
  86. 2
      typescript/typechain/optics-xapps/factories/PingPongRouter__factory.ts
  87. 32
      typescript/typechain/optics-xapps/factories/Replica__factory.ts
  88. 2
      typescript/typechain/optics-xapps/factories/RouterTemplate__factory.ts
  89. 21
      typescript/typechain/optics-xapps/factories/XAppConnectionManager__factory.ts
  90. 27
      vectors/destinationNonce.json
  91. 27
      vectors/destinationSequence.json
  92. 4
      vectors/message.json

84
rust/Cargo.lock generated

@ -890,9 +890,9 @@ version = "0.5.1"
source = "git+https://github.com/gakonst/ethers-rs?branch=master#824bedbd428ef6671596d45216b2cfc19834665b"
dependencies = [
"ethers-contract",
"ethers-core 0.5.1",
"ethers-core",
"ethers-middleware",
"ethers-providers 0.5.1 (git+https://github.com/gakonst/ethers-rs?branch=master)",
"ethers-providers",
"ethers-signers",
]
@ -903,8 +903,8 @@ source = "git+https://github.com/gakonst/ethers-rs?branch=master#824bedbd428ef66
dependencies = [
"ethers-contract-abigen",
"ethers-contract-derive",
"ethers-core 0.5.1",
"ethers-providers 0.5.1 (git+https://github.com/gakonst/ethers-rs?branch=master)",
"ethers-core",
"ethers-providers",
"futures-util",
"hex",
"once_cell",
@ -923,7 +923,7 @@ dependencies = [
"anyhow",
"cargo_metadata",
"cfg-if",
"ethers-core 0.5.1",
"ethers-core",
"getrandom",
"hex",
"once_cell",
@ -942,7 +942,7 @@ version = "0.5.1"
source = "git+https://github.com/gakonst/ethers-rs?branch=master#824bedbd428ef6671596d45216b2cfc19834665b"
dependencies = [
"ethers-contract-abigen",
"ethers-core 0.5.1",
"ethers-core",
"hex",
"proc-macro2",
"quote",
@ -975,30 +975,6 @@ dependencies = [
"tokio",
]
[[package]]
name = "ethers-core"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "777686df15e28e0e49d2e7d1a4e5db111eac404a1c67cccf3009af9d6163dc39"
dependencies = [
"arrayvec 0.7.1",
"bytes",
"ecdsa",
"elliptic-curve",
"ethabi",
"generic-array 0.14.4",
"glob",
"hex",
"k256",
"rand",
"rlp",
"rlp-derive",
"serde 1.0.130",
"serde_json",
"thiserror",
"tiny-keccak",
]
[[package]]
name = "ethers-middleware"
version = "0.5.1"
@ -1006,8 +982,8 @@ source = "git+https://github.com/gakonst/ethers-rs?branch=master#824bedbd428ef66
dependencies = [
"async-trait",
"ethers-contract",
"ethers-core 0.5.1",
"ethers-providers 0.5.1 (git+https://github.com/gakonst/ethers-rs?branch=master)",
"ethers-core",
"ethers-providers",
"ethers-signers",
"futures-util",
"instant",
@ -1022,40 +998,6 @@ dependencies = [
"url",
]
[[package]]
name = "ethers-providers"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7edfb15611b9514e7a8f5904ad3be15004efc6f4ecb40703b985d8fa1d5cc672"
dependencies = [
"async-trait",
"auto_impl",
"bytes",
"ethers-core 0.5.2",
"futures-channel",
"futures-core",
"futures-timer",
"futures-util",
"hex",
"parking_lot",
"pin-project",
"reqwest",
"serde 1.0.130",
"serde_json",
"thiserror",
"tokio",
"tokio-tungstenite",
"tokio-util",
"tracing",
"tracing-futures",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-timer",
"web-sys",
"ws_stream_wasm",
]
[[package]]
name = "ethers-providers"
version = "0.5.1"
@ -1064,7 +1006,7 @@ dependencies = [
"async-trait",
"auto_impl",
"bytes",
"ethers-core 0.5.1",
"ethers-core",
"futures-channel",
"futures-core",
"futures-timer",
@ -1099,7 +1041,7 @@ dependencies = [
"coins-bip39",
"elliptic-curve",
"eth-keystore",
"ethers-core 0.5.1",
"ethers-core",
"futures-executor",
"futures-util",
"hex",
@ -2199,7 +2141,7 @@ dependencies = [
"async-trait",
"color-eyre",
"ethers",
"ethers-providers 0.5.1 (git+https://github.com/gakonst/ethers-rs?branch=master)",
"ethers-providers",
"ethers-signers",
"hex",
"lazy_static",
@ -2220,17 +2162,13 @@ dependencies = [
"color-eyre",
"ethers",
"ethers-contract",
"ethers-providers 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ethers-signers",
"hex",
"optics-core",
"reqwest",
"serde 1.0.130",
"serde_json",
"thiserror",
"tokio",
"tracing",
"url",
]
[[package]]

@ -82,7 +82,7 @@ impl OpticsAgent for Kathy {
destination = message.destination,
recipient = message.recipient
);
home.enqueue(&message).await?;
home.dispatch(&message).await?;
}
_ => {
info!("Reached the end of the static message queue. Shutting down.");

@ -107,7 +107,7 @@ impl Replica {
let seq_span = tracing::trace_span!(
"ReplicaProcessor",
name = self.replica.name(),
sequence = next_to_inspect,
nonce = next_to_inspect,
replica_domain = self.replica.local_domain(),
home_domain = self.home.local_domain(),
);
@ -148,7 +148,7 @@ impl Replica {
async fn try_msg_by_domain_and_seq(&self, domain: u32, current_seq: u32) -> Result<bool> {
use optics_core::traits::Replica;
let message = match self.home.message_by_sequence(domain, current_seq).await {
let message = match self.home.message_by_nonce(domain, current_seq).await {
Ok(Some(m)) => m,
Ok(None) => {
info!("Message not yet found");

@ -48,7 +48,7 @@ impl UpdatePoller {
// If the replica has a queue of pending updates, we use the last queue
// root instead
let (old_root_res, queue_end_res) =
join!(self.replica.current_root(), self.replica.queue_end());
join!(self.replica.committed_root(), self.replica.queue_end());
let old_root = {
if let Some(end) = queue_end_res? {

@ -86,23 +86,23 @@ impl UpdateHandler {
async fn acceptable(&self, update: &Update) -> Result<bool> {
// Poll chain API to see if queue still contains new root
// and old root still equals home's current root
let (in_queue, current_root) = tokio::join!(
let (in_queue, committed_root) = tokio::join!(
self.home.queue_contains(update.new_root),
self.home.current_root()
self.home.committed_root()
);
if in_queue.is_err() {
info!("Update no longer in queue");
}
if current_root.is_err() {
if committed_root.is_err() {
error!("Connection gone");
}
let in_queue = in_queue?;
let current_root = current_root?;
let committed_root = committed_root?;
let old_root = update.previous_root;
Ok(in_queue && current_root == old_root)
Ok(in_queue && committed_root == old_root)
}
#[tracing::instrument(err, skip(self), fields(self = %self))]

@ -42,7 +42,7 @@ where
C: Common + ?Sized + 'static,
{
interval: u64,
current_root: H256,
committed_root: H256,
tx: mpsc::Sender<SignedUpdate>,
contract: Arc<C>,
}
@ -59,7 +59,7 @@ where
) -> Self {
Self {
interval,
current_root: from,
committed_root: from,
tx,
contract,
}
@ -68,7 +68,7 @@ where
async fn poll_and_send_update(&mut self) -> Result<()> {
let update_opt = self
.contract
.signed_update_by_old_root(self.current_root)
.signed_update_by_old_root(self.committed_root)
.await?;
if update_opt.is_none() {
@ -76,7 +76,7 @@ where
}
let new_update = update_opt.unwrap();
self.current_root = new_update.update.new_root;
self.committed_root = new_update.update.new_root;
self.tx.send(new_update).await?;
Ok(())
@ -99,7 +99,7 @@ where
C: Common + ?Sized + 'static,
{
interval: u64,
current_root: H256,
committed_root: H256,
tx: mpsc::Sender<SignedUpdate>,
contract: Arc<C>,
}
@ -115,7 +115,7 @@ where
contract: Arc<C>,
) -> Self {
Self {
current_root: from,
committed_root: from,
tx,
contract,
interval,
@ -125,7 +125,7 @@ where
async fn update_history(&mut self) -> Result<()> {
let previous_update = self
.contract
.signed_update_by_new_root(self.current_root)
.signed_update_by_new_root(self.committed_root)
.await?;
if previous_update.is_none() {
@ -137,9 +137,9 @@ where
let previous_update = previous_update.unwrap();
// set up for next loop iteration
self.current_root = previous_update.update.previous_root;
self.committed_root = previous_update.update.previous_root;
self.tx.send(previous_update).await?;
if self.current_root.is_zero() {
if self.committed_root.is_zero() {
// Task finished
return Err(Report::new(WatcherError::SyncingFinished));
}
@ -216,7 +216,7 @@ impl UpdateHandler {
let update = update.unwrap();
let old_root = update.update.previous_root;
if old_root == self.home.current_root().await? {
if old_root == self.home.committed_root().await? {
// It is okay if tx reverts
let _ = self.home.update(&update).await;
}
@ -372,7 +372,7 @@ impl OpticsAgent for Watcher {
let replica = self
.replica_by_name(name)
.ok_or_else(|| eyre!("No replica named {}", name))?;
let from = replica.current_root().await?;
let from = replica.committed_root().await?;
self.watch_tasks.write().await.insert(
(*name).to_owned(),
@ -389,7 +389,7 @@ impl OpticsAgent for Watcher {
}
let home = self.home();
let from = home.current_root().await?;
let from = home.committed_root().await?;
let home_watcher =
ContractWatcher::new(self.interval_seconds, from, tx.clone(), home.clone())
@ -486,7 +486,7 @@ mod test {
.await
.expect("Should have received Ok(())");
assert_eq!(contract_watcher.current_root, second_root);
assert_eq!(contract_watcher.committed_root, second_root);
assert_eq!(rx.recv().await.unwrap(), signed_update);
}
@ -556,7 +556,7 @@ mod test {
.await
.expect("Should have received Ok(())");
assert_eq!(history_sync.current_root, first_root);
assert_eq!(history_sync.committed_root, first_root);
assert_eq!(rx.recv().await.unwrap(), second_signed_update);
// Second update_history call returns zero -> first update
@ -566,7 +566,7 @@ mod test {
.await
.expect_err("Should have received WatcherError::SyncingFinished");
assert_eq!(history_sync.current_root, zero_root);
assert_eq!(history_sync.committed_root, zero_root);
assert_eq!(rx.recv().await.unwrap(), first_signed_update)
}

@ -13,6 +13,12 @@
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "messageHash",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "uint256",
@ -22,19 +28,13 @@
{
"indexed": true,
"internalType": "uint64",
"name": "destinationAndSequence",
"name": "destinationAndNonce",
"type": "uint64"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "leaf",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "current",
"name": "committedRoot",
"type": "bytes32"
},
{
@ -213,12 +213,12 @@
},
{
"inputs": [],
"name": "count",
"name": "committedRoot",
"outputs": [
{
"internalType": "uint256",
"internalType": "bytes32",
"name": "",
"type": "uint256"
"type": "bytes32"
}
],
"stateMutability": "view",
@ -226,12 +226,12 @@
},
{
"inputs": [],
"name": "current",
"name": "count",
"outputs": [
{
"internalType": "bytes32",
"internalType": "uint256",
"name": "",
"type": "bytes32"
"type": "uint256"
}
],
"stateMutability": "view",
@ -240,50 +240,50 @@
{
"inputs": [
{
"internalType": "bytes32",
"name": "_oldRoot",
"type": "bytes32"
},
{
"internalType": "bytes32[2]",
"name": "_newRoot",
"type": "bytes32[2]"
"internalType": "uint32",
"name": "_destinationDomain",
"type": "uint32"
},
{
"internalType": "bytes",
"name": "_signature",
"type": "bytes"
"internalType": "bytes32",
"name": "_recipientAddress",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "_signature2",
"name": "_messageBody",
"type": "bytes"
}
],
"name": "doubleUpdate",
"name": "dispatch",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "_destinationDomain",
"type": "uint32"
},
{
"internalType": "bytes32",
"name": "_recipientAddress",
"name": "_oldRoot",
"type": "bytes32"
},
{
"internalType": "bytes32[2]",
"name": "_newRoot",
"type": "bytes32[2]"
},
{
"internalType": "bytes",
"name": "_messageBody",
"name": "_signature",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "_signature2",
"type": "bytes"
}
],
"name": "enqueue",
"name": "doubleUpdate",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
@ -356,6 +356,25 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"name": "nonces",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
@ -434,25 +453,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"name": "sequences",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
@ -498,7 +498,7 @@
"outputs": [
{
"internalType": "bytes32",
"name": "_current",
"name": "_committedRoot",
"type": "bytes32"
},
{
@ -540,7 +540,7 @@
"inputs": [
{
"internalType": "bytes32",
"name": "_currentRoot",
"name": "_committedRoot",
"type": "bytes32"
},
{

@ -53,7 +53,7 @@
{
"indexed": true,
"internalType": "uint32",
"name": "sequence",
"name": "nonce",
"type": "uint32"
},
{
@ -174,6 +174,19 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "committedRoot",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "confirm",
@ -200,19 +213,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "current",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
@ -268,7 +268,7 @@
},
{
"internalType": "bytes32",
"name": "_current",
"name": "_committedRoot",
"type": "bytes32"
},
{

@ -118,25 +118,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"name": "isOwner",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{

@ -83,8 +83,8 @@ where
}
#[tracing::instrument(err, skip(self))]
async fn current_root(&self) -> Result<H256, ChainCommunicationError> {
Ok(self.contract.current().call().await?.into())
async fn committed_root(&self) -> Result<H256, ChainCommunicationError> {
Ok(self.contract.committed_root().call().await?.into())
}
#[tracing::instrument(err, skip(self))]
@ -184,12 +184,12 @@ where
}
#[tracing::instrument(err, skip(self))]
async fn raw_message_by_sequence(
async fn raw_message_by_nonce(
&self,
destination: u32,
sequence: u32,
nonce: u32,
) -> Result<Option<RawCommittedMessage>, ChainCommunicationError> {
let dest_and_seq = utils::destination_and_sequence(destination, sequence);
let dest_and_seq = utils::destination_and_nonce(destination, nonce);
let events = self
.contract
@ -201,7 +201,7 @@ where
Ok(events.into_iter().next().map(|f| RawCommittedMessage {
leaf_index: f.leaf_index.as_u32(),
current_root: f.current.into(),
committed_root: f.committed_root.into(),
message: f.message,
}))
}
@ -221,7 +221,7 @@ where
Ok(events.into_iter().next().map(|f| RawCommittedMessage {
leaf_index: f.leaf_index.as_u32(),
current_root: f.current.into(),
committed_root: f.committed_root.into(),
message: f.message,
}))
}
@ -238,17 +238,17 @@ where
.query()
.await?
.first()
.map(|event| event.leaf.into()))
.map(|event| event.message_hash.into()))
}
#[tracing::instrument(err, skip(self))]
async fn sequences(&self, destination: u32) -> Result<u32, ChainCommunicationError> {
Ok(self.contract.sequences(destination).call().await?)
async fn nonces(&self, destination: u32) -> Result<u32, ChainCommunicationError> {
Ok(self.contract.nonces(destination).call().await?)
}
#[tracing::instrument(err, skip(self))]
async fn enqueue(&self, message: &Message) -> Result<TxOutcome, ChainCommunicationError> {
let tx = self.contract.enqueue(
async fn dispatch(&self, message: &Message) -> Result<TxOutcome, ChainCommunicationError> {
let tx = self.contract.dispatch(
message.destination,
message.recipient.to_fixed_bytes(),
message.body.clone(),

@ -87,8 +87,8 @@ where
}
#[tracing::instrument(err)]
async fn current_root(&self) -> Result<H256, ChainCommunicationError> {
Ok(self.contract.current().call().await?.into())
async fn committed_root(&self) -> Result<H256, ChainCommunicationError> {
Ok(self.contract.committed_root().call().await?.into())
}
#[tracing::instrument(err)]

@ -53,15 +53,6 @@ where
self.domain
}
#[tracing::instrument(err)]
async fn is_owner(&self, address: OpticsIdentifier) -> Result<bool, ChainCommunicationError> {
Ok(self
.contract
.is_owner(address.as_ethereum_address())
.call()
.await?)
}
#[tracing::instrument(err)]
async fn is_replica(&self, address: OpticsIdentifier) -> Result<bool, ChainCommunicationError> {
Ok(self

@ -75,19 +75,15 @@ impl Home for Homes {
}
#[instrument(level = "trace", err)]
async fn raw_message_by_sequence(
async fn raw_message_by_nonce(
&self,
destination: u32,
sequence: u32,
nonce: u32,
) -> Result<Option<RawCommittedMessage>, ChainCommunicationError> {
match self {
Homes::Ethereum(home) => home.raw_message_by_sequence(destination, sequence).await,
Homes::Mock(mock_home) => {
mock_home
.raw_message_by_sequence(destination, sequence)
.await
}
Homes::Other(home) => home.raw_message_by_sequence(destination, sequence).await,
Homes::Ethereum(home) => home.raw_message_by_nonce(destination, nonce).await,
Homes::Mock(mock_home) => mock_home.raw_message_by_nonce(destination, nonce).await,
Homes::Other(home) => home.raw_message_by_nonce(destination, nonce).await,
}
}
@ -116,20 +112,20 @@ impl Home for Homes {
}
#[instrument(level = "trace", err)]
async fn sequences(&self, destination: u32) -> Result<u32, ChainCommunicationError> {
async fn nonces(&self, destination: u32) -> Result<u32, ChainCommunicationError> {
match self {
Homes::Ethereum(home) => home.sequences(destination).await,
Homes::Mock(mock_home) => mock_home.sequences(destination).await,
Homes::Other(home) => home.sequences(destination).await,
Homes::Ethereum(home) => home.nonces(destination).await,
Homes::Mock(mock_home) => mock_home.nonces(destination).await,
Homes::Other(home) => home.nonces(destination).await,
}
}
#[instrument(level = "trace", err)]
async fn enqueue(&self, message: &Message) -> Result<TxOutcome, ChainCommunicationError> {
async fn dispatch(&self, message: &Message) -> Result<TxOutcome, ChainCommunicationError> {
match self {
Homes::Ethereum(home) => home.enqueue(message).await,
Homes::Mock(mock_home) => mock_home.enqueue(message).await,
Homes::Other(home) => home.enqueue(message).await,
Homes::Ethereum(home) => home.dispatch(message).await,
Homes::Mock(mock_home) => mock_home.dispatch(message).await,
Homes::Other(home) => home.dispatch(message).await,
}
}
@ -196,11 +192,11 @@ impl Common for Homes {
}
}
async fn current_root(&self) -> Result<H256, ChainCommunicationError> {
async fn committed_root(&self) -> Result<H256, ChainCommunicationError> {
match self {
Homes::Ethereum(home) => home.current_root().await,
Homes::Mock(mock_home) => mock_home.current_root().await,
Homes::Other(home) => home.current_root().await,
Homes::Ethereum(home) => home.committed_root().await,
Homes::Mock(mock_home) => mock_home.committed_root().await,
Homes::Other(home) => home.committed_root().await,
}
}

@ -186,11 +186,11 @@ impl Common for Replicas {
}
}
async fn current_root(&self) -> Result<H256, ChainCommunicationError> {
async fn committed_root(&self) -> Result<H256, ChainCommunicationError> {
match self {
Replicas::Ethereum(replica) => replica.current_root().await,
Replicas::Mock(mock_replica) => mock_replica.current_root().await,
Replicas::Other(replica) => replica.current_root().await,
Replicas::Ethereum(replica) => replica.committed_root().await,
Replicas::Mock(mock_replica) => mock_replica.committed_root().await,
Replicas::Other(replica) => replica.committed_root().await,
}
}

@ -62,20 +62,6 @@ impl ConnectionManager for ConnectionManagers {
}
}
async fn is_owner(&self, address: OpticsIdentifier) -> Result<bool, ChainCommunicationError> {
match self {
ConnectionManagers::Ethereum(connection_manager) => {
connection_manager.is_owner(address).await
}
ConnectionManagers::Mock(connection_manager) => {
connection_manager.is_owner(address).await
}
ConnectionManagers::Other(connection_manager) => {
connection_manager.is_owner(address).await
}
}
}
async fn is_replica(&self, address: OpticsIdentifier) -> Result<bool, ChainCommunicationError> {
match self {
ConnectionManagers::Ethereum(connection_manager) => {

@ -5,6 +5,6 @@ fn main() {
#[cfg(feature = "output")]
{
output_home_domain_hashes();
output_destination_and_sequences();
output_destination_and_nonces();
}
}

@ -65,7 +65,7 @@ fn format_message(
pub struct Home<S> {
local: u32,
updater: Address,
current_root: H256,
committed_root: H256,
state: S,
}
@ -95,7 +95,7 @@ impl From<Home<Waiting>> for Home<Failed> {
Self {
local: h.local,
updater: h.updater,
current_root: h.current_root,
committed_root: h.committed_root,
state: Failed {
accumulator: h.state.accumulator,
queue: h.state.queue,
@ -115,13 +115,13 @@ impl Home<Waiting> {
Self {
local,
updater,
current_root: Default::default(),
committed_root: Default::default(),
state: Waiting::default(),
}
}
/// Enqueue a message
pub fn enqueue(&mut self, sender: H256, destination: u32, recipient: H256, body: &[u8]) {
/// Dispatch a message
pub fn dispatch(&mut self, sender: H256, destination: u32, recipient: H256, body: &[u8]) {
let message = format_message(self.local, sender, destination, recipient, body);
let message_hash = hash(&message);
self.state.accumulator.ingest(message_hash);
@ -129,10 +129,10 @@ impl Home<Waiting> {
}
fn _update(&mut self, update: &Update) -> Result<(), OpticsError> {
if update.previous_root != self.current_root {
if update.previous_root != self.committed_root {
return Err(OpticsError::WrongCurrentRoot {
actual: update.previous_root,
expected: self.current_root,
expected: self.committed_root,
});
}
@ -152,7 +152,7 @@ impl Home<Waiting> {
pub fn produce_update(&self) -> Update {
Update {
home_domain: self.local,
previous_root: self.current_root,
previous_root: self.committed_root,
new_root: self.state.accumulator.root(),
}
}

@ -4,7 +4,7 @@ use crate::{
TREE_DEPTH,
},
test_utils::find_vector,
utils::{destination_and_sequence, home_domain_hash},
utils::{destination_and_nonce, home_domain_hash},
FailureNotification, OpticsMessage, Update,
};
use ethers::{
@ -30,7 +30,7 @@ pub mod output_functions {
sender: H256::from(
H160::from_str("0x1111111111111111111111111111111111111111").unwrap(),
),
sequence: 1,
nonce: 1,
destination: 2000,
recipient: H256::from(
H160::from_str("0x2222222222222222222222222222222222222222").unwrap(),
@ -43,9 +43,9 @@ pub mod output_functions {
"sender": optics_message.sender,
"destination": optics_message.destination,
"recipient": optics_message.recipient,
"sequence": optics_message.sequence,
"nonce": optics_message.nonce,
"body": optics_message.body,
"leaf": optics_message.to_leaf(),
"messageHash": optics_message.to_leaf(),
});
let json = json!([message_json]).to_string();
@ -121,15 +121,15 @@ pub mod output_functions {
.expect("Failed to write to file");
}
/// Outputs combined destination and sequence test cases in /vector/
/// destinationSequence.json
pub fn output_destination_and_sequences() {
/// Outputs combined destination and nonce test cases in /vector/
/// destinationNonce.json
pub fn output_destination_and_nonces() {
let test_cases: Vec<Value> = (1..=5)
.map(|i| {
json!({
"destination": i,
"sequence": i + 1,
"expectedDestinationAndSequence": destination_and_sequence(i, i + 1)
"nonce": i + 1,
"expectedDestinationAndNonce": destination_and_nonce(i, i + 1)
})
})
.collect();
@ -140,7 +140,7 @@ pub mod output_functions {
.write(true)
.create(true)
.truncate(true)
.open(find_vector("destinationSequence.json"))
.open(find_vector("destinationNonce.json"))
.expect("Failed to open/create file");
file.write_all(json.as_bytes())

@ -15,7 +15,7 @@ pub struct RawCommittedMessage {
/// The index at which the message is committed
pub leaf_index: u32,
/// The home's current root when the message was committed.
pub current_root: H256,
pub committed_root: H256,
/// The fully detailed message that was committed
pub message: Vec<u8>,
}
@ -27,7 +27,7 @@ pub struct CommittedMessage {
/// The index at which the message is committed
pub leaf_index: u32,
/// The home's current root when the message was committed.
pub current_root: H256,
pub committed_root: H256,
/// The fully detailed message that was committed
pub message: OpticsMessage,
}
@ -51,7 +51,7 @@ impl TryFrom<RawCommittedMessage> for CommittedMessage {
fn try_from(raw: RawCommittedMessage) -> Result<Self, Self::Error> {
Ok(Self {
leaf_index: raw.leaf_index,
current_root: raw.current_root,
committed_root: raw.committed_root,
message: OpticsMessage::read_from(&mut &raw.message[..])?,
})
}
@ -69,24 +69,24 @@ pub trait Home: Common + Send + Sync + std::fmt::Debug {
home_domain_hash(self.local_domain())
}
/// Fetch the message to destination at the sequence number (or error).
/// Fetch the message to destination at the nonce (or error).
/// This should fetch events from the chain API.
///
/// Used by processors to get messages in order
async fn raw_message_by_sequence(
async fn raw_message_by_nonce(
&self,
destination: u32,
sequence: u32,
nonce: u32,
) -> Result<Option<RawCommittedMessage>, ChainCommunicationError>;
/// Fetch the message to destination at the sequence number (or error).
/// Fetch the message to destination at the nonce (or error).
/// This should fetch events from the chain API
async fn message_by_sequence(
async fn message_by_nonce(
&self,
destination: u32,
sequence: u32,
nonce: u32,
) -> Result<Option<CommittedMessage>, ChainCommunicationError> {
self.raw_message_by_sequence(destination, sequence)
self.raw_message_by_nonce(destination, nonce)
.await?
.map(CommittedMessage::try_from)
.transpose()
@ -116,19 +116,19 @@ pub trait Home: Common + Send + Sync + std::fmt::Debug {
/// Fetch the tree_index-th leaf inserted into the merkle tree.
/// Returns `Ok(None)` if no leaf exists for given `tree_size` (`Ok(None)`
/// serves as the return value for an index error). If tree_index == 0,
/// this will return the first enqueued leaf. This is because the Home
/// this will return the first inserted leaf. This is because the Home
/// emits the index at which the leaf was inserted in (`tree.count() - 1`),
/// thus the first enqueued leaf has an index of 0.
/// thus the first inserted leaf has an index of 0.
async fn leaf_by_tree_index(
&self,
tree_index: usize,
) -> Result<Option<H256>, ChainCommunicationError>;
/// Fetch the sequence
async fn sequences(&self, destination: u32) -> Result<u32, ChainCommunicationError>;
/// Fetch the nonce
async fn nonces(&self, destination: u32) -> Result<u32, ChainCommunicationError>;
/// Queue a message.
async fn enqueue(&self, message: &Message) -> Result<TxOutcome, ChainCommunicationError>;
/// Dispatch a message.
async fn dispatch(&self, message: &Message) -> Result<TxOutcome, ChainCommunicationError>;
/// Check if queue contains root.
async fn queue_contains(&self, root: H256) -> Result<bool, ChainCommunicationError>;

@ -103,7 +103,7 @@ pub trait Common: Sync + Send + std::fmt::Debug {
async fn state(&self) -> Result<State, ChainCommunicationError>;
/// Fetch the current root.
async fn current_root(&self) -> Result<H256, ChainCommunicationError>;
async fn committed_root(&self) -> Result<H256, ChainCommunicationError>;
/// Fetch the first signed update building off of `old_root`. If `old_root`
/// was never accepted or has never been updated, this will return `Ok(None )`.
@ -123,8 +123,8 @@ pub trait Common: Sync + Send + std::fmt::Debug {
/// Fetch most recent signed_update.
async fn poll_signed_update(&self) -> Result<Option<SignedUpdate>, ChainCommunicationError> {
let current_root = self.current_root().await?;
self.signed_update_by_new_root(current_root).await
let committed_root = self.committed_root().await?;
self.signed_update_by_new_root(committed_root).await
}
/// Submit a signed update for inclusion

@ -10,9 +10,6 @@ pub trait ConnectionManager: Send + Sync + std::fmt::Debug {
/// Return the contract's local domain ID
fn local_domain(&self) -> u32;
/// Return true if provided address is the contract's owner
async fn is_owner(&self, address: OpticsIdentifier) -> Result<bool, ChainCommunicationError>;
/// Returns true if provided address is enrolled replica
async fn is_replica(&self, address: OpticsIdentifier) -> Result<bool, ChainCommunicationError>;

@ -12,7 +12,7 @@ pub struct OpticsMessage {
/// 32 Address in home convention
pub sender: H256,
/// 4 Count of all previous messages to destination
pub sequence: u32,
pub nonce: u32,
/// 4 SLIP-44 ID
pub destination: u32,
/// 32 Address in destination convention
@ -39,7 +39,7 @@ impl Encode for OpticsMessage {
{
writer.write_all(&self.origin.to_be_bytes())?;
writer.write_all(self.sender.as_ref())?;
writer.write_all(&self.sequence.to_be_bytes())?;
writer.write_all(&self.nonce.to_be_bytes())?;
writer.write_all(&self.destination.to_be_bytes())?;
writer.write_all(self.recipient.as_ref())?;
writer.write_all(&self.body)?;
@ -58,8 +58,8 @@ impl Decode for OpticsMessage {
let mut sender = H256::zero();
reader.read_exact(sender.as_mut())?;
let mut sequence = [0u8; 4];
reader.read_exact(&mut sequence)?;
let mut nonce = [0u8; 4];
reader.read_exact(&mut nonce)?;
let mut destination = [0u8; 4];
reader.read_exact(&mut destination)?;
@ -75,7 +75,7 @@ impl Decode for OpticsMessage {
sender,
destination: u32::from_be_bytes(destination),
recipient,
sequence: u32::from_be_bytes(sequence),
nonce: u32::from_be_bytes(nonce),
body,
})
}
@ -95,7 +95,7 @@ impl std::fmt::Display for OpticsMessage {
write!(
f,
"OpticsMessage {}->{}:{}",
self.origin, self.destination, self.sequence,
self.origin, self.destination, self.nonce,
)
}
}

@ -28,12 +28,12 @@ pub fn home_domain_hash(home_domain: u32) -> H256 {
)
}
/// Destination and destination-specific sequence combined in single field (
/// (destination << 32) & sequence)
pub fn destination_and_sequence(destination: u32, sequence: u32) -> u64 {
/// Destination and destination-specific nonce combined in single field (
/// (destination << 32) & nonce)
pub fn destination_and_nonce(destination: u32, nonce: u32) -> u64 {
assert!(destination < u32::MAX);
assert!(sequence < u32::MAX);
((destination as u64) << 32) | sequence as u64
assert!(nonce < u32::MAX);
((destination as u64) << 32) | nonce as u64
}
/// A Hex String of length `N` representing bytes of length `N / 2`

@ -19,10 +19,10 @@ mock! {
pub fn _home_domain_hash(&self) -> H256 {}
pub fn _raw_message_by_sequence(
pub fn _raw_message_by_nonce(
&self,
destination: u32,
sequence: u32,
nonce: u32,
) -> Result<Option<RawCommittedMessage>, ChainCommunicationError> {}
pub fn _raw_message_by_leaf(
@ -36,9 +36,9 @@ mock! {
tree_index: usize,
) -> Result<Option<H256>, ChainCommunicationError> {}
pub fn _sequences(&self, destination: u32) -> Result<u32, ChainCommunicationError> {}
pub fn _nonces(&self, destination: u32) -> Result<u32, ChainCommunicationError> {}
pub fn _enqueue(&self, message: &Message) -> Result<TxOutcome, ChainCommunicationError> {}
pub fn _dispatch(&self, message: &Message) -> Result<TxOutcome, ChainCommunicationError> {}
pub fn _queue_contains(&self, root: H256) -> Result<bool, ChainCommunicationError> {}
@ -58,7 +58,7 @@ mock! {
pub fn _state(&self) -> Result<State, ChainCommunicationError> {}
pub fn _current_root(&self) -> Result<H256, ChainCommunicationError> {}
pub fn _committed_root(&self) -> Result<H256, ChainCommunicationError> {}
pub fn _signed_update_by_old_root(
&self,
@ -95,12 +95,12 @@ impl Home for MockHomeContract {
self._home_domain_hash()
}
async fn raw_message_by_sequence(
async fn raw_message_by_nonce(
&self,
destination: u32,
sequence: u32,
nonce: u32,
) -> Result<Option<RawCommittedMessage>, ChainCommunicationError> {
self._raw_message_by_sequence(destination, sequence)
self._raw_message_by_nonce(destination, nonce)
}
async fn raw_message_by_leaf(
@ -117,12 +117,12 @@ impl Home for MockHomeContract {
self._leaf_by_tree_index(tree_index)
}
async fn sequences(&self, destination: u32) -> Result<u32, ChainCommunicationError> {
self._sequences(destination)
async fn nonces(&self, destination: u32) -> Result<u32, ChainCommunicationError> {
self._nonces(destination)
}
async fn enqueue(&self, message: &Message) -> Result<TxOutcome, ChainCommunicationError> {
self._enqueue(message)
async fn dispatch(&self, message: &Message) -> Result<TxOutcome, ChainCommunicationError> {
self._dispatch(message)
}
async fn queue_contains(&self, root: H256) -> Result<bool, ChainCommunicationError> {
@ -159,8 +159,8 @@ impl Common for MockHomeContract {
self._state()
}
async fn current_root(&self) -> Result<H256, ChainCommunicationError> {
self._current_root()
async fn committed_root(&self) -> Result<H256, ChainCommunicationError> {
self._committed_root()
}
async fn signed_update_by_old_root(

@ -45,7 +45,7 @@ mock! {
pub fn _state(&self) -> Result<State, ChainCommunicationError> {}
pub fn _current_root(&self) -> Result<H256, ChainCommunicationError> {}
pub fn _committed_root(&self) -> Result<H256, ChainCommunicationError> {}
pub fn _signed_update_by_old_root(
&self,
@ -148,8 +148,8 @@ impl Common for MockReplicaContract {
self._state()
}
async fn current_root(&self) -> Result<H256, ChainCommunicationError> {
self._current_root()
async fn committed_root(&self) -> Result<H256, ChainCommunicationError> {
self._committed_root()
}
async fn signed_update_by_old_root(

@ -12,8 +12,6 @@ mock! {
pub ConnectionManagerContract {
pub fn _local_domain(&self) -> u32 {}
pub fn _is_owner(&self, address: OpticsIdentifier) -> Result<bool, ChainCommunicationError> {}
pub fn _is_replica(&self, address: OpticsIdentifier) -> Result<bool, ChainCommunicationError> {}
pub fn _watcher_permission(
@ -61,10 +59,6 @@ impl ConnectionManager for MockConnectionManagerContract {
self._local_domain()
}
async fn is_owner(&self, address: OpticsIdentifier) -> Result<bool, ChainCommunicationError> {
self._is_owner(address)
}
async fn is_replica(&self, address: OpticsIdentifier) -> Result<bool, ChainCommunicationError> {
self._is_replica(address)
}

@ -16,15 +16,15 @@ abstract contract Common is QueueManager {
// ============ Enums ============
// States:
// (0) UNINITIALIZED before initialize function is called
// 0 - UnInitialized - before initialize function is called
// note: the contract is initialized at deploy time, so it should never be in this state
// (1) ACTIVE as long as the contract has not become fraudulent
// (2) FAILED after a valid fraud proof has been submitted;
// 1 - Active - as long as the contract has not become fraudulent
// 2 - Failed - after a valid fraud proof has been submitted;
// contract will no longer accept updates or new messages
enum States {
UNINITIALIZED,
ACTIVE,
FAILED
UnInitialized,
Active,
Failed
}
// ============ Immutable Variables ============
@ -39,7 +39,7 @@ abstract contract Common is QueueManager {
// Current state of contract
States public state;
// The latest root that has been signed by the Updater
bytes32 public current;
bytes32 public committedRoot;
// ============ Upgrade Gap ============
@ -49,8 +49,8 @@ abstract contract Common is QueueManager {
// ============ Events ============
/**
* @notice Event emitted when update is made on Home or unconfirmed update
* root is enqueued on Replica
* @notice Emitted when update is made on Home
* or unconfirmed update root is submitted on Replica
* @param homeDomain Domain of home contract
* @param oldRoot Old merkle root
* @param newRoot New merkle root
@ -84,7 +84,7 @@ abstract contract Common is QueueManager {
* @notice Ensures that contract state != FAILED when the function is called
*/
modifier notFailed() {
require(state != States.FAILED, "failed state");
require(state != States.Failed, "failed state");
_;
}
@ -99,7 +99,7 @@ abstract contract Common is QueueManager {
function __Common_initialize(address _updater) internal initializer {
__QueueManager_intialize();
updater = _updater;
state = States.ACTIVE;
state = States.Active;
}
// ============ External Functions ============
@ -157,13 +157,14 @@ abstract contract Common is QueueManager {
* @dev Called when a valid fraud proof is submitted
*/
function _setFailed() internal {
state = States.FAILED;
state = States.Failed;
}
/**
* @notice Performs the state modifications necessary
* to move the contract into failed state
* @dev Called when a double update or fraudulent update is detected
* @notice Moves the contract into failed state
* @dev Called when fraud is proven
* (Double Update is submitted on Home or Replica,
* or Improper Update is submitted on Home)
*/
function _fail() internal virtual;

@ -37,8 +37,8 @@ contract Home is Version0, MerkleTreeManager, Common, OwnableUpgradeable {
// ============ Public Storage Variables ============
// domain => next available nonce
mapping(uint32 => uint32) public sequences;
// domain => next available nonce for the domain
mapping(uint32 => uint32) public nonces;
// contract responsible for Updater bonding, slashing and rotation
IUpdaterManager public updaterManager;
@ -50,19 +50,19 @@ contract Home is Version0, MerkleTreeManager, Common, OwnableUpgradeable {
// ============ Events ============
/**
* @notice Emitted when a new message is enqueued
* @notice Emitted when a new message is dispatched via Optics
* @param leafIndex Index of message's leaf in merkle tree
* @param destinationAndSequence Destination and destination-specific
* sequence combined in single field ((destination << 32) & sequence)
* @param leaf Hash of formatted message; the leaf inserted to the Merkle tree for the message
* @param current the latest notarized root submitted in the last signed Update
* @param message Raw bytes of enqueued message
* @param destinationAndNonce Destination and destination-specific
* nonce combined in single field ((destination << 32) & nonce)
* @param messageHash Hash of message; the leaf inserted to the Merkle tree for the message
* @param committedRoot the latest notarized root submitted in the last signed Update
* @param message Raw bytes of message
*/
event Dispatch(
bytes32 indexed messageHash,
uint256 indexed leafIndex,
uint64 indexed destinationAndSequence,
bytes32 indexed leaf,
bytes32 current,
uint64 indexed destinationAndNonce,
bytes32 committedRoot,
bytes message
);
@ -152,20 +152,20 @@ contract Home is Version0, MerkleTreeManager, Common, OwnableUpgradeable {
* @param _recipientAddress Address of recipient on destination chain as bytes32
* @param _messageBody Raw bytes content of message
*/
function enqueue(
function dispatch(
uint32 _destinationDomain,
bytes32 _recipientAddress,
bytes memory _messageBody
) external notFailed {
require(_messageBody.length <= MAX_MESSAGE_BODY_BYTES, "msg too long");
// get the next sequence for the destination domain, then increment it
uint32 _sequence = sequences[_destinationDomain];
sequences[_destinationDomain] = _sequence + 1;
// get the next nonce for the destination domain, then increment it
uint32 _nonce = nonces[_destinationDomain];
nonces[_destinationDomain] = _nonce + 1;
// format the message into packed bytes
bytes memory _message = Message.formatMessage(
localDomain,
bytes32(uint256(uint160(msg.sender))),
_sequence,
_nonce,
_destinationDomain,
_recipientAddress,
_messageBody
@ -178,58 +178,58 @@ contract Home is Version0, MerkleTreeManager, Common, OwnableUpgradeable {
// Emit Dispatch event with message information
// note: leafIndex is count() - 1 since new leaf has already been inserted
emit Dispatch(
count() - 1,
_destinationAndSequence(_destinationDomain, _sequence),
_messageHash,
current,
count() - 1,
_destinationAndNonce(_destinationDomain, _nonce),
committedRoot,
_message
);
}
/**
* @notice Submit a signature from the Updater "notarizing" an enqueued root,
* which updates the Home contract's `current` root,
* @notice Submit a signature from the Updater "notarizing" a root,
* which updates the Home contract's `committedRoot`,
* and publishes the signature which will be relayed to Replica contracts
* @dev emits Update event
* @dev If _newRoot is not contained in the queue,
* the Update is a fraudulent Improper Update, so
* the Updater is slashed & Home is set to FAILED state
* @param _currentRoot Current updated merkle root which the update is building off of
* @param _committedRoot Current updated merkle root which the update is building off of
* @param _newRoot New merkle root to update the contract state to
* @param _signature Updater signature on `_currentRoot` and `_newRoot`
* @param _signature Updater signature on `_committedRoot` and `_newRoot`
*/
function update(
bytes32 _currentRoot,
bytes32 _committedRoot,
bytes32 _newRoot,
bytes memory _signature
) external notFailed {
// check that the update is not fraudulent;
// if fraud is detected, Updater is slashed & Home is set to FAILED state
if (improperUpdate(_currentRoot, _newRoot, _signature)) return;
if (improperUpdate(_committedRoot, _newRoot, _signature)) return;
// clear all of the intermediate roots contained in this update from the queue
while (true) {
bytes32 _next = queue.dequeue();
if (_next == _newRoot) break;
}
// update the Home state with the latest signed root & emit event
current = _newRoot;
emit Update(localDomain, _currentRoot, _newRoot, _signature);
committedRoot = _newRoot;
emit Update(localDomain, _committedRoot, _newRoot, _signature);
}
/**
* @notice Suggest an update for the Updater to sign and submit.
* @dev If queue is empty, null bytes returned for both
* (No update is necessary because no messages have been dispatched since the last update)
* @return _current Latest updated root
* @return _new Latest enqueued root
* @return _committedRoot Latest root signed by the Updater
* @return _new Latest enqueued Merkle root
*/
function suggestUpdate()
external
view
returns (bytes32 _current, bytes32 _new)
returns (bytes32 _committedRoot, bytes32 _new)
{
if (queue.length() != 0) {
_current = current;
_committedRoot = committedRoot;
_new = queue.lastItem();
}
}
@ -247,7 +247,7 @@ contract Home is Version0, MerkleTreeManager, Common, OwnableUpgradeable {
* @notice Check if an Update is an Improper Update;
* if so, slash the Updater and set the contract to FAILED state.
*
* An Improper Update is an update building off of the Home's `current` root
* An Improper Update is an update building off of the Home's `committedRoot`
* for which the `_newRoot` does not currently exist in the Home's queue.
* This would mean that message(s) that were not truly
* dispatched on Home were falsely included in the signed root.
@ -260,12 +260,12 @@ contract Home is Version0, MerkleTreeManager, Common, OwnableUpgradeable {
* in order to slash the Updater with an Improper Update.
*
* An Improper Update submitted to the Replica is only valid
* while the `_oldRoot` is still equal to the `current` root on Home;
* if the `current` root on Home has already been updated with a valid Update,
* while the `_oldRoot` is still equal to the `committedRoot` on Home;
* if the `committedRoot` on Home has already been updated with a valid Update,
* then the Updater should be slashed with a Double Update.
* @dev Reverts (and doesn't slash updater) if signature is invalid or
* update not current
* @param _oldRoot Old merkle tree root (should equal home's current root)
* @param _oldRoot Old merkle tree root (should equal home's committedRoot)
* @param _newRoot New merkle tree root
* @param _signature Updater signature on `_oldRoot` and `_newRoot`
* @return TRUE if update was an Improper Update (implying Updater was slashed)
@ -279,7 +279,7 @@ contract Home is Version0, MerkleTreeManager, Common, OwnableUpgradeable {
_isUpdaterSignature(_oldRoot, _newRoot, _signature),
"!updater sig"
);
require(_oldRoot == current, "not a current update");
require(_oldRoot == committedRoot, "not a current update");
// if the _newRoot is not currently contained in the queue,
// slash the Updater and set the contract to FAILED state
if (!queue.contains(_newRoot)) {
@ -330,17 +330,17 @@ contract Home is Version0, MerkleTreeManager, Common, OwnableUpgradeable {
/**
* @notice Internal utility function that combines
* `_destination` and `_sequence`.
* @dev Both destination and sequence should be less than 2^32 - 1
* `_destination` and `_nonce`.
* @dev Both destination and nonce should be less than 2^32 - 1
* @param _destination Domain of destination chain
* @param _sequence Current sequence for given destination chain
* @return Returns (`_destination` << 32) & `_sequence`
* @param _nonce Current nonce for given destination chain
* @return Returns (`_destination` << 32) & `_nonce`
*/
function _destinationAndSequence(uint32 _destination, uint32 _sequence)
function _destinationAndNonce(uint32 _destination, uint32 _nonce)
internal
pure
returns (uint64)
{
return (uint64(_destination) << 32) | _sequence;
return (uint64(_destination) << 32) | _nonce;
}
}

@ -14,141 +14,157 @@ import {TypedMemView} from "@summa-tx/memview-sol/contracts/TypedMemView.sol";
/**
* @title Replica
* @author Celo Labs Inc.
* @notice Contract responsible for tracking root updates on home,
* and dispatching messages on Replica to end recipients.
* @notice Track root updates on Home,
* prove and dispatch messages to end recipients.
*/
contract Replica is Version0, Common {
// ============ Libraries ============
using QueueLib for QueueLib.Queue;
using MerkleLib for MerkleLib.Tree;
using TypedMemView for bytes;
using TypedMemView for bytes29;
using Message for bytes29;
/// @notice Status of message
// ============ Enums ============
// Status of Message:
// 0 - None - message has not been proven or processed
// 1 - Proven - message inclusion proof has been validated
// 2 - Processed - message has been dispatched to recipient
enum MessageStatus {
None,
Pending,
Proven,
Processed
}
event ProcessSuccess(bytes32 indexed messageHash);
event ProcessError(
bytes32 indexed messageHash,
uint32 indexed sequence,
address indexed recipient,
bytes returnData
);
// ============ Constants ============
/// @notice Minimum gas for message processing
// Minimum gas for message processing
uint256 public constant PROCESS_GAS = 850000;
/// @notice Reserved gas (to ensure tx completes in case message processing runs out)
// Reserved gas (to ensure tx completes in case message processing runs out)
uint256 public constant RESERVE_GAS = 15000;
/// @notice Domain of home chain
uint32 public remoteDomain;
// ============ Public Storage ============
/// @notice Number of seconds to wait before enqueued root becomes confirmable
// Domain of home chain
uint32 public remoteDomain;
// Number of seconds to wait before root becomes confirmable
uint256 public optimisticSeconds;
/// @notice Mapping of enqueued roots to allowable confirmation times
// re-entrancy guard
uint8 private entered;
// Mapping of roots to allowable confirmation times
mapping(bytes32 => uint256) public confirmAt;
// Mapping of message leaves to MessageStatus
mapping(bytes32 => MessageStatus) public messages;
/// @dev re-entrancy guard
uint8 private entered;
// ============ Upgrade Gap ============
/// @notice Mapping of message leaves to MessageStatus
mapping(bytes32 => MessageStatus) public messages;
// gap for upgrade safety
uint256[44] private __GAP;
uint256[44] private __GAP; // gap for upgrade safety
// ============ Events ============
constructor(uint32 _localDomain) Common(_localDomain) {} // solhint-disable-line no-empty-blocks
/**
* @notice Emitted when message is processed without error
* @param messageHash Hash of message processed
*/
event ProcessSuccess(bytes32 indexed messageHash);
function acceptableRoot(bytes32 _root) public view returns (bool) {
uint256 _time = confirmAt[_root];
if (_time == 0) {
return false;
}
return block.timestamp >= _time;
}
/**
* @notice Emitted when processing message reverts
* @param messageHash Hash of message that failed to process
* @param nonce nonce of the message, set for each domain by remote Home
* @param recipient the intended recipient of the failed message
* @param returnData the return data from the failed message
*/
event ProcessError(
bytes32 indexed messageHash,
uint32 indexed nonce,
address indexed recipient,
bytes returnData
);
// ============ Constructor ============
// solhint-disable-next-line no-empty-blocks
constructor(uint32 _localDomain) Common(_localDomain) {}
// ============ Initializer ============
function initialize(
uint32 _remoteDomain,
address _updater,
bytes32 _current,
bytes32 _committedRoot,
uint256 _optimisticSeconds
) public initializer {
__Common_initialize(_updater);
entered = 1;
remoteDomain = _remoteDomain;
current = _current;
confirmAt[_current] = 1;
committedRoot = _committedRoot;
confirmAt[_committedRoot] = 1;
optimisticSeconds = _optimisticSeconds;
}
// ============ External Functions ============
/**
* @notice Called by external agent. Enqueues signed update's new root,
* @notice Called by external agent. Submits the signed update's new root,
* marks root's allowable confirmation time, and emits an `Update` event.
* @dev Reverts if update doesn't build off queue's last root or replica's
* current root if queue is empty. Also reverts if signature is invalid.
* committedRoot if queue is empty. Also reverts if signature is invalid.
* @param _oldRoot Old merkle root
* @param _newRoot New merkle root
* @param _signature Updater's signature on `_oldRoot` and `_newRoot`
**/
*/
function update(
bytes32 _oldRoot,
bytes32 _newRoot,
bytes memory _signature
) external notFailed {
// ensure that update is building off the last submitted root
if (queue.length() > 0) {
require(_oldRoot == queue.lastItem(), "not end of queue");
} else {
require(current == _oldRoot, "not current update");
require(_oldRoot == committedRoot, "not current update");
}
// validate updater signature
require(
_isUpdaterSignature(_oldRoot, _newRoot, _signature),
"!updater sig"
);
// Hook for future use
_beforeUpdate();
// Set the new root's confirmation timer
// And add the new root to the queue of roots
// set the new root's confirmation timer
confirmAt[_newRoot] = block.timestamp + optimisticSeconds;
// add the new root to the queue of roots
queue.enqueue(_newRoot);
emit Update(remoteDomain, _oldRoot, _newRoot, _signature);
}
/**
* @notice Called by external agent. Confirms as many confirmable roots in
* queue as possible, updating replica's current root to be the last
* queue as possible, updating replica's committedRoot to be the last
* confirmed root.
* @dev Reverts if queue started as empty (i.e. no roots to confirm)
**/
*/
function confirm() external notFailed {
require(queue.length() != 0, "!pending");
bytes32 _pending;
// Traverse the queue by peeking each iterm to see if it ought to be
// confirmed. If so, dequeue it
bytes32 _pending;
uint256 _remaining = queue.length();
while (_remaining > 0 && acceptableRoot(queue.peek())) {
_pending = queue.dequeue();
_remaining -= 1;
}
// This condition is hit if the while loop is never executed, because
// the first queue item has not hit its timer yet
require(_pending != bytes32(0), "!time");
// Hook for future use
_beforeConfirm();
current = _pending;
// Update committedRoot to last confirmed root
committedRoot = _pending;
}
/**
@ -159,7 +175,7 @@ contract Replica is Version0, Common {
* @param _message Formatted message (refer to Common.sol Message library)
* @param _proof Merkle proof of inclusion for message's leaf
* @param _index Index of leaf in home's merkle tree
**/
*/
function proveAndProcess(
bytes memory _message,
bytes32[32] calldata _proof,
@ -171,11 +187,10 @@ contract Replica is Version0, Common {
/**
* @notice Called by external agent. Returns next pending root to be
* confirmed and its confirmation time. If queue is empty, returns null
* values.
* confirmed and its confirmation time.
* @return _pending Pending (unconfirmed) root
* @return _confirmAt Pending root's confirmation time
**/
*/
function nextPending()
external
view
@ -185,47 +200,41 @@ contract Replica is Version0, Common {
_pending = queue.peek();
_confirmAt = confirmAt[_pending];
} else {
_pending = current;
_confirmAt = confirmAt[current];
_pending = committedRoot;
_confirmAt = confirmAt[committedRoot];
}
}
/**
* @notice Called by external agent. Returns true if there is a confirmable
* root in the queue and false if otherwise.
**/
*/
function canConfirm() external view returns (bool) {
return queue.length() != 0 && acceptableRoot(queue.peek());
}
/**
* @notice Given formatted message, attempts to dispatch message payload to
* end recipient.
* @dev Requires recipient to have implemented `handle` method (refer to
* XAppConnectionManager.sol). Reverts if formatted message's destination domain
* doesn't match replica's own domain, if message is out of order (skips
* one or more sequence numbers), if message has not been proven (doesn't
* have MessageStatus.Pending), or if not enough gas is provided for
* dispatch transaction.
* @param _message Formatted message (refer to Common.sol Message library)
* @return _success True if dispatch transaction succeeded (false if
* otherwise)
**/
* @notice Given formatted message, attempts to dispatch
* message payload to end recipient.
* @dev Recipient must implement a `handle` method (refer to IMessageRecipient.sol)
* Reverts if formatted message's destination domain is not the Replica's domain,
* if message has not been proven,
* or if not enough gas is provided for the dispatch transaction.
* @param _message Formatted message
* @return _success TRUE iff dispatch transaction succeeded
*/
function process(bytes memory _message) public returns (bool _success) {
bytes29 _m = _message.ref(0);
bytes32 _messageHash = _m.keccak();
uint32 _sequence = _m.sequence();
// ensure message was meant for this domain
require(_m.destination() == localDomain, "!destination");
require(messages[_messageHash] == MessageStatus.Pending, "!pending");
// ensure message has been proven
bytes32 _messageHash = _m.keccak();
require(messages[_messageHash] == MessageStatus.Proven, "!proven");
// check re-entrancy guard
require(entered == 1, "!reentrant");
entered = 0;
// update the status and next to process
// update message status as processed
messages[_messageHash] = MessageStatus.Processed;
// NB:
// A call running out of gas TYPICALLY errors the whole tx. We want to
// a) ensure the call has a sufficient amount of gas to make a
// meaningful state change.
@ -234,10 +243,10 @@ contract Replica is Version0, Common {
// To do this, we require that we have enough gas to process
// and still return. We then delegate only the minimum processing gas.
require(gasleft() >= PROCESS_GAS + RESERVE_GAS, "!gas");
// transparently return.
// get the message recipient
address _recipient = _m.recipientAddress();
// dispatch message to recipient
// by low-level calling "handle" function
bytes memory _returnData;
(_success, _returnData) = _recipient.call{gas: PROCESS_GAS}(
abi.encodeWithSignature(
@ -247,21 +256,45 @@ contract Replica is Version0, Common {
_m.body().clone()
)
);
// emit process results
if (_success) {
emit ProcessSuccess(_messageHash);
} else {
emit ProcessError(_messageHash, _sequence, _recipient, _returnData);
emit ProcessError(
_messageHash,
_m.nonce(),
_recipient,
_returnData
);
}
// reset re-entrancy guard
entered = 1;
}
// ============ Public Functions ============
/**
* @notice Check that the root has been submitted
* and that the optimistic timeout period has expired,
* meaning the root can be processed
* @param _root the Merkle root, submitted in an update, to check
* @return TRUE iff root has been submitted & timeout has expired
*/
function acceptableRoot(bytes32 _root) public view returns (bool) {
uint256 _time = confirmAt[_root];
if (_time == 0) {
return false;
}
return block.timestamp >= _time;
}
/**
* @notice Attempts to prove the validity of message given its leaf, the
* merkle proof of inclusion for the leaf, and the index of the leaf.
* @dev Reverts if message's MessageStatus != None (i.e. if message was
* already proven or processed)
* @dev For convenience, we allow proving against any previous root.
* This means that witnesses never need to be updated for the new root
* @param _leaf Leaf of message to prove
* @param _proof Merkle proof of inclusion for leaf
* @param _index Index of leaf in home's merkle tree
@ -272,25 +305,31 @@ contract Replica is Version0, Common {
bytes32[32] calldata _proof,
uint256 _index
) public returns (bool) {
// ensure that message has not been proven or processed
require(messages[_leaf] == MessageStatus.None, "!MessageStatus.None");
bytes32 _actual = MerkleLib.branchRoot(_leaf, _proof, _index);
// NB:
// For convenience, we allow proving against any previous root.
// This means that witnesses never need to be updated for the new root
if (acceptableRoot(_actual)) {
messages[_leaf] = MessageStatus.Pending;
// calculate the expected root based on the proof
bytes32 _calculatedRoot = MerkleLib.branchRoot(_leaf, _proof, _index);
// if the root is valid, change status to Proven
if (acceptableRoot(_calculatedRoot)) {
messages[_leaf] = MessageStatus.Proven;
return true;
}
return false;
}
/// @notice Hash of Home's domain concatenated with "OPTICS"
/**
* @notice Hash of Home domain concatenated with "OPTICS"
*/
function homeDomainHash() public view override returns (bytes32) {
return _homeDomainHash(remoteDomain);
}
/// @notice Sets contract state to FAILED
// ============ Internal Functions ============
/**
* @notice Moves the contract into failed state
* @dev Called when a Double Update is submitted
*/
function _fail() internal override {
_setFailed();
}

@ -9,46 +9,92 @@ import {TypeCasts} from "../libs/TypeCasts.sol";
import {ECDSA} from "@openzeppelin/contracts/cryptography/ECDSA.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title XAppConnectionManager
* @author Celo Labs Inc.
* @notice Manages a registry of local Replica contracts
* for remote Home domains. Accepts Watcher signatures
* to un-enroll Replicas attached to fraudulent remote Homes
*/
contract XAppConnectionManager is Ownable {
mapping(address => uint32) public replicaToDomain;
mapping(uint32 => address) public domainToReplica;
// ============ Public Storage ============
// Home contract
Home public home;
// local Replica address => remote Home domain
mapping(address => uint32) public replicaToDomain;
// remote Home domain => local Replica address
mapping(uint32 => address) public domainToReplica;
// watcher address => replica remote domain => has/doesn't have permission
mapping(address => mapping(uint32 => bool)) private watcherPermissions;
// ============ Events ============
/**
* @notice Emitted when a new Replica is enrolled / added
* @param domain the remote domain of the Home contract for the Replica
* @param replica the address of the Replica
*/
event ReplicaEnrolled(uint32 indexed domain, address replica);
/**
* @notice Emitted when a new Replica is un-enrolled / removed
* @param domain the remote domain of the Home contract for the Replica
* @param replica the address of the Replica
*/
event ReplicaUnenrolled(uint32 indexed domain, address replica);
/**
* @notice Emitted when Watcher permissions are changed
* @param domain the remote domain of the Home contract for the Replica
* @param watcher the address of the Watcher
* @param access TRUE if the Watcher was given permissions, FALSE if permissions were removed
*/
event WatcherPermissionSet(
uint32 indexed domain,
address watcher,
bool access
);
// solhint-disable-next-line no-empty-blocks
constructor() Ownable() {}
// ============ Modifiers ============
modifier onlyReplica() {
require(isReplica(msg.sender), "!replica");
_;
}
// ============ Constructor ============
// solhint-disable-next-line no-empty-blocks
constructor() Ownable() {}
// ============ External Functions ============
/**
* @notice Un-Enroll a replica contract
* in the case that fraud was detected on the Home
* @dev in the future, if fraud occurs on the Home contract,
* the Watcher will submit their signature directly to the Home
* and it can be relayed to all remote chains to un-enroll the Replicas
* @param _domain the remote domain of the Home contract for the Replica
* @param _updater the address of the Updater for the Home contract (also stored on Replica)
* @param _signature signature of watcher on (domain, replica address, updater address)
*/
function unenrollReplica(
uint32 _domain,
bytes32 _updater,
bytes memory _signature
) external {
// ensure that the replica is currently set
address _replica = domainToReplica[_domain];
require(_replica != address(0), "!replica exists");
// ensure that the signature is on the proper updater
require(
Replica(_replica).updater() == TypeCasts.bytes32ToAddress(_updater),
"!current updater"
);
// get the watcher address from the signature
// and ensure that the watcher has permission to un-enroll this replica
address _watcher = _recoverWatcherFromSig(
_domain,
TypeCasts.addressToBytes32(_replica),
@ -56,66 +102,108 @@ contract XAppConnectionManager is Ownable {
_signature
);
require(watcherPermissions[_watcher][_domain], "!valid watcher");
// remove the replica from mappings
_unenrollReplica(_replica);
}
function setHome(address _home) public onlyOwner {
/**
* @notice Set the address of the local Home contract
* @param _home the address of the local Home contract
*/
function setHome(address _home) external onlyOwner {
home = Home(_home);
}
/**
* @notice Allow Owner to enroll Replica contract
* @param _replica the address of the Replica
* @param _domain the remote domain of the Home contract for the Replica
*/
function ownerEnrollReplica(address _replica, uint32 _domain)
public
external
onlyOwner
{
// un-enroll any existing replica
_unenrollReplica(_replica);
// add replica and domain to two-way mapping
replicaToDomain[_replica] = _domain;
domainToReplica[_domain] = _replica;
emit ReplicaEnrolled(_domain, _replica);
}
function ownerUnenrollReplica(address _replica) public onlyOwner {
/**
* @notice Allow Owner to un-enroll Replica contract
* @param _replica the address of the Replica
*/
function ownerUnenrollReplica(address _replica) external onlyOwner {
_unenrollReplica(_replica);
}
/**
* @notice Allow Owner to set Watcher permissions for a Replica
* @param _watcher the address of the Watcher
* @param _domain the remote domain of the Home contract for the Replica
* @param _access TRUE to give the Watcher permissions, FALSE to remove permissions
*/
function setWatcherPermission(
address _watcher,
uint32 _domain,
bool _access
) public onlyOwner {
) external onlyOwner {
watcherPermissions[_watcher][_domain] = _access;
emit WatcherPermissionSet(_domain, _watcher, _access);
}
function localDomain() public view returns (uint32) {
/**
* @notice Query local domain from Home
* @return local domain
*/
function localDomain() external view returns (uint32) {
return home.localDomain();
}
function isOwner(address _owner) public view returns (bool) {
return _owner == owner();
}
function isReplica(address _replica) public view returns (bool) {
return replicaToDomain[_replica] != 0;
}
/**
* @notice Get access permissions for the watcher on the domain
* @param _watcher the address of the watcher
* @param _domain the domain to check for watcher permissions
* @return TRUE iff _watcher has permission to un-enroll replicas on _domain
*/
function watcherPermission(address _watcher, uint32 _domain)
public
external
view
returns (bool)
{
return watcherPermissions[_watcher][_domain];
}
// ============ Public Functions ============
/**
* @notice Check whether _replica is enrolled
* @param _replica the replica to check for enrollment
* @return TRUE iff _replica is enrolled
*/
function isReplica(address _replica) public view returns (bool) {
return replicaToDomain[_replica] != 0;
}
// ============ Internal Functions ============
/**
* @notice Remove the replica from the two-way mappings
* @param _replica replica to un-enroll
*/
function _unenrollReplica(address _replica) internal {
uint32 _currentDomain = replicaToDomain[_replica];
domainToReplica[_currentDomain] = address(0);
replicaToDomain[_replica] = 0;
emit ReplicaUnenrolled(_currentDomain, _replica);
}
/**
* @notice Get the Watcher address from the provided signature
* @return address of watcher that signed
*/
function _recoverWatcherFromSig(
uint32 _domain,
bytes32 _replica,
@ -124,7 +212,6 @@ contract XAppConnectionManager is Ownable {
) internal view returns (address) {
bytes32 _homeDomainHash = Replica(TypeCasts.bytes32ToAddress(_replica))
.homeDomainHash();
bytes32 _digest = keccak256(
abi.encodePacked(_homeDomainHash, _domain, _updater)
);

@ -14,32 +14,62 @@ import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {TypedMemView} from "@summa-tx/memview-sol/contracts/TypedMemView.sol";
contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
// ============ Libraries ============
using SafeMath for uint256;
using TypedMemView for bytes;
using TypedMemView for bytes29;
using GovernanceMessage for bytes29;
// ============ Immutables ============
uint32 public immutable localDomain;
uint256 public immutable recoveryTimelock; // number of seconds before recovery can be activated
// number of seconds before recovery can be activated
uint256 public immutable recoveryTimelock;
// ============ Public Storage ============
// timestamp when recovery timelock expires; 0 if timelock has not been initiated
uint256 public recoveryActiveAt;
// the address of the recovery manager multisig
address public recoveryManager;
// the local entity empowered to call governance functions, set to 0x0 on non-Governor chains
address public governor;
// domain of Governor chain -- for accepting incoming messages from Governor
uint32 public governorDomain;
// xAppConnectionManager contract which stores Replica addresses
XAppConnectionManager public xAppConnectionManager;
// domain -> remote GovernanceRouter contract address
mapping(uint32 => bytes32) public routers;
// array of all domains with registered GovernanceRouter
uint32[] public domains;
uint256 public recoveryActiveAt; // timestamp when recovery timelock expires; 0 if timelock has not been initiated
address public recoveryManager; // the address of the recovery manager multisig
// ============ Upgrade Gap ============
address public governor; // the local entity empowered to call governance functions, set to 0x0 on non-Governor chains
uint32 public governorDomain; // domain of Governor chain -- for accepting incoming messages from Governor
// gap for upgrade safety
uint256[43] private __GAP;
XAppConnectionManager public xAppConnectionManager;
mapping(uint32 => bytes32) public routers; // registry of domain -> remote GovernanceRouter contract address
uint32[] public domains; // array of all domains registered
uint256[43] private __GAP; // gap for upgrade safety
// ============ Events ============
/**
* @notice Emitted a remote GovernanceRouter address is added, removed, or changed
* @param domain the domain of the remote Router
* @param previousRouter the previously registered router; 0 if router is being added
* @param newRouter the new registered router; 0 if router is being removed
*/
event SetRouter(
uint32 indexed domain,
bytes32 previousRouter,
bytes32 newRouter
);
/**
* @notice Emitted when the Governor role is transferred
* @param previousGovernorDomain the domain of the previous Governor
* @param newGovernorDomain the domain of the new Governor
* @param previousGovernor the address of the previous Governor; 0 if the governor was remote
* @param newGovernor the address of the new Governor; 0 if the governor is remote
*/
event TransferGovernor(
uint32 previousGovernorDomain,
uint32 newGovernorDomain,
@ -47,44 +77,39 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
address indexed newGovernor
);
/**
* @notice Emitted when the RecoveryManager role is transferred
* @param previousRecoveryManager the address of the previous RecoveryManager
* @param newRecoveryManager the address of the new RecoveryManager
*/
event TransferRecoveryManager(
address indexed previousRecoveryManager,
address indexed newRecoveryManager
);
event InitiateRecovery(address indexed recoveryManager, uint256 endBlock);
event ExitRecovery(address recoveryManager);
constructor(uint32 _localDomain, uint256 _recoveryTimelock) {
localDomain = _localDomain;
recoveryTimelock = _recoveryTimelock;
}
function initialize(
address _xAppConnectionManager,
address _recoveryManager
) public initializer {
// initialize governor
address _governorAddr = msg.sender;
bool _isLocalGovernor = true;
_transferGovernor(localDomain, _governorAddr, _isLocalGovernor);
recoveryManager = _recoveryManager;
// initialize XAppConnectionManager
setXAppConnectionManager(_xAppConnectionManager);
require(
xAppConnectionManager.localDomain() == localDomain,
"XAppConnectionManager bad domain"
/**
* @notice Emitted when recovery state is initiated by the RecoveryManager
* @param recoveryManager the address of the current RecoveryManager who initiated the transition
* @param recoveryActiveAt the block at which recovery state will be active
*/
event InitiateRecovery(
address indexed recoveryManager,
uint256 recoveryActiveAt
);
}
/**
* @notice Emitted when recovery state is exited by the RecoveryManager
* @param recoveryManager the address of the current RecoveryManager who initiated the transition
*/
event ExitRecovery(address recoveryManager);
modifier typeAssert(bytes29 _view, GovernanceMessage.Types _type) {
_view.assertType(uint40(_type));
_;
}
// ============ Modifiers ============
modifier onlyReplica() {
require(xAppConnectionManager.isReplica(msg.sender), "!replica");
_;
@ -127,12 +152,39 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
_;
}
// ============ Constructor ============
constructor(uint32 _localDomain, uint256 _recoveryTimelock) {
localDomain = _localDomain;
recoveryTimelock = _recoveryTimelock;
}
// ============ Initializer ============
function initialize(
address _xAppConnectionManager,
address _recoveryManager
) public initializer {
// initialize governor
address _governorAddr = msg.sender;
bool _isLocalGovernor = true;
_transferGovernor(localDomain, _governorAddr, _isLocalGovernor);
// initialize recovery manager
recoveryManager = _recoveryManager;
// initialize XAppConnectionManager
setXAppConnectionManager(_xAppConnectionManager);
require(
xAppConnectionManager.localDomain() == localDomain,
"XAppConnectionManager bad domain"
);
}
// ============ External Functions ============
/**
* @notice Handle Optics messages
*
* For all non-Governor chains to handle messages
* sent from the Governor chain via Optics.
*
* Governor chain should never receive messages,
* because non-Governor chains are not able to send them
* @param _origin The domain (of the Governor Router)
@ -145,7 +197,6 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
bytes memory _message
) external override onlyReplica onlyGovernorRouter(_origin, _sender) {
bytes29 _msg = _message.ref(0);
if (_msg.isValidCall()) {
_handleCall(_msg.tryAsCall());
} else if (_msg.isValidTransferGovernor()) {
@ -179,10 +230,16 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
uint32 _destination,
GovernanceMessage.Call[] calldata _calls
) external onlyGovernor onlyNotInRecovery {
// ensure that destination chain has enrolled router
bytes32 _router = _mustHaveRouter(_destination);
// format call message
bytes memory _msg = GovernanceMessage.formatCalls(_calls);
Home(xAppConnectionManager.home()).enqueue(_destination, _router, _msg);
// dispatch call message using Optics
Home(xAppConnectionManager.home()).dispatch(
_destination,
_router,
_msg
);
}
/**
@ -196,21 +253,23 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
onlyNotInRecovery
{
bool _isLocalGovernor = _isLocalDomain(_newDomain);
_transferGovernor(_newDomain, _newGovernor, _isLocalGovernor); // transfer the governor locally
if (_isLocalGovernor) {
// transfer the governor locally
_transferGovernor(_newDomain, _newGovernor, _isLocalGovernor);
// if the governor domain is local, we only need to change the governor address locally
// no need to message remote routers; they should already have the same domain set and governor = bytes32(0)
if (_isLocalGovernor) {
return;
}
// format transfer governor message
bytes memory _transferGovernorMessage = GovernanceMessage
.formatTransferGovernor(
_newDomain,
TypeCasts.addressToBytes32(_newGovernor)
);
// send transfer governor message to all remote routers
// note: this assumes that the Router is on the global GovernorDomain;
// this causes a process error when relinquishing governorship
// on a newly deployed domain which is not the GovernorDomain
_sendToAllRemoteRouters(_transferGovernorMessage);
}
@ -224,7 +283,6 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
onlyRecoveryManager
{
emit TransferRecoveryManager(recoveryManager, _newRecoveryManager);
recoveryManager = _newRecoveryManager;
}
@ -239,8 +297,9 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
onlyGovernor
onlyNotInRecovery
{
_setRouter(_domain, _router); // set the router locally
// set the router locally
_setRouter(_domain, _router);
// format message to set the router on all remote routers
bytes memory _setRouterMessage = GovernanceMessage.formatSetRouter(
_domain,
_router
@ -261,7 +320,8 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
external
onlyGovernorOrRecoveryManager
{
_setRouter(_domain, _router); // set the router locally
// set the router locally
_setRouter(_domain, _router);
}
/**
@ -286,9 +346,8 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
onlyRecoveryManager
{
require(recoveryActiveAt == 0, "recovery already initiated");
// set the time that recovery will be active
recoveryActiveAt = block.timestamp.add(recoveryTimelock);
emit InitiateRecovery(recoveryManager, recoveryActiveAt);
}
@ -298,12 +357,16 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
*/
function exitRecovery() external onlyRecoveryManager {
require(recoveryActiveAt != 0, "recovery not initiated");
delete recoveryActiveAt;
emit ExitRecovery(recoveryManager);
}
// ============ Public Functions ============
/**
* @notice Check if the contract is in recovery mode currently
* @return TRUE iff the contract is actively in recovery mode currently
*/
function inRecovery() public view returns (bool) {
uint256 _recoveryActiveAt = recoveryActiveAt;
bool _recoveryInitiated = _recoveryActiveAt != 0;
@ -311,6 +374,8 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
return _recoveryInitiated && _recoveryActive;
}
// ============ Internal Functions ============
/**
* @notice Handle message dispatching calls locally
* @param _msg The message
@ -336,7 +401,6 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
uint32 _newDomain = _msg.domain();
address _newGovernor = TypeCasts.bytes32ToAddress(_msg.governor());
bool _isLocalGovernor = _isLocalDomain(_newDomain);
_transferGovernor(_newDomain, _newGovernor, _isLocalGovernor);
}
@ -350,7 +414,6 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
{
uint32 _domain = _msg.domain();
bytes32 _router = _msg.router();
_setRouter(_domain, _router);
}
@ -363,7 +426,7 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
for (uint256 i = 0; i < domains.length; i++) {
if (domains[i] != uint32(0)) {
_home.enqueue(domains[i], routers[domains[i]], _msg);
_home.dispatch(domains[i], routers[domains[i]], _msg);
}
}
}
@ -378,10 +441,10 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
returns (bytes memory _ret)
{
address _toContract = TypeCasts.bytes32ToAddress(_call.to);
// attempt to dispatch using low-level call
bool _success;
(_success, _ret) = _toContract.call(_call.data);
// revert if the call failed
require(_success, "call failed");
}
@ -400,14 +463,13 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
if (!_isLocalGovernor) {
_mustHaveRouter(_newDomain);
}
// Governor is 0x0 unless the governor is local
address _newGov = _isLocalGovernor ? _newGovernor : address(0);
// emit event before updating state variables
emit TransferGovernor(governorDomain, _newDomain, governor, _newGov);
// update state
governorDomain = _newDomain;
governor = _newGov;
emit TransferGovernor(governorDomain, _newDomain, governor, _newGov);
}
/**
@ -417,18 +479,18 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
*/
function _setRouter(uint32 _domain, bytes32 _newRouter) internal {
bytes32 _previousRouter = routers[_domain];
// emit event at beginning in case return after remove
emit SetRouter(_domain, _previousRouter, _newRouter);
// if the router is being removed, remove the domain
if (_newRouter == bytes32(0)) {
_removeDomain(_domain);
return;
}
// if the router is being added, add the domain
if (_previousRouter == bytes32(0)) {
_addDomain(_domain);
}
// update state with new router
routers[_domain] = _newRouter;
}
@ -446,7 +508,6 @@ contract GovernanceRouter is Version0, Initializable, IMessageRecipient {
*/
function _removeDomain(uint32 _domain) internal {
delete routers[_domain];
// find the index of the domain to remove & delete it from domains[]
for (uint256 i = 0; i < domains.length; i++) {
if (domains[i] == _domain) {

@ -17,12 +17,12 @@ contract TestHome is Home {
return homeDomainHash();
}
function testDestinationAndSequence(uint32 _destination, uint32 _sequence)
function testDestinationAndNonce(uint32 _destination, uint32 _nonce)
external
pure
returns (uint64)
{
return _destinationAndSequence(_destination, _sequence);
return _destinationAndNonce(_destination, _nonce);
}
function setFailed() public {

@ -21,8 +21,8 @@ contract TestMessage {
return _message.ref(0).sender();
}
function sequence(bytes memory _message) external pure returns (uint32) {
return _message.ref(0).sequence();
function nonce(bytes memory _message) external pure returns (uint32) {
return _message.ref(0).nonce();
}
function destination(bytes memory _message) external pure returns (uint32) {

@ -24,11 +24,11 @@ contract TestReplica is Replica {
function setMessagePending(bytes memory _message) external {
bytes29 _m = _message.ref(0);
messages[_m.keccak()] = MessageStatus.Pending;
messages[_m.keccak()] = MessageStatus.Proven;
}
function setCurrentRoot(bytes32 _newRoot) external {
current = _newRoot;
function setCommittedRoot(bytes32 _newRoot) external {
committedRoot = _newRoot;
confirmAt[_newRoot] = 1;
}

@ -23,7 +23,7 @@ library Message {
* @notice Returns formatted (packed) message with provided fields
* @param _originDomain Domain of home chain
* @param _sender Address of sender as bytes32
* @param _sequence Destination-specific sequence number
* @param _nonce Destination-specific nonce
* @param _destinationDomain Domain of destination chain
* @param _recipient Address of recipient on destination chain as bytes32
* @param _messageBody Raw bytes of message body
@ -32,7 +32,7 @@ library Message {
function formatMessage(
uint32 _originDomain,
bytes32 _sender,
uint32 _sequence,
uint32 _nonce,
uint32 _destinationDomain,
bytes32 _recipient,
bytes memory _messageBody
@ -41,7 +41,7 @@ library Message {
abi.encodePacked(
_originDomain,
_sender,
_sequence,
_nonce,
_destinationDomain,
_recipient,
_messageBody
@ -52,7 +52,7 @@ library Message {
* @notice Returns leaf of formatted message with provided fields.
* @param _origin Domain of home chain
* @param _sender Address of sender as bytes32
* @param _sequence Destination-specific sequence number
* @param _nonce Destination-specific nonce number
* @param _destination Domain of destination chain
* @param _recipient Address of recipient on destination chain as bytes32
* @param _body Raw bytes of message body
@ -61,7 +61,7 @@ library Message {
function messageHash(
uint32 _origin,
bytes32 _sender,
uint32 _sequence,
uint32 _nonce,
uint32 _destination,
bytes32 _recipient,
bytes memory _body
@ -71,7 +71,7 @@ library Message {
formatMessage(
_origin,
_sender,
_sequence,
_nonce,
_destination,
_recipient,
_body
@ -89,8 +89,8 @@ library Message {
return _message.index(4, 32);
}
/// @notice Returns message's sequence field
function sequence(bytes29 _message) internal pure returns (uint32) {
/// @notice Returns message's nonce field
function nonce(bytes29 _message) internal pure returns (uint32) {
return uint32(_message.indexUint(36, 4));
}
@ -119,6 +119,6 @@ library Message {
}
function leaf(bytes29 _message) internal view returns (bytes32) {
return messageHash(origin(_message), sender(_message), sequence(_message), destination(_message), recipient(_message), TypedMemView.clone(body(_message)));
return messageHash(origin(_message), sender(_message), nonce(_message), destination(_message), recipient(_message), TypedMemView.clone(body(_message)));
}
}

@ -139,7 +139,7 @@ contract BridgeRouter is Version0, Router, TokenRegistry {
// format Transfer Tokens action
bytes29 _action = BridgeMessage.formatTransfer(_recipient, _amount);
// send message to remote chain via Optics
Home(xAppConnectionManager.home()).enqueue(
Home(xAppConnectionManager.home()).dispatch(
_destination,
_remote,
BridgeMessage.formatMessage(_formatTokenId(_token), _action)
@ -346,7 +346,7 @@ contract BridgeRouter is Version0, Router, TokenRegistry {
_bridgeToken.decimals()
);
// send message to remote chain via Optics
Home(xAppConnectionManager.home()).enqueue(
Home(xAppConnectionManager.home()).dispatch(
_messageOrigin,
_messageRemoteRouter,
BridgeMessage.formatMessage(_tokenId, _updateDetailsAction)
@ -384,7 +384,7 @@ contract BridgeRouter is Version0, Router, TokenRegistry {
// format Request Details message
bytes29 _action = BridgeMessage.formatRequestDetails();
// send message to remote chain via Optics
Home(xAppConnectionManager.home()).enqueue(
Home(xAppConnectionManager.home()).dispatch(
_destination,
_remote,
BridgeMessage.formatMessage(_tokenId, _action)

@ -9,7 +9,7 @@ import {MerkleLib} from "@celo-org/optics-sol/libs/Merkle.sol";
import {QueueLib} from "@celo-org/optics-sol/libs/Queue.sol";
// We reproduce a significant amount of logic from `Home` to ensure that
// calling enqueue here is AT LEAST AS EXPENSIVE as calling it on home
// calling dispatch here is AT LEAST AS EXPENSIVE as calling it on home
contract MockCore is MerkleTreeManager, QueueManager {
using QueueLib for QueueLib.Queue;
using MerkleLib for MerkleLib.Tree;
@ -23,12 +23,12 @@ contract MockCore is MerkleTreeManager, QueueManager {
);
event Dispatch(
uint256 indexed leafIndex,
uint64 indexed destinationAndSequence,
uint64 indexed destinationAndNonce,
bytes32 indexed leaf,
bytes message
);
mapping(uint32 => uint32) public sequences;
mapping(uint32 => uint32) public nonces;
function localDomain() public pure returns (uint32) {
return 5;
@ -39,18 +39,18 @@ contract MockCore is MerkleTreeManager, QueueManager {
}
// We reproduce the logic here to simulate
function enqueue(
function dispatch(
uint32 _destination,
bytes32 _recipient,
bytes calldata _body
) external {
require(_body.length <= MAX_MESSAGE_BODY_BYTES, "!too big");
uint32 _sequence = sequences[_destination];
uint32 _nonce = nonces[_destination];
bytes memory _message = Message.formatMessage(
localDomain(),
bytes32(uint256(uint160(msg.sender))),
_sequence,
_nonce,
_destination,
_recipient,
_body
@ -63,24 +63,24 @@ contract MockCore is MerkleTreeManager, QueueManager {
// leafIndex is count() - 1 since new leaf has already been inserted
emit Dispatch(
count() - 1,
_destinationAndSequence(_destination, _sequence),
_destinationAndNonce(_destination, _nonce),
_leaf,
_message
);
emit Enqueue(_destination, _recipient, _body);
sequences[_destination] = _sequence + 1;
nonces[_destination] = _nonce + 1;
}
function isReplica(address) public pure returns (bool) {
return true;
}
function _destinationAndSequence(uint32 _destination, uint32 _sequence)
function _destinationAndNonce(uint32 _destination, uint32 _nonce)
internal
pure
returns (uint64)
{
return (uint64(_destination) << 32) | _sequence;
return (uint64(_destination) << 32) | _nonce;
}
}

@ -64,7 +64,6 @@ contract PingPongRouter is Router {
bytes memory _message
) external override onlyReplica onlyRemoteRouter(_origin, _sender) {
bytes29 _msg = _message.ref(0);
if (_msg.isPing()) {
_handlePing(_origin, _msg);
} else if (_msg.isPong()) {
@ -109,10 +108,8 @@ contract PingPongRouter is Router {
// get the volley count for this game
uint256 _count = _message.count();
uint32 _match = _message.matchId();
// emit a Received event
emit Received(_origin, _match, _count, _isPing);
// send the opposite volley back
_send(_origin, !_isPing, _match, _count + 1);
}
@ -127,11 +124,9 @@ contract PingPongRouter is Router {
function initiatePingPongMatch(uint32 _destinationDomain) external {
// the PingPong match always begins with a Ping volley
bool _isPing = true;
// increment match counter
uint32 _match = nextMatch;
nextMatch = _match + 1;
// send the first volley to the destination domain
_send(_destinationDomain, _isPing, _match, 0);
}
@ -150,15 +145,12 @@ contract PingPongRouter is Router {
) internal {
// get the xApp Router at the destinationDomain
bytes32 _remoteRouterAddress = _mustHaveRemote(_destinationDomain);
// format the ping message
bytes memory _message = _isPing
? PingPongMessage.formatPing(_match, _count)
: PingPongMessage.formatPong(_match, _count);
// send the message to the xApp Router
(_home()).enqueue(_destinationDomain, _remoteRouterAddress, _message);
(_home()).dispatch(_destinationDomain, _remoteRouterAddress, _message);
// emit a Sent event
emit Sent(_destinationDomain, _match, _count, _isPing);
}

@ -53,7 +53,6 @@ contract RouterTemplate is Router {
bytes memory _message
) external override onlyReplica onlyRemoteRouter(_origin, _sender) {
bytes29 _msg = _message.ref(0);
// route message to appropriate _handle function
// based on what type of message is encoded
if (_msg.isTypeA()) {
@ -73,7 +72,6 @@ contract RouterTemplate is Router {
function _handleTypeA(bytes29 _message) internal {
// parse the information from the message
uint256 _number = _message.number();
// implement the logic for executing the action
// (in this example case, emit an event with the number that was sent)
emit TypeAReceived(_number);
@ -95,12 +93,10 @@ contract RouterTemplate is Router {
{
// get the xApp Router at the destinationDomain
bytes32 _remoteRouterAddress = _mustHaveRemote(_destinationDomain);
// encode a message to send to the remote xApp Router
bytes memory _outboundMessage = Message.formatTypeA(_number);
// send the message to the xApp Router
_home().enqueue(
_home().dispatch(
_destinationDomain,
_remoteRouterAddress,
_outboundMessage

@ -532,7 +532,7 @@ async function deployHubAndSpokes(gov: CoreDeploy, spokes: CoreDeploy[]) {
* that have been deployed, initialized, and configured
* according to the deployOptics script
*
* @dev The first chain in the sequence will be the governing chain
* @dev The first chain in the array will be the governing chain
*
* @param deploys - An array of chain deploys
*/

@ -104,7 +104,7 @@ function formatSetRouter(domain: types.Domain, address: types.Address): string {
);
}
function messageToLeaf(message: types.HexString): string {
function messageHash(message: types.HexString): string {
return ethers.utils.solidityKeccak256(['bytes'], [message]);
}
@ -114,7 +114,7 @@ function ethersAddressToBytes32(address: types.Address): string {
.toLowerCase();
}
function destinationAndSequence(
function destinationAndNonce(
destination: types.Domain,
sequence: number,
): ethers.BigNumber {
@ -193,9 +193,9 @@ export const optics: types.HardhatOpticsHelpers = {
formatSetRouter,
formatCalls,
},
messageToLeaf,
messageHash,
ethersAddressToBytes32,
destinationAndSequence,
destinationAndNonce,
domainHash,
signedFailureNotification,
};

@ -11,9 +11,9 @@ export interface HardhatOpticsHelpers {
formatSetRouter: Function;
formatCalls: Function;
};
messageToLeaf: Function;
messageHash: Function;
ethersAddressToBytes32: Function;
destinationAndSequence: Function;
destinationAndNonce: Function;
domainHash: Function;
signedFailureNotification: Function;
}

File diff suppressed because it is too large Load Diff

@ -3,7 +3,7 @@ import { expect } from 'chai';
import { providers } from 'ethers';
import {
enqueueUpdateToReplica,
updateReplica,
formatCall,
formatOpticsMessage,
} from './utils';
@ -113,29 +113,29 @@ describe('GovernanceRouter', async () => {
implementation2.address,
]);
const currentRoot = await governorHome.current();
const committedRoot = await governorHome.committedRoot();
// dispatch call on local governorRouter
let tx = await governorRouter.callRemote(nonGovernorDomain, [call]);
let receipt = await tx.wait(0);
let leaf = receipt.events?.[0].topics[3];
let leaf = receipt.events?.[0].topics[1];
expect(leaf).to.equal(helpers.proof.leaf);
const [, latestRoot] = await governorHome.suggestUpdate();
expect(latestRoot).to.equal(helpers.root);
const { signature } = await updater.signUpdate(currentRoot, latestRoot);
const { signature } = await updater.signUpdate(committedRoot, latestRoot);
await expect(governorHome.update(currentRoot, latestRoot, signature))
await expect(governorHome.update(committedRoot, latestRoot, signature))
.to.emit(governorHome, 'Update')
.withArgs(governorDomain, currentRoot, latestRoot, signature);
.withArgs(governorDomain, committedRoot, latestRoot, signature);
expect(await governorHome.current()).to.equal(latestRoot);
expect(await governorHome.committedRoot()).to.equal(latestRoot);
expect(await governorHome.queueContains(latestRoot)).to.be.false;
await enqueueUpdateToReplica(
{ oldRoot: currentRoot, newRoot: latestRoot, signature },
await updateReplica(
{ oldRoot: committedRoot, newRoot: latestRoot, signature },
governorReplicaOnNonGovernorChain,
);
@ -154,18 +154,18 @@ describe('GovernanceRouter', async () => {
await governorReplicaOnNonGovernorChain.confirm();
// after confirming, current root should be equal to the last submitted update
expect(await governorReplicaOnNonGovernorChain.current()).to.equal(
// after confirming, committedRoot should be equal to the last submitted update
expect(await governorReplicaOnNonGovernorChain.committedRoot()).to.equal(
latestRoot,
);
const callMessage = optics.governance.formatCalls([call]);
const sequence = await governorHome.sequences(nonGovernorDomain);
const nonce = await governorHome.nonces(nonGovernorDomain);
const opticsMessage = optics.formatMessage(
governorDomain,
governorRouter.address,
sequence - 1,
nonce - 1,
nonGovernorDomain,
nonGovernorRouter.address,
callMessage,
@ -331,7 +331,7 @@ describe('GovernanceRouter', async () => {
it('Transfers governorship', async () => {
// Transfer governor on current governor chain
// get root on governor chain before transferring governor
const currentRoot = await governorHome.current();
const committedRoot = await governorHome.committedRoot();
// Governor HAS NOT been transferred on original governor domain
await expectGovernor(governorRouter, governorDomain, firstGovernor);
@ -361,10 +361,10 @@ describe('GovernanceRouter', async () => {
// get new root and signed update
const newRoot = await governorHome.queueEnd();
const { signature } = await updater.signUpdate(currentRoot, newRoot);
const { signature } = await updater.signUpdate(committedRoot, newRoot);
// update governor chain home
await governorHome.update(currentRoot, newRoot, signature);
await governorHome.update(committedRoot, newRoot, signature);
const transferGovernorMessage = optics.governance.formatTransferGovernor(
nonGovernorDomain,
@ -379,7 +379,7 @@ describe('GovernanceRouter', async () => {
);
// Set current root on replica
await governorReplicaOnNonGovernorChain.setCurrentRoot(newRoot);
await governorReplicaOnNonGovernorChain.setCommittedRoot(newRoot);
// Governor HAS been transferred on original governor domain
await expectGovernor(

@ -21,7 +21,7 @@ const remoteDomain = domains[1];
/*
* Deploy the full Optics suite on two chains
* enqueue messages to Home
* dispatch messages to Home
* sign and submit updates to Home
* relay updates to Replica
* confirm updates on Replica
@ -33,7 +33,7 @@ describe('SimpleCrossChainMessage', async () => {
let deploys: Deploy[] = [];
let randomSigner: Signer,
firstRootEnqueuedToReplica: string,
firstRootSubmittedToReplica: string,
updater: Updater,
latestRoot: string,
latestUpdate: Update;
@ -57,8 +57,8 @@ describe('SimpleCrossChainMessage', async () => {
let length = await governorHome.queueLength();
expect(length).to.equal(1);
let [suggestedCurrent, suggestedNew] = await governorHome.suggestUpdate();
expect(suggestedCurrent).to.equal(nullRoot);
let [suggestedCommitted, suggestedNew] = await governorHome.suggestUpdate();
expect(suggestedCommitted).to.equal(nullRoot);
expect(suggestedNew).to.not.equal(nullRoot);
// nonGovernorHome has 2 updates
@ -67,8 +67,8 @@ describe('SimpleCrossChainMessage', async () => {
length = await nonGovernorHome.queueLength();
expect(length).to.equal(2);
[suggestedCurrent, suggestedNew] = await nonGovernorHome.suggestUpdate();
expect(suggestedCurrent).to.equal(nullRoot);
[suggestedCommitted, suggestedNew] = await nonGovernorHome.suggestUpdate();
expect(suggestedCommitted).to.equal(nullRoot);
expect(suggestedNew).to.not.equal(nullRoot);
});
@ -82,7 +82,7 @@ describe('SimpleCrossChainMessage', async () => {
expect(length).to.equal(0);
const [pending, confirmAt] = await replica.nextPending();
expect(pending).to.equal(await replica.current());
expect(pending).to.equal(await replica.committedRoot());
expect(confirmAt).to.equal(1);
}
}
@ -92,7 +92,7 @@ describe('SimpleCrossChainMessage', async () => {
const messages = ['message'].map((message) =>
utils.formatMessage(message, remoteDomain, randomSigner.address),
);
const update = await utils.enqueueMessagesAndUpdateHome(
const update = await utils.dispatchMessagesAndUpdateHome(
deploys[0].contracts.home?.proxy!,
messages,
updater,
@ -103,7 +103,7 @@ describe('SimpleCrossChainMessage', async () => {
});
it('Destination Replica Accepts the first update', async () => {
firstRootEnqueuedToReplica = await utils.enqueueUpdateToReplica(
firstRootSubmittedToReplica = await utils.updateReplica(
latestUpdate,
deploys[1].contracts.replicas[localDomain].proxy!,
);
@ -113,7 +113,7 @@ describe('SimpleCrossChainMessage', async () => {
const messages = ['message1', 'message2', 'message3'].map((message) =>
utils.formatMessage(message, remoteDomain, randomSigner.address),
);
const update = await utils.enqueueMessagesAndUpdateHome(
const update = await utils.dispatchMessagesAndUpdateHome(
deploys[0].contracts.home?.proxy!,
messages,
updater,
@ -124,7 +124,7 @@ describe('SimpleCrossChainMessage', async () => {
});
it('Destination Replica Accepts the second update', async () => {
await utils.enqueueUpdateToReplica(
await utils.updateReplica(
latestUpdate,
deploys[1].contracts.replicas[localDomain].proxy,
);
@ -133,7 +133,7 @@ describe('SimpleCrossChainMessage', async () => {
it('Destination Replica shows first update as the next pending', async () => {
const replica = deploys[1].contracts.replicas[localDomain].proxy;
const [pending] = await replica.nextPending();
expect(pending).to.equal(firstRootEnqueuedToReplica);
expect(pending).to.equal(firstRootSubmittedToReplica);
});
it('Destination Replica Batch-confirms several ready updates', async () => {
@ -150,7 +150,7 @@ describe('SimpleCrossChainMessage', async () => {
// after confirming, current root should be equal to the last submitted update
const { newRoot } = latestUpdate;
expect(await replica.current()).to.equal(newRoot);
expect(await replica.committedRoot()).to.equal(newRoot);
});
it('Proves and processes a message on Replica', async () => {
@ -173,11 +173,11 @@ describe('SimpleCrossChainMessage', async () => {
// Create Optics message that is sent from the governor domain and governor
// to the nonGovernorRouter on the nonGovernorDomain
const sequence = 0;
const nonce = 0;
const opticsMessage = optics.formatMessage(
1000,
governorRouter.address,
sequence,
nonce,
2000,
nonGovernorRouter.address,
callMessage,
@ -185,21 +185,21 @@ describe('SimpleCrossChainMessage', async () => {
// get merkle proof
const { path, index } = proveAndProcessTestCases[0];
const leaf = optics.messageToLeaf(opticsMessage);
const messageHash = optics.messageHash(opticsMessage);
// set root
const proofRoot = await replica.testBranchRoot(
leaf,
messageHash,
path as BytesArray,
index,
);
await replica.setCurrentRoot(proofRoot);
await replica.setCommittedRoot(proofRoot);
// prove and process message
await replica.proveAndProcess(opticsMessage, path as BytesArray, index);
// expect call to have been processed
expect(await TestRecipient.processed()).to.be.true;
expect(await replica.messages(leaf)).to.equal(MessageStatus.PROCESSED);
expect(await replica.messages(messageHash)).to.equal(MessageStatus.PROCESSED);
});
});

@ -18,11 +18,11 @@ type MessageDetails = {
};
/*
* Enqueue a message to the specified Home contract
* Dispatch a message from the specified Home contract
* and return the updated root
*
* @param chainDetails - ChainDetails type containing every deployed domain
* @param homeDomain - domain of the Home contract to which we will enqueue the message
* @param homeDomain - domain of the Home contract
* @param messageDetails - Message type containing
* the message string,
* the destination domain to which the message will be sent,
@ -30,14 +30,14 @@ type MessageDetails = {
*
* @return newRoot - bytes32 of the latest root
*/
export async function enqueueMessageToHome(
export async function dispatchMessage(
home: Home,
messageDetails: MessageDetails,
): Promise<string> {
const { message, destinationDomain, recipientAddress } = messageDetails;
// Send message with random signer address as msg.sender
await home.enqueue(
await home.dispatch(
destinationDomain,
optics.ethersAddressToBytes32(recipientAddress),
ethers.utils.formatBytes32String(message),
@ -49,40 +49,40 @@ export async function enqueueMessageToHome(
}
/*
* Enqueue a set of messages to the specified Home contract,
* Dispatch a set of messages to the specified Home contract,
* then sign and submit an update to the Home contract
*
* @param chainDetails - ChainDetails type containing every deployed domain
* @param homeDomain - domain of the Home contract to which we will enqueue all of messages / submit the update
* @param homeDomain - domain of the Home contract
* @param messages - Message[]
*
* @return update - Update type
*/
export async function enqueueMessagesAndUpdateHome(
export async function dispatchMessagesAndUpdateHome(
home: Home,
messages: MessageDetails[],
updater: Updater,
): Promise<Update> {
const homeDomain = await home.localDomain();
const oldRoot = await home.current();
const oldRoot = await home.committedRoot();
// enqueue each message to Home and get the intermediate root
const enqueuedRoots = [];
// dispatch each message from Home and get the intermediate root
const roots = [];
for (let message of messages) {
const newRoot = await enqueueMessageToHome(home, message);
const newRoot = await dispatchMessage(home, message);
enqueuedRoots.push(newRoot);
roots.push(newRoot);
}
// ensure that Home queue contains
// all of the roots we just enqueued
for (let root of enqueuedRoots) {
for (let root of roots) {
expect(await home.queueContains(root)).to.be.true;
}
// sign & submit an update from oldRoot to newRoot
const newRoot = enqueuedRoots[enqueuedRoots.length - 1];
const newRoot = roots[roots.length - 1];
const { signature } = await updater.signUpdate(oldRoot, newRoot);
@ -91,12 +91,12 @@ export async function enqueueMessagesAndUpdateHome(
.withArgs(homeDomain, oldRoot, newRoot, signature);
// ensure that Home root is now newRoot
expect(await home.current()).to.equal(newRoot);
expect(await home.committedRoot()).to.equal(newRoot);
// ensure that Home queue no longer contains
// any of the roots we just enqueued -
// they should be removed from queue when update is submitted
for (let root of enqueuedRoots) {
for (let root of roots) {
expect(await home.queueContains(root)).to.be.false;
}
@ -108,16 +108,16 @@ export async function enqueueMessagesAndUpdateHome(
}
/*
* Enqueue a signed update to the Replica contract
* Submit a signed update to the Replica contract
*
* @param chainDetails - ChainDetails type containing every deployed domain
* @param latestUpdateOnOriginChain - Update type, the last Update submitted to the Home chain for this Replica
* @param homeDomain - domain of the Home contract from which the update originated
* @param replicaDomain - domain of the Replica contract where the update will be submitted
*
* @return finalRoot - updated state root enqueued to the Replica
* @return finalRoot - updated state root submitted to the Replica
*/
export async function enqueueUpdateToReplica(
export async function updateReplica(
latestUpdateOnOriginChain: Update,
replica: Replica,
): Promise<string> {
@ -160,7 +160,7 @@ export async function formatOpticsMessage(
destinationRouter: TestGovernanceRouter,
message: string,
): Promise<string> {
const sequence = 0;
const nonce = 0;
const governorDomain = await governorRouter.localDomain();
const destinationDomain = await destinationRouter.localDomain();
@ -169,7 +169,7 @@ export async function formatOpticsMessage(
const opticsMessage = optics.formatMessage(
governorDomain,
governorRouter.address,
sequence,
nonce,
destinationDomain,
destinationRouter.address,
message,

@ -13,7 +13,7 @@ import {
} from '../../typechain/optics-core';
import homeDomainHashTestCases from '../../../vectors/homeDomainHash.json';
import destinationSequenceTestCases from '../../../vectors/destinationSequence.json';
import destinationNonceTestCases from '../../../vectors/destinationNonce.json';
const localDomain = 1000;
const destDomain = 2000;
@ -29,11 +29,11 @@ describe('Home', async () => {
fakeUpdater: Updater,
fakeUpdaterManager: UpdaterManager;
// Helper function that enqueues message and returns its root.
// The message recipient is the same for all messages enqueued.
const enqueueMessageAndGetRoot = async (message: string) => {
// Helper function that dispatches message and returns intermediate root.
// The message recipient is the same for all messages dispatched.
const dispatchMessageAndGetRoot = async (message: string) => {
message = ethers.utils.formatBytes32String(message);
await home.enqueue(
await home.dispatch(
destDomain,
optics.ethersAddressToBytes32(recipient.address),
message,
@ -82,7 +82,7 @@ describe('Home', async () => {
const message = ethers.utils.formatBytes32String('message');
await expect(
home.enqueue(
home.dispatch(
destDomain,
optics.ethersAddressToBytes32(recipient.address),
message,
@ -110,12 +110,12 @@ describe('Home', async () => {
}
});
it('Does not enqueue large messages', async () => {
it('Does not dispatch too large messages', async () => {
const message = `0x${Buffer.alloc(3000).toString('hex')}`;
await expect(
home
.connect(signer)
.enqueue(
.dispatch(
destDomain,
optics.ethersAddressToBytes32(recipient.address),
message,
@ -123,33 +123,33 @@ describe('Home', async () => {
).to.be.revertedWith('msg too long');
});
it('Enqueues a message', async () => {
it('Dispatches a message', async () => {
const message = ethers.utils.formatBytes32String('message');
const sequence = await home.sequences(localDomain);
const nonce = await home.nonces(localDomain);
// Format data that will be emitted from Dispatch event
const destinationAndSequence = optics.destinationAndSequence(
const destinationAndNonce = optics.destinationAndNonce(
destDomain,
sequence,
nonce,
);
const opticsMessage = optics.formatMessage(
localDomain,
signer.address,
sequence,
nonce,
destDomain,
recipient.address,
message,
);
const leaf = optics.messageToLeaf(opticsMessage);
const messageHash = optics.messageHash(opticsMessage);
const leafIndex = await home.nextLeafIndex();
const current = await home.current();
const committedRoot = await home.committedRoot();
// Send message with signer address as msg.sender
await expect(
home
.connect(signer)
.enqueue(
.dispatch(
destDomain,
optics.ethersAddressToBytes32(recipient.address),
message,
@ -157,25 +157,25 @@ describe('Home', async () => {
)
.to.emit(home, 'Dispatch')
.withArgs(
messageHash,
leafIndex,
destinationAndSequence,
leaf,
current,
destinationAndNonce,
committedRoot,
opticsMessage,
);
});
it('Suggests current root and latest root on suggestUpdate', async () => {
const currentRoot = await home.current();
const committedRoot = await home.committedRoot();
const message = ethers.utils.formatBytes32String('message');
await home.enqueue(
await home.dispatch(
destDomain,
optics.ethersAddressToBytes32(recipient.address),
message,
);
const latestEnqueuedRoot = await home.queueEnd();
const [suggestedCurrent, suggestedNew] = await home.suggestUpdate();
expect(suggestedCurrent).to.equal(currentRoot);
const [suggestedCommitted, suggestedNew] = await home.suggestUpdate();
expect(suggestedCommitted).to.equal(committedRoot);
expect(suggestedNew).to.equal(latestEnqueuedRoot);
});
@ -183,43 +183,43 @@ describe('Home', async () => {
const length = await home.queueLength();
expect(length).to.equal(0);
const [suggestedCurrent, suggestedNew] = await home.suggestUpdate();
expect(suggestedCurrent).to.equal(emptyAddress);
const [suggestedCommitted, suggestedNew] = await home.suggestUpdate();
expect(suggestedCommitted).to.equal(emptyAddress);
expect(suggestedNew).to.equal(emptyAddress);
});
it('Accepts a valid update', async () => {
const currentRoot = await home.current();
const newRoot = await enqueueMessageAndGetRoot('message');
const { signature } = await updater.signUpdate(currentRoot, newRoot);
const committedRoot = await home.committedRoot();
const newRoot = await dispatchMessageAndGetRoot('message');
const { signature } = await updater.signUpdate(committedRoot, newRoot);
await expect(home.update(currentRoot, newRoot, signature))
await expect(home.update(committedRoot, newRoot, signature))
.to.emit(home, 'Update')
.withArgs(localDomain, currentRoot, newRoot, signature);
expect(await home.current()).to.equal(newRoot);
.withArgs(localDomain, committedRoot, newRoot, signature);
expect(await home.committedRoot()).to.equal(newRoot);
expect(await home.queueContains(newRoot)).to.be.false;
});
it('Batch-accepts several updates', async () => {
const currentRoot = await home.current();
const newRoot1 = await enqueueMessageAndGetRoot('message1');
const newRoot2 = await enqueueMessageAndGetRoot('message2');
const newRoot3 = await enqueueMessageAndGetRoot('message3');
const { signature } = await updater.signUpdate(currentRoot, newRoot3);
const committedRoot = await home.committedRoot();
const newRoot1 = await dispatchMessageAndGetRoot('message1');
const newRoot2 = await dispatchMessageAndGetRoot('message2');
const newRoot3 = await dispatchMessageAndGetRoot('message3');
const { signature } = await updater.signUpdate(committedRoot, newRoot3);
await expect(home.update(currentRoot, newRoot3, signature))
await expect(home.update(committedRoot, newRoot3, signature))
.to.emit(home, 'Update')
.withArgs(localDomain, currentRoot, newRoot3, signature);
expect(await home.current()).to.equal(newRoot3);
.withArgs(localDomain, committedRoot, newRoot3, signature);
expect(await home.committedRoot()).to.equal(newRoot3);
expect(await home.queueContains(newRoot1)).to.be.false;
expect(await home.queueContains(newRoot2)).to.be.false;
expect(await home.queueContains(newRoot3)).to.be.false;
});
it('Rejects update that does not build off of current root', async () => {
// First root is current root
const secondRoot = await enqueueMessageAndGetRoot('message');
const thirdRoot = await enqueueMessageAndGetRoot('message2');
// First root is committedRoot
const secondRoot = await dispatchMessageAndGetRoot('message');
const thirdRoot = await dispatchMessageAndGetRoot('message2');
// Try to submit update that skips the current (first) root
const { signature } = await updater.signUpdate(secondRoot, thirdRoot);
@ -229,11 +229,11 @@ describe('Home', async () => {
});
it('Rejects update that does not exist in queue', async () => {
const currentRoot = await home.current();
const committedRoot = await home.committedRoot();
const fakeNewRoot = ethers.utils.formatBytes32String('fake root');
const { signature } = await updater.signUpdate(currentRoot, fakeNewRoot);
const { signature } = await updater.signUpdate(committedRoot, fakeNewRoot);
await expect(home.update(currentRoot, fakeNewRoot, signature)).to.emit(
await expect(home.update(committedRoot, fakeNewRoot, signature)).to.emit(
home,
'ImproperUpdate',
);
@ -241,21 +241,21 @@ describe('Home', async () => {
});
it('Rejects update from non-updater address', async () => {
const currentRoot = await home.current();
const newRoot = await enqueueMessageAndGetRoot('message');
const committedRoot = await home.committedRoot();
const newRoot = await dispatchMessageAndGetRoot('message');
const { signature: fakeSignature } = await fakeUpdater.signUpdate(
currentRoot,
committedRoot,
newRoot,
);
await expect(
home.update(currentRoot, newRoot, fakeSignature),
home.update(committedRoot, newRoot, fakeSignature),
).to.be.revertedWith('!updater sig');
});
it('Fails on valid double update proof', async () => {
const firstRoot = await home.current();
const secondRoot = await enqueueMessageAndGetRoot('message');
const thirdRoot = await enqueueMessageAndGetRoot('message2');
const firstRoot = await home.committedRoot();
const secondRoot = await dispatchMessageAndGetRoot('message');
const thirdRoot = await dispatchMessageAndGetRoot('message2');
const { signature } = await updater.signUpdate(firstRoot, secondRoot);
const { signature: signature2 } = await updater.signUpdate(
firstRoot,
@ -272,13 +272,13 @@ describe('Home', async () => {
expect(await home.state()).to.equal(OpticsState.FAILED);
});
it('Correctly calculates destinationAndSequence', async () => {
for (let testCase of destinationSequenceTestCases) {
let { destination, sequence, expectedDestinationAndSequence } = testCase;
const solidityDestinationAndSequence =
await home.testDestinationAndSequence(destination, sequence);
expect(solidityDestinationAndSequence).to.equal(
expectedDestinationAndSequence,
it('Correctly calculates destinationAndNonce', async () => {
for (let testCase of destinationNonceTestCases) {
let { destination, nonce, expectedDestinationAndNonce } = testCase;
const solidityDestinationAndNonce =
await home.testDestinationAndNonce(destination, nonce);
expect(solidityDestinationAndNonce).to.equal(
expectedDestinationAndNonce,
);
}
});

@ -19,13 +19,13 @@ describe('Message', async () => {
it('Returns fields from a message', async () => {
const [sender, recipient] = await ethers.getSigners();
const sequence = 1;
const nonce = 1;
const body = ethers.utils.formatBytes32String('message');
const message = optics.formatMessage(
remoteDomain,
sender.address,
sequence,
nonce,
localDomain,
recipient.address,
body,
@ -35,7 +35,7 @@ describe('Message', async () => {
expect(await messageLib.sender(message)).to.equal(
optics.ethersAddressToBytes32(sender.address),
);
expect(await messageLib.sequence(message)).to.equal(sequence);
expect(await messageLib.nonce(message)).to.equal(nonce);
expect(await messageLib.destination(message)).to.equal(localDomain);
expect(await messageLib.recipient(message)).to.equal(
optics.ethersAddressToBytes32(recipient.address),
@ -49,7 +49,7 @@ describe('Message', async () => {
it('Matches Rust-output OpticsMessage and leaf', async () => {
const origin = 1000;
const sender = '0x1111111111111111111111111111111111111111';
const sequence = 1;
const nonce = 1;
const destination = 2000;
const recipient = '0x2222222222222222222222222222222222222222';
const body = ethers.utils.arrayify('0x1234');
@ -57,7 +57,7 @@ describe('Message', async () => {
const opticsMessage = optics.formatMessage(
origin,
sender,
sequence,
nonce,
destination,
recipient,
body,
@ -66,16 +66,16 @@ describe('Message', async () => {
const {
origin: testOrigin,
sender: testSender,
sequence: testSequence,
nonce: testNonce,
destination: testDestination,
recipient: testRecipient,
body: testBody,
leaf,
messageHash,
} = testCases[0];
expect(await messageLib.origin(opticsMessage)).to.equal(testOrigin);
expect(await messageLib.sender(opticsMessage)).to.equal(testSender);
expect(await messageLib.sequence(opticsMessage)).to.equal(testSequence);
expect(await messageLib.nonce(opticsMessage)).to.equal(testNonce);
expect(await messageLib.destination(opticsMessage)).to.equal(
testDestination,
);
@ -83,7 +83,7 @@ describe('Message', async () => {
expect(await messageLib.body(opticsMessage)).to.equal(
ethers.utils.hexlify(testBody),
);
expect(await messageLib.leaf(opticsMessage)).to.equal(leaf);
expect(optics.messageToLeaf(opticsMessage)).to.equal(leaf);
expect(await messageLib.leaf(opticsMessage)).to.equal(messageHash);
expect(optics.messageHash(opticsMessage)).to.equal(messageHash);
});
});

@ -39,10 +39,10 @@ describe('Replica', async () => {
updater: Updater,
fakeUpdater: Updater;
const enqueueValidUpdate = async (newRoot: string) => {
const submitValidUpdate = async (newRoot: string) => {
let oldRoot;
if ((await replica.queueLength()).isZero()) {
oldRoot = await replica.current();
oldRoot = await replica.committedRoot();
} else {
oldRoot = await replica.queueEnd();
}
@ -91,7 +91,7 @@ describe('Replica', async () => {
expect(await replica.state()).to.equal(OpticsState.FAILED);
const newRoot = ethers.utils.formatBytes32String('new root');
await expect(enqueueValidUpdate(newRoot)).to.be.revertedWith(
await expect(submitValidUpdate(newRoot)).to.be.revertedWith(
'failed state',
);
});
@ -120,21 +120,21 @@ describe('Replica', async () => {
it('Enqueues pending updates', async () => {
const firstNewRoot = ethers.utils.formatBytes32String('first new root');
await enqueueValidUpdate(firstNewRoot);
await submitValidUpdate(firstNewRoot);
expect(await replica.queueEnd()).to.equal(firstNewRoot);
const secondNewRoot = ethers.utils.formatBytes32String('second next root');
await enqueueValidUpdate(secondNewRoot);
await submitValidUpdate(secondNewRoot);
expect(await replica.queueEnd()).to.equal(secondNewRoot);
});
it('Returns the earliest pending update', async () => {
const firstNewRoot = ethers.utils.formatBytes32String('first new root');
await enqueueValidUpdate(firstNewRoot);
await submitValidUpdate(firstNewRoot);
const beforeTimestamp = await replica.timestamp();
const secondNewRoot = ethers.utils.formatBytes32String('second next root');
await enqueueValidUpdate(secondNewRoot);
await submitValidUpdate(secondNewRoot);
const [pending, confirmAt] = await replica.nextPending();
expect(pending).to.equal(firstNewRoot);
@ -143,13 +143,13 @@ describe('Replica', async () => {
it('Returns the current value when the queue is empty', async () => {
const [pending, confirmAt] = await replica.nextPending();
expect(pending).to.equal(await replica.current());
expect(pending).to.equal(await replica.committedRoot());
expect(confirmAt).to.equal(1);
});
it('Rejects update with invalid signature', async () => {
const firstNewRoot = ethers.utils.formatBytes32String('first new root');
await enqueueValidUpdate(firstNewRoot);
await submitValidUpdate(firstNewRoot);
const secondNewRoot = ethers.utils.formatBytes32String('second new root');
const { signature: fakeSignature } = await fakeUpdater.signUpdate(
@ -174,7 +174,7 @@ describe('Replica', async () => {
it('Rejects updates not building off latest enqueued root', async () => {
const firstNewRoot = ethers.utils.formatBytes32String('first new root');
await enqueueValidUpdate(firstNewRoot);
await submitValidUpdate(firstNewRoot);
const fakeLatestRoot = ethers.utils.formatBytes32String('fake root');
const secondNewRoot = ethers.utils.formatBytes32String('second new root');
@ -189,7 +189,7 @@ describe('Replica', async () => {
});
it('Accepts a double update proof', async () => {
const firstRoot = await replica.current();
const firstRoot = await replica.committedRoot();
const secondRoot = ethers.utils.formatBytes32String('second root');
const thirdRoot = ethers.utils.formatBytes32String('third root');
@ -213,28 +213,28 @@ describe('Replica', async () => {
it('Confirms a ready update', async () => {
const newRoot = ethers.utils.formatBytes32String('new root');
await enqueueValidUpdate(newRoot);
await submitValidUpdate(newRoot);
await increaseTimestampBy(ethers.provider, optimisticSeconds);
expect(await replica.canConfirm()).to.be.true;
await replica.confirm();
expect(await replica.current()).to.equal(newRoot);
expect(await replica.committedRoot()).to.equal(newRoot);
});
it('Batch-confirms several ready updates', async () => {
const firstNewRoot = ethers.utils.formatBytes32String('first new root');
await enqueueValidUpdate(firstNewRoot);
await submitValidUpdate(firstNewRoot);
const secondNewRoot = ethers.utils.formatBytes32String('second next root');
await enqueueValidUpdate(secondNewRoot);
await submitValidUpdate(secondNewRoot);
// Increase time enough for both updates to be confirmable
await increaseTimestampBy(ethers.provider, optimisticSeconds * 2);
expect(await replica.canConfirm()).to.be.true;
await replica.confirm();
expect(await replica.current()).to.equal(secondNewRoot);
expect(await replica.committedRoot()).to.equal(secondNewRoot);
});
it('Rejects confirmation attempt on empty queue', async () => {
@ -246,10 +246,10 @@ describe('Replica', async () => {
it('Rejects an early confirmation attempt', async () => {
const firstNewRoot = ethers.utils.formatBytes32String('first new root');
await enqueueValidUpdate(firstNewRoot);
await submitValidUpdate(firstNewRoot);
// Don't increase time enough for update to be confirmable.
// Note that we use optimisticSeconds - 2 because the call to enqueue
// Note that we use optimisticSeconds - 2 because the call to submit
// the valid root has already increased the timestamp by 1.
await increaseTimestampBy(ethers.provider, optimisticSeconds - 2);
@ -262,7 +262,7 @@ describe('Replica', async () => {
const testCase = merkleTestCases[0];
let { leaf, index, path } = testCase.proofs[0];
await replica.setCurrentRoot(testCase.expectedRoot);
await replica.setCommittedRoot(testCase.expectedRoot);
// Ensure proper static call return value
expect(await replica.callStatic.prove(leaf, path as BytesArray, index)).to
@ -276,7 +276,7 @@ describe('Replica', async () => {
const testCase = merkleTestCases[0];
let { leaf, index, path } = testCase.proofs[0];
await replica.setCurrentRoot(testCase.expectedRoot);
await replica.setCommittedRoot(testCase.expectedRoot);
// Prove message, which changes status to MessageStatus.Pending
await replica.prove(leaf, path as BytesArray, index);
@ -298,7 +298,7 @@ describe('Replica', async () => {
path[0] = path[1];
path[1] = firstHash;
await replica.setCurrentRoot(testCase.expectedRoot);
await replica.setCommittedRoot(testCase.expectedRoot);
expect(await replica.callStatic.prove(leaf, path as BytesArray, index)).to
.be.false;
@ -313,11 +313,11 @@ describe('Replica', async () => {
const testRecipientFactory = new contracts.TestRecipient__factory(signer);
const testRecipient = await testRecipientFactory.deploy();
const sequence = 0;
const nonce = 0;
const opticsMessage = optics.formatMessage(
remoteDomain,
sender.address,
sequence,
nonce,
localDomain,
testRecipient.address,
'0x',
@ -333,24 +333,24 @@ describe('Replica', async () => {
const processTx = replica.process(opticsMessage);
await expect(processTx)
.to.emit(replica, 'ProcessSuccess')
.withArgs(optics.messageToLeaf(opticsMessage));
.withArgs(optics.messageHash(opticsMessage));
});
it('Fails to process an unproved message', async () => {
const [sender, recipient] = await ethers.getSigners();
const sequence = 0;
const nonce = 0;
const body = ethers.utils.formatBytes32String('message');
const opticsMessage = optics.formatMessage(
remoteDomain,
sender.address,
sequence,
nonce,
localDomain,
recipient.address,
body,
);
await expect(replica.process(opticsMessage)).to.be.revertedWith('!pending');
await expect(replica.process(opticsMessage)).to.be.revertedWith('!proven');
});
for (let i = 0; i < badRecipientFactories.length; i++) {
@ -361,11 +361,11 @@ describe('Replica', async () => {
const factory = new badRecipientFactories[i](signer);
const badRecipient = await factory.deploy();
const sequence = 0;
const nonce = 0;
const opticsMessage = optics.formatMessage(
remoteDomain,
sender.address,
sequence,
nonce,
localDomain,
badRecipient.address,
'0x',
@ -379,13 +379,13 @@ describe('Replica', async () => {
it('Fails to process message with wrong destination Domain', async () => {
const [sender, recipient] = await ethers.getSigners();
const sequence = 0;
const nonce = 0;
const body = ethers.utils.formatBytes32String('message');
const opticsMessage = optics.formatMessage(
remoteDomain,
sender.address,
sequence,
nonce,
// Wrong destination Domain
localDomain + 5,
recipient.address,
@ -398,13 +398,13 @@ describe('Replica', async () => {
});
it('Processes message sent to a non-existent contract address', async () => {
const sequence = 0;
const nonce = 0;
const body = ethers.utils.formatBytes32String('message');
const opticsMessage = optics.formatMessage(
remoteDomain,
opticsMessageSender.address,
sequence,
nonce,
localDomain,
'0x1234567890123456789012345678901234567890', // non-existent contract address
body,
@ -417,13 +417,13 @@ describe('Replica', async () => {
it('Fails to process an undergased transaction', async () => {
const [sender, recipient] = await ethers.getSigners();
const sequence = 0;
const nonce = 0;
const body = ethers.utils.formatBytes32String('message');
const opticsMessage = optics.formatMessage(
remoteDomain,
sender.address,
sequence,
nonce,
localDomain,
recipient.address,
body,
@ -444,11 +444,11 @@ describe('Replica', async () => {
const factory = new contracts.BadRecipientHandle__factory(recipient);
const testRecipient = await factory.deploy();
const sequence = 0;
const nonce = 0;
const opticsMessage = optics.formatMessage(
remoteDomain,
sender.address,
sequence,
nonce,
localDomain,
testRecipient.address,
'0x',
@ -467,14 +467,14 @@ describe('Replica', async () => {
const testRecipientFactory = new contracts.TestRecipient__factory(signer);
const testRecipient = await testRecipientFactory.deploy();
const sequence = 0;
const nonce = 0;
// Note that hash of this message specifically matches leaf of 1st
// proveAndProcess test case
const opticsMessage = optics.formatMessage(
remoteDomain,
sender.address,
sequence,
nonce,
localDomain,
testRecipient.address,
'0x',
@ -482,7 +482,7 @@ describe('Replica', async () => {
// Assert above message and test case have matching leaves
const { path, index } = proveAndProcessTestCases[0];
const messageLeaf = optics.messageToLeaf(opticsMessage);
const messageHash = optics.messageHash(opticsMessage);
// Set replica's current root to match newly computed root that includes
// the new leaf (normally root will have already been computed and path
@ -490,22 +490,22 @@ describe('Replica', async () => {
// impossible to find the inputs that create a pre-determined root, we
// simply recalculate root with the leaf using branchRoot)
const proofRoot = await replica.testBranchRoot(
messageLeaf,
messageHash,
path as BytesArray,
index,
);
await replica.setCurrentRoot(proofRoot);
await replica.setCommittedRoot(proofRoot);
await replica.proveAndProcess(opticsMessage, path as BytesArray, index);
expect(await replica.messages(messageLeaf)).to.equal(
expect(await replica.messages(messageHash)).to.equal(
MessageStatus.PROCESSED,
);
});
it('Has proveAndProcess fail if prove fails', async () => {
const [sender, recipient] = await ethers.getSigners();
const sequence = 0;
const nonce = 0;
// Use 1st proof of 1st merkle vector test case
const testCase = merkleTestCases[0];
@ -515,7 +515,7 @@ describe('Replica', async () => {
const opticsMessage = optics.formatMessage(
remoteDomain,
sender.address,
sequence,
nonce,
localDomain,
recipient.address,
'0x',
@ -523,7 +523,7 @@ describe('Replica', async () => {
// Ensure root given in proof and actual root don't match so that
// replica.prove(...) will fail
const actualRoot = await replica.current();
const actualRoot = await replica.committedRoot();
const proofRoot = await replica.testBranchRoot(
leaf,
path as BytesArray,

@ -65,13 +65,6 @@ describe('XAppConnectionManager', async () => {
).to.be.revertedWith(ONLY_OWNER_REVERT_MSG);
});
it('isOwner returns true for owner and false for non-owner', async () => {
const [newOwner, nonOwner] = await ethers.getSigners();
await connectionManager.transferOwnership(newOwner.address);
expect(await connectionManager.isOwner(newOwner.address)).to.be.true;
expect(await connectionManager.isOwner(nonOwner.address)).to.be.false;
});
it('isReplica returns true for enrolledReplica and false for non-enrolled Replica', async () => {
const [nonEnrolledReplica] = await ethers.getSigners();
expect(await connectionManager.isReplica(enrolledReplica.address)).to.be

@ -21,7 +21,7 @@ import { TypedEventFilter, TypedEvent, TypedListener } from "./commons";
interface CommonInterface extends ethers.utils.Interface {
functions: {
"current()": FunctionFragment;
"committedRoot()": FunctionFragment;
"doubleUpdate(bytes32,bytes32[2],bytes,bytes)": FunctionFragment;
"homeDomainHash()": FunctionFragment;
"localDomain()": FunctionFragment;
@ -32,7 +32,10 @@ interface CommonInterface extends ethers.utils.Interface {
"updater()": FunctionFragment;
};
encodeFunctionData(functionFragment: "current", values?: undefined): string;
encodeFunctionData(
functionFragment: "committedRoot",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "doubleUpdate",
values: [BytesLike, [BytesLike, BytesLike], BytesLike, BytesLike]
@ -57,7 +60,10 @@ interface CommonInterface extends ethers.utils.Interface {
encodeFunctionData(functionFragment: "state", values?: undefined): string;
encodeFunctionData(functionFragment: "updater", values?: undefined): string;
decodeFunctionResult(functionFragment: "current", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "committedRoot",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "doubleUpdate",
data: BytesLike
@ -135,7 +141,7 @@ export class Common extends BaseContract {
interface: CommonInterface;
functions: {
current(overrides?: CallOverrides): Promise<[string]>;
committedRoot(overrides?: CallOverrides): Promise<[string]>;
doubleUpdate(
_oldRoot: BytesLike,
@ -163,7 +169,7 @@ export class Common extends BaseContract {
updater(overrides?: CallOverrides): Promise<[string]>;
};
current(overrides?: CallOverrides): Promise<string>;
committedRoot(overrides?: CallOverrides): Promise<string>;
doubleUpdate(
_oldRoot: BytesLike,
@ -188,7 +194,7 @@ export class Common extends BaseContract {
updater(overrides?: CallOverrides): Promise<string>;
callStatic: {
current(overrides?: CallOverrides): Promise<string>;
committedRoot(overrides?: CallOverrides): Promise<string>;
doubleUpdate(
_oldRoot: BytesLike,
@ -249,7 +255,7 @@ export class Common extends BaseContract {
};
estimateGas: {
current(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<BigNumber>;
doubleUpdate(
_oldRoot: BytesLike,
@ -278,7 +284,7 @@ export class Common extends BaseContract {
};
populateTransaction: {
current(overrides?: CallOverrides): Promise<PopulatedTransaction>;
committedRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
doubleUpdate(
_oldRoot: BytesLike,

@ -489,10 +489,10 @@ export class GovernanceRouter extends BaseContract {
InitiateRecovery(
recoveryManager?: string | null,
endBlock?: null
recoveryActiveAt?: null
): TypedEventFilter<
[string, BigNumber],
{ recoveryManager: string; endBlock: BigNumber }
{ recoveryManager: string; recoveryActiveAt: BigNumber }
>;
SetRouter(

@ -22,21 +22,21 @@ import { TypedEventFilter, TypedEvent, TypedListener } from "./commons";
interface HomeInterface extends ethers.utils.Interface {
functions: {
"MAX_MESSAGE_BODY_BYTES()": FunctionFragment;
"committedRoot()": FunctionFragment;
"count()": FunctionFragment;
"current()": FunctionFragment;
"dispatch(uint32,bytes32,bytes)": FunctionFragment;
"doubleUpdate(bytes32,bytes32[2],bytes,bytes)": FunctionFragment;
"enqueue(uint32,bytes32,bytes)": FunctionFragment;
"homeDomainHash()": FunctionFragment;
"improperUpdate(bytes32,bytes32,bytes)": FunctionFragment;
"initialize(address)": FunctionFragment;
"localDomain()": FunctionFragment;
"nonces(uint32)": FunctionFragment;
"owner()": FunctionFragment;
"queueContains(bytes32)": FunctionFragment;
"queueEnd()": FunctionFragment;
"queueLength()": FunctionFragment;
"renounceOwnership()": FunctionFragment;
"root()": FunctionFragment;
"sequences(uint32)": FunctionFragment;
"setUpdater(address)": FunctionFragment;
"setUpdaterManager(address)": FunctionFragment;
"state()": FunctionFragment;
@ -52,16 +52,19 @@ interface HomeInterface extends ethers.utils.Interface {
functionFragment: "MAX_MESSAGE_BODY_BYTES",
values?: undefined
): string;
encodeFunctionData(functionFragment: "count", values?: undefined): string;
encodeFunctionData(functionFragment: "current", values?: undefined): string;
encodeFunctionData(
functionFragment: "doubleUpdate",
values: [BytesLike, [BytesLike, BytesLike], BytesLike, BytesLike]
functionFragment: "committedRoot",
values?: undefined
): string;
encodeFunctionData(functionFragment: "count", values?: undefined): string;
encodeFunctionData(
functionFragment: "enqueue",
functionFragment: "dispatch",
values: [BigNumberish, BytesLike, BytesLike]
): string;
encodeFunctionData(
functionFragment: "doubleUpdate",
values: [BytesLike, [BytesLike, BytesLike], BytesLike, BytesLike]
): string;
encodeFunctionData(
functionFragment: "homeDomainHash",
values?: undefined
@ -75,6 +78,10 @@ interface HomeInterface extends ethers.utils.Interface {
functionFragment: "localDomain",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "nonces",
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
encodeFunctionData(
functionFragment: "queueContains",
@ -90,10 +97,6 @@ interface HomeInterface extends ethers.utils.Interface {
values?: undefined
): string;
encodeFunctionData(functionFragment: "root", values?: undefined): string;
encodeFunctionData(
functionFragment: "sequences",
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "setUpdater", values: [string]): string;
encodeFunctionData(
functionFragment: "setUpdaterManager",
@ -123,13 +126,16 @@ interface HomeInterface extends ethers.utils.Interface {
functionFragment: "MAX_MESSAGE_BODY_BYTES",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "committedRoot",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "count", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "current", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "dispatch", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "doubleUpdate",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "enqueue", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "homeDomainHash",
data: BytesLike
@ -143,6 +149,7 @@ interface HomeInterface extends ethers.utils.Interface {
functionFragment: "localDomain",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "nonces", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "queueContains",
@ -158,7 +165,6 @@ interface HomeInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "root", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "sequences", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setUpdater", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "setUpdaterManager",
@ -182,7 +188,7 @@ interface HomeInterface extends ethers.utils.Interface {
): Result;
events: {
"Dispatch(uint256,uint64,bytes32,bytes32,bytes)": EventFragment;
"Dispatch(bytes32,uint256,uint64,bytes32,bytes)": EventFragment;
"DoubleUpdate(bytes32,bytes32[2],bytes,bytes)": EventFragment;
"ImproperUpdate(bytes32,bytes32,bytes)": EventFragment;
"NewUpdater(address)": EventFragment;
@ -248,9 +254,16 @@ export class Home extends BaseContract {
functions: {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<[BigNumber]>;
committedRoot(overrides?: CallOverrides): Promise<[string]>;
count(overrides?: CallOverrides): Promise<[BigNumber]>;
current(overrides?: CallOverrides): Promise<[string]>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
doubleUpdate(
_oldRoot: BytesLike,
@ -260,13 +273,6 @@ export class Home extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
homeDomainHash(overrides?: CallOverrides): Promise<[string]>;
improperUpdate(
@ -283,6 +289,8 @@ export class Home extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<[number]>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<[number]>;
owner(overrides?: CallOverrides): Promise<[string]>;
queueContains(
@ -300,8 +308,6 @@ export class Home extends BaseContract {
root(overrides?: CallOverrides): Promise<[string]>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<[number]>;
setUpdater(
_updater: string,
overrides?: Overrides & { from?: string | Promise<string> }
@ -316,7 +322,7 @@ export class Home extends BaseContract {
suggestUpdate(
overrides?: CallOverrides
): Promise<[string, string] & { _current: string; _new: string }>;
): Promise<[string, string] & { _committedRoot: string; _new: string }>;
transferOwnership(
newOwner: string,
@ -328,7 +334,7 @@ export class Home extends BaseContract {
): Promise<[BigNumber] & { count: BigNumber }>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
@ -341,9 +347,16 @@ export class Home extends BaseContract {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<string>;
count(overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<string>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
doubleUpdate(
_oldRoot: BytesLike,
@ -353,13 +366,6 @@ export class Home extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
homeDomainHash(overrides?: CallOverrides): Promise<string>;
improperUpdate(
@ -376,6 +382,8 @@ export class Home extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<number>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
owner(overrides?: CallOverrides): Promise<string>;
queueContains(_item: BytesLike, overrides?: CallOverrides): Promise<boolean>;
@ -390,8 +398,6 @@ export class Home extends BaseContract {
root(overrides?: CallOverrides): Promise<string>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
setUpdater(
_updater: string,
overrides?: Overrides & { from?: string | Promise<string> }
@ -406,7 +412,7 @@ export class Home extends BaseContract {
suggestUpdate(
overrides?: CallOverrides
): Promise<[string, string] & { _current: string; _new: string }>;
): Promise<[string, string] & { _committedRoot: string; _new: string }>;
transferOwnership(
newOwner: string,
@ -416,7 +422,7 @@ export class Home extends BaseContract {
tree(overrides?: CallOverrides): Promise<BigNumber>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
@ -429,9 +435,16 @@ export class Home extends BaseContract {
callStatic: {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<string>;
count(overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<string>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: CallOverrides
): Promise<void>;
doubleUpdate(
_oldRoot: BytesLike,
@ -441,13 +454,6 @@ export class Home extends BaseContract {
overrides?: CallOverrides
): Promise<void>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: CallOverrides
): Promise<void>;
homeDomainHash(overrides?: CallOverrides): Promise<string>;
improperUpdate(
@ -464,6 +470,8 @@ export class Home extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<number>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
owner(overrides?: CallOverrides): Promise<string>;
queueContains(
@ -479,8 +487,6 @@ export class Home extends BaseContract {
root(overrides?: CallOverrides): Promise<string>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
setUpdater(_updater: string, overrides?: CallOverrides): Promise<void>;
setUpdaterManager(
@ -492,7 +498,7 @@ export class Home extends BaseContract {
suggestUpdate(
overrides?: CallOverrides
): Promise<[string, string] & { _current: string; _new: string }>;
): Promise<[string, string] & { _committedRoot: string; _new: string }>;
transferOwnership(
newOwner: string,
@ -502,7 +508,7 @@ export class Home extends BaseContract {
tree(overrides?: CallOverrides): Promise<BigNumber>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: CallOverrides
@ -515,18 +521,18 @@ export class Home extends BaseContract {
filters: {
Dispatch(
messageHash?: BytesLike | null,
leafIndex?: BigNumberish | null,
destinationAndSequence?: BigNumberish | null,
leaf?: BytesLike | null,
current?: null,
destinationAndNonce?: BigNumberish | null,
committedRoot?: null,
message?: null
): TypedEventFilter<
[BigNumber, BigNumber, string, string, string],
[string, BigNumber, BigNumber, string, string],
{
messageHash: string;
leafIndex: BigNumber;
destinationAndSequence: BigNumber;
leaf: string;
current: string;
destinationAndNonce: BigNumber;
committedRoot: string;
message: string;
}
>;
@ -596,9 +602,16 @@ export class Home extends BaseContract {
estimateGas: {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<BigNumber>;
count(overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<BigNumber>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
doubleUpdate(
_oldRoot: BytesLike,
@ -608,13 +621,6 @@ export class Home extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
homeDomainHash(overrides?: CallOverrides): Promise<BigNumber>;
improperUpdate(
@ -631,6 +637,8 @@ export class Home extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<BigNumber>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
owner(overrides?: CallOverrides): Promise<BigNumber>;
queueContains(
@ -648,11 +656,6 @@ export class Home extends BaseContract {
root(overrides?: CallOverrides): Promise<BigNumber>;
sequences(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
setUpdater(
_updater: string,
overrides?: Overrides & { from?: string | Promise<string> }
@ -675,7 +678,7 @@ export class Home extends BaseContract {
tree(overrides?: CallOverrides): Promise<BigNumber>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
@ -691,9 +694,16 @@ export class Home extends BaseContract {
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
committedRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
count(overrides?: CallOverrides): Promise<PopulatedTransaction>;
current(overrides?: CallOverrides): Promise<PopulatedTransaction>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
doubleUpdate(
_oldRoot: BytesLike,
@ -703,13 +713,6 @@ export class Home extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
homeDomainHash(overrides?: CallOverrides): Promise<PopulatedTransaction>;
improperUpdate(
@ -726,6 +729,11 @@ export class Home extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<PopulatedTransaction>;
nonces(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
queueContains(
@ -743,11 +751,6 @@ export class Home extends BaseContract {
root(overrides?: CallOverrides): Promise<PopulatedTransaction>;
sequences(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
setUpdater(
_updater: string,
overrides?: Overrides & { from?: string | Promise<string> }
@ -770,7 +773,7 @@ export class Home extends BaseContract {
tree(overrides?: CallOverrides): Promise<PopulatedTransaction>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }

@ -25,9 +25,9 @@ interface ReplicaInterface extends ethers.utils.Interface {
"RESERVE_GAS()": FunctionFragment;
"acceptableRoot(bytes32)": FunctionFragment;
"canConfirm()": FunctionFragment;
"committedRoot()": FunctionFragment;
"confirm()": FunctionFragment;
"confirmAt(bytes32)": FunctionFragment;
"current()": FunctionFragment;
"doubleUpdate(bytes32,bytes32[2],bytes,bytes)": FunctionFragment;
"homeDomainHash()": FunctionFragment;
"initialize(uint32,address,bytes32,uint256)": FunctionFragment;
@ -63,12 +63,15 @@ interface ReplicaInterface extends ethers.utils.Interface {
functionFragment: "canConfirm",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "committedRoot",
values?: undefined
): string;
encodeFunctionData(functionFragment: "confirm", values?: undefined): string;
encodeFunctionData(
functionFragment: "confirmAt",
values: [BytesLike]
): string;
encodeFunctionData(functionFragment: "current", values?: undefined): string;
encodeFunctionData(
functionFragment: "doubleUpdate",
values: [BytesLike, [BytesLike, BytesLike], BytesLike, BytesLike]
@ -210,9 +213,12 @@ interface ReplicaInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "canConfirm", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "committedRoot",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "confirm", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "confirmAt", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "current", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "doubleUpdate",
data: BytesLike
@ -326,14 +332,14 @@ export class Replica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<[boolean]>;
committedRoot(overrides?: CallOverrides): Promise<[string]>;
confirm(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
confirmAt(arg0: BytesLike, overrides?: CallOverrides): Promise<[BigNumber]>;
current(overrides?: CallOverrides): Promise<[string]>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -347,7 +353,7 @@ export class Replica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
@ -480,14 +486,14 @@ export class Replica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<boolean>;
committedRoot(overrides?: CallOverrides): Promise<string>;
confirm(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
confirmAt(arg0: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<string>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -501,7 +507,7 @@ export class Replica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
@ -632,12 +638,12 @@ export class Replica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<boolean>;
committedRoot(overrides?: CallOverrides): Promise<string>;
confirm(overrides?: CallOverrides): Promise<void>;
confirmAt(arg0: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<string>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -651,7 +657,7 @@ export class Replica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: CallOverrides
): Promise<void>;
@ -791,14 +797,14 @@ export class Replica extends BaseContract {
ProcessError(
messageHash?: BytesLike | null,
sequence?: BigNumberish | null,
nonce?: BigNumberish | null,
recipient?: string | null,
returnData?: null
): TypedEventFilter<
[string, number, string, string],
{
messageHash: string;
sequence: number;
nonce: number;
recipient: string;
returnData: string;
}
@ -836,14 +842,14 @@ export class Replica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<BigNumber>;
confirm(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
confirmAt(arg0: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<BigNumber>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -857,7 +863,7 @@ export class Replica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
@ -990,6 +996,8 @@ export class Replica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<PopulatedTransaction>;
committedRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
confirm(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
@ -999,8 +1007,6 @@ export class Replica extends BaseContract {
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
current(overrides?: CallOverrides): Promise<PopulatedTransaction>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -1014,7 +1020,7 @@ export class Replica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;

@ -21,7 +21,7 @@ import { TypedEventFilter, TypedEvent, TypedListener } from "./commons";
interface TestCommonInterface extends ethers.utils.Interface {
functions: {
"current()": FunctionFragment;
"committedRoot()": FunctionFragment;
"doubleUpdate(bytes32,bytes32[2],bytes,bytes)": FunctionFragment;
"homeDomainHash()": FunctionFragment;
"localDomain()": FunctionFragment;
@ -34,7 +34,10 @@ interface TestCommonInterface extends ethers.utils.Interface {
"updater()": FunctionFragment;
};
encodeFunctionData(functionFragment: "current", values?: undefined): string;
encodeFunctionData(
functionFragment: "committedRoot",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "doubleUpdate",
values: [BytesLike, [BytesLike, BytesLike], BytesLike, BytesLike]
@ -64,7 +67,10 @@ interface TestCommonInterface extends ethers.utils.Interface {
): string;
encodeFunctionData(functionFragment: "updater", values?: undefined): string;
decodeFunctionResult(functionFragment: "current", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "committedRoot",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "doubleUpdate",
data: BytesLike
@ -147,7 +153,7 @@ export class TestCommon extends BaseContract {
interface: TestCommonInterface;
functions: {
current(overrides?: CallOverrides): Promise<[string]>;
committedRoot(overrides?: CallOverrides): Promise<[string]>;
doubleUpdate(
_oldRoot: BytesLike,
@ -187,7 +193,7 @@ export class TestCommon extends BaseContract {
updater(overrides?: CallOverrides): Promise<[string]>;
};
current(overrides?: CallOverrides): Promise<string>;
committedRoot(overrides?: CallOverrides): Promise<string>;
doubleUpdate(
_oldRoot: BytesLike,
@ -224,7 +230,7 @@ export class TestCommon extends BaseContract {
updater(overrides?: CallOverrides): Promise<string>;
callStatic: {
current(overrides?: CallOverrides): Promise<string>;
committedRoot(overrides?: CallOverrides): Promise<string>;
doubleUpdate(
_oldRoot: BytesLike,
@ -294,7 +300,7 @@ export class TestCommon extends BaseContract {
};
estimateGas: {
current(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<BigNumber>;
doubleUpdate(
_oldRoot: BytesLike,
@ -335,7 +341,7 @@ export class TestCommon extends BaseContract {
};
populateTransaction: {
current(overrides?: CallOverrides): Promise<PopulatedTransaction>;
committedRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
doubleUpdate(
_oldRoot: BytesLike,

@ -567,10 +567,10 @@ export class TestGovernanceRouter extends BaseContract {
InitiateRecovery(
recoveryManager?: string | null,
endBlock?: null
recoveryActiveAt?: null
): TypedEventFilter<
[string, BigNumber],
{ recoveryManager: string; endBlock: BigNumber }
{ recoveryManager: string; recoveryActiveAt: BigNumber }
>;
SetRouter(

@ -22,28 +22,28 @@ import { TypedEventFilter, TypedEvent, TypedListener } from "./commons";
interface TestHomeInterface extends ethers.utils.Interface {
functions: {
"MAX_MESSAGE_BODY_BYTES()": FunctionFragment;
"committedRoot()": FunctionFragment;
"count()": FunctionFragment;
"current()": FunctionFragment;
"dispatch(uint32,bytes32,bytes)": FunctionFragment;
"doubleUpdate(bytes32,bytes32[2],bytes,bytes)": FunctionFragment;
"enqueue(uint32,bytes32,bytes)": FunctionFragment;
"homeDomainHash()": FunctionFragment;
"improperUpdate(bytes32,bytes32,bytes)": FunctionFragment;
"initialize(address)": FunctionFragment;
"localDomain()": FunctionFragment;
"nextLeafIndex()": FunctionFragment;
"nonces(uint32)": FunctionFragment;
"owner()": FunctionFragment;
"queueContains(bytes32)": FunctionFragment;
"queueEnd()": FunctionFragment;
"queueLength()": FunctionFragment;
"renounceOwnership()": FunctionFragment;
"root()": FunctionFragment;
"sequences(uint32)": FunctionFragment;
"setFailed()": FunctionFragment;
"setUpdater(address)": FunctionFragment;
"setUpdaterManager(address)": FunctionFragment;
"state()": FunctionFragment;
"suggestUpdate()": FunctionFragment;
"testDestinationAndSequence(uint32,uint32)": FunctionFragment;
"testDestinationAndNonce(uint32,uint32)": FunctionFragment;
"testHomeDomainHash()": FunctionFragment;
"transferOwnership(address)": FunctionFragment;
"tree()": FunctionFragment;
@ -56,16 +56,19 @@ interface TestHomeInterface extends ethers.utils.Interface {
functionFragment: "MAX_MESSAGE_BODY_BYTES",
values?: undefined
): string;
encodeFunctionData(functionFragment: "count", values?: undefined): string;
encodeFunctionData(functionFragment: "current", values?: undefined): string;
encodeFunctionData(
functionFragment: "doubleUpdate",
values: [BytesLike, [BytesLike, BytesLike], BytesLike, BytesLike]
functionFragment: "committedRoot",
values?: undefined
): string;
encodeFunctionData(functionFragment: "count", values?: undefined): string;
encodeFunctionData(
functionFragment: "enqueue",
functionFragment: "dispatch",
values: [BigNumberish, BytesLike, BytesLike]
): string;
encodeFunctionData(
functionFragment: "doubleUpdate",
values: [BytesLike, [BytesLike, BytesLike], BytesLike, BytesLike]
): string;
encodeFunctionData(
functionFragment: "homeDomainHash",
values?: undefined
@ -83,6 +86,10 @@ interface TestHomeInterface extends ethers.utils.Interface {
functionFragment: "nextLeafIndex",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "nonces",
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
encodeFunctionData(
functionFragment: "queueContains",
@ -98,10 +105,6 @@ interface TestHomeInterface extends ethers.utils.Interface {
values?: undefined
): string;
encodeFunctionData(functionFragment: "root", values?: undefined): string;
encodeFunctionData(
functionFragment: "sequences",
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "setFailed", values?: undefined): string;
encodeFunctionData(functionFragment: "setUpdater", values: [string]): string;
encodeFunctionData(
@ -114,7 +117,7 @@ interface TestHomeInterface extends ethers.utils.Interface {
values?: undefined
): string;
encodeFunctionData(
functionFragment: "testDestinationAndSequence",
functionFragment: "testDestinationAndNonce",
values: [BigNumberish, BigNumberish]
): string;
encodeFunctionData(
@ -140,13 +143,16 @@ interface TestHomeInterface extends ethers.utils.Interface {
functionFragment: "MAX_MESSAGE_BODY_BYTES",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "committedRoot",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "count", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "current", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "dispatch", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "doubleUpdate",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "enqueue", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "homeDomainHash",
data: BytesLike
@ -164,6 +170,7 @@ interface TestHomeInterface extends ethers.utils.Interface {
functionFragment: "nextLeafIndex",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "nonces", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "queueContains",
@ -179,7 +186,6 @@ interface TestHomeInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "root", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "sequences", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setFailed", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setUpdater", data: BytesLike): Result;
decodeFunctionResult(
@ -192,7 +198,7 @@ interface TestHomeInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "testDestinationAndSequence",
functionFragment: "testDestinationAndNonce",
data: BytesLike
): Result;
decodeFunctionResult(
@ -212,7 +218,7 @@ interface TestHomeInterface extends ethers.utils.Interface {
): Result;
events: {
"Dispatch(uint256,uint64,bytes32,bytes32,bytes)": EventFragment;
"Dispatch(bytes32,uint256,uint64,bytes32,bytes)": EventFragment;
"DoubleUpdate(bytes32,bytes32[2],bytes,bytes)": EventFragment;
"ImproperUpdate(bytes32,bytes32,bytes)": EventFragment;
"NewUpdater(address)": EventFragment;
@ -278,9 +284,16 @@ export class TestHome extends BaseContract {
functions: {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<[BigNumber]>;
committedRoot(overrides?: CallOverrides): Promise<[string]>;
count(overrides?: CallOverrides): Promise<[BigNumber]>;
current(overrides?: CallOverrides): Promise<[string]>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
doubleUpdate(
_oldRoot: BytesLike,
@ -290,13 +303,6 @@ export class TestHome extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
homeDomainHash(overrides?: CallOverrides): Promise<[string]>;
improperUpdate(
@ -315,6 +321,8 @@ export class TestHome extends BaseContract {
nextLeafIndex(overrides?: CallOverrides): Promise<[BigNumber]>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<[number]>;
owner(overrides?: CallOverrides): Promise<[string]>;
queueContains(
@ -332,8 +340,6 @@ export class TestHome extends BaseContract {
root(overrides?: CallOverrides): Promise<[string]>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<[number]>;
setFailed(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
@ -352,11 +358,11 @@ export class TestHome extends BaseContract {
suggestUpdate(
overrides?: CallOverrides
): Promise<[string, string] & { _current: string; _new: string }>;
): Promise<[string, string] & { _committedRoot: string; _new: string }>;
testDestinationAndSequence(
testDestinationAndNonce(
_destination: BigNumberish,
_sequence: BigNumberish,
_nonce: BigNumberish,
overrides?: CallOverrides
): Promise<[BigNumber]>;
@ -372,7 +378,7 @@ export class TestHome extends BaseContract {
): Promise<[BigNumber] & { count: BigNumber }>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
@ -385,9 +391,16 @@ export class TestHome extends BaseContract {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<string>;
count(overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<string>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
doubleUpdate(
_oldRoot: BytesLike,
@ -397,13 +410,6 @@ export class TestHome extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
homeDomainHash(overrides?: CallOverrides): Promise<string>;
improperUpdate(
@ -422,6 +428,8 @@ export class TestHome extends BaseContract {
nextLeafIndex(overrides?: CallOverrides): Promise<BigNumber>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
owner(overrides?: CallOverrides): Promise<string>;
queueContains(_item: BytesLike, overrides?: CallOverrides): Promise<boolean>;
@ -436,8 +444,6 @@ export class TestHome extends BaseContract {
root(overrides?: CallOverrides): Promise<string>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
setFailed(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
@ -456,11 +462,11 @@ export class TestHome extends BaseContract {
suggestUpdate(
overrides?: CallOverrides
): Promise<[string, string] & { _current: string; _new: string }>;
): Promise<[string, string] & { _committedRoot: string; _new: string }>;
testDestinationAndSequence(
testDestinationAndNonce(
_destination: BigNumberish,
_sequence: BigNumberish,
_nonce: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
@ -474,7 +480,7 @@ export class TestHome extends BaseContract {
tree(overrides?: CallOverrides): Promise<BigNumber>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
@ -487,9 +493,16 @@ export class TestHome extends BaseContract {
callStatic: {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<string>;
count(overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<string>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: CallOverrides
): Promise<void>;
doubleUpdate(
_oldRoot: BytesLike,
@ -499,13 +512,6 @@ export class TestHome extends BaseContract {
overrides?: CallOverrides
): Promise<void>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: CallOverrides
): Promise<void>;
homeDomainHash(overrides?: CallOverrides): Promise<string>;
improperUpdate(
@ -524,6 +530,8 @@ export class TestHome extends BaseContract {
nextLeafIndex(overrides?: CallOverrides): Promise<BigNumber>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
owner(overrides?: CallOverrides): Promise<string>;
queueContains(
@ -539,8 +547,6 @@ export class TestHome extends BaseContract {
root(overrides?: CallOverrides): Promise<string>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
setFailed(overrides?: CallOverrides): Promise<void>;
setUpdater(_updater: string, overrides?: CallOverrides): Promise<void>;
@ -554,11 +560,11 @@ export class TestHome extends BaseContract {
suggestUpdate(
overrides?: CallOverrides
): Promise<[string, string] & { _current: string; _new: string }>;
): Promise<[string, string] & { _committedRoot: string; _new: string }>;
testDestinationAndSequence(
testDestinationAndNonce(
_destination: BigNumberish,
_sequence: BigNumberish,
_nonce: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
@ -572,7 +578,7 @@ export class TestHome extends BaseContract {
tree(overrides?: CallOverrides): Promise<BigNumber>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: CallOverrides
@ -585,18 +591,18 @@ export class TestHome extends BaseContract {
filters: {
Dispatch(
messageHash?: BytesLike | null,
leafIndex?: BigNumberish | null,
destinationAndSequence?: BigNumberish | null,
leaf?: BytesLike | null,
current?: null,
destinationAndNonce?: BigNumberish | null,
committedRoot?: null,
message?: null
): TypedEventFilter<
[BigNumber, BigNumber, string, string, string],
[string, BigNumber, BigNumber, string, string],
{
messageHash: string;
leafIndex: BigNumber;
destinationAndSequence: BigNumber;
leaf: string;
current: string;
destinationAndNonce: BigNumber;
committedRoot: string;
message: string;
}
>;
@ -666,9 +672,16 @@ export class TestHome extends BaseContract {
estimateGas: {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<BigNumber>;
count(overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<BigNumber>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
doubleUpdate(
_oldRoot: BytesLike,
@ -678,13 +691,6 @@ export class TestHome extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
homeDomainHash(overrides?: CallOverrides): Promise<BigNumber>;
improperUpdate(
@ -703,6 +709,8 @@ export class TestHome extends BaseContract {
nextLeafIndex(overrides?: CallOverrides): Promise<BigNumber>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
owner(overrides?: CallOverrides): Promise<BigNumber>;
queueContains(
@ -720,11 +728,6 @@ export class TestHome extends BaseContract {
root(overrides?: CallOverrides): Promise<BigNumber>;
sequences(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
setFailed(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
@ -743,9 +746,9 @@ export class TestHome extends BaseContract {
suggestUpdate(overrides?: CallOverrides): Promise<BigNumber>;
testDestinationAndSequence(
testDestinationAndNonce(
_destination: BigNumberish,
_sequence: BigNumberish,
_nonce: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
@ -759,7 +762,7 @@ export class TestHome extends BaseContract {
tree(overrides?: CallOverrides): Promise<BigNumber>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
@ -775,9 +778,16 @@ export class TestHome extends BaseContract {
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
committedRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
count(overrides?: CallOverrides): Promise<PopulatedTransaction>;
current(overrides?: CallOverrides): Promise<PopulatedTransaction>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
doubleUpdate(
_oldRoot: BytesLike,
@ -787,13 +797,6 @@ export class TestHome extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
homeDomainHash(overrides?: CallOverrides): Promise<PopulatedTransaction>;
improperUpdate(
@ -812,6 +815,11 @@ export class TestHome extends BaseContract {
nextLeafIndex(overrides?: CallOverrides): Promise<PopulatedTransaction>;
nonces(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
queueContains(
@ -829,11 +837,6 @@ export class TestHome extends BaseContract {
root(overrides?: CallOverrides): Promise<PopulatedTransaction>;
sequences(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
setFailed(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
@ -852,9 +855,9 @@ export class TestHome extends BaseContract {
suggestUpdate(overrides?: CallOverrides): Promise<PopulatedTransaction>;
testDestinationAndSequence(
testDestinationAndNonce(
_destination: BigNumberish,
_sequence: BigNumberish,
_nonce: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
@ -870,7 +873,7 @@ export class TestHome extends BaseContract {
tree(overrides?: CallOverrides): Promise<PopulatedTransaction>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }

@ -23,11 +23,11 @@ interface TestMessageInterface extends ethers.utils.Interface {
"body(bytes)": FunctionFragment;
"destination(bytes)": FunctionFragment;
"leaf(bytes)": FunctionFragment;
"nonce(bytes)": FunctionFragment;
"origin(bytes)": FunctionFragment;
"recipient(bytes)": FunctionFragment;
"recipientAddress(bytes)": FunctionFragment;
"sender(bytes)": FunctionFragment;
"sequence(bytes)": FunctionFragment;
};
encodeFunctionData(functionFragment: "body", values: [BytesLike]): string;
@ -36,6 +36,7 @@ interface TestMessageInterface extends ethers.utils.Interface {
values: [BytesLike]
): string;
encodeFunctionData(functionFragment: "leaf", values: [BytesLike]): string;
encodeFunctionData(functionFragment: "nonce", values: [BytesLike]): string;
encodeFunctionData(functionFragment: "origin", values: [BytesLike]): string;
encodeFunctionData(
functionFragment: "recipient",
@ -46,7 +47,6 @@ interface TestMessageInterface extends ethers.utils.Interface {
values: [BytesLike]
): string;
encodeFunctionData(functionFragment: "sender", values: [BytesLike]): string;
encodeFunctionData(functionFragment: "sequence", values: [BytesLike]): string;
decodeFunctionResult(functionFragment: "body", data: BytesLike): Result;
decodeFunctionResult(
@ -54,6 +54,7 @@ interface TestMessageInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "leaf", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "nonce", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "origin", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "recipient", data: BytesLike): Result;
decodeFunctionResult(
@ -61,7 +62,6 @@ interface TestMessageInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "sender", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "sequence", data: BytesLike): Result;
events: {};
}
@ -119,6 +119,8 @@ export class TestMessage extends BaseContract {
leaf(_message: BytesLike, overrides?: CallOverrides): Promise<[string]>;
nonce(_message: BytesLike, overrides?: CallOverrides): Promise<[number]>;
origin(_message: BytesLike, overrides?: CallOverrides): Promise<[number]>;
recipient(
@ -132,8 +134,6 @@ export class TestMessage extends BaseContract {
): Promise<[string]>;
sender(_message: BytesLike, overrides?: CallOverrides): Promise<[string]>;
sequence(_message: BytesLike, overrides?: CallOverrides): Promise<[number]>;
};
body(_message: BytesLike, overrides?: CallOverrides): Promise<string>;
@ -142,6 +142,8 @@ export class TestMessage extends BaseContract {
leaf(_message: BytesLike, overrides?: CallOverrides): Promise<string>;
nonce(_message: BytesLike, overrides?: CallOverrides): Promise<number>;
origin(_message: BytesLike, overrides?: CallOverrides): Promise<number>;
recipient(_message: BytesLike, overrides?: CallOverrides): Promise<string>;
@ -153,8 +155,6 @@ export class TestMessage extends BaseContract {
sender(_message: BytesLike, overrides?: CallOverrides): Promise<string>;
sequence(_message: BytesLike, overrides?: CallOverrides): Promise<number>;
callStatic: {
body(_message: BytesLike, overrides?: CallOverrides): Promise<string>;
@ -165,6 +165,8 @@ export class TestMessage extends BaseContract {
leaf(_message: BytesLike, overrides?: CallOverrides): Promise<string>;
nonce(_message: BytesLike, overrides?: CallOverrides): Promise<number>;
origin(_message: BytesLike, overrides?: CallOverrides): Promise<number>;
recipient(_message: BytesLike, overrides?: CallOverrides): Promise<string>;
@ -175,8 +177,6 @@ export class TestMessage extends BaseContract {
): Promise<string>;
sender(_message: BytesLike, overrides?: CallOverrides): Promise<string>;
sequence(_message: BytesLike, overrides?: CallOverrides): Promise<number>;
};
filters: {};
@ -191,6 +191,8 @@ export class TestMessage extends BaseContract {
leaf(_message: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
nonce(_message: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
origin(_message: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
recipient(
@ -204,11 +206,6 @@ export class TestMessage extends BaseContract {
): Promise<BigNumber>;
sender(_message: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
sequence(
_message: BytesLike,
overrides?: CallOverrides
): Promise<BigNumber>;
};
populateTransaction: {
@ -227,27 +224,27 @@ export class TestMessage extends BaseContract {
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
origin(
nonce(
_message: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
recipient(
origin(
_message: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
recipientAddress(
recipient(
_message: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
sender(
recipientAddress(
_message: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
sequence(
sender(
_message: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;

@ -25,9 +25,9 @@ interface TestReplicaInterface extends ethers.utils.Interface {
"RESERVE_GAS()": FunctionFragment;
"acceptableRoot(bytes32)": FunctionFragment;
"canConfirm()": FunctionFragment;
"committedRoot()": FunctionFragment;
"confirm()": FunctionFragment;
"confirmAt(bytes32)": FunctionFragment;
"current()": FunctionFragment;
"doubleUpdate(bytes32,bytes32[2],bytes,bytes)": FunctionFragment;
"homeDomainHash()": FunctionFragment;
"initialize(uint32,address,bytes32,uint256)": FunctionFragment;
@ -42,7 +42,7 @@ interface TestReplicaInterface extends ethers.utils.Interface {
"queueEnd()": FunctionFragment;
"queueLength()": FunctionFragment;
"remoteDomain()": FunctionFragment;
"setCurrentRoot(bytes32)": FunctionFragment;
"setCommittedRoot(bytes32)": FunctionFragment;
"setFailed()": FunctionFragment;
"setMessagePending(bytes)": FunctionFragment;
"setRemoteDomain(uint32)": FunctionFragment;
@ -72,12 +72,15 @@ interface TestReplicaInterface extends ethers.utils.Interface {
functionFragment: "canConfirm",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "committedRoot",
values?: undefined
): string;
encodeFunctionData(functionFragment: "confirm", values?: undefined): string;
encodeFunctionData(
functionFragment: "confirmAt",
values: [BytesLike]
): string;
encodeFunctionData(functionFragment: "current", values?: undefined): string;
encodeFunctionData(
functionFragment: "doubleUpdate",
values: [BytesLike, [BytesLike, BytesLike], BytesLike, BytesLike]
@ -200,7 +203,7 @@ interface TestReplicaInterface extends ethers.utils.Interface {
values?: undefined
): string;
encodeFunctionData(
functionFragment: "setCurrentRoot",
functionFragment: "setCommittedRoot",
values: [BytesLike]
): string;
encodeFunctionData(functionFragment: "setFailed", values?: undefined): string;
@ -283,9 +286,12 @@ interface TestReplicaInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "canConfirm", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "committedRoot",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "confirm", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "confirmAt", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "current", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "doubleUpdate",
data: BytesLike
@ -328,7 +334,7 @@ interface TestReplicaInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "setCurrentRoot",
functionFragment: "setCommittedRoot",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "setFailed", data: BytesLike): Result;
@ -426,14 +432,14 @@ export class TestReplica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<[boolean]>;
committedRoot(overrides?: CallOverrides): Promise<[string]>;
confirm(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
confirmAt(arg0: BytesLike, overrides?: CallOverrides): Promise<[BigNumber]>;
current(overrides?: CallOverrides): Promise<[string]>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -447,7 +453,7 @@ export class TestReplica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
@ -560,7 +566,7 @@ export class TestReplica extends BaseContract {
remoteDomain(overrides?: CallOverrides): Promise<[number]>;
setCurrentRoot(
setCommittedRoot(
_newRoot: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
@ -653,14 +659,14 @@ export class TestReplica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<boolean>;
committedRoot(overrides?: CallOverrides): Promise<string>;
confirm(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
confirmAt(arg0: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<string>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -674,7 +680,7 @@ export class TestReplica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
@ -782,7 +788,7 @@ export class TestReplica extends BaseContract {
remoteDomain(overrides?: CallOverrides): Promise<number>;
setCurrentRoot(
setCommittedRoot(
_newRoot: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
@ -878,12 +884,12 @@ export class TestReplica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<boolean>;
committedRoot(overrides?: CallOverrides): Promise<string>;
confirm(overrides?: CallOverrides): Promise<void>;
confirmAt(arg0: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<string>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -897,7 +903,7 @@ export class TestReplica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: CallOverrides
): Promise<void>;
@ -1007,7 +1013,7 @@ export class TestReplica extends BaseContract {
remoteDomain(overrides?: CallOverrides): Promise<number>;
setCurrentRoot(
setCommittedRoot(
_newRoot: BytesLike,
overrides?: CallOverrides
): Promise<void>;
@ -1105,14 +1111,14 @@ export class TestReplica extends BaseContract {
ProcessError(
messageHash?: BytesLike | null,
sequence?: BigNumberish | null,
nonce?: BigNumberish | null,
recipient?: string | null,
returnData?: null
): TypedEventFilter<
[string, number, string, string],
{
messageHash: string;
sequence: number;
nonce: number;
recipient: string;
returnData: string;
}
@ -1150,14 +1156,14 @@ export class TestReplica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<BigNumber>;
confirm(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
confirmAt(arg0: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<BigNumber>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -1171,7 +1177,7 @@ export class TestReplica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
@ -1280,7 +1286,7 @@ export class TestReplica extends BaseContract {
remoteDomain(overrides?: CallOverrides): Promise<BigNumber>;
setCurrentRoot(
setCommittedRoot(
_newRoot: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
@ -1377,6 +1383,8 @@ export class TestReplica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<PopulatedTransaction>;
committedRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
confirm(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
@ -1386,8 +1394,6 @@ export class TestReplica extends BaseContract {
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
current(overrides?: CallOverrides): Promise<PopulatedTransaction>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -1401,7 +1407,7 @@ export class TestReplica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
@ -1513,7 +1519,7 @@ export class TestReplica extends BaseContract {
remoteDomain(overrides?: CallOverrides): Promise<PopulatedTransaction>;
setCurrentRoot(
setCommittedRoot(
_newRoot: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;

@ -23,7 +23,6 @@ interface TestXAppConnectionManagerInterface extends ethers.utils.Interface {
functions: {
"domainToReplica(uint32)": FunctionFragment;
"home()": FunctionFragment;
"isOwner(address)": FunctionFragment;
"isReplica(address)": FunctionFragment;
"localDomain()": FunctionFragment;
"owner()": FunctionFragment;
@ -44,7 +43,6 @@ interface TestXAppConnectionManagerInterface extends ethers.utils.Interface {
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "home", values?: undefined): string;
encodeFunctionData(functionFragment: "isOwner", values: [string]): string;
encodeFunctionData(functionFragment: "isReplica", values: [string]): string;
encodeFunctionData(
functionFragment: "localDomain",
@ -94,7 +92,6 @@ interface TestXAppConnectionManagerInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "home", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "isOwner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "isReplica", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "localDomain",
@ -203,8 +200,6 @@ export class TestXAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<[string]>;
isOwner(_owner: string, overrides?: CallOverrides): Promise<[boolean]>;
isReplica(_replica: string, overrides?: CallOverrides): Promise<[boolean]>;
localDomain(overrides?: CallOverrides): Promise<[number]>;
@ -274,8 +269,6 @@ export class TestXAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<string>;
isOwner(_owner: string, overrides?: CallOverrides): Promise<boolean>;
isReplica(_replica: string, overrides?: CallOverrides): Promise<boolean>;
localDomain(overrides?: CallOverrides): Promise<number>;
@ -345,8 +338,6 @@ export class TestXAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<string>;
isOwner(_owner: string, overrides?: CallOverrides): Promise<boolean>;
isReplica(_replica: string, overrides?: CallOverrides): Promise<boolean>;
localDomain(overrides?: CallOverrides): Promise<number>;
@ -441,8 +432,6 @@ export class TestXAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<BigNumber>;
isOwner(_owner: string, overrides?: CallOverrides): Promise<BigNumber>;
isReplica(_replica: string, overrides?: CallOverrides): Promise<BigNumber>;
localDomain(overrides?: CallOverrides): Promise<BigNumber>;
@ -516,11 +505,6 @@ export class TestXAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<PopulatedTransaction>;
isOwner(
_owner: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
isReplica(
_replica: string,
overrides?: CallOverrides

@ -23,7 +23,6 @@ interface XAppConnectionManagerInterface extends ethers.utils.Interface {
functions: {
"domainToReplica(uint32)": FunctionFragment;
"home()": FunctionFragment;
"isOwner(address)": FunctionFragment;
"isReplica(address)": FunctionFragment;
"localDomain()": FunctionFragment;
"owner()": FunctionFragment;
@ -43,7 +42,6 @@ interface XAppConnectionManagerInterface extends ethers.utils.Interface {
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "home", values?: undefined): string;
encodeFunctionData(functionFragment: "isOwner", values: [string]): string;
encodeFunctionData(functionFragment: "isReplica", values: [string]): string;
encodeFunctionData(
functionFragment: "localDomain",
@ -89,7 +87,6 @@ interface XAppConnectionManagerInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "home", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "isOwner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "isReplica", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "localDomain",
@ -194,8 +191,6 @@ export class XAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<[string]>;
isOwner(_owner: string, overrides?: CallOverrides): Promise<[boolean]>;
isReplica(_replica: string, overrides?: CallOverrides): Promise<[boolean]>;
localDomain(overrides?: CallOverrides): Promise<[number]>;
@ -257,8 +252,6 @@ export class XAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<string>;
isOwner(_owner: string, overrides?: CallOverrides): Promise<boolean>;
isReplica(_replica: string, overrides?: CallOverrides): Promise<boolean>;
localDomain(overrides?: CallOverrides): Promise<number>;
@ -320,8 +313,6 @@ export class XAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<string>;
isOwner(_owner: string, overrides?: CallOverrides): Promise<boolean>;
isReplica(_replica: string, overrides?: CallOverrides): Promise<boolean>;
localDomain(overrides?: CallOverrides): Promise<number>;
@ -408,8 +399,6 @@ export class XAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<BigNumber>;
isOwner(_owner: string, overrides?: CallOverrides): Promise<BigNumber>;
isReplica(_replica: string, overrides?: CallOverrides): Promise<BigNumber>;
localDomain(overrides?: CallOverrides): Promise<BigNumber>;
@ -475,11 +464,6 @@ export class XAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<PopulatedTransaction>;
isOwner(
_owner: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
isReplica(
_replica: string,
overrides?: CallOverrides

@ -71,7 +71,7 @@ const _abi = [
},
{
inputs: [],
name: "current",
name: "committedRoot",
outputs: [
{
internalType: "bytes32",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -160,7 +160,7 @@ const _abi = [
];
const _bytecode =
"0x60806040526040516109663803806109668339818101604052602081101561002657600080fd5b505160006100326100a1565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600280546001600160a01b0319166001600160a01b03929092169190911790556100a5565b3390565b6108b2806100b46000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b146100f25780639d54f41914610123578063df034cd014610156578063f2fde38b1461015e5761007d565b80635b3c2cbf146100825780636ef0f37f146100b7578063715018a6146100ea575b600080fd5b6100b56004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610191565b005b6100b5600480360360208110156100cd57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610263565b6100b56103f8565b6100fa61050f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100b56004803603602081101561013957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661052b565b6100fa61068f565b6100b56004803603602081101561017457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166106ab565b60015473ffffffffffffffffffffffffffffffffffffffff16331461021757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600560248201527f21686f6d65000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8316815290517f4180932f5f5f11458bcd408e42c54626987799e7c4c89f40f484fefdfdfff14f9181900360200190a150565b61026b61084c565b73ffffffffffffffffffffffffffffffffffffffff1661028961050f565b73ffffffffffffffffffffffffffffffffffffffff161461030b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61031481610850565b61037f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f21636f6e747261637420686f6d65000000000000000000000000000000000000604482015290519081900360640190fd5b6001805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fa6c230e5615262e310dcb42eaf014e813e5d8580abf5b00d2186ca8e9833de219181900360200190a150565b61040061084c565b73ffffffffffffffffffffffffffffffffffffffff1661041e61050f565b73ffffffffffffffffffffffffffffffffffffffff16146104a057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b61053361084c565b73ffffffffffffffffffffffffffffffffffffffff1661055161050f565b73ffffffffffffffffffffffffffffffffffffffff16146105d357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff838116918217909255600154604080517f9d54f419000000000000000000000000000000000000000000000000000000008152600481019390935251921691639d54f4199160248082019260009290919082900301818387803b15801561067457600080fd5b505af1158015610688573d6000803e3d6000fd5b5050505050565b60025473ffffffffffffffffffffffffffffffffffffffff1690565b6106b361084c565b73ffffffffffffffffffffffffffffffffffffffff166106d161050f565b73ffffffffffffffffffffffffffffffffffffffff161461075357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81166107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806108576026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b3390565b3b15159056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220f32634f6f95f30cdd9d998e3651273e324c96932ae4a784da36e5b980dcf004664736f6c63430007060033";
"0x60806040526040516109663803806109668339818101604052602081101561002657600080fd5b505160006100326100a1565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600280546001600160a01b0319166001600160a01b03929092169190911790556100a5565b3390565b6108b2806100b46000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b146100f25780639d54f41914610123578063df034cd014610156578063f2fde38b1461015e5761007d565b80635b3c2cbf146100825780636ef0f37f146100b7578063715018a6146100ea575b600080fd5b6100b56004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610191565b005b6100b5600480360360208110156100cd57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610263565b6100b56103f8565b6100fa61050f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100b56004803603602081101561013957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661052b565b6100fa61068f565b6100b56004803603602081101561017457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166106ab565b60015473ffffffffffffffffffffffffffffffffffffffff16331461021757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600560248201527f21686f6d65000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8316815290517f4180932f5f5f11458bcd408e42c54626987799e7c4c89f40f484fefdfdfff14f9181900360200190a150565b61026b61084c565b73ffffffffffffffffffffffffffffffffffffffff1661028961050f565b73ffffffffffffffffffffffffffffffffffffffff161461030b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61031481610850565b61037f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f21636f6e747261637420686f6d65000000000000000000000000000000000000604482015290519081900360640190fd5b6001805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fa6c230e5615262e310dcb42eaf014e813e5d8580abf5b00d2186ca8e9833de219181900360200190a150565b61040061084c565b73ffffffffffffffffffffffffffffffffffffffff1661041e61050f565b73ffffffffffffffffffffffffffffffffffffffff16146104a057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b61053361084c565b73ffffffffffffffffffffffffffffffffffffffff1661055161050f565b73ffffffffffffffffffffffffffffffffffffffff16146105d357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff838116918217909255600154604080517f9d54f419000000000000000000000000000000000000000000000000000000008152600481019390935251921691639d54f4199160248082019260009290919082900301818387803b15801561067457600080fd5b505af1158015610688573d6000803e3d6000fd5b5050505050565b60025473ffffffffffffffffffffffffffffffffffffffff1690565b6106b361084c565b73ffffffffffffffffffffffffffffffffffffffff166106d161050f565b73ffffffffffffffffffffffffffffffffffffffff161461075357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81166107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806108576026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b3390565b3b15159056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212205c2149b7ce67b5979e106305ae0e594b1b764f5e0b7b5a334af51c14885e2b1d64736f6c63430007060033";
export class UpdaterManager__factory extends ContractFactory {
constructor(signer?: Signer) {

File diff suppressed because one or more lines are too long

@ -21,7 +21,7 @@ import { TypedEventFilter, TypedEvent, TypedListener } from "./commons";
interface CommonInterface extends ethers.utils.Interface {
functions: {
"current()": FunctionFragment;
"committedRoot()": FunctionFragment;
"doubleUpdate(bytes32,bytes32[2],bytes,bytes)": FunctionFragment;
"homeDomainHash()": FunctionFragment;
"localDomain()": FunctionFragment;
@ -32,7 +32,10 @@ interface CommonInterface extends ethers.utils.Interface {
"updater()": FunctionFragment;
};
encodeFunctionData(functionFragment: "current", values?: undefined): string;
encodeFunctionData(
functionFragment: "committedRoot",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "doubleUpdate",
values: [BytesLike, [BytesLike, BytesLike], BytesLike, BytesLike]
@ -57,7 +60,10 @@ interface CommonInterface extends ethers.utils.Interface {
encodeFunctionData(functionFragment: "state", values?: undefined): string;
encodeFunctionData(functionFragment: "updater", values?: undefined): string;
decodeFunctionResult(functionFragment: "current", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "committedRoot",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "doubleUpdate",
data: BytesLike
@ -135,7 +141,7 @@ export class Common extends BaseContract {
interface: CommonInterface;
functions: {
current(overrides?: CallOverrides): Promise<[string]>;
committedRoot(overrides?: CallOverrides): Promise<[string]>;
doubleUpdate(
_oldRoot: BytesLike,
@ -163,7 +169,7 @@ export class Common extends BaseContract {
updater(overrides?: CallOverrides): Promise<[string]>;
};
current(overrides?: CallOverrides): Promise<string>;
committedRoot(overrides?: CallOverrides): Promise<string>;
doubleUpdate(
_oldRoot: BytesLike,
@ -188,7 +194,7 @@ export class Common extends BaseContract {
updater(overrides?: CallOverrides): Promise<string>;
callStatic: {
current(overrides?: CallOverrides): Promise<string>;
committedRoot(overrides?: CallOverrides): Promise<string>;
doubleUpdate(
_oldRoot: BytesLike,
@ -249,7 +255,7 @@ export class Common extends BaseContract {
};
estimateGas: {
current(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<BigNumber>;
doubleUpdate(
_oldRoot: BytesLike,
@ -278,7 +284,7 @@ export class Common extends BaseContract {
};
populateTransaction: {
current(overrides?: CallOverrides): Promise<PopulatedTransaction>;
committedRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
doubleUpdate(
_oldRoot: BytesLike,

@ -22,21 +22,21 @@ import { TypedEventFilter, TypedEvent, TypedListener } from "./commons";
interface HomeInterface extends ethers.utils.Interface {
functions: {
"MAX_MESSAGE_BODY_BYTES()": FunctionFragment;
"committedRoot()": FunctionFragment;
"count()": FunctionFragment;
"current()": FunctionFragment;
"dispatch(uint32,bytes32,bytes)": FunctionFragment;
"doubleUpdate(bytes32,bytes32[2],bytes,bytes)": FunctionFragment;
"enqueue(uint32,bytes32,bytes)": FunctionFragment;
"homeDomainHash()": FunctionFragment;
"improperUpdate(bytes32,bytes32,bytes)": FunctionFragment;
"initialize(address)": FunctionFragment;
"localDomain()": FunctionFragment;
"nonces(uint32)": FunctionFragment;
"owner()": FunctionFragment;
"queueContains(bytes32)": FunctionFragment;
"queueEnd()": FunctionFragment;
"queueLength()": FunctionFragment;
"renounceOwnership()": FunctionFragment;
"root()": FunctionFragment;
"sequences(uint32)": FunctionFragment;
"setUpdater(address)": FunctionFragment;
"setUpdaterManager(address)": FunctionFragment;
"state()": FunctionFragment;
@ -52,16 +52,19 @@ interface HomeInterface extends ethers.utils.Interface {
functionFragment: "MAX_MESSAGE_BODY_BYTES",
values?: undefined
): string;
encodeFunctionData(functionFragment: "count", values?: undefined): string;
encodeFunctionData(functionFragment: "current", values?: undefined): string;
encodeFunctionData(
functionFragment: "doubleUpdate",
values: [BytesLike, [BytesLike, BytesLike], BytesLike, BytesLike]
functionFragment: "committedRoot",
values?: undefined
): string;
encodeFunctionData(functionFragment: "count", values?: undefined): string;
encodeFunctionData(
functionFragment: "enqueue",
functionFragment: "dispatch",
values: [BigNumberish, BytesLike, BytesLike]
): string;
encodeFunctionData(
functionFragment: "doubleUpdate",
values: [BytesLike, [BytesLike, BytesLike], BytesLike, BytesLike]
): string;
encodeFunctionData(
functionFragment: "homeDomainHash",
values?: undefined
@ -75,6 +78,10 @@ interface HomeInterface extends ethers.utils.Interface {
functionFragment: "localDomain",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "nonces",
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
encodeFunctionData(
functionFragment: "queueContains",
@ -90,10 +97,6 @@ interface HomeInterface extends ethers.utils.Interface {
values?: undefined
): string;
encodeFunctionData(functionFragment: "root", values?: undefined): string;
encodeFunctionData(
functionFragment: "sequences",
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "setUpdater", values: [string]): string;
encodeFunctionData(
functionFragment: "setUpdaterManager",
@ -123,13 +126,16 @@ interface HomeInterface extends ethers.utils.Interface {
functionFragment: "MAX_MESSAGE_BODY_BYTES",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "committedRoot",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "count", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "current", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "dispatch", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "doubleUpdate",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "enqueue", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "homeDomainHash",
data: BytesLike
@ -143,6 +149,7 @@ interface HomeInterface extends ethers.utils.Interface {
functionFragment: "localDomain",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "nonces", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "queueContains",
@ -158,7 +165,6 @@ interface HomeInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "root", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "sequences", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setUpdater", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "setUpdaterManager",
@ -182,7 +188,7 @@ interface HomeInterface extends ethers.utils.Interface {
): Result;
events: {
"Dispatch(uint256,uint64,bytes32,bytes32,bytes)": EventFragment;
"Dispatch(bytes32,uint256,uint64,bytes32,bytes)": EventFragment;
"DoubleUpdate(bytes32,bytes32[2],bytes,bytes)": EventFragment;
"ImproperUpdate(bytes32,bytes32,bytes)": EventFragment;
"NewUpdater(address)": EventFragment;
@ -248,9 +254,16 @@ export class Home extends BaseContract {
functions: {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<[BigNumber]>;
committedRoot(overrides?: CallOverrides): Promise<[string]>;
count(overrides?: CallOverrides): Promise<[BigNumber]>;
current(overrides?: CallOverrides): Promise<[string]>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
doubleUpdate(
_oldRoot: BytesLike,
@ -260,13 +273,6 @@ export class Home extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
homeDomainHash(overrides?: CallOverrides): Promise<[string]>;
improperUpdate(
@ -283,6 +289,8 @@ export class Home extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<[number]>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<[number]>;
owner(overrides?: CallOverrides): Promise<[string]>;
queueContains(
@ -300,8 +308,6 @@ export class Home extends BaseContract {
root(overrides?: CallOverrides): Promise<[string]>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<[number]>;
setUpdater(
_updater: string,
overrides?: Overrides & { from?: string | Promise<string> }
@ -316,7 +322,7 @@ export class Home extends BaseContract {
suggestUpdate(
overrides?: CallOverrides
): Promise<[string, string] & { _current: string; _new: string }>;
): Promise<[string, string] & { _committedRoot: string; _new: string }>;
transferOwnership(
newOwner: string,
@ -328,7 +334,7 @@ export class Home extends BaseContract {
): Promise<[BigNumber] & { count: BigNumber }>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
@ -341,9 +347,16 @@ export class Home extends BaseContract {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<string>;
count(overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<string>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
doubleUpdate(
_oldRoot: BytesLike,
@ -353,13 +366,6 @@ export class Home extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
homeDomainHash(overrides?: CallOverrides): Promise<string>;
improperUpdate(
@ -376,6 +382,8 @@ export class Home extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<number>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
owner(overrides?: CallOverrides): Promise<string>;
queueContains(_item: BytesLike, overrides?: CallOverrides): Promise<boolean>;
@ -390,8 +398,6 @@ export class Home extends BaseContract {
root(overrides?: CallOverrides): Promise<string>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
setUpdater(
_updater: string,
overrides?: Overrides & { from?: string | Promise<string> }
@ -406,7 +412,7 @@ export class Home extends BaseContract {
suggestUpdate(
overrides?: CallOverrides
): Promise<[string, string] & { _current: string; _new: string }>;
): Promise<[string, string] & { _committedRoot: string; _new: string }>;
transferOwnership(
newOwner: string,
@ -416,7 +422,7 @@ export class Home extends BaseContract {
tree(overrides?: CallOverrides): Promise<BigNumber>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
@ -429,9 +435,16 @@ export class Home extends BaseContract {
callStatic: {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<string>;
count(overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<string>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: CallOverrides
): Promise<void>;
doubleUpdate(
_oldRoot: BytesLike,
@ -441,13 +454,6 @@ export class Home extends BaseContract {
overrides?: CallOverrides
): Promise<void>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: CallOverrides
): Promise<void>;
homeDomainHash(overrides?: CallOverrides): Promise<string>;
improperUpdate(
@ -464,6 +470,8 @@ export class Home extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<number>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
owner(overrides?: CallOverrides): Promise<string>;
queueContains(
@ -479,8 +487,6 @@ export class Home extends BaseContract {
root(overrides?: CallOverrides): Promise<string>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
setUpdater(_updater: string, overrides?: CallOverrides): Promise<void>;
setUpdaterManager(
@ -492,7 +498,7 @@ export class Home extends BaseContract {
suggestUpdate(
overrides?: CallOverrides
): Promise<[string, string] & { _current: string; _new: string }>;
): Promise<[string, string] & { _committedRoot: string; _new: string }>;
transferOwnership(
newOwner: string,
@ -502,7 +508,7 @@ export class Home extends BaseContract {
tree(overrides?: CallOverrides): Promise<BigNumber>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: CallOverrides
@ -515,18 +521,18 @@ export class Home extends BaseContract {
filters: {
Dispatch(
messageHash?: BytesLike | null,
leafIndex?: BigNumberish | null,
destinationAndSequence?: BigNumberish | null,
leaf?: BytesLike | null,
current?: null,
destinationAndNonce?: BigNumberish | null,
committedRoot?: null,
message?: null
): TypedEventFilter<
[BigNumber, BigNumber, string, string, string],
[string, BigNumber, BigNumber, string, string],
{
messageHash: string;
leafIndex: BigNumber;
destinationAndSequence: BigNumber;
leaf: string;
current: string;
destinationAndNonce: BigNumber;
committedRoot: string;
message: string;
}
>;
@ -596,9 +602,16 @@ export class Home extends BaseContract {
estimateGas: {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<BigNumber>;
count(overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<BigNumber>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
doubleUpdate(
_oldRoot: BytesLike,
@ -608,13 +621,6 @@ export class Home extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
homeDomainHash(overrides?: CallOverrides): Promise<BigNumber>;
improperUpdate(
@ -631,6 +637,8 @@ export class Home extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<BigNumber>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
owner(overrides?: CallOverrides): Promise<BigNumber>;
queueContains(
@ -648,11 +656,6 @@ export class Home extends BaseContract {
root(overrides?: CallOverrides): Promise<BigNumber>;
sequences(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
setUpdater(
_updater: string,
overrides?: Overrides & { from?: string | Promise<string> }
@ -675,7 +678,7 @@ export class Home extends BaseContract {
tree(overrides?: CallOverrides): Promise<BigNumber>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
@ -691,9 +694,16 @@ export class Home extends BaseContract {
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
committedRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
count(overrides?: CallOverrides): Promise<PopulatedTransaction>;
current(overrides?: CallOverrides): Promise<PopulatedTransaction>;
dispatch(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
doubleUpdate(
_oldRoot: BytesLike,
@ -703,13 +713,6 @@ export class Home extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
enqueue(
_destinationDomain: BigNumberish,
_recipientAddress: BytesLike,
_messageBody: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
homeDomainHash(overrides?: CallOverrides): Promise<PopulatedTransaction>;
improperUpdate(
@ -726,6 +729,11 @@ export class Home extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<PopulatedTransaction>;
nonces(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
queueContains(
@ -743,11 +751,6 @@ export class Home extends BaseContract {
root(overrides?: CallOverrides): Promise<PopulatedTransaction>;
sequences(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
setUpdater(
_updater: string,
overrides?: Overrides & { from?: string | Promise<string> }
@ -770,7 +773,7 @@ export class Home extends BaseContract {
tree(overrides?: CallOverrides): Promise<PopulatedTransaction>;
update(
_currentRoot: BytesLike,
_committedRoot: BytesLike,
_newRoot: BytesLike,
_signature: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }

@ -23,15 +23,15 @@ interface MockCoreInterface extends ethers.utils.Interface {
functions: {
"MAX_MESSAGE_BODY_BYTES()": FunctionFragment;
"count()": FunctionFragment;
"enqueue(uint32,bytes32,bytes)": FunctionFragment;
"dispatch(uint32,bytes32,bytes)": FunctionFragment;
"home()": FunctionFragment;
"isReplica(address)": FunctionFragment;
"localDomain()": FunctionFragment;
"nonces(uint32)": FunctionFragment;
"queueContains(bytes32)": FunctionFragment;
"queueEnd()": FunctionFragment;
"queueLength()": FunctionFragment;
"root()": FunctionFragment;
"sequences(uint32)": FunctionFragment;
"tree()": FunctionFragment;
};
@ -41,7 +41,7 @@ interface MockCoreInterface extends ethers.utils.Interface {
): string;
encodeFunctionData(functionFragment: "count", values?: undefined): string;
encodeFunctionData(
functionFragment: "enqueue",
functionFragment: "dispatch",
values: [BigNumberish, BytesLike, BytesLike]
): string;
encodeFunctionData(functionFragment: "home", values?: undefined): string;
@ -50,6 +50,10 @@ interface MockCoreInterface extends ethers.utils.Interface {
functionFragment: "localDomain",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "nonces",
values: [BigNumberish]
): string;
encodeFunctionData(
functionFragment: "queueContains",
values: [BytesLike]
@ -60,10 +64,6 @@ interface MockCoreInterface extends ethers.utils.Interface {
values?: undefined
): string;
encodeFunctionData(functionFragment: "root", values?: undefined): string;
encodeFunctionData(
functionFragment: "sequences",
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "tree", values?: undefined): string;
decodeFunctionResult(
@ -71,13 +71,14 @@ interface MockCoreInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "count", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "enqueue", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "dispatch", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "home", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "isReplica", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "localDomain",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "nonces", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "queueContains",
data: BytesLike
@ -88,7 +89,6 @@ interface MockCoreInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "root", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "sequences", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "tree", data: BytesLike): Result;
events: {
@ -148,7 +148,7 @@ export class MockCore extends BaseContract {
count(overrides?: CallOverrides): Promise<[BigNumber]>;
enqueue(
dispatch(
_destination: BigNumberish,
_recipient: BytesLike,
_body: BytesLike,
@ -161,6 +161,8 @@ export class MockCore extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<[number]>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<[number]>;
queueContains(
_item: BytesLike,
overrides?: CallOverrides
@ -172,8 +174,6 @@ export class MockCore extends BaseContract {
root(overrides?: CallOverrides): Promise<[string]>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<[number]>;
tree(
overrides?: CallOverrides
): Promise<[BigNumber] & { count: BigNumber }>;
@ -183,7 +183,7 @@ export class MockCore extends BaseContract {
count(overrides?: CallOverrides): Promise<BigNumber>;
enqueue(
dispatch(
_destination: BigNumberish,
_recipient: BytesLike,
_body: BytesLike,
@ -196,6 +196,8 @@ export class MockCore extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<number>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
queueContains(_item: BytesLike, overrides?: CallOverrides): Promise<boolean>;
queueEnd(overrides?: CallOverrides): Promise<string>;
@ -204,8 +206,6 @@ export class MockCore extends BaseContract {
root(overrides?: CallOverrides): Promise<string>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
tree(overrides?: CallOverrides): Promise<BigNumber>;
callStatic: {
@ -213,7 +213,7 @@ export class MockCore extends BaseContract {
count(overrides?: CallOverrides): Promise<BigNumber>;
enqueue(
dispatch(
_destination: BigNumberish,
_recipient: BytesLike,
_body: BytesLike,
@ -226,6 +226,8 @@ export class MockCore extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<number>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
queueContains(
_item: BytesLike,
overrides?: CallOverrides
@ -237,22 +239,20 @@ export class MockCore extends BaseContract {
root(overrides?: CallOverrides): Promise<string>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
tree(overrides?: CallOverrides): Promise<BigNumber>;
};
filters: {
Dispatch(
leafIndex?: BigNumberish | null,
destinationAndSequence?: BigNumberish | null,
destinationAndNonce?: BigNumberish | null,
leaf?: BytesLike | null,
message?: null
): TypedEventFilter<
[BigNumber, BigNumber, string, string],
{
leafIndex: BigNumber;
destinationAndSequence: BigNumber;
destinationAndNonce: BigNumber;
leaf: string;
message: string;
}
@ -273,7 +273,7 @@ export class MockCore extends BaseContract {
count(overrides?: CallOverrides): Promise<BigNumber>;
enqueue(
dispatch(
_destination: BigNumberish,
_recipient: BytesLike,
_body: BytesLike,
@ -286,6 +286,8 @@ export class MockCore extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<BigNumber>;
nonces(arg0: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
queueContains(
_item: BytesLike,
overrides?: CallOverrides
@ -297,11 +299,6 @@ export class MockCore extends BaseContract {
root(overrides?: CallOverrides): Promise<BigNumber>;
sequences(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
tree(overrides?: CallOverrides): Promise<BigNumber>;
};
@ -312,7 +309,7 @@ export class MockCore extends BaseContract {
count(overrides?: CallOverrides): Promise<PopulatedTransaction>;
enqueue(
dispatch(
_destination: BigNumberish,
_recipient: BytesLike,
_body: BytesLike,
@ -328,6 +325,11 @@ export class MockCore extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<PopulatedTransaction>;
nonces(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
queueContains(
_item: BytesLike,
overrides?: CallOverrides
@ -339,11 +341,6 @@ export class MockCore extends BaseContract {
root(overrides?: CallOverrides): Promise<PopulatedTransaction>;
sequences(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
tree(overrides?: CallOverrides): Promise<PopulatedTransaction>;
};
}

@ -25,9 +25,9 @@ interface ReplicaInterface extends ethers.utils.Interface {
"RESERVE_GAS()": FunctionFragment;
"acceptableRoot(bytes32)": FunctionFragment;
"canConfirm()": FunctionFragment;
"committedRoot()": FunctionFragment;
"confirm()": FunctionFragment;
"confirmAt(bytes32)": FunctionFragment;
"current()": FunctionFragment;
"doubleUpdate(bytes32,bytes32[2],bytes,bytes)": FunctionFragment;
"homeDomainHash()": FunctionFragment;
"initialize(uint32,address,bytes32,uint256)": FunctionFragment;
@ -63,12 +63,15 @@ interface ReplicaInterface extends ethers.utils.Interface {
functionFragment: "canConfirm",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "committedRoot",
values?: undefined
): string;
encodeFunctionData(functionFragment: "confirm", values?: undefined): string;
encodeFunctionData(
functionFragment: "confirmAt",
values: [BytesLike]
): string;
encodeFunctionData(functionFragment: "current", values?: undefined): string;
encodeFunctionData(
functionFragment: "doubleUpdate",
values: [BytesLike, [BytesLike, BytesLike], BytesLike, BytesLike]
@ -210,9 +213,12 @@ interface ReplicaInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "canConfirm", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "committedRoot",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "confirm", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "confirmAt", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "current", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "doubleUpdate",
data: BytesLike
@ -326,14 +332,14 @@ export class Replica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<[boolean]>;
committedRoot(overrides?: CallOverrides): Promise<[string]>;
confirm(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
confirmAt(arg0: BytesLike, overrides?: CallOverrides): Promise<[BigNumber]>;
current(overrides?: CallOverrides): Promise<[string]>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -347,7 +353,7 @@ export class Replica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
@ -480,14 +486,14 @@ export class Replica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<boolean>;
committedRoot(overrides?: CallOverrides): Promise<string>;
confirm(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
confirmAt(arg0: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<string>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -501,7 +507,7 @@ export class Replica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
@ -632,12 +638,12 @@ export class Replica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<boolean>;
committedRoot(overrides?: CallOverrides): Promise<string>;
confirm(overrides?: CallOverrides): Promise<void>;
confirmAt(arg0: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<string>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -651,7 +657,7 @@ export class Replica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: CallOverrides
): Promise<void>;
@ -791,14 +797,14 @@ export class Replica extends BaseContract {
ProcessError(
messageHash?: BytesLike | null,
sequence?: BigNumberish | null,
nonce?: BigNumberish | null,
recipient?: string | null,
returnData?: null
): TypedEventFilter<
[string, number, string, string],
{
messageHash: string;
sequence: number;
nonce: number;
recipient: string;
returnData: string;
}
@ -836,14 +842,14 @@ export class Replica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<BigNumber>;
committedRoot(overrides?: CallOverrides): Promise<BigNumber>;
confirm(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
confirmAt(arg0: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
current(overrides?: CallOverrides): Promise<BigNumber>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -857,7 +863,7 @@ export class Replica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
@ -990,6 +996,8 @@ export class Replica extends BaseContract {
canConfirm(overrides?: CallOverrides): Promise<PopulatedTransaction>;
committedRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
confirm(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
@ -999,8 +1007,6 @@ export class Replica extends BaseContract {
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
current(overrides?: CallOverrides): Promise<PopulatedTransaction>;
doubleUpdate(
_oldRoot: BytesLike,
_newRoot: [BytesLike, BytesLike],
@ -1014,7 +1020,7 @@ export class Replica extends BaseContract {
initialize(
_remoteDomain: BigNumberish,
_updater: string,
_current: BytesLike,
_committedRoot: BytesLike,
_optimisticSeconds: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;

@ -23,7 +23,6 @@ interface XAppConnectionManagerInterface extends ethers.utils.Interface {
functions: {
"domainToReplica(uint32)": FunctionFragment;
"home()": FunctionFragment;
"isOwner(address)": FunctionFragment;
"isReplica(address)": FunctionFragment;
"localDomain()": FunctionFragment;
"owner()": FunctionFragment;
@ -43,7 +42,6 @@ interface XAppConnectionManagerInterface extends ethers.utils.Interface {
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "home", values?: undefined): string;
encodeFunctionData(functionFragment: "isOwner", values: [string]): string;
encodeFunctionData(functionFragment: "isReplica", values: [string]): string;
encodeFunctionData(
functionFragment: "localDomain",
@ -89,7 +87,6 @@ interface XAppConnectionManagerInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "home", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "isOwner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "isReplica", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "localDomain",
@ -194,8 +191,6 @@ export class XAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<[string]>;
isOwner(_owner: string, overrides?: CallOverrides): Promise<[boolean]>;
isReplica(_replica: string, overrides?: CallOverrides): Promise<[boolean]>;
localDomain(overrides?: CallOverrides): Promise<[number]>;
@ -257,8 +252,6 @@ export class XAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<string>;
isOwner(_owner: string, overrides?: CallOverrides): Promise<boolean>;
isReplica(_replica: string, overrides?: CallOverrides): Promise<boolean>;
localDomain(overrides?: CallOverrides): Promise<number>;
@ -320,8 +313,6 @@ export class XAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<string>;
isOwner(_owner: string, overrides?: CallOverrides): Promise<boolean>;
isReplica(_replica: string, overrides?: CallOverrides): Promise<boolean>;
localDomain(overrides?: CallOverrides): Promise<number>;
@ -408,8 +399,6 @@ export class XAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<BigNumber>;
isOwner(_owner: string, overrides?: CallOverrides): Promise<BigNumber>;
isReplica(_replica: string, overrides?: CallOverrides): Promise<BigNumber>;
localDomain(overrides?: CallOverrides): Promise<BigNumber>;
@ -475,11 +464,6 @@ export class XAppConnectionManager extends BaseContract {
home(overrides?: CallOverrides): Promise<PopulatedTransaction>;
isOwner(
_owner: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
isReplica(
_replica: string,
overrides?: CallOverrides

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -71,7 +71,7 @@ const _abi = [
},
{
inputs: [],
name: "current",
name: "committedRoot",
outputs: [
{
internalType: "bytes32",

@ -101,7 +101,7 @@ const _abi = [
];
const _bytecode =
"0x60c060405234801561001057600080fd5b5060405161045d38038061045d8339818101604052604081101561003357600080fd5b5080516020909101516001600160601b0319606083811b821660805282901b1660a0526040805163095ea7b360e01b81526001600160a01b038084166004830152600019602483015291519184169163095ea7b39160448082019260009290919082900301818387803b1580156100a957600080fd5b505af11580156100bd573d6000803e3d6000fd5b50505050505060805160601c60a05160601c6103626100fb6000398061023e52806102e052508061014152806101fb52806102bc52506103626000f3fe60806040526004361061005a5760003560e01c80633fc8cef3116100435780633fc8cef3146100ad578063e78cea92146100eb578063ec93e5f0146101005761005a565b806303c1d2831461005f5780632e96d5a31461008a575b600080fd5b6100886004803603604081101561007557600080fd5b5063ffffffff813516906020013561013f565b005b610088600480360360208110156100a057600080fd5b503563ffffffff166102a5565b3480156100b957600080fd5b506100c26102ba565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100f757600080fd5b506100c26102de565b6100886004803603604081101561011657600080fd5b50803563ffffffff16906020013573ffffffffffffffffffffffffffffffffffffffff16610302565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156101a757600080fd5b505af11580156101bb573d6000803e3d6000fd5b5050604080517f1cabf08f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000008116600483015234602483015263ffffffff881660448301526064820187905291517f00000000000000000000000000000000000000000000000000000000000000009092169450631cabf08f9350608480820193506000929182900301818387803b15801561028957600080fd5b505af115801561029d573d6000803e3d6000fd5b505050505050565b6102b7816102b233610313565b61013f565b50565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b61030f826102b283610313565b5050565b73ffffffffffffffffffffffffffffffffffffffff169056fea2646970667358221220f8f10fe684884a10e05477198a5f793e889e408ab7ef2e678e1bb6db3a7b5d5f64736f6c63430007060033";
"0x60c060405234801561001057600080fd5b5060405161045d38038061045d8339818101604052604081101561003357600080fd5b5080516020909101516001600160601b0319606083811b821660805282901b1660a0526040805163095ea7b360e01b81526001600160a01b038084166004830152600019602483015291519184169163095ea7b39160448082019260009290919082900301818387803b1580156100a957600080fd5b505af11580156100bd573d6000803e3d6000fd5b50505050505060805160601c60a05160601c6103626100fb6000398061023e52806102e052508061014152806101fb52806102bc52506103626000f3fe60806040526004361061005a5760003560e01c80633fc8cef3116100435780633fc8cef3146100ad578063e78cea92146100eb578063ec93e5f0146101005761005a565b806303c1d2831461005f5780632e96d5a31461008a575b600080fd5b6100886004803603604081101561007557600080fd5b5063ffffffff813516906020013561013f565b005b610088600480360360208110156100a057600080fd5b503563ffffffff166102a5565b3480156100b957600080fd5b506100c26102ba565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100f757600080fd5b506100c26102de565b6100886004803603604081101561011657600080fd5b50803563ffffffff16906020013573ffffffffffffffffffffffffffffffffffffffff16610302565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156101a757600080fd5b505af11580156101bb573d6000803e3d6000fd5b5050604080517f1cabf08f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000008116600483015234602483015263ffffffff881660448301526064820187905291517f00000000000000000000000000000000000000000000000000000000000000009092169450631cabf08f9350608480820193506000929182900301818387803b15801561028957600080fd5b505af115801561029d573d6000803e3d6000fd5b505050505050565b6102b7816102b233610313565b61013f565b50565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b61030f826102b283610313565b5050565b73ffffffffffffffffffffffffffffffffffffffff169056fea26469706673582212208e5e110db6d71757d8d64426455cd6e1f2646ec8137978ec168b8d22f04659b864736f6c63430007060033";
export class ETHHelper__factory extends ContractFactory {
constructor(signer?: Signer) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,27 @@
[
{
"destination": 1,
"expectedDestinationAndNonce": 4294967298,
"nonce": 2
},
{
"destination": 2,
"expectedDestinationAndNonce": 8589934595,
"nonce": 3
},
{
"destination": 3,
"expectedDestinationAndNonce": 12884901892,
"nonce": 4
},
{
"destination": 4,
"expectedDestinationAndNonce": 17179869189,
"nonce": 5
},
{
"destination": 5,
"expectedDestinationAndNonce": 21474836486,
"nonce": 6
}
]

@ -1,27 +0,0 @@
[
{
"destination": 1,
"expectedDestinationAndSequence": 4294967298,
"sequence": 2
},
{
"destination": 2,
"expectedDestinationAndSequence": 8589934595,
"sequence": 3
},
{
"destination": 3,
"expectedDestinationAndSequence": 12884901892,
"sequence": 4
},
{
"destination": 4,
"expectedDestinationAndSequence": 17179869189,
"sequence": 5
},
{
"destination": 5,
"expectedDestinationAndSequence": 21474836486,
"sequence": 6
}
]

@ -5,10 +5,10 @@
52
],
"destination": 2000,
"leaf": "0x31def026c93f999e8beacc858eb138c6ed85e1d6db7928786a5f72cb70836316",
"messageHash": "0x31def026c93f999e8beacc858eb138c6ed85e1d6db7928786a5f72cb70836316",
"origin": 1000,
"recipient": "0x0000000000000000000000002222222222222222222222222222222222222222",
"sender": "0x0000000000000000000000001111111111111111111111111111111111111111",
"sequence": 1
"nonce": 1
}
]

Loading…
Cancel
Save