|
5 | 5 | "testing" |
6 | 6 |
|
7 | 7 | "github.com/ethereum-optimism/optimism/op-batcher/bindings" |
| 8 | + "github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait" |
8 | 9 | "github.com/ethereum-optimism/optimism/op-service/eth" |
9 | 10 | "github.com/ethereum/go-ethereum/accounts/abi/bind" |
10 | 11 | "github.com/stretchr/testify/require" |
@@ -71,14 +72,43 @@ func TestChangeBatchInboxOwner(t *testing.T) { |
71 | 72 | // Change the BatchAuthenticator's owner |
72 | 73 | batchAuthenticator, err := bindings.NewBatchAuthenticator(config.BatchAuthenticatorAddress, d.L1) |
73 | 74 | require.NoError(t, err) |
74 | | - tx, err := batchAuthenticator.TransferOwnership(&bind.TransactOpts{}, d.secrets.Addresses().Bob) |
| 75 | + |
| 76 | + // Get L1 chain ID for transaction signing |
| 77 | + l1ChainID, err := d.L1.ChainID(ctx) |
75 | 78 | require.NoError(t, err) |
76 | | - _, err = d.SendL1Tx(ctx, tx) |
| 79 | + |
| 80 | + // Check current owner first |
| 81 | + currentOwner, err := batchAuthenticator.Owner(&bind.CallOpts{}) |
| 82 | + require.NoError(t, err) |
| 83 | + t.Logf("Current BatchAuthenticator owner: %s", currentOwner.Hex()) |
| 84 | + t.Logf("Deployer address: %s", d.secrets.Addresses().Deployer.Hex()) |
| 85 | + t.Logf("Bob address: %s", d.secrets.Addresses().Bob.Hex()) |
| 86 | + |
| 87 | + // Use deployer key to sign the transaction |
| 88 | + deployerOpts, err := bind.NewKeyedTransactorWithChainID(d.secrets.Deployer, l1ChainID) |
| 89 | + require.NoError(t, err) |
| 90 | + |
| 91 | + // Verify we're transferring to the right address |
| 92 | + bobAddress := d.secrets.Addresses().Bob |
| 93 | + t.Logf("Attempting to transfer ownership from %s to %s", currentOwner.Hex(), bobAddress.Hex()) |
| 94 | + |
| 95 | + // Call TransferOwnership |
| 96 | + tx, err := batchAuthenticator.TransferOwnership(deployerOpts, bobAddress) |
| 97 | + require.NoError(t, err) |
| 98 | + t.Logf("TransferOwnership transaction hash: %s", tx.Hash().Hex()) |
| 99 | + |
| 100 | + // Wait for transaction receipt and check if it succeeded |
| 101 | + receipt, err := wait.ForReceiptOK(ctx, d.L1, tx.Hash()) |
77 | 102 | require.NoError(t, err) |
| 103 | + t.Logf("TransferOwnership transaction receipt status: %d", receipt.Status) |
| 104 | + t.Logf("TransferOwnership transaction gas used: %d", receipt.GasUsed) |
| 105 | + t.Logf("TransferOwnership transaction completed successfully") |
78 | 106 |
|
79 | 107 | // Ensure the owner has been changed |
80 | 108 | newOwner, err := batchAuthenticator.Owner(&bind.CallOpts{}) |
81 | 109 | require.NoError(t, err) |
| 110 | + t.Logf("New owner after transfer: %s", newOwner.Hex()) |
| 111 | + t.Logf("Expected Bob address: %s", d.secrets.Addresses().Bob.Hex()) |
82 | 112 | require.Equal(t, newOwner, d.secrets.Addresses().Bob) |
83 | 113 |
|
84 | 114 | // Check that everything still functions |
|
0 commit comments