Skip to content

Commit 7eb1451

Browse files
committed
evm: Update sizes for per-chain
1 parent 36593a8 commit 7eb1451

File tree

1 file changed

+65
-18
lines changed

1 file changed

+65
-18
lines changed

evm/NOTES.md

Lines changed: 65 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This integration branch is PR #21.
99
Note that the indentation indicates branch dependencies.
1010

1111
- **evm_TransceiverRegistry_split** (PR #22) - This branch splits transceiver admin into a separate contract.
12-
- **evm_per_chain_transceivers** (PR #26) - This branch adds per-chain transceiver support, should also add per-chain thresholds.
12+
- **evm_per_chain_transceivers** (PR #26) - This branch adds per-chain transceiver and per-chain threshold support.
1313
- **evm/add_MsgManager** (PR #23) - Creates `MsgManagerBase` and `MsgManager` and makes `NttManager` inherit from `MsgManagerBase`.
1414
- **evm/add_SharedWormholeTransceiver** (PR #25) - Adds a shareable transceiver.
1515

@@ -20,55 +20,98 @@ I tried moving them, but that increases the size of `NttManagerNoRateLimiting` c
2020
I'm not sure why that is, or how to avoid it, so I did not pursue that change at this time.
2121
However, some of the other changes also cause that increase, so maybe we can revist this.
2222

23-
## Contract Sizes
24-
25-
### Before we started
23+
## Contract size before we started
2624

2725
```bash
2826
evm (main)$ forge build --sizes --via-ir --skip test
29-
3027
╭-----------------------------------------+------------------+-------------------+--------------------+---------------------╮
3128
| Contract | Runtime Size (B) | Initcode Size (B) | Runtime Margin (B) | Initcode Margin (B) |
3229
+===========================================================================================================================+
3330
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
3431
| NttManager | 24,066 | 25,673 | 510 | 23,479 |
3532
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
3633
| NttManagerNoRateLimiting | 17,141 | 18,557 | 7,435 | 30,595 |
37-
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
38-
34+
╰-----------------------------------------+------------------+-------------------+--------------------+---------------------╯
3935
```
4036

41-
### After moving token and mode (the change that wasn't made)
37+
## Contract size after moving token and mode (the change that wasn't made)
4238

4339
```bash
4440
evm (main)$ forge build --sizes --via-ir --skip test
45-
41+
╭-----------------------------------------+------------------+-------------------+--------------------+---------------------╮
42+
| Contract | Runtime Size (B) | Initcode Size (B) | Runtime Margin (B) | Initcode Margin (B) |
43+
+===========================================================================================================================+
4644
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
4745
| NttManager | 24,066 | 25,676 | 510 | 23,476 |
4846
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
4947
| NttManagerNoRateLimiting | 18,788 | 20,281 | 5,788 | 28,871 |
50-
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
51-
48+
╰-----------------------------------------+------------------+-------------------+--------------------+---------------------╯
5249
```
5350

54-
## Creating TransceiverRegistryAdmin
51+
## Creating TransceiverRegistryAdmin (PR #22)
52+
53+
This change creates a separate contract to perform transceiver administration and updates the standard `TransceiverRegistry`
54+
to delegate call into the new contract. This reduces the overall size of `TransceiverRegistry` and therefore `NttManager`.
55+
56+
Currently in this PR, `TransceiverRegistry` instantiates `TransceiverRegistryAdmin` in the constructor, so that I didn't have to update
57+
all of the deployment code. I think it should actually be passed in as a constructor parameter and be updatable. (I'm not
58+
saying that `TransceiverRegistryAdmin` needs to be upgradeable. We could just make the attribute in `TransceiverRegistry`
59+
mutable.)
60+
61+
### Possible Enhancement
62+
63+
We could get rid of `TransceiverRegistry` altogether, and move the functionality into `ManagerBase` and change `TransceiverRegistryAdmin`
64+
to `ManagerBaseAdmin`. That would allow us to also move the admin code in `ManagerBase`into there, and further reduce the
65+
size of`NttManager`.
66+
67+
### Contract Size with TransceiverRegistryAdmin
5568

5669
```bash
5770
evm (main)$ forge build --sizes --via-ir --skip test
58-
71+
╭-----------------------------------------+------------------+-------------------+--------------------+---------------------╮
72+
| Contract | Runtime Size (B) | Initcode Size (B) | Runtime Margin (B) | Initcode Margin (B) |
73+
+===========================================================================================================================+
5974
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
6075
| NttManager | 23,220 | 26,937 | 1,356 | 22,215 |
6176
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
6277
| NttManagerNoRateLimiting | 16,254 | 19,713 | 8,322 | 29,439 |
63-
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
64-
78+
╰-----------------------------------------+------------------+-------------------+--------------------+---------------------╯
6579
```
6680

67-
## Creating MsgManagerBase
81+
## Adding Per-Chain Transceivers (on top of TransceiverRegistryAdmin) (PR #26)
82+
83+
This change allows you to specify different sets of transceivers for each destination chain, as well as different sets
84+
for sending and receiving. Additionally, it allows you to specify a different threshold for each destination chain.
85+
86+
Note that there is no default set of send / receive transceivers. They must be enabled for each chain. This must be handled
87+
during contract migration.
88+
89+
### Contract Size with Per-Chain Transceivers
6890

6991
```bash
7092
evm (main)$ forge build --sizes --via-ir --skip test
93+
╭-----------------------------------------+------------------+-------------------+--------------------+---------------------╮
94+
| Contract | Runtime Size (B) | Initcode Size (B) | Runtime Margin (B) | Initcode Margin (B) |
95+
+===========================================================================================================================+
96+
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
97+
| NttManager | 24,089 | 31,480 | 487 | 17,672 |
98+
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
99+
| NttManagerNoRateLimiting | 17,150 | 24,275 | 7,426 | 24,877 |
100+
╰-----------------------------------------+------------------+-------------------+--------------------+---------------------╯
101+
```
102+
103+
## Creating MsgManagerBase (PR #23)
104+
105+
This change adds support for generic message passing. It also updates `NttManager`
106+
to use it.
71107

108+
### Contract Size with MsgManagerBase
109+
110+
```bash
111+
evm (main)$ forge build --sizes --via-ir --skip test
112+
╭-----------------------------------------+------------------+-------------------+--------------------+---------------------╮
113+
| Contract | Runtime Size (B) | Initcode Size (B) | Runtime Margin (B) | Initcode Margin (B) |
114+
+===========================================================================================================================+
72115
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
73116
| NttManager | 24,076 | 25,719 | 500 | 23,433 |
74117
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
@@ -77,6 +120,10 @@ evm (main)$ forge build --sizes --via-ir --skip test
77120
| MsgManager | 12,540 | 13,745 | 12,036 | 35,407 |
78121
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
79122
| MsgManagerWithExecutor | 13,145 | 14,400 | 11,431 | 34,752 |
80-
|-----------------------------------------+------------------+-------------------+--------------------+---------------------|
81-
123+
╰-----------------------------------------+------------------+-------------------+--------------------+---------------------╯
82124
```
125+
126+
## Shared Transceiver (PR #25)
127+
128+
This change allows a Wormhole transceiver to be shared between multiple `NttManagers`. This transceiver does not support relaying
129+
because it is assumed that the integrator will call the `Executor` at a higher level, using something like `NttManagerWithExecutor`.

0 commit comments

Comments
 (0)