Skip to content

Commit

Permalink
Move enclave packages into op-enclave subdir
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehoog committed Oct 4, 2024
1 parent 45d30f6 commit b791433
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 14 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cmd/enclave/main.go → op-enclave/cmd/enclave/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ 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"
)

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)
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion op-proposer/proposer/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
14 changes: 7 additions & 7 deletions op-proposer/proposer/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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,
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion op-proposer/proposer/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b791433

Please sign in to comment.