Commit 53fefb1e authored by Adrian Sutton's avatar Adrian Sutton

op-program: Build op-program client binary

Always builds a MIPs version of the client binary suitable for execution inside cannon.
parent af33b29f
......@@ -62,7 +62,9 @@ func unmarshalBytes32LE(in []byte, z *Uint256Quantity) {
// MarshalSSZ encodes the ExecutionPayload as SSZ type
func (payload *ExecutionPayload) MarshalSSZ(w io.Writer) (n int, err error) {
if len(payload.ExtraData) > math.MaxUint32-executionPayloadFixedPart {
// Cast to uint32 to enable 32-bit MIPS support where math.MaxUint32-executionPayloadFixedPart is too big for int
// In that case, len(payload.ExtraData) can't be longer than an int so this is always false anyway.
if uint32(len(payload.ExtraData)) > math.MaxUint32-uint32(executionPayloadFixedPart) {
return 0, ErrExtraDataTooLarge
}
......
......@@ -8,9 +8,22 @@ LDFLAGSSTRING +=-X github.com/ethereum-optimism/optimism/op-program/version.Vers
LDFLAGSSTRING +=-X github.com/ethereum-optimism/optimism/op-program/version.Meta=$(VERSION_META)
LDFLAGS := -ldflags "$(LDFLAGSSTRING)"
op-program:
op-program: \
op-program-host \
op-program-client \
op-program-client-mips
op-program-host:
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-program ./host/cmd/main.go
op-program-client:
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-program-client ./client/cmd/main.go
op-program-client-mips:
env GO111MODULE=on GOOS=linux GOARCH=mips GOMIPS=softfloat go build -v $(LDFLAGS) -o ./bin/op-program-client.elf ./client/cmd/main.go
# verify output with: readelf -h bin/op-program-client.elf
# result is mips32, big endian, R3000
clean:
rm -rf bin
......
package main
import (
"github.com/ethereum-optimism/optimism/op-program/client"
oplog "github.com/ethereum-optimism/optimism/op-service/log"
)
func main() {
// Default to a machine parsable but relatively human friendly log format.
// Don't do anything fancy to detect if color output is supported.
logger := oplog.NewLogger(oplog.CLIConfig{
Level: "info",
Format: "logfmt",
Color: false,
})
client.Main(logger)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment