diff --git a/Dockerfile b/Dockerfile index 5c55e57..518c9f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,10 +13,11 @@ RUN mkdir -p /build COPY go.mod go.sum ./ RUN go mod download -COPY . . +COPY op-enclave/ op-enclave/ -RUN CGO_ENABLED=0 go build -o bin/enclave ./cmd/enclave +RUN CGO_ENABLED=0 go build -o bin/enclave ./op-enclave/cmd/enclave +COPY eif/ eif/ COPY --from=bootstrap /build/out bootstrap RUN linuxkit build --format kernel+initrd --no-sbom --name init-ramdisk ./eif/init-ramdisk.yaml RUN linuxkit build --format kernel+initrd --no-sbom --name user-ramdisk ./eif/user-ramdisk.yaml diff --git a/cmd/enclave/main.go b/op-enclave/cmd/enclave/main.go similarity index 83% rename from cmd/enclave/main.go rename to op-enclave/cmd/enclave/main.go index c2566a9..c4eca9c 100644 --- a/cmd/enclave/main.go +++ b/op-enclave/cmd/enclave/main.go @@ -6,7 +6,7 @@ import ( oplog "github.com/ethereum-optimism/optimism/op-service/log" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/rpc" - "github.com/mdehoog/op-enclave/enclave" + enclave2 "github.com/mdehoog/op-enclave/op-enclave/enclave" "github.com/mdlayher/vsock" ) @@ -14,11 +14,11 @@ func main() { oplog.SetupDefaults() s := rpc.NewServer() - serv, err := enclave.NewServer() + serv, err := enclave2.NewServer() if err != nil { log.Crit("Error creating API server", "error", err) } - err = s.RegisterName(enclave.Namespace, serv) + err = s.RegisterName(enclave2.Namespace, serv) if err != nil { log.Crit("Error registering API", "error", err) } diff --git a/enclave/client.go b/op-enclave/enclave/client.go similarity index 100% rename from enclave/client.go rename to op-enclave/enclave/client.go diff --git a/enclave/config.go b/op-enclave/enclave/config.go similarity index 100% rename from enclave/config.go rename to op-enclave/enclave/config.go diff --git a/enclave/l1_receipts_fetcher.go b/op-enclave/enclave/l1_receipts_fetcher.go similarity index 100% rename from enclave/l1_receipts_fetcher.go rename to op-enclave/enclave/l1_receipts_fetcher.go diff --git a/enclave/l2_system_config_fetcher.go b/op-enclave/enclave/l2_system_config_fetcher.go similarity index 100% rename from enclave/l2_system_config_fetcher.go rename to op-enclave/enclave/l2_system_config_fetcher.go diff --git a/enclave/rpc.go b/op-enclave/enclave/rpc.go similarity index 100% rename from enclave/rpc.go rename to op-enclave/enclave/rpc.go diff --git a/enclave/server.go b/op-enclave/enclave/server.go similarity index 100% rename from enclave/server.go rename to op-enclave/enclave/server.go diff --git a/op-proposer/proposer/driver.go b/op-proposer/proposer/driver.go index 9f87b7c..896ea26 100644 --- a/op-proposer/proposer/driver.go +++ b/op-proposer/proposer/driver.go @@ -15,7 +15,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" "github.com/mdehoog/op-enclave/bindings" - "github.com/mdehoog/op-enclave/enclave" + "github.com/mdehoog/op-enclave/op-enclave/enclave" ) var ( diff --git a/op-proposer/proposer/prover.go b/op-proposer/proposer/prover.go index 7ddcbb8..f1f9fd6 100644 --- a/op-proposer/proposer/prover.go +++ b/op-proposer/proposer/prover.go @@ -12,19 +12,19 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" "github.com/hashicorp/go-multierror" - "github.com/mdehoog/op-enclave/enclave" + enclave2 "github.com/mdehoog/op-enclave/op-enclave/enclave" ) type Prover struct { - config *enclave.PerChainConfig + config *enclave2.PerChainConfig configHash common.Hash l1 L1Client l2 L2Client - enclave enclave.RPC + enclave enclave2.RPC } type Proposal struct { - Output *enclave.Proposal + Output *enclave2.Proposal BlockRef eth.L2BlockRef } @@ -33,13 +33,13 @@ func NewProver( l1 L1Client, l2 L2Client, rollup RollupClient, - enclav enclave.RPC, + enclav enclave2.RPC, ) (*Prover, error) { rollupConfig, err := rollup.RollupConfig(ctx) if err != nil { return nil, fmt.Errorf("failed to fetch rollup config: %w", err) } - cfg := enclave.FromRollupConfig(rollupConfig) + cfg := enclave2.FromRollupConfig(rollupConfig) return &Prover{ config: cfg, @@ -170,7 +170,7 @@ func (o *Prover) Generate(ctx context.Context, blockNumber uint64) (*Proposal, b } func (o *Prover) Aggregate(ctx context.Context, prevOutputRoot common.Hash, proposals []*Proposal) (*Proposal, error) { - prop := make([]*enclave.Proposal, len(proposals)) + prop := make([]*enclave2.Proposal, len(proposals)) for i, p := range proposals { prop[i] = p.Output } diff --git a/op-proposer/proposer/service.go b/op-proposer/proposer/service.go index 3c5d5f8..903e6d6 100644 --- a/op-proposer/proposer/service.go +++ b/op-proposer/proposer/service.go @@ -18,7 +18,7 @@ import ( oprpc "github.com/ethereum-optimism/optimism/op-service/rpc" "github.com/ethereum-optimism/optimism/op-service/txmgr" "github.com/ethereum/go-ethereum/ethclient" - "github.com/mdehoog/op-enclave/enclave" + "github.com/mdehoog/op-enclave/op-enclave/enclave" "github.com/mdehoog/op-enclave/op-proposer/metrics" "github.com/ethereum/go-ethereum/common"