Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions espresso/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,6 @@ services:
- sh
- -c
- |
echo "Delaying op-batcher-tee for 45 minutes..."
sleep 2700
export DEPLOYMENT_MODE=local
export L1_RPC_URL="http://127.0.0.1:${L1_HTTP_PORT}"
export L2_RPC_URL="http://127.0.0.1:${OP_HTTP_PORT}"
Expand Down
2 changes: 1 addition & 1 deletion espresso/docker/l1-geth/devnet-genesis-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"nonce": "0x0",
"timestamp": "0x685c6a58",
"extraData": "0x",
"gasLimit": "0xaf79e0",
"gasLimit": "0x2aea540",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised this does not need 63m gas for validation lol

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validation's still split in multiple calls, so max we do in one call is something about 20-30m gas
63m would be very unfortunate, because Ethereum is currently at about 45m, so we wouldn't be able to use this with the actual L1.

"difficulty": "0x0",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
Expand Down
9 changes: 6 additions & 3 deletions op-batcher/batcher/espresso.go
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ func (l *BatchSubmitter) registerBatcher(ctx context.Context) error {
return nil
}

log.Info("Batch authenticator address", "value", l.RollupConfig.BatchAuthenticatorAddress)
l.Log.Info("Batch authenticator address", "value", l.RollupConfig.BatchAuthenticatorAddress)
code, err := l.L1Client.CodeAt(ctx, l.RollupConfig.BatchAuthenticatorAddress, nil)
if err != nil {
return fmt.Errorf("Failed to check code at contrat address: %w", err)
Expand Down Expand Up @@ -1074,7 +1074,7 @@ func (l *BatchSubmitter) registerBatcher(ctx context.Context) error {
// Verify every CA certiciate in the chain in an individual transaction. This avoids running into block gas limit
// that could happen if CertManager verifies the whole certificate chain in one transaction.
parentCertHash := crypto.Keccak256Hash(l.Attestation.Document.CABundle[0])
for _, cert := range l.Attestation.Document.CABundle {
for i, cert := range l.Attestation.Document.CABundle {
txData, err := createVerifyCertTransaction(certManager, certManagerAbi, cert, true, parentCertHash)
if err != nil {
return fmt.Errorf("failed to create verify certificate transaction: %w", err)
Expand All @@ -1088,6 +1088,7 @@ func (l *BatchSubmitter) registerBatcher(ctx context.Context) error {
continue
}

l.Log.Info("Verifying CABundle", "certNumber", i, "certsTotal", len(l.Attestation.Document.CABundle))
_, err = l.Txmgr.Send(ctx, txmgr.TxCandidate{
TxData: txData,
To: &certManagerAddress,
Expand All @@ -1103,6 +1104,7 @@ func (l *BatchSubmitter) registerBatcher(ctx context.Context) error {
return fmt.Errorf("failed to create verify client certificate transaction: %w", err)
}
if txData != nil {
l.Log.Info("Verifying Client Certificate")
_, err = l.Txmgr.Send(ctx, txmgr.TxCandidate{
TxData: txData,
To: &certManagerAddress,
Expand All @@ -1128,9 +1130,10 @@ func (l *BatchSubmitter) registerBatcher(ctx context.Context) error {
To: &l.RollupConfig.BatchAuthenticatorAddress,
}

l.Log.Info("Registering batcher with the batch inbox contract")
_, err = l.Txmgr.Send(ctx, candidate)
if err != nil {
return fmt.Errorf("failed to send transaction: %w", err)
return fmt.Errorf("failed to send registerBatcher transaction: %w", err)
}

l.Log.Info("Registered batcher with the batch inbox contract")
Expand Down
19 changes: 10 additions & 9 deletions op-batcher/enclave-tools/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/hex"
"fmt"
"log"
"log/slog"
"os"
"strings"

Expand Down Expand Up @@ -124,17 +125,17 @@ func buildAction(c *cli.Context) error {
}

ctx := context.Background()
fmt.Printf("Building enclave image...")
slog.Info("Building enclave image...")
measurements, err := enclave_tools.BuildBatcherImage(ctx, opRoot, tag, batcherArgs...)
if err != nil {
return fmt.Errorf("failed to build enclave image: %w", err)
}

fmt.Println("Build completed successfully!")
fmt.Println("Measurements:")
fmt.Printf(" PCR0: %s\n", measurements.PCR0)
fmt.Printf(" PCR1: %s\n", measurements.PCR1)
fmt.Printf(" PCR2: %s\n", measurements.PCR2)
slog.Info("Build completed successfully!")
slog.Info("Measurements",
"PCR0", measurements.PCR0,
"PCR1", measurements.PCR1,
"PCR2", measurements.PCR2)

return nil
}
Expand Down Expand Up @@ -163,13 +164,13 @@ func registerAction(c *cli.Context) error {
}

ctx := context.Background()
fmt.Printf("Registering enclave hash...")
slog.Info("Registering enclave hash...")
err = enclave_tools.RegisterEnclaveHash(ctx, authAddr, l1URL, key, pcr0Bytes)
if err != nil {
return fmt.Errorf("failed to register enclave hash: %w", err)
}

fmt.Printf("Enclave hash registered successfully!")
slog.Info("Enclave hash registered successfully!")
return nil
}

Expand All @@ -186,7 +187,7 @@ func runAction(c *cli.Context) error {
ctx := context.Background()
enclaverCli := &enclave_tools.EnclaverCli{}

fmt.Printf("Starting enclave: %s\n", imageName)
slog.Info("Starting enclave", "image", imageName)
err = enclaverCli.RunEnclave(ctx, imageName, args)
if err != nil {
return err
Expand Down
5 changes: 4 additions & 1 deletion op-batcher/enclave-tools/enclaver.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"regexp"
"time"

"github.com/ethereum/go-ethereum/log"
"github.com/google/uuid"
"gopkg.in/yaml.v2"
)
Expand Down Expand Up @@ -138,13 +139,15 @@ func (*EnclaverCli) RunEnclave(ctx context.Context, name string, args []string)
"-d",
"--privileged",
"--net=host",
fmt.Sprintf("--name=batcher-enclaver-%s", nameSuffix),
"--name=batcher-enclaver-"+nameSuffix,
"--device=/dev/nitro_enclaves",
name,
)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

log.Info("Starting enclave container: %v...\n", "command", cmd.Args)

if err := cmd.Start(); err != nil {
return fmt.Errorf("failed to start enclave container: %w", err)
}
Expand Down
Loading