Skip to content

Commit 090844c

Browse files
Better handling of configuration variables.
1 parent 16a9ba7 commit 090844c

File tree

7 files changed

+25
-11
lines changed

7 files changed

+25
-11
lines changed

.github/workflows/espresso-devnet-tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ jobs:
6767
- name: Run Key Rotation test
6868
run: go test -timeout 30m -p 1 -count 1 -run 'TestKeyRotation' -v ./espresso/devnet-tests/...
6969

70-
# - name: Run Change Batch Inbox Owner test
71-
# run: go test -timeout 30m -p 1 -count 1 -run 'TestChangeBatchInboxOwner -v ./espresso/devnet-tests/...
70+
- name: Run Change Batch Inbox Owner test
71+
run: go test -timeout 30m -p 1 -count 1 -run 'TestChangeBatchInboxOwner' -v ./espresso/devnet-tests/...
7272

7373
- name: Save Nix cache
7474
uses: nix-community/cache-nix-action/save@v6

espresso/.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ OPERATOR_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf
3434
# cast wallet address --private-key $OPERATOR_PRIVATE_KEY
3535
OPERATOR_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
3636

37+
# Deployer address for contract ownership (index 3 from mnemonic)
38+
# cast wallet address --mnemonic "test test ... junk" --hd-path "m/44'/60'/0'/0/3"
39+
DEPLOYER_ADDRESS=0x90F79bf6EB2c4f870365E785982E1f101E93b906
40+
3741
# cast wallet address --mnemonic "test test ... junk" --hd-path "m/44'/60'/0'/0/1"
3842
PROPOSER_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8
3943

espresso/devnet-tests/key_rotation_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ func TestChangeBatchInboxOwner(t *testing.T) {
9191
// Verify we're transferring to the right address
9292
bobAddress := d.secrets.Addresses().Bob
9393
t.Logf("Attempting to transfer ownership from %s to %s", currentOwner.Hex(), bobAddress.Hex())
94-
94+
9595
// Call TransferOwnership
9696
tx, err := batchAuthenticator.TransferOwnership(deployerOpts, bobAddress)
9797
require.NoError(t, err)
9898
t.Logf("TransferOwnership transaction hash: %s", tx.Hash().Hex())
99-
99+
100100
// Wait for transaction receipt and check if it succeeded
101101
receipt, err := wait.ForReceiptOK(ctx, d.L1, tx.Hash())
102102
require.NoError(t, err)

espresso/scripts/prepare-allocs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ dasel put -f "${DEPLOYER_DIR}/intent.toml" -s .chains.[0].roles.proposer -v "${P
9696
# contract addresses are deterministic.
9797
dasel put -f "${DEPLOYER_DIR}/state.json" -s create2Salt -v "0xaecea4f57fadb2097ccd56594f2f22715ac52f92971c5913b70a7f1134b68feb"
9898

99-
op-deployer apply --l1-rpc-url "${ANVIL_URL}" \
99+
DEPLOYER_ADDRESS="${DEPLOYER_ADDRESS}" op-deployer apply --l1-rpc-url "${ANVIL_URL}" \
100100
--workdir "${DEPLOYER_DIR}" \
101101
--private-key="${OPERATOR_PRIVATE_KEY}"
102102

op-deployer/pkg/deployer/opcm/espresso.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type DeployEspressoOutput struct {
2727
}
2828

2929
type DeployEspressoScript struct {
30-
Run func(input, output common.Address) error
30+
Run func(input, output, deployerAddress common.Address) error
3131
}
3232

3333
type DeployAWSNitroVerifierScript struct {
@@ -72,6 +72,7 @@ func DeployAWSNitroVerifier(
7272
func DeployEspresso(
7373
host *script.Host,
7474
input DeployEspressoInput,
75+
deployerAddress common.Address,
7576
) (DeployEspressoOutput, error) {
7677
var output DeployEspressoOutput
7778
inputAddr := host.NewScriptAddress()
@@ -97,7 +98,7 @@ func DeployEspresso(
9798
}
9899
defer cleanupDeploy()
99100

100-
if err := deployScript.Run(inputAddr, outputAddr); err != nil {
101+
if err := deployScript.Run(inputAddr, outputAddr, deployerAddress); err != nil {
101102
return output, fmt.Errorf("failed to run %s script: %w", implContract, err)
102103
}
103104

op-deployer/pkg/deployer/pipeline/espresso.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package pipeline
22

33
import (
44
"fmt"
5+
"os"
56

67
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
78
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
@@ -36,11 +37,21 @@ func DeployEspresso(env *Env, intent *state.Intent, st *state.State, chainID com
3637
}
3738

3839
var eo opcm.DeployEspressoOutput
40+
// Read deployer address from environment variable, fallback to env.Deployer
41+
var deployerAddress common.Address
42+
if deployerEnv := os.Getenv("DEPLOYER_ADDRESS"); deployerEnv != "" {
43+
deployerAddress = common.HexToAddress(deployerEnv)
44+
lgr.Info("Using deployer address from DEPLOYER_ADDRESS env var", "address", deployerAddress.Hex())
45+
} else {
46+
deployerAddress = env.Deployer
47+
lgr.Info("Using deployer address from env.Deployer", "address", deployerAddress.Hex())
48+
}
49+
3950
eo, err = opcm.DeployEspresso(env.L1ScriptHost, opcm.DeployEspressoInput{
4051
Salt: st.Create2Salt,
4152
PreApprovedBatcherKey: chainIntent.PreApprovedBatcherKey,
4253
NitroTEEVerifier: nvo.NitroTEEVerifierAddress,
43-
})
54+
}, deployerAddress)
4455
if err != nil {
4556
return fmt.Errorf("failed to deploy espresso contracts: %w", err)
4657
}

packages/contracts-bedrock/scripts/deploy/DeployEspresso.s.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,8 @@ contract DeployEspressoOutput is BaseDeployIO {
7373
}
7474

7575
contract DeployEspresso is Script {
76-
function run(DeployEspressoInput input, DeployEspressoOutput output) public {
76+
function run(DeployEspressoInput input, DeployEspressoOutput output, address deployerAddress) public {
7777
IEspressoTEEVerifier teeVerifier = deployTEEVerifier(input);
78-
// Use the deployer address (index 3 from mnemonic) instead of msg.sender (index 0)
79-
address deployerAddress = 0x90F79bf6EB2c4f870365E785982E1f101E93b906;
8078
IBatchAuthenticator batchAuthenticator = deployBatchAuthenticator(input, output, teeVerifier, deployerAddress);
8179
deployBatchInbox(input, output, batchAuthenticator);
8280
checkOutput(output);

0 commit comments

Comments
 (0)