Skip to content

Commit b357fb3

Browse files
committed
Add additional deployment and view scripts, and deploy flashtestations to multiple networks
The existing deployment scripts all take arguments via the .env file, and this becomes difficult and error prone when we have to deploy multiple contracts and keep track of many env vars. This PR adds a DeployAll script which takes its arguments via 'forge script' command line arguments, which is simpler and less error-prone. We also get a helpful script for viewing a TEE's RegisteredTEE struct, and deploy the flashtestation contracts to several networks Individual Commits: make first DeployAll script which deploys Policy and Registry deploy some more to experimental deploy more on experimental deploy to alphanet permission 0x306ab4fe782dde50a97584b6d4cad9375f7b5d02199c4c78821ad6622670c6b7 workloadID on unichain sepolia commit DeployAll script, update README, and deploy mainnet flashtestations contracts add script/GetRegistration.s.sol script this is helpful for viewing a particular TEE registration's measurement registers
1 parent 7cc7f68 commit b357fb3

32 files changed

+2919
-143
lines changed

README.md

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,25 @@ cp env.sample .env
8585
Then, provide correct values for the following env vars, which all the forge scripts below will use:
8686

8787
- ETHERSCAN_API_KEY
88-
- UNICHAIN_SEPOLIA_RPC_URL
88+
- RPC_URL
8989

90-
### Unichain Sepolia
90+
### DeployAll
9191

92-
#### FlashtestationsRegistry
92+
Deploys both the FlashtestationsRegistry and the BlockBuilderPolicy. This is the simplest and best way to deploy the necessary contracts in the flashtestations repository
93+
94+
```bash
95+
# add the RPC_URL and ETHERSCAN_API_KEY's to your environment. Make sure RPC_URL is set to the intended network (e.g. unichain sepolia)
96+
source .env
97+
98+
# Deploy script/DeployAll.s.sol:DeployAllScript expects run(address owner, address automataAttestationContract)
99+
# See https://github.com/automata-network/automata-dcap-attestation/tree/4c579aff71562afe254de4009f5235873fdcc953?tab=readme-ov-file#deployment
100+
# for the appropriate `AutomataDcapAttestationFee.sol` contract that matches your $RPC_URL's network
101+
forge script script/DeployAll.s.sol:DeployAllScript \
102+
--sig "run(address,address)" <FLASHTESTATIONS CONTRACT OWNER ADDRESS> <AutomataDcapAttestationFee CONTRACT ADDRESS> \
103+
--rpc-url $RPC_URL --interactives 1 -vvvv --broadcast --verify
104+
```
105+
106+
### FlashtestationsRegistry
93107

94108
This is the primary contract of this repository. It allows TDX v4 devices to register themselves onchain with an Ethereum address/public key, such that later transactions from that address can be trusted to originate from a TEE.
95109

@@ -106,10 +120,10 @@ FLASHTESTATION_REGISTRY_OWNER=0x0000000000000000000000000000000000000042
106120
Then, to deploy, run:
107121

108122
```
109-
forge script --chain 1301 script/FlashtestationRegistry.s.sol:FlashtestationRegistryScript --rpc-url $UNICHAIN_SEPOLIA_RPC_URL --broadcast --verify --interactives 1 -vvvv
123+
forge script --chain 1301 script/FlashtestationRegistry.s.sol:FlashtestationRegistryScript --rpc-url $RPC_URL --broadcast --verify --interactives 1 -vvvv
110124
```
111125

112-
#### BlockBuilderPolicy
126+
### BlockBuilderPolicy
113127

114128
A simple contract that allows your organization (e.g. Flashbots) to permission TEE's and their registered Ethereum addresses + workloadIds
115129

@@ -126,12 +140,12 @@ OWNER_BLOCK_BUILDER_POLICY=0x0000000000000000000000000000000000000042
126140
Then, to deploy, run:
127141

128142
```
129-
forge script --chain 1301 script/BlockBuilderPolicy.s.sol:BlockBuilderPolicyScript --rpc-url $UNICHAIN_SEPOLIA_RPC_URL --broadcast --verify --interactives 1 -vvvv
143+
forge script --chain 1301 script/BlockBuilderPolicy.s.sol:BlockBuilderPolicyScript --rpc-url $RPC_URL --broadcast --verify --interactives 1 -vvvv
130144
```
131145

132-
#### MockQuotes
146+
### MockQuotes
133147

134-
**FetchRemoteQuote**
148+
#### FetchRemoteQuote
135149

136150
Create a raw attestation quote and store it in `script/raw_tdx_quotes/`. This is needed for the `RegisterTEEScript` script for its $PATH_TO_ATTESTATION_QUOTE argument
137151

@@ -149,12 +163,12 @@ TEE_ADDRESS=0x0000000000000000000000000000000000000042
149163
Then, to fetch the quote, run:
150164

151165
```
152-
forge script script/MockQuotes.s.sol:FetchRemoteQuote --rpc-url $UNICHAIN_SEPOLIA_RPC_URL -vvvv
166+
forge script script/MockQuotes.s.sol:FetchRemoteQuote --rpc-url $RPC_URL -vvvv
153167
```
154168

155-
#### Interactions
169+
### Interactions
156170

157-
**RegisterTEEScript**
171+
#### RegisterTEEScript
158172

159173
This registers a TEE-controlled address using a quote generated by a v4 TDX device
160174

@@ -175,15 +189,15 @@ Then, to execute, run:
175189
# Note: we pass '--skip-simulation' because of a bug where the forge EVM does not contain the precompiles necessary
176190
# to execute the FlashtestationRegistry.registerTEEService, and so we need to skip simulating it locally
177191
#
178-
# Note: we need to use a RPC provider like Alchemy for the $UNICHAIN_SEPOLIA_RPC_URL argument, and we can't
192+
# Note: we need to use a RPC provider like Alchemy for the $RPC_URL argument, and we can't
179193
# use https://sepolia.unichain.org, because this script makes so many gas-heavy calls that it will last
180194
# longer than 128 blocks worth of time, at which point the full nodes at sepolia.unichain.org will start
181195
# to return errors. We must use RPC provider like Alchemy because they can service calls to archive nodes,
182196
# which get around this problem.
183-
forge script --chain 1301 script/Interactions.s.sol:RegisterTEEScript --rpc-url $UNICHAIN_SEPOLIA_RPC_URL --broadcast --verify --interactives 1 -vvvv --skip-simulation
197+
forge script --chain 1301 script/Interactions.s.sol:RegisterTEEScript --rpc-url $RPC_URL --broadcast --verify --interactives 1 -vvvv --skip-simulation
184198
```
185199

186-
**ComputeWorkloadIdScript**
200+
#### ComputeWorkloadIdScript
187201

188202
Prints out the WorkloadId for a TEE registered by TEE-controlled address (like in the `RegisterTEEScript` above).
189203

@@ -207,10 +221,10 @@ ADDRESS_BLOCK_BUILDER_POLICY=0x0000000000000000000000000000000000000042
207221
Then, to execute, run:
208222

209223
```
210-
forge script --chain 1301 script/Interactions.s.sol:ComputeWorkloadIdScript --rpc-url $UNICHAIN_SEPOLIA_RPC_URL
224+
forge script --chain 1301 script/Interactions.s.sol:ComputeWorkloadIdScript --rpc-url $RPC_URL
211225
```
212226

213-
**AddWorkloadToPolicyScript**
227+
#### AddWorkloadToPolicyScript
214228

215229
Add a workloadId computed from the `ComputeWorkloadIdScript` script above
216230

@@ -243,5 +257,5 @@ RECORD_LOCATORS="https://github.com/flashbots/flashbots-images/commit/a5aa6c75fb
243257
Then, to execute, run:
244258

245259
```
246-
forge script --chain 1301 script/Interactions.s.sol:AddWorkloadToPolicyScript --rpc-url $UNICHAIN_SEPOLIA_RPC_URL --broadcast --verify --interactives 1 -vvvv
260+
forge script --chain 1301 script/Interactions.s.sol:AddWorkloadToPolicyScript --rpc-url $RPC_URL --broadcast --verify --interactives 1 -vvvv
247261
```

broadcast/DeployAll.s.sol/130/run-1762274713527.json

Lines changed: 285 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/DeployAll.s.sol/130/run-latest.json

Lines changed: 285 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/DeployAll.s.sol/22444422/run-1760032999004.json

Lines changed: 285 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/DeployAll.s.sol/22444422/run-1760033446530.json

Lines changed: 285 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/DeployAll.s.sol/22444422/run-latest.json

Lines changed: 285 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/DeployAll.s.sol/33611633/run-1759352610667.json

Lines changed: 285 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/DeployAll.s.sol/33611633/run-1759437215954.json

Lines changed: 285 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/DeployAll.s.sol/33611633/run-1759503120019.json

Lines changed: 285 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/DeployAll.s.sol/33611633/run-latest.json

Lines changed: 285 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)