diff --git a/.github/workflows/espresso-devnet-tests.yaml b/.github/workflows/espresso-devnet-tests.yaml index 95d71846e23..0846fc958e7 100644 --- a/.github/workflows/espresso-devnet-tests.yaml +++ b/.github/workflows/espresso-devnet-tests.yaml @@ -38,6 +38,18 @@ jobs: - name: Compile contracts run: just compile-contracts + - name: Load environment variables + run: | + while IFS= read -r line; do + # Skip comments and empty lines + if [[ ! "$line" =~ ^#.* ]] && [[ -n "$line" ]]; then + # Remove quotes from values + line=$(echo "$line" | sed 's/"\(.*\)"/\1/') + echo "$line" >> $GITHUB_ENV + fi + done < ./espresso/.env + shell: bash + - name: Build Devnet without TEE run: | cd op-deployer diff --git a/.github/workflows/espresso-enclave.yaml b/.github/workflows/espresso-enclave.yaml index 8939f64b3f9..2797157f4df 100644 --- a/.github/workflows/espresso-enclave.yaml +++ b/.github/workflows/espresso-enclave.yaml @@ -68,6 +68,18 @@ jobs: --port 22 \ --cidr 0.0.0.0/0 || true + - name: Load environment variables + run: | + while IFS= read -r line; do + # Skip comments and empty lines + if [[ ! "$line" =~ ^#.* ]] && [[ -n "$line" ]]; then + # Remove quotes from values + line=$(echo "$line" | sed 's/"\(.*\)"/\1/') + echo "$line" >> $GITHUB_ENV + fi + done < ./espresso/.env + shell: bash + - name: Launch EC2 Instance id: ec2 run: | @@ -108,6 +120,17 @@ jobs: run: | ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=5 -i key.pem ec2-user@$DNS << EOF export BRANCH_NAME=$BRANCH_NAME + export ESPRESSO_ATTESTATION_VERIFIER_NETWORK_RPC_URL="${ESPRESSO_ATTESTATION_VERIFIER_NETWORK_RPC_URL}" + export ESPRESSO_ATTESTATION_VERIFIER_NETWORK_PRIVATE_KEY="${ESPRESSO_ATTESTATION_VERIFIER_NETWORK_PRIVATE_KEY}" + export ESPRESSO_ATTESTATION_VERIFIER_SP1_PROVER="${ESPRESSO_ATTESTATION_VERIFIER_SP1_PROVER}" + export ESPRESSO_ATTESTATION_VERIFIER_RPC_URL="${ESPRESSO_ATTESTATION_VERIFIER_RPC_URL}" + export ESPRESSO_ATTESTATION_VERIFIER_NITRO_VERIFIER_ADDRESS="${ESPRESSO_ATTESTATION_VERIFIER_NITRO_VERIFIER_ADDRESS}" + export ESPRESSO_ATTESTATION_VERIFIER_NETWORK_USE_DOCKER="${ESPRESSO_ATTESTATION_VERIFIER_NETWORK_USE_DOCKER}" + export ESPRESSO_ATTESTATION_VERIFIER_SKIP_TIME_VALIDITY_CHECK="${ESPRESSO_ATTESTATION_VERIFIER_SKIP_TIME_VALIDITY_CHECK}" + export ESPRESSO_ATTESTATION_VERIFIER_RUST_LOG="${ESPRESSO_ATTESTATION_VERIFIER_RUST_LOG}" + export ESPRESSO_ATTESTATION_VERIFIER_HOST="${ESPRESSO_ATTESTATION_VERIFIER_HOST}" + export ESPRESSO_ATTESTATION_VERIFIER_PORT="${ESPRESSO_ATTESTATION_VERIFIER_PORT}" + export ESPRESSO_ATTESTATION_VERIFIER_DOCKER_IMAGE="${ESPRESSO_ATTESTATION_VERIFIER_DOCKER_IMAGE}" ./run-tests-github-actions.sh ${{ secrets.CACHIX_AUTH_TOKEN }} EOF diff --git a/.github/workflows/espresso-integration.yaml b/.github/workflows/espresso-integration.yaml index 9f33765b873..3d3714e8702 100644 --- a/.github/workflows/espresso-integration.yaml +++ b/.github/workflows/espresso-integration.yaml @@ -8,7 +8,7 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04-8core strategy: fail-fast: false matrix: @@ -37,6 +37,18 @@ jobs: - name: Compile contracts run: just compile-contracts + - name: Load environment variables + run: | + while IFS= read -r line; do + # Skip comments and empty lines + if [[ ! "$line" =~ ^#.* ]] && [[ -n "$line" ]]; then + # Remove quotes from values + line=$(echo "$line" | sed 's/"\(.*\)"/\1/') + echo "$line" >> $GITHUB_ENV + fi + done < ./espresso/.env + shell: bash + - name: Generate test slice id: test_split uses: hashicorp-forge/go-test-split-action@v1 diff --git a/espresso/.env b/espresso/.env index 32443839196..ff2b64f8d83 100644 --- a/espresso/.env +++ b/espresso/.env @@ -26,6 +26,20 @@ ESPRESSO_SEQUENCER_API_PORT=24000 ESPRESSO_DEV_NODE_PORT=24002 ESPRESSO_BUILDER_PORT=31003 + +##### Espresso Attestation Verifier Service ###### +ESPRESSO_ATTESTATION_VERIFIER_PORT=8080 +ESPRESSO_ATTESTATION_VERIFIER_RPC_URL="https://rpc.ankr.com/eth_sepolia/ece75e2d2d01c537031b3b31a619b7830674b9cd1b9fe6bc957a3d393c035dbb" +ESPRESSO_ATTESTATION_VERIFIER_SP1_PROVER="mock" +ESPRESSO_ATTESTATION_VERIFIER_NITRO_VERIFIER_ADDRESS="0x2D7fbBAD6792698Ba92e67b7e180f8010B9Ec788" +ESPRESSO_ATTESTATION_VERIFIER_SKIP_TIME_VALIDITY_CHECK=true +ESPRESSO_ATTESTATION_VERIFIER_HOST="0.0.0.0" +ESPRESSO_ATTESTATION_VERIFIER_NETWORK_PRIVATE_KEY="0x71f8e55f7555c946eadd5a2b5897465a9813b3ee493d6ef4ba6f1505a6e97af3" +ESPRESSO_ATTESTATION_VERIFIER_NETWORK_RPC_URL="https://rpc.mainnet.succinct.xyz" +ESPRESSO_ATTESTATION_VERIFIER_NETWORK_USE_DOCKER=1 +ESPRESSO_ATTESTATION_VERIFIER_RUST_LOG="info" +ESPRESSO_ATTESTATION_VERIFIER_DOCKER_IMAGE="ghcr.io/espressosystems/attestation-verifier-zk:sha-0e987c3" + L1_ENGINE_PORT=8551 L1_HTTP_PORT=8545 L1_BEACON_PORT=5052 diff --git a/espresso/cli.go b/espresso/cli.go index 1b5cb9e177e..f339d0be3cb 100644 --- a/espresso/cli.go +++ b/espresso/cli.go @@ -36,6 +36,7 @@ var ( OriginHeight = espressoFlags("origin-height") NamespaceFlagName = espressoFlags("namespace") RollupL1UrlFlagName = espressoFlags("rollup-l1-url") + AttestationServiceFlagName = espressoFlags("espresso-attestation-service") ) func CLIFlags(envPrefix string, category string) []cli.Flag { @@ -103,20 +104,27 @@ func CLIFlags(envPrefix string, category string) []cli.Flag { EnvVars: espressoEnvs(envPrefix, "ROLLUP_L1_URL"), Category: category, }, + &cli.StringFlag{ + Name: AttestationServiceFlagName, + Usage: "URL of the Espresso attestation service", + EnvVars: espressoEnvs(envPrefix, "ATTESTATION_SERVICE_URL"), + Category: category, + }, } } type CLIConfig struct { - Enabled bool - PollInterval time.Duration - UseFetchAPI bool - QueryServiceURLs []string - LightClientAddr common.Address - L1URL string - RollupL1URL string - TestingBatcherPrivateKey *ecdsa.PrivateKey - Namespace uint64 - OriginHeight uint64 + Enabled bool + PollInterval time.Duration + UseFetchAPI bool + QueryServiceURLs []string + LightClientAddr common.Address + L1URL string + RollupL1URL string + TestingBatcherPrivateKey *ecdsa.PrivateKey + Namespace uint64 + OriginHeight uint64 + EspressoAttestationService string } func (c CLIConfig) Check() error { @@ -137,19 +145,23 @@ func (c CLIConfig) Check() error { if c.Namespace == 0 { return fmt.Errorf("namespace is required when Espresso is enabled") } + if c.EspressoAttestationService == "" { + return fmt.Errorf("attestation service URL is required when Espresso is enabled") + } } return nil } func ReadCLIConfig(c *cli.Context) CLIConfig { config := CLIConfig{ - Enabled: c.Bool(EnabledFlagName), - PollInterval: c.Duration(PollIntervalFlagName), - UseFetchAPI: c.Bool(UseFetchApiFlagName), - L1URL: c.String(L1UrlFlagName), - RollupL1URL: c.String(RollupL1UrlFlagName), - Namespace: c.Uint64(NamespaceFlagName), - OriginHeight: c.Uint64(OriginHeight), + Enabled: c.Bool(EnabledFlagName), + PollInterval: c.Duration(PollIntervalFlagName), + UseFetchAPI: c.Bool(UseFetchApiFlagName), + L1URL: c.String(L1UrlFlagName), + RollupL1URL: c.String(RollupL1UrlFlagName), + Namespace: c.Uint64(NamespaceFlagName), + OriginHeight: c.Uint64(OriginHeight), + EspressoAttestationService: c.String(AttestationServiceFlagName), } config.QueryServiceURLs = c.StringSlice(QueryServiceUrlsFlagName) diff --git a/espresso/docker-compose.yml b/espresso/docker-compose.yml index 1e77ff9f47a..c6233e41eab 100644 --- a/espresso/docker-compose.yml +++ b/espresso/docker-compose.yml @@ -359,6 +359,8 @@ services: condition: service_healthy l2-genesis: condition: service_completed_successfully + attestation-service-zk: + condition: service_healthy environment: L1_RPC: http://l1-geth:${L1_HTTP_PORT} OP_BATCHER_L1_ETH_RPC: http://l1-geth:${L1_HTTP_PORT} @@ -374,6 +376,7 @@ services: - --espresso.enabled=true - --espresso.fetch-api=true - --espresso.poll-interval=1s + - --espresso.espresso-attestation-service=http://attestation-service-zk:${ESPRESSO_ATTESTATION_VERIFIER_PORT} - --espresso.light-client-addr=0x703848f4c85f18e3acd8196c8ec91eb0b7bd0797 - --espresso.testing-batcher-private-key=${OP_TESTING_BATCHER_PRIVATE_KEY:-$OPERATOR_PRIVATE_KEY} - --private-key=${OP_BATCHER_PRIVATE_KEY:-$OPERATOR_PRIVATE_KEY} @@ -417,7 +420,11 @@ services: condition: service_started l2-genesis: condition: service_completed_successfully + attestation-service-zk: + condition: service_healthy network_mode: "host" + env_file: + - ./.env environment: http_proxy: http://127.0.0.1:3128 HTTP_PROXY: http://127.0.0.1:3128 @@ -444,6 +451,7 @@ services: export L2_RPC_URL="http://127.0.0.1:${OP_HTTP_PORT}" export ROLLUP_RPC_URL="http://127.0.0.1:${ROLLUP_PORT}" export ESPRESSO_URL1="http://127.0.0.1:${ESPRESSO_SEQUENCER_API_PORT}" + export ESPRESSO_ATTESTATION_SERVICE_URL="http://127.0.0.1:${ESPRESSO_ATTESTATION_VERIFIER_PORT}" /source/espresso/docker/op-batcher-tee/run-enclave.sh # Legacy op-proposer (for non-succinct mode) @@ -627,6 +635,36 @@ services: start_period: 240s restart: unless-stopped + attestation-service-zk: + image: ghcr.io/espressosystems/attestation-verifier-zk:sha-0e987c3 + platform: linux/amd64 + ports: + - "${ESPRESSO_ATTESTATION_VERIFIER_PORT}:${ESPRESSO_ATTESTATION_VERIFIER_PORT}" + healthcheck: + test: + [ + "CMD-SHELL", + "timeout 2 bash -c 'cat < /dev/null > /dev/tcp/localhost/${ESPRESSO_ATTESTATION_VERIFIER_PORT}' || exit 1", + ] + interval: 5s + timeout: 3s + retries: 30 + start_period: 150s + env_file: + - ./.env + environment: + # This is a demo private key for tests, it doesnt contain any funds + NETWORK_PRIVATE_KEY: "${ESPRESSO_ATTESTATION_VERIFIER_NETWORK_PRIVATE_KEY}" + NETWORK_RPC_URL: "${ESPRESSO_ATTESTATION_VERIFIER_NETWORK_RPC_URL}" + SP1_PROVER: "${ESPRESSO_ATTESTATION_VERIFIER_SP1_PROVER}" + RPC_URL: "${ESPRESSO_ATTESTATION_VERIFIER_RPC_URL}" + NITRO_VERIFIER_ADDRESS: "${ESPRESSO_ATTESTATION_VERIFIER_NITRO_VERIFIER_ADDRESS}" + USE_DOCKER: "${ESPRESSO_ATTESTATION_VERIFIER_NETWORK_USE_DOCKER}" + SKIP_TIME_VALIDITY_CHECK: "${ESPRESSO_ATTESTATION_VERIFIER_SKIP_TIME_VALIDITY_CHECK}" + RUST_LOG: "${ESPRESSO_ATTESTATION_VERIFIER_RUST_LOG}" + HOST: "${ESPRESSO_ATTESTATION_VERIFIER_HOST}" + PORT: "${ESPRESSO_ATTESTATION_VERIFIER_PORT}" + espresso-dev-node: image: ${ESPRESSO_DEV_NODE_IMAGE} depends_on: diff --git a/espresso/docker/op-batcher-tee/run-enclave.sh b/espresso/docker/op-batcher-tee/run-enclave.sh index ccc98397114..e07f78b6759 100755 --- a/espresso/docker/op-batcher-tee/run-enclave.sh +++ b/espresso/docker/op-batcher-tee/run-enclave.sh @@ -10,6 +10,7 @@ set -e : ${ROLLUP_RPC_URL:?Error: ROLLUP_RPC_URL is required} : ${ESPRESSO_URL1:?Error: ESPRESSO_URL1 is required} : ${OPERATOR_PRIVATE_KEY:?Error: OPERATOR_PRIVATE_KEY is required} +: ${ESPRESSO_ATTESTATION_SERVICE_URL:?Error: ESPRESSO_ATTESTATION_SERVICE_URL is required} # Optional configuration with defaults TAG="${TAG:-op-batcher-enclavetool}" @@ -28,6 +29,7 @@ echo "L1 RPC URL: $L1_RPC_URL" echo "L2 RPC URL: $L2_RPC_URL" echo "Rollup RPC URL: $ROLLUP_RPC_URL" echo "Espresso URLs: $ESPRESSO_URL1, $ESPRESSO_URL2" +echo "Attestation service url: $ESPRESSO_ATTESTATION_SERVICE_URL" echo "Debug Mode: $ENCLAVE_DEBUG" echo "Monitor Interval: $MONITOR_INTERVAL seconds" echo "Memory: ${MEMORY_MB}MB" @@ -48,6 +50,7 @@ BATCHER_ARGS="$BATCHER_ARGS,--max-channel-duration=1" BATCHER_ARGS="$BATCHER_ARGS,--target-num-frames=1" BATCHER_ARGS="$BATCHER_ARGS,--espresso.fetch-api=true" BATCHER_ARGS="$BATCHER_ARGS,--espresso.light-client-addr=0x703848f4c85f18e3acd8196c8ec91eb0b7bd0797" +BATCHER_ARGS="$BATCHER_ARGS,--espresso.espresso-attestation-service=$ESPRESSO_ATTESTATION_SERVICE_URL" # Add debug arguments if enabled if [ "$ENCLAVE_DEBUG" = "true" ]; then diff --git a/espresso/environment/5_batch_authentication_test.go b/espresso/environment/5_batch_authentication_test.go index 01c31f664e2..8622f8d15f5 100644 --- a/espresso/environment/5_batch_authentication_test.go +++ b/espresso/environment/5_batch_authentication_test.go @@ -11,17 +11,12 @@ import ( "github.com/ethereum-optimism/optimism/op-e2e/e2eutils/geth" "github.com/ethereum-optimism/optimism/op-e2e/system/e2esys" "github.com/ethereum/go-ethereum/crypto" - "github.com/hf/nitrite" ) // TestE2eDevnetWithInvalidAttestation verifies that the batcher correctly fails to register // when provided with an invalid attestation. This test ensures that the batch inbox contract // properly validates attestations func TestE2eDevnetWithInvalidAttestation(t *testing.T) { - // Sishan TODO: this test is skipped now as we skip the attestation verification, should be restored after https://app.asana.com/1/1208976916964769/project/1209976130071762/task/1211868671079203?focus=true - // Related task: https://app.asana.com/1/1208976916964769/project/1209976130071762/task/1212349352131215?focus=true - t.Skip("skipping E2E invalid attestation test for now as we skip the attestation verification, should be restored after zk verification added.") - ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -45,11 +40,7 @@ func TestE2eDevnetWithInvalidAttestation(t *testing.T) { } batchDriver := system.BatchSubmitter.TestDriver() - batchDriver.Attestation = &nitrite.Result{ - Document: &nitrite.Document{ - CABundle: [][]byte{[]byte{1, 2, 3, 4}}, - }, - } + batchDriver.Attestation = []byte("this is an invalid attestation") err = batchDriver.StartBatchSubmitting() if err == nil { @@ -72,9 +63,15 @@ func TestE2eDevnetWithUnattestedBatcherKey(t *testing.T) { launcher := new(env.EspressoDevNodeLauncherDocker) - privateKey, err := crypto.GenerateKey() + // This is a random private key belonging to address 0xe16d5c4080C0faD6D2Ef4eb07C657674a217271C that will result in Mock Nitro verifier to return `false` + // because the given key is not registered as an attested batcher. + // Check the following code in Mock Espresso Nitro verifier: + // if (signer == address(0xe16d5c4080C0faD6D2Ef4eb07C657674a217271C)) { + // return false; + // } + privateKey, err := crypto.HexToECDSA("841c29acb9520a7ea8a48e7686cd825b93e8a3ecd966b62cb396ff8a2cd7e80e") if err != nil { - t.Fatalf("failed to generate private key") + t.Fatalf("failed to parse private key: %v", err) } system, _, err := diff --git a/espresso/environment/enclave_helpers.go b/espresso/environment/enclave_helpers.go index 03abbde8b01..781b3318500 100644 --- a/espresso/environment/enclave_helpers.go +++ b/espresso/environment/enclave_helpers.go @@ -182,7 +182,7 @@ func LaunchBatcherInEnclave() E2eDevnetLauncherOption { for _, url := range c.Espresso.QueryServiceURLs { appendArg(&args, espresso.QueryServiceUrlsFlagName, url) } - + appendArg(&args, espresso.AttestationServiceFlagName, c.Espresso.EspressoAttestationService) err := SetupEnclaver(ct.Ctx, sys, args...) if err != nil { panic(fmt.Sprintf("failed to setup enclaver: %v", err)) diff --git a/espresso/environment/espresso_docker_helpers.go b/espresso/environment/espresso_docker_helpers.go index 063ffce89cc..89368c715e7 100644 --- a/espresso/environment/espresso_docker_helpers.go +++ b/espresso/environment/espresso_docker_helpers.go @@ -44,8 +44,10 @@ type DockerContainerConfig struct { Ports []string - Network string - AutoRM bool + Network string + AutoRM bool + Platform string + Name string } // DockerBuildArg is a configuration struct that is used to pass @@ -71,6 +73,13 @@ func (d *DockerCli) LaunchContainer(ctx context.Context, config DockerContainerC ctx, cancel := context.WithCancel(ctx) defer cancel() + // Remove existing container with the same name if it exists + if config.Name != "" { + // Try to remove the container, ignore errors if it doesn't exist + removeCmd := exec.CommandContext(ctx, "docker", "rm", "-f", config.Name) + _ = removeCmd.Run() // Ignore errors - container might not exist + } + outputBuffer := new(bytes.Buffer) var args []string // Let's build the arguments for the docker launch command @@ -91,6 +100,14 @@ func (d *DockerCli) LaunchContainer(ctx context.Context, config DockerContainerC args = append(args, "-p", port) } } + // Add platform support + if config.Platform != "" { + args = append(args, "--platform", config.Platform) + } + + if config.Name != "" { + args = append(args, "--name", config.Name) + } for key, value := range config.Environment { args = append(args, "-e", key+"="+value) diff --git a/espresso/environment/optitmism_espresso_test_helpers.go b/espresso/environment/optitmism_espresso_test_helpers.go index aba11f3efcb..c99cf3f6aba 100644 --- a/espresso/environment/optitmism_espresso_test_helpers.go +++ b/espresso/environment/optitmism_espresso_test_helpers.go @@ -15,6 +15,7 @@ import ( "net" "net/http" "net/url" + "os" "strconv" "testing" "time" @@ -345,7 +346,7 @@ func (l *EspressoDevNodeLauncherDocker) GetE2eDevnetWithFaultDisputeSysConfig(ct func (l *EspressoDevNodeLauncherDocker) GetE2eDevnetStartOptions(originalCtx context.Context, t *testing.T, sysConfig *e2esys.SystemConfig, options ...E2eDevnetLauncherOption) ([]e2esys.StartOption, *E2eDevnetLauncherContext) { initialOptions := []E2eDevnetLauncherOption{ allowHostDockerInternalVirtualHost(), - launchEspressoDevNodeDocker(), + launchEspressoDevNodeAndAttestationServiceDocker(), } if l.EnclaveBatcher { @@ -801,10 +802,11 @@ func ensureHardCodedPortsAreMappedFromTheirOriginalValues(containerInfo *DockerC } } -// launchEspressoDevNodeDocker is E2eDevnetLauncherOption that launches th +// launchEspressoDevNodeAndAttestationVerifierZKStartOption is E2eDevnetLauncherOption that launches the // Espresso Dev Node within a Docker container. It also ensures that the // Espresso Dev Node is actively producing blocks before returning. -func launchEspressoDevNodeStartOption(ct *E2eDevnetLauncherContext) e2esys.StartOption { +// Additionally, it launches the Attestation Verifier ZK server in a Docker container. +func launchEspressoDevNodeAndAttestationVerifierZKStartOption(ct *E2eDevnetLauncherContext) e2esys.StartOption { return e2esys.StartOption{ Role: "launch-espresso-dev-node", BatcherMod: func(c *batcher.CLIConfig, sys *e2esys.System) { @@ -867,19 +869,164 @@ func launchEspressoDevNodeStartOption(ct *E2eDevnetLauncherContext) e2esys.Start c.Espresso.QueryServiceURLs = espressoDevNode.espressoUrls c.LogConfig.Level = slog.LevelDebug c.Espresso.LightClientAddr = common.HexToAddress(ESPRESSO_LIGHT_CLIENT_ADDRESS) + + // Now launch the attestation verifier zk server + launchEspressoAttestationVerifierService(ct, c) + }, + } +} + +// launchEspressoAttestationVerifierService launches the attestation verifier zk server +// in a Docker container and configures the batcher CLIConfig to use it. +func launchEspressoAttestationVerifierService(ct *E2eDevnetLauncherContext, c *batcher.CLIConfig) { + // Now we need to launch the attestation verifier zk server + fmt.Println("Starting attestation verifier zk server...") + + espressoAttestationVerifierNetworkRPCURL := os.Getenv("ESPRESSO_ATTESTATION_VERIFIER_NETWORK_RPC_URL") + if espressoAttestationVerifierNetworkRPCURL == "" { + ct.Error = fmt.Errorf("ESPRESSO_ATTESTATION_VERIFIER_NETWORK_RPC_URL environment variable is not set") + return + } + + espressoAttestationVerifierSp1Prover := os.Getenv("ESPRESSO_ATTESTATION_VERIFIER_SP1_PROVER") + if espressoAttestationVerifierSp1Prover == "" { + ct.Error = fmt.Errorf("ESPRESSO_ATTESTATION_VERIFIER_SP1_PROVER environment variable is not set") + return + } + + espressoAttestationVerifierNitroVerifierAddress := os.Getenv("ESPRESSO_ATTESTATION_VERIFIER_NITRO_VERIFIER_ADDRESS") + if espressoAttestationVerifierNitroVerifierAddress == "" { + ct.Error = fmt.Errorf("ESPRESSO_ATTESTATION_VERIFIER_NITRO_VERIFIER_ADDRESS environment variable is not set") + return + } + + espressoAttestationVerifierUseDocker := os.Getenv("ESPRESSO_ATTESTATION_VERIFIER_NETWORK_USE_DOCKER") + if espressoAttestationVerifierUseDocker == "" { + ct.Error = fmt.Errorf("ESPRESSO_ATTESTATION_VERIFIER_NETWORK_USE_DOCKER environment variable is not set") + return + } + + espressoAttestationVerifierSkipTimeValidityCheck := os.Getenv("ESPRESSO_ATTESTATION_VERIFIER_SKIP_TIME_VALIDITY_CHECK") + if espressoAttestationVerifierSkipTimeValidityCheck == "" { + ct.Error = fmt.Errorf("ESPRESSO_ATTESTATION_VERIFIER_SKIP_TIME_VALIDITY_CHECK environment variable is not set") + return + } + + espressoAttestationVerifierRustLog := os.Getenv("ESPRESSO_ATTESTATION_VERIFIER_RUST_LOG") + if espressoAttestationVerifierRustLog == "" { + ct.Error = fmt.Errorf("ESPRESSO_ATTESTATION_VERIFIER_RUST_LOG environment variable is not set") + return + } + + espressoAttestationVerifierNetworkPrivateKey := os.Getenv("ESPRESSO_ATTESTATION_VERIFIER_NETWORK_PRIVATE_KEY") + if espressoAttestationVerifierNetworkPrivateKey == "" { + ct.Error = fmt.Errorf("networkPrivateKey environment variable is not set") + return + } + + espressoAttestationVerifierRPCUrl := os.Getenv("ESPRESSO_ATTESTATION_VERIFIER_RPC_URL") + if espressoAttestationVerifierRPCUrl == "" { + ct.Error = fmt.Errorf("RPC_URL environment variable is not set") + return + } + + espressoAttestationVerifierHost := os.Getenv("ESPRESSO_ATTESTATION_VERIFIER_HOST") + if espressoAttestationVerifierHost == "" { + ct.Error = fmt.Errorf("ESPRESSO_ATTESTATION_VERIFIER_HOST environment variable is not set") + return + } + + espressoAttestationVerifierPort := os.Getenv("ESPRESSO_ATTESTATION_VERIFIER_PORT") + if espressoAttestationVerifierPort == "" { + ct.Error = fmt.Errorf("ESPRESSO_ATTESTATION_VERIFIER_PORT environment variable is not set") + return + } + + espressoAttestationVerifierDockerImage := os.Getenv("ESPRESSO_ATTESTATION_VERIFIER_DOCKER_IMAGE") + if espressoAttestationVerifierDockerImage == "" { + ct.Error = fmt.Errorf("ESPRESSO_ATTESTATION_VERIFIER_DOCKER_IMAGE environment variable is not set") + return + } + + dockerConfig := DockerContainerConfig{ + Image: espressoAttestationVerifierDockerImage, + Network: determineDockerNetworkMode(), + Ports: []string{ + espressoAttestationVerifierPort, }, + Name: "attestation-verifier-zk", + Platform: "linux/amd64", + Environment: map[string]string{ + "NETWORK_RPC_URL": espressoAttestationVerifierNetworkRPCURL, + "SP1_PROVER": espressoAttestationVerifierSp1Prover, + "NITRO_VERIFIER_ADDRESS": espressoAttestationVerifierNitroVerifierAddress, + "USE_DOCKER": espressoAttestationVerifierUseDocker, + "SKIP_TIME_VALIDITY_CHECK": espressoAttestationVerifierSkipTimeValidityCheck, + "RUST_LOG": espressoAttestationVerifierRustLog, + "NETWORK_PRIVATE_KEY": espressoAttestationVerifierNetworkPrivateKey, + "RPC_URL": espressoAttestationVerifierRPCUrl, + "HOST": espressoAttestationVerifierHost, + "PORT": espressoAttestationVerifierPort, + }, + } + containerCli := new(DockerCli) + + attestationVerifierInfo, err := containerCli.LaunchContainer(ct.Ctx, dockerConfig) + if err != nil { + ct.Error = FailedToLaunchDockerContainer{Cause: err} + return + } + + // Get the actual mapped port + ports := attestationVerifierInfo.PortMap[espressoAttestationVerifierPort] + if len(ports) == 0 { + ct.Error = fmt.Errorf("no port mapping found for attestation verifier") + return } + healthCheckCtx, cancel := context.WithTimeout(ct.Ctx, 60*time.Second) + defer cancel() + + ticker := time.NewTicker(500 * time.Millisecond) + defer ticker.Stop() + attestationHostPort, err := getContainerRemappedHostPort(ports[0]) + if err != nil { + ct.Error = err + return + } + + // Use the actual host:port for health check + attestationURL := "http://" + attestationHostPort + + c.Espresso.EspressoAttestationService = attestationURL + + for { + select { + case <-healthCheckCtx.Done(): + ct.Error = fmt.Errorf("attestation verifier did not become healthy: %w", healthCheckCtx.Err()) + return + case <-ticker.C: + resp, err := http.Get(attestationURL + "/health") + if err == nil && resp.StatusCode == http.StatusOK { + resp.Body.Close() + goto healthy + } + if resp != nil { + resp.Body.Close() + } + } + } +healthy: } -// launchEspressoDevNodeDocker is E2eDevnetLauncherOption that launches th +// launchEspressoDevNodeAndAttestationVerifierZKStartOption is E2eDevnetLauncherOption that launches the // Espresso Dev Node within a Docker container. It also ensures that the // Espresso Dev Node is actively producing blocks before returning. -func launchEspressoDevNodeDocker() E2eDevnetLauncherOption { +func launchEspressoDevNodeAndAttestationServiceDocker() E2eDevnetLauncherOption { return func(ct *E2eDevnetLauncherContext) E2eSystemOption { return E2eSystemOption{ StartOptions: []e2esys.StartOption{ - launchEspressoDevNodeStartOption(ct), + launchEspressoDevNodeAndAttestationVerifierZKStartOption(ct), }, } } diff --git a/espresso/scripts/run-tests-github-actions.sh b/espresso/scripts/run-tests-github-actions.sh index fbbdb03646b..4ffb5498463 100644 --- a/espresso/scripts/run-tests-github-actions.sh +++ b/espresso/scripts/run-tests-github-actions.sh @@ -28,4 +28,4 @@ sudo systemctl start nitro-enclaves-allocator.service echo "[*] Running tests in nix develop shell..." -nix develop --command bash -c "just compile-contracts-fast && just build-batcher-enclave-image && just espresso-enclave-tests" +nix develop --command bash -c "source ./espresso/.env && just compile-contracts-fast && just build-batcher-enclave-image && just espresso-enclave-tests" diff --git a/op-batcher/batcher/driver.go b/op-batcher/batcher/driver.go index 664d483de67..bdb39d4c7e6 100644 --- a/op-batcher/batcher/driver.go +++ b/op-batcher/batcher/driver.go @@ -11,7 +11,6 @@ import ( "sync/atomic" "time" - "github.com/hf/nitrite" "golang.org/x/sync/errgroup" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -109,7 +108,23 @@ type DriverSetup struct { EspressoStreamer espresso.EspressoStreamer[derive.EspressoBatch] EspressoClient espressoClient.EspressoClient ChainSigner opcrypto.ChainSigner - Attestation *nitrite.Result + Attestation []byte +} + +type EspressoOnchainProof struct { + ZKType string `json:"zktype"` + ZKVMVersion string `json:"zkvm_version"` + ProgramID struct { + VerifierID string `json:"verifier_id"` + VerifierProofID string `json:"verifier_proof_id"` + AggregatorID string `json:"aggregator_id"` + } `json:"program_id"` + RawProof struct { + EncodedProof string `json:"encoded_proof"` + Journal string `json:"journal"` + } `json:"raw_proof"` + OnchainProof string `json:"onchain_proof"` + ProofType string `json:"proof_type"` } // BatchSubmitter encapsulates a service responsible for submitting L2 tx diff --git a/op-batcher/batcher/espresso.go b/op-batcher/batcher/espresso.go index 42040dbaa1b..5b8a2d7d997 100644 --- a/op-batcher/batcher/espresso.go +++ b/op-batcher/batcher/espresso.go @@ -1,8 +1,14 @@ package batcher import ( + "bytes" + "encoding/hex" + "encoding/json" "errors" "fmt" + "io" + "net/http" + "strings" "time" "context" @@ -12,8 +18,6 @@ import ( espressoClient "github.com/EspressoSystems/espresso-network/sdks/go/client" tagged_base64 "github.com/EspressoSystems/espresso-network/sdks/go/tagged-base64" espressoCommon "github.com/EspressoSystems/espresso-network/sdks/go/types" - - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" @@ -958,32 +962,38 @@ func (l *BatchSubmitter) registerBatcher(ctx context.Context) error { 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) + return fmt.Errorf("failed to check code at contract address: %w", err) } if len(code) == 0 { - return fmt.Errorf("No contract deployed at this address %w", err) + return fmt.Errorf("no contract deployed at this address %w", err) } - // Sishan TODO: I've skipped lots of verification for now as this will run out-of-gas, should replace it with zk tee nitro verifier later. - // Sishan TODO: this is also why `TestE2eDevnetWithInvalidAttestation` is failing now and we skipped it. - // Sishan TODO: relevant task and PR https://app.asana.com/1/1208976916964769/project/1209976130071762/task/1211868671079203?focus=true https://app.asana.com/1/1208976916964769/project/1209976130071762/task/1212349352131215?focus=true https://github.com/EspressoSystems/optimism-espresso-integration/pull/288 - abi, err := bindings.BatchAuthenticatorMetaData.GetAbi() if err != nil { return fmt.Errorf("failed to get Batch Authenticator ABI: %w", err) } - // Extract PCR0 hash from attestation document - pcr0Hash := crypto.Keccak256Hash(l.Attestation.Document.PCRs[0]) + onchainProof, err := l.GenerateZKProof(ctx, l.Attestation) + if err != nil { + l.Log.Error("failed to generate zk proof from nitro attestation", "err", err) + return fmt.Errorf("failed to generate zk proof from nitro attestation: %w", err) + } - // Extract enclave address from attestation document public key - // The publicKey's first byte 0x04 determines if the public key is compressed or not, so we ignore it - publicKeyHash := crypto.Keccak256Hash(l.Attestation.Document.PublicKey[1:]) - enclaveAddress := common.BytesToAddress(publicKeyHash[12:]) + journalBytes, err := hex.DecodeString(stripHexPrefix(onchainProof.RawProof.Journal)) + if err != nil { + l.Log.Error("failed to decode journal hex string", "err", err) + return fmt.Errorf("failed to decode journal hex string: %w", err) + } + onchainProofBytes, err := hex.DecodeString(stripHexPrefix(onchainProof.OnchainProof)) + if err != nil { + l.Log.Error("failed to decode onchain proof hex string", "err", err) + return fmt.Errorf("failed to decode onchain proof hex string: %w", err) + } + log.Info("successfully generated zk proof from nitro attestation") - txData, err := abi.Pack("registerSignerWithoutAttestationVerification", pcr0Hash, l.Attestation.COSESign1, l.Attestation.Signature, enclaveAddress) + txData, err := abi.Pack("registerSigner", journalBytes, onchainProofBytes) if err != nil { - return fmt.Errorf("failed to create RegisterSignerWithoutAttestationVerification transaction: %w", err) + return fmt.Errorf("failed to create registerSigner transaction: %w", err) } candidate := txmgr.TxCandidate{ @@ -1002,6 +1012,42 @@ func (l *BatchSubmitter) registerBatcher(ctx context.Context) error { return nil } +func (l *BatchSubmitter) GenerateZKProof(ctx context.Context, attestationBytes []byte) (*EspressoOnchainProof, error) { + attestationServiceURL := strings.TrimSuffix(l.Config.EspressoAttestationService, "/") + url := attestationServiceURL + "/generate_proof" + request, err := http.NewRequestWithContext(ctx, "POST", url, bytes.NewBuffer(attestationBytes)) + if err != nil { + return nil, err + } + + request.Header.Set("Content-Type", "application/octet-stream") + client := http.Client{ + Timeout: 2 * time.Minute, + } + res, err := client.Do(request) + if err != nil { + return nil, err + } + defer res.Body.Close() + + if res.StatusCode != http.StatusOK { + return nil, fmt.Errorf("received non-200 response: %d", res.StatusCode) + } + + responseData, err := io.ReadAll(res.Body) + if err != nil { + return nil, err + } + + var zkProof EspressoOnchainProof + err = json.Unmarshal(responseData, &zkProof) + if err != nil { + return nil, err + } + + return &zkProof, nil +} + // sendTxWithEspresso uses the txmgr queue to send the given transaction candidate after setting // its gaslimit. It will block if the txmgr queue has reached its MaxPendingTransactions limit. func (l *BatchSubmitter) sendTxWithEspresso(txdata txData, isCancel bool, candidate *txmgr.TxCandidate, queue TxSender[txRef], receiptsCh chan txmgr.TxReceipt[txRef]) { @@ -1083,3 +1129,10 @@ func (l *BatchSubmitter) sendTxWithEspresso(txdata txData, isCancel bool, candid l.Log.Debug("Queueing transaction", "txRef", transactionReference) queue.Send(transactionReference, *candidate, receiptsCh) } + +func stripHexPrefix(hexStr string) string { + if len(hexStr) >= 2 && hexStr[:2] == "0x" { + return hexStr[2:] + } + return hexStr +} diff --git a/op-batcher/batcher/service.go b/op-batcher/batcher/service.go index bded41e01b0..7e13a615644 100644 --- a/op-batcher/batcher/service.go +++ b/op-batcher/batcher/service.go @@ -39,10 +39,11 @@ import ( var ErrAlreadyStopped = errors.New("already stopped") type BatcherConfig struct { - NetworkTimeout time.Duration - PollInterval time.Duration - EspressoPollInterval time.Duration - MaxPendingTransactions uint64 + NetworkTimeout time.Duration + PollInterval time.Duration + EspressoPollInterval time.Duration + EspressoAttestationService string + MaxPendingTransactions uint64 // UseAltDA is true if the rollup config has a DA challenge address so the batcher // will post inputs to the DA server and post commitments to blobs or calldata. @@ -94,7 +95,7 @@ type BatcherService struct { opcrypto.ChainSigner EspressoStreamer espresso.EspressoStreamer[derive.EspressoBatch] EspressoClient espressoClient.EspressoClient - Attestation *nitrite.Result + Attestation []byte } type DriverSetupOption func(setup *DriverSetup) @@ -564,6 +565,7 @@ func (bs *BatcherService) initEspresso(cfg *CLIConfig) error { bs.UseEspresso = true bs.EspressoPollInterval = cfg.Espresso.PollInterval + bs.EspressoAttestationService = cfg.Espresso.EspressoAttestationService urlZero := cfg.Espresso.QueryServiceURLs[0] espressoClient := espressoClient.NewClient(urlZero) @@ -606,11 +608,11 @@ func (bs *BatcherService) initEspresso(cfg *CLIConfig) error { } else { // output length of attestation bs.Log.Info("Successfully got attestation. Attestation length", "length", len(attestationBytes)) - result, err := nitrite.Verify(attestationBytes, nitrite.VerifyOptions{}) + _, err := nitrite.Verify(attestationBytes, nitrite.VerifyOptions{}) if err != nil { return fmt.Errorf("Couldn't verify attestation: %w", err) } - bs.Attestation = result + bs.Attestation = attestationBytes } return nil diff --git a/op-batcher/bindings/batch_authenticator.go b/op-batcher/bindings/batch_authenticator.go index f279acfe157..c7d7b9f35f6 100644 --- a/op-batcher/bindings/batch_authenticator.go +++ b/op-batcher/bindings/batch_authenticator.go @@ -31,8 +31,8 @@ var ( // BatchAuthenticatorMetaData contains all meta data concerning the BatchAuthenticator contract. var BatchAuthenticatorMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"_espressoTEEVerifier\",\"type\":\"address\",\"internalType\":\"contractIEspressoTEEVerifier\"},{\"name\":\"_teeBatcher\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_nonTeeBatcher\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"activeIsTee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"authenticateBatchInfo\",\"inputs\":[{\"name\":\"commitment\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_signature\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"decodeAttestationTbs\",\"inputs\":[{\"name\":\"attestation\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"espressoTEEVerifier\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"contractIEspressoTEEVerifier\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"nitroValidator\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"contractINitroValidator\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"nonTeeBatcher\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"registerSigner\",\"inputs\":[{\"name\":\"attestationTbs\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"signature\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"registerSignerWithoutAttestationVerification\",\"inputs\":[{\"name\":\"pcr0Hash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"attestationTbs\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"signature\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"enclaveAddress\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"switchBatcher\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"teeBatcher\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"validBatchInfo\",\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"version\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false}]", - Bin: "0x6101006040523461007b5761001e610015610197565b9291909161045e565b610026610080565b611dc1610668823960805181818161088001526115ba015260a0518161075e015260c0518181816109b801528181610bc501528181610f9201526114b9015260e05181818161029b0152610e780152611dc190f35b610086565b60405190565b5f80fd5b601f801991011690565b634e487b7160e01b5f52604160045260245ffd5b906100b29061008a565b810190811060018060401b038211176100ca57604052565b610094565b906100e26100db610080565b92836100a8565b565b5f80fd5b60018060a01b031690565b6100fc906100e8565b90565b610108906100f3565b90565b610114816100ff565b0361011b57565b5f80fd5b9050519061012c8261010b565b565b610137816100f3565b0361013e57565b5f80fd5b9050519061014f8261012e565b565b60808183031261019257610167825f830161011f565b9261018f6101788460208501610142565b936101868160408601610142565b93606001610142565b90565b6100e4565b6101b5612429803803806101aa816100cf565b928339810190610151565b90919293565b90565b90565b6101d56101d06101da926101bb565b6101be565b6100e8565b90565b6101e6906101c1565b90565b60209181520190565b60207f6368657200000000000000000000000000000000000000000000000000000000917f426174636841757468656e74696361746f723a207a65726f20746565206261745f8201520152565b61024c60246040926101e9565b610255816101f2565b0190565b61026e9060208101905f81830391015261023f565b90565b1561027857565b610280610080565b62461bcd60e51b81528061029660048201610259565b0390fd5b60207f2062617463686572000000000000000000000000000000000000000000000000917f426174636841757468656e74696361746f723a207a65726f206e6f6e2d7465655f8201520152565b6102f460286040926101e9565b6102fd8161029a565b0190565b6103169060208101905f8183039101526102e7565b90565b1561032057565b610328610080565b62461bcd60e51b81528061033e60048201610301565b0390fd5b61034c90516100ff565b90565b61036361035e610368926100e8565b6101be565b6100e8565b90565b6103749061034f565b90565b6103809061036b565b90565b60e01b90565b610392906100f3565b90565b61039e81610389565b036103a557565b5f80fd5b905051906103b682610395565b565b906020828203126103d1576103ce915f016103a9565b90565b6100e4565b5f0190565b6103e3610080565b3d5f823e3d90fd5b6103f49061036b565b90565b6104009061034f565b90565b61040c906103f7565b90565b5f1b90565b9061042060ff9161040f565b9181191691161790565b151590565b6104389061042a565b90565b90565b9061045361044e61045a9261042f565b61043b565b8254610414565b9055565b906104ea93929161046d61056a565b6104928261048b6104856104805f6101dd565b6100f3565b916100f3565b1415610271565b6104b7836104b06104aa6104a55f6101dd565b6100f3565b916100f3565b1415610319565b60c05260805260a05260206104d46104cf60c0610342565b610377565b63d80a4c28906104e2610080565b948592610383565b825281806104fa600482016103d6565b03915afa80156105655761051c61052191610535945f91610537575b506103eb565b610403565b60e0526105306001600261043e565b6105f7565b565b610558915060203d811161055e575b61055081836100a8565b8101906103b8565b5f610516565b503d610546565b6103db565b61057a61057561065a565b6105f7565b565b5f1c90565b60018060a01b031690565b61059861059d9161057c565b610581565b90565b6105aa905461058c565b90565b906105be60018060a01b039161040f565b9181191691161790565b6105d19061036b565b90565b90565b906105ec6105e76105f3926105c8565b6105d4565b82546105ad565b9055565b6106005f6105a0565b61060a825f6105d7565b9061063e6106387f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0936105c8565b916105c8565b91610647610080565b80610651816103d6565b0390a3565b5f90565b610662610656565b50339056fe60806040526004361015610013575b610ab7565b61001d5f3561010c565b806302afd6e3146101075780631b076a4c1461010257806354fd4d50146100fd578063715018a6146100f85780637877a9ed146100f35780638da5cb5b146100ee578063a903a277146100e9578063b1bd4285146100e4578063ba58e82a146100df578063bc347f47146100da578063d909ba7c146100d5578063f2fde38b146100d0578063f81f2083146100cb578063fa14fe6d146100c65763fc619e410361000e57610a83565b610a08565b610981565b6108f5565b6108a2565b61084b565b610814565b610780565b610726565b6105c8565b610571565b6104d8565b6104a3565b610316565b610250565b60e01c90565b60405190565b5f80fd5b5f80fd5b5f80fd5b90565b61013081610124565b0361013757565b5f80fd5b9050359061014882610127565b565b5f80fd5b5f80fd5b5f80fd5b909182601f830112156101905781359167ffffffffffffffff831161018b57602001926001830284011161018657565b610152565b61014e565b61014a565b60018060a01b031690565b6101a990610195565b90565b6101b5816101a0565b036101bc57565b5f80fd5b905035906101cd826101ac565b565b9190608083820312610246576101e7815f850161013b565b92602081013567ffffffffffffffff81116102415782610208918301610156565b929093604083013567ffffffffffffffff811161023c5761022e83610239928601610156565b9390946060016101c0565b90565b610120565b610120565b61011c565b5f0190565b346102855761026f6102633660046101cf565b94939093929192610bb6565b610277610112565b806102818161024b565b0390f35b610118565b5f91031261029457565b61011c565b7f000000000000000000000000000000000000000000000000000000000000000090565b90565b6102d46102cf6102d992610195565b6102bd565b610195565b90565b6102e5906102c0565b90565b6102f1906102dc565b90565b6102fd906102e8565b9052565b9190610314905f602085019401906102f4565b565b346103465761032636600461028a565b610342610331610299565b610339610112565b91829182610301565b0390f35b610118565b601f801991011690565b634e487b7160e01b5f52604160045260245ffd5b906103739061034b565b810190811067ffffffffffffffff82111761038d57604052565b610355565b906103a561039e610112565b9283610369565b565b67ffffffffffffffff81116103c5576103c160209161034b565b0190565b610355565b906103dc6103d7836103a7565b610392565b918252565b5f7f312e302e30000000000000000000000000000000000000000000000000000000910152565b61041260056103ca565b9061041f602083016103e1565b565b610429610408565b90565b610434610421565b90565b61043f61042c565b90565b5190565b60209181520190565b90825f9392825e0152565b6104796104826020936104879361047081610442565b93848093610446565b9586910161044f565b61034b565b0190565b6104a09160208201915f81840391015261045a565b90565b346104d3576104b336600461028a565b6104cf6104be610437565b6104c6610112565b9182918261048b565b0390f35b610118565b34610506576104e836600461028a565b6104f0610d34565b6104f8610112565b806105028161024b565b0390f35b610118565b1c90565b60ff1690565b61052590600861052a930261050b565b61050f565b90565b906105389154610515565b90565b61054760025f9061052d565b90565b151590565b6105589061054a565b9052565b919061056f905f6020850194019061054f565b565b346105a15761058136600461028a565b61059d61058c61053b565b610594610112565b9182918261055c565b0390f35b610118565b6105af906101a0565b9052565b91906105c6905f602085019401906105a6565b565b346105f8576105d836600461028a565b6105f46105e3610d73565b6105eb610112565b918291826105b3565b0390f35b610118565b5f80fd5b67ffffffffffffffff811161061f5761061b60209161034b565b0190565b610355565b90825f939282370152565b9092919261064461063f82610601565b610392565b938185526020850190828401116106605761065e92610624565b565b6105fd565b9080601f83011215610683578160206106809335910161062f565b90565b61014a565b906020828203126106b8575f82013567ffffffffffffffff81116106b3576106b09201610665565b90565b610120565b61011c565b5190565b60209181520190565b6106e96106f26020936106f7936106e0816106bd565b938480936106c1565b9586910161044f565b61034b565b0190565b90916107156107239360408401908482035f8601526106ca565b9160208184039101526106ca565b90565b346107575761073e610739366004610688565b610e5b565b9061075361074a610112565b928392836106fb565b0390f35b610118565b7f000000000000000000000000000000000000000000000000000000000000000090565b346107b05761079036600461028a565b6107ac61079b61075c565b6107a3610112565b918291826105b3565b0390f35b610118565b909160408284031261080f575f82013567ffffffffffffffff811161080a57836107e0918401610156565b929093602082013567ffffffffffffffff8111610805576108019201610156565b9091565b610120565b610120565b61011c565b34610846576108306108273660046107b5565b92919091610f8a565b610838610112565b806108428161024b565b0390f35b610118565b346108795761085b36600461028a565b6108636110d9565b61086b610112565b806108758161024b565b0390f35b610118565b7f000000000000000000000000000000000000000000000000000000000000000090565b346108d2576108b236600461028a565b6108ce6108bd61087e565b6108c5610112565b918291826105b3565b0390f35b610118565b906020828203126108f0576108ed915f016101c0565b90565b61011c565b346109235761090d6109083660046108d7565b6111ce565b610915610112565b8061091f8161024b565b0390f35b610118565b906020828203126109415761093e915f0161013b565b90565b61011c565b61094f90610124565b90565b9061095c90610946565b5f5260205260405f2090565b61097e906109796001915f92610952565b61052d565b90565b346109b1576109ad61099c610997366004610928565b610968565b6109a4610112565b9182918261055c565b0390f35b610118565b7f000000000000000000000000000000000000000000000000000000000000000090565b6109e3906102dc565b90565b6109ef906109da565b9052565b9190610a06905f602085019401906109e6565b565b34610a3857610a1836600461028a565b610a34610a236109b6565b610a2b610112565b918291826109f3565b0390f35b610118565b919091604081840312610a7e57610a56835f830161013b565b92602082013567ffffffffffffffff8111610a7957610a759201610156565b9091565b610120565b61011c565b34610ab257610a9c610a96366004610a3d565b91611436565b610aa4610112565b80610aae8161024b565b0390f35b610118565b5f80fd5b5f80fd5b60e01b90565b610ace906101a0565b90565b610ada81610ac5565b03610ae157565b5f80fd5b90505190610af282610ad1565b565b90602082820312610b0d57610b0a915f01610ae5565b90565b61011c565b610b1a610112565b3d5f823e3d90fd5b610b2b906102dc565b90565b5f910312610b3857565b61011c565b610b4690610124565b9052565b9190610b6481610b5d81610b69956106c1565b8095610624565b61034b565b0190565b9695939094610b9e88606095610bac95610b91610bb49a5f60808601950190610b3d565b8b830360208d0152610b4a565b9188830360408a0152610b4a565b9401906105a6565b565b9194909293610bff6020610be97f00000000000000000000000000000000000000000000000000000000000000006109da565b63d80a4c2890610bf7610112565b938492610abf565b82528180610c0f6004820161024b565b03915afa8015610cdf57610c2a915f91610cb1575b50610b22565b926302afd6e390949695919295843b15610cac575f96610c5e948894610c6993610c52610112565b9b8c9a8b998a98610abf565b885260048801610b6d565b03925af18015610ca757610c7b575b50565b610c9a905f3d8111610ca0575b610c928183610369565b810190610b2e565b5f610c78565b503d610c88565b610b12565b610abb565b610cd2915060203d8111610cd8575b610cca8183610369565b810190610af4565b5f610c24565b503d610cc0565b610b12565b610cec61174a565b610cf4610d21565b565b90565b610d0d610d08610d1292610cf6565b6102bd565b610195565b90565b610d1e90610cf9565b90565b610d32610d2d5f610d15565b6117c0565b565b610d3c610ce4565b565b5f90565b5f1c90565b60018060a01b031690565b610d5e610d6391610d42565b610d47565b90565b610d709054610d52565b90565b610d7b610d3e565b50610d855f610d66565b90565b606090565b90929192610da2610d9d82610601565b610392565b93818552602085019082840111610dbe57610dbc9261044f565b565b6105fd565b9080601f83011215610de157816020610dde93519101610d8d565b90565b61014a565b919091604081840312610e3e575f81015167ffffffffffffffff8111610e395783610e12918301610dc3565b92602082015167ffffffffffffffff8111610e3457610e319201610dc3565b90565b610120565b610120565b61011c565b610e589160208201915f8184039101526106ca565b90565b905f610ec392610e69610d88565b50610e72610d88565b50610e9c7f00000000000000000000000000000000000000000000000000000000000000006102e8565b610eb863a903a277610eac610112565b96879485938493610abf565b835260048301610e43565b03915afa8015610f03575f80939091610edc575b509190565b9050610efb9192503d805f833e610ef38183610369565b810190610de6565b91905f610ed7565b610b12565b634e487b7160e01b5f52602160045260245ffd5b60021115610f2657565b610f08565b90610f3582610f1c565b565b610f4090610f2b565b90565b610f4c90610f37565b9052565b959492610f8894610f72610f809360409560608b01918b83035f8d0152610b4a565b9188830360208a0152610b4a565b940190610f43565b565b929192610fb67f00000000000000000000000000000000000000000000000000000000000000006109da565b906335ecb4c190929493600191833b1561103857610ff5610fea935f97938894610fde610112565b9a8b998a988997610abf565b875260048701610f50565b03925af1801561103357611007575b50565b611026905f3d811161102c575b61101e8183610369565b810190610b2e565b5f611004565b503d611014565b610b12565b610abb565b61104561174a565b61104d6110ba565b565b61105b61106091610d42565b61050f565b90565b61106d905461104f565b90565b5f1b90565b9061108160ff91611070565b9181191691161790565b6110949061054a565b90565b90565b906110af6110aa6110b69261108b565b611097565b8254611075565b9055565b6110d76110d06110ca6002611063565b1561054a565b600261109a565b565b6110e161103d565b565b6110f4906110ef61174a565b61119e565b565b60207f6464726573730000000000000000000000000000000000000000000000000000917f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20615f8201520152565b6111506026604092610446565b611159816110f6565b0190565b6111729060208101905f818303910152611143565b90565b1561117c57565b611184610112565b62461bcd60e51b81528061119a6004820161115d565b0390fd5b6111cc906111c7816111c06111ba6111b55f610d15565b6101a0565b916101a0565b1415611175565b6117c0565b565b6111d7906110e3565b565b6111e491369161062f565b90565b634e487b7160e01b5f52603260045260245ffd5b90611205826106bd565b81101561121757600160209102010190565b6111e7565b90565b90565b61123661123161123b9261121c565b6102bd565b61121f565b90565b60ff60f81b1690565b611251905161123e565b90565b60f81c90565b60ff1690565b61127461126f6112799261125a565b6102bd565b61125a565b90565b61128861128d91611254565b611260565b90565b6112a461129f6112a992610cf6565b6102bd565b61125a565b90565b90565b6112c36112be6112c8926112ac565b6102bd565b61125a565b90565b90565b6112e26112dd6112e7926112cb565b6102bd565b61125a565b90565b634e487b7160e01b5f52601160045260245ffd5b61130a6113109161125a565b9161125a565b019060ff821161131c57565b6112ea565b60f81b90565b61133b6113366113409261125a565b611321565b61123e565b90565b5f7f496e76616c6964207369676e6174757265000000000000000000000000000000910152565b6113776011602092610446565b61138081611343565b0190565b6113999060208101905f81830391015261136a565b90565b6113a58161054a565b036113ac57565b5f80fd5b905051906113bd8261139c565b565b906020828203126113d8576113d5915f016113b0565b90565b61011c565b5f7f496e76616c6964207369676e6572000000000000000000000000000000000000910152565b611411600e602092610446565b61141a816113dd565b0190565b6114339060208101905f818303910152611404565b90565b916114449061148f926111d9565b61146861146361145e836114586040611222565b906111fb565b611247565b61127c565b8061147b6114755f611290565b9161125a565b1480156116ae575b611673575b508261181f565b806114aa6114a461149f5f610d15565b6101a0565b916101a0565b14611651576114f360206114dd7f00000000000000000000000000000000000000000000000000000000000000006109da565b63d80a4c28906114eb610112565b938492610abf565b825281806115036004820161024b565b03915afa801561164c5761152460209161154e935f9161161f575b50610b22565b630123d0c1906115438592611537610112565b95869485938493610abf565b8352600483016105b3565b03915afa801561161a5761156a915f916115ec575b501561054a565b90816115b0575b5061158e5761158c906115876001916001610952565b61109a565b565b611596610112565b62461bcd60e51b8152806115ac6004820161141e565b0390fd5b90506115e46115de7f00000000000000000000000000000000000000000000000000000000000000006101a0565b916101a0565b14155f611571565b61160d915060203d8111611613575b6116058183610369565b8101906113bf565b5f611563565b503d6115fb565b610b12565b61163f9150833d8111611645575b6116378183610369565b810190610af4565b5f61151e565b503d61162d565b610b12565b611659610112565b62461bcd60e51b81528061166f60048201611384565b0390fd5b61168a61168f91611684601b6112ce565b906112fe565b611327565b6116a7826116a16040935f1a93611222565b906111fb565b535f611488565b50806116c36116bd60016112af565b9161125a565b14611483565b5f7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572910152565b6116fc60208092610446565b611705816116c9565b0190565b61171e9060208101905f8183039101526116f0565b90565b1561172857565b611730610112565b62461bcd60e51b81528061174660048201611709565b0390fd5b611774611755610d73565b61176e611768611763611840565b6101a0565b916101a0565b14611721565b565b9061178760018060a01b0391611070565b9181191691161790565b61179a906102dc565b90565b90565b906117b56117b06117bc92611791565b61179d565b8254611776565b9055565b6117c95f610d66565b6117d3825f6117a0565b906118076118017f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e093611791565b91611791565b91611810610112565b8061181a8161024b565b0390a3565b61183d916118359161182f610d3e565b50611878565b919091611ac7565b90565b611848610d3e565b503390565b5f90565b90565b61186861186361186d92611851565b6102bd565b61121f565b90565b5f90565b5f90565b611880610d3e565b5061188961184d565b50611893826106bd565b6118a66118a06041611854565b9161121f565b145f146118eb576118e5916118b9611870565b506118c2611870565b506118cb611874565b506020810151606060408301519201515f1a909192611c90565b91909190565b50506118f65f610d15565b90600290565b6005111561190657565b610f08565b90611915826118fc565b565b60207f7565000000000000000000000000000000000000000000000000000000000000917f45434453413a20696e76616c6964207369676e6174757265202776272076616c5f8201520152565b6119716022604092610446565b61197a81611917565b0190565b6119939060208101905f818303910152611964565b90565b60207f7565000000000000000000000000000000000000000000000000000000000000917f45434453413a20696e76616c6964207369676e6174757265202773272076616c5f8201520152565b6119f06022604092610446565b6119f981611996565b0190565b611a129060208101905f8183039101526119e3565b90565b5f7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800910152565b611a49601f602092610446565b611a5281611a15565b0190565b611a6b9060208101905f818303910152611a3c565b90565b5f7f45434453413a20696e76616c6964207369676e61747572650000000000000000910152565b611aa26018602092610446565b611aab81611a6e565b0190565b611ac49060208101905f818303910152611a95565b90565b80611ada611ad45f61190b565b9161190b565b145f14611ae45750565b80611af8611af2600161190b565b9161190b565b145f14611b2157611b07610112565b62461bcd60e51b815280611b1d60048201611aaf565b0390fd5b80611b35611b2f600261190b565b9161190b565b145f14611b5e57611b44610112565b62461bcd60e51b815280611b5a60048201611a56565b0390fd5b80611b72611b6c600361190b565b9161190b565b145f14611b9b57611b81610112565b62461bcd60e51b815280611b97600482016119fd565b0390fd5b611bae611ba8600461190b565b9161190b565b14611bb557565b611bbd610112565b62461bcd60e51b815280611bd36004820161197e565b0390fd5b611beb611be6611bf09261121f565b6102bd565b61121f565b90565b611bff611c0491610d42565b611bd7565b90565b90565b611c1e611c19611c2392611c07565b6102bd565b61121f565b90565b90565b611c3d611c38611c4292611c26565b6102bd565b61125a565b90565b611c4e9061125a565b9052565b611c87611c8e94611c7d606094989795611c73608086019a5f870190610b3d565b6020850190611c45565b6040830190610b3d565b0190610b3d565b565b929190611c9b610d3e565b50611ca461184d565b50611cae83611bf3565b611ce0611cda7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0611c0a565b9161121f565b11611da15780611cf9611cf3601b6112ce565b9161125a565b141580611d85575b611d7257611d205f936020959293611d17610112565b94859485611c52565b838052039060015afa15611d6d57611d385f51611070565b80611d53611d4d611d485f610d15565b6101a0565b916101a0565b14611d5d57905f90565b50611d675f610d15565b90600190565b610b12565b50505050611d7f5f610d15565b90600490565b5080611d9a611d94601c611c29565b9161125a565b1415611d01565b50505050611dae5f610d15565b9060039056fea164736f6c634300081c000a", + ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"_espressoTEEVerifier\",\"type\":\"address\",\"internalType\":\"contractIEspressoTEEVerifier\"},{\"name\":\"_teeBatcher\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_nonTeeBatcher\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"activeIsTee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"authenticateBatchInfo\",\"inputs\":[{\"name\":\"commitment\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_signature\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"espressoTEEVerifier\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"contractIEspressoTEEVerifier\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"nonTeeBatcher\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"registerSigner\",\"inputs\":[{\"name\":\"attestationTbs\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"signature\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"switchBatcher\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"teeBatcher\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"validBatchInfo\",\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"version\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false}]", + Bin: "0x60e060405234801561000f575f5ffd5b50604051611b25380380611b2583398181016040528101906100319190610358565b61004d6100426101f760201b60201c565b6101fe60201b60201c565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036100bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100b29061043c565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610129576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610120906104ca565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff16815250508273ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508173ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1681525050600160025f6101000a81548160ff0219169083151502179055506101ee816101fe60201b60201c565b505050506104e8565b5f33905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6102ec826102c3565b9050919050565b5f6102fd826102e2565b9050919050565b61030d816102f3565b8114610317575f5ffd5b50565b5f8151905061032881610304565b92915050565b610337816102e2565b8114610341575f5ffd5b50565b5f815190506103528161032e565b92915050565b5f5f5f5f608085870312156103705761036f6102bf565b5b5f61037d8782880161031a565b945050602061038e87828801610344565b935050604061039f87828801610344565b92505060606103b087828801610344565b91505092959194509250565b5f82825260208201905092915050565b7f426174636841757468656e74696361746f723a207a65726f20746565206261745f8201527f6368657200000000000000000000000000000000000000000000000000000000602082015250565b5f6104266024836103bc565b9150610431826103cc565b604082019050919050565b5f6020820190508181035f8301526104538161041a565b9050919050565b7f426174636841757468656e74696361746f723a207a65726f206e6f6e2d7465655f8201527f2062617463686572000000000000000000000000000000000000000000000000602082015250565b5f6104b46028836103bc565b91506104bf8261045a565b604082019050919050565b5f6020820190508181035f8301526104e1816104a8565b9050919050565b60805160a05160c0516115fe6105275f395f81816102ad0152818161043701526105b101525f61028901525f818161037401526106bd01526115fe5ff3fe608060405234801561000f575f5ffd5b50600436106100b2575f3560e01c8063bc347f471161006f578063bc347f4714610154578063d909ba7c1461015e578063f2fde38b1461017c578063f81f208314610198578063fa14fe6d146101c8578063fc619e41146101e6576100b2565b806354fd4d50146100b6578063715018a6146100d45780637877a9ed146100de5780638da5cb5b146100fc578063b1bd42851461011a578063ba58e82a14610138575b5f5ffd5b6100be610202565b6040516100cb9190610c6f565b60405180910390f35b6100dc61023b565b005b6100e661024e565b6040516100f39190610ca9565b60405180910390f35b610104610260565b6040516101119190610d01565b60405180910390f35b610122610287565b60405161012f9190610d01565b60405180910390f35b610152600480360381019061014d9190610d83565b6102ab565b005b61015c610340565b005b610166610372565b6040516101739190610d01565b60405180910390f35b61019660048036038101906101919190610e2b565b610396565b005b6101b260048036038101906101ad9190610e89565b610418565b6040516101bf9190610ca9565b60405180910390f35b6101d0610435565b6040516101dd9190610f0f565b60405180910390f35b61020060048036038101906101fb9190610f28565b610459565b005b6040518060400160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b61024361077c565b61024c5f6107fa565b565b60025f9054906101000a900460ff1681565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166335ecb4c18585858560016040518663ffffffff1660e01b815260040161030d959493929190611042565b5f604051808303815f87803b158015610324575f5ffd5b505af1158015610336573d5f5f3e3d5ffd5b5050505050505050565b61034861077c565b60025f9054906101000a900460ff161560025f6101000a81548160ff021916908315150217905550565b7f000000000000000000000000000000000000000000000000000000000000000081565b61039e61077c565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361040c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610403906110f9565b60405180910390fd5b610415816107fa565b50565b6001602052805f5260405f205f915054906101000a900460ff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f82828080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f8201169050808301925050505050505090505f816040815181106104b5576104b4611117565b5b602001015160f81c60f81b60f81c90505f8160ff1614806104d9575060018160ff16145b1561053457601b816104eb919061117d565b90508060f81b8260408151811061050557610504611117565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505b5f61053f86846108bb565b90505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036105af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a6906111fb565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d80a4c286040518163ffffffff1660e01b8152600401602060405180830381865afa158015610618573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061063c9190611254565b73ffffffffffffffffffffffffffffffffffffffff16630123d0c1826040518263ffffffff1660e01b81526004016106749190610d01565b602060405180830381865afa15801561068f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106b391906112a9565b15801561070c57507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1561074c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107439061131e565b60405180910390fd5b6001805f8881526020019081526020015f205f6101000a81548160ff021916908315150217905550505050505050565b6107846108e0565b73ffffffffffffffffffffffffffffffffffffffff166107a2610260565b73ffffffffffffffffffffffffffffffffffffffff16146107f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ef90611386565b60405180910390fd5b565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f5f5f6108c885856108e7565b915091506108d581610933565b819250505092915050565b5f33905090565b5f5f6041835103610924575f5f5f602086015192506040860151915060608601515f1a905061091887828585610afe565b9450945050505061092c565b5f6002915091505b9250929050565b5f600481111561094657610945610fcf565b5b81600481111561095957610958610fcf565b5b0315610afb576001600481111561097357610972610fcf565b5b81600481111561098657610985610fcf565b5b036109c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109bd906113ee565b60405180910390fd5b600260048111156109da576109d9610fcf565b5b8160048111156109ed576109ec610fcf565b5b03610a2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2490611456565b60405180910390fd5b60036004811115610a4157610a40610fcf565b5b816004811115610a5457610a53610fcf565b5b03610a94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8b906114e4565b60405180910390fd5b600480811115610aa757610aa6610fcf565b5b816004811115610aba57610ab9610fcf565b5b03610afa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af190611572565b60405180910390fd5b5b50565b5f5f7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0835f1c1115610b36575f600391509150610bf6565b601b8560ff1614158015610b4e5750601c8560ff1614155b15610b5f575f600491509150610bf6565b5f6001878787876040515f8152602001604052604051610b8294939291906115ae565b6020604051602081039080840390855afa158015610ba2573d5f5f3e3d5ffd5b5050506020604051035190505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610bee575f60019250925050610bf6565b805f92509250505b94509492505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f610c4182610bff565b610c4b8185610c09565b9350610c5b818560208601610c19565b610c6481610c27565b840191505092915050565b5f6020820190508181035f830152610c878184610c37565b905092915050565b5f8115159050919050565b610ca381610c8f565b82525050565b5f602082019050610cbc5f830184610c9a565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610ceb82610cc2565b9050919050565b610cfb81610ce1565b82525050565b5f602082019050610d145f830184610cf2565b92915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f840112610d4357610d42610d22565b5b8235905067ffffffffffffffff811115610d6057610d5f610d26565b5b602083019150836001820283011115610d7c57610d7b610d2a565b5b9250929050565b5f5f5f5f60408587031215610d9b57610d9a610d1a565b5b5f85013567ffffffffffffffff811115610db857610db7610d1e565b5b610dc487828801610d2e565b9450945050602085013567ffffffffffffffff811115610de757610de6610d1e565b5b610df387828801610d2e565b925092505092959194509250565b610e0a81610ce1565b8114610e14575f5ffd5b50565b5f81359050610e2581610e01565b92915050565b5f60208284031215610e4057610e3f610d1a565b5b5f610e4d84828501610e17565b91505092915050565b5f819050919050565b610e6881610e56565b8114610e72575f5ffd5b50565b5f81359050610e8381610e5f565b92915050565b5f60208284031215610e9e57610e9d610d1a565b5b5f610eab84828501610e75565b91505092915050565b5f819050919050565b5f610ed7610ed2610ecd84610cc2565b610eb4565b610cc2565b9050919050565b5f610ee882610ebd565b9050919050565b5f610ef982610ede565b9050919050565b610f0981610eef565b82525050565b5f602082019050610f225f830184610f00565b92915050565b5f5f5f60408486031215610f3f57610f3e610d1a565b5b5f610f4c86828701610e75565b935050602084013567ffffffffffffffff811115610f6d57610f6c610d1e565b5b610f7986828701610d2e565b92509250509250925092565b5f82825260208201905092915050565b828183375f83830152505050565b5f610fae8385610f85565b9350610fbb838584610f95565b610fc483610c27565b840190509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b6002811061100d5761100c610fcf565b5b50565b5f81905061101d82610ffc565b919050565b5f61102c82611010565b9050919050565b61103c81611022565b82525050565b5f6060820190508181035f83015261105b818789610fa3565b90508181036020830152611070818587610fa3565b905061107f6040830184611033565b9695505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20615f8201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b5f6110e3602683610c09565b91506110ee82611089565b604082019050919050565b5f6020820190508181035f830152611110816110d7565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60ff82169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61118782611144565b915061119283611144565b9250828201905060ff8111156111ab576111aa611150565b5b92915050565b7f496e76616c6964207369676e61747572650000000000000000000000000000005f82015250565b5f6111e5601183610c09565b91506111f0826111b1565b602082019050919050565b5f6020820190508181035f830152611212816111d9565b9050919050565b5f61122382610ce1565b9050919050565b61123381611219565b811461123d575f5ffd5b50565b5f8151905061124e8161122a565b92915050565b5f6020828403121561126957611268610d1a565b5b5f61127684828501611240565b91505092915050565b61128881610c8f565b8114611292575f5ffd5b50565b5f815190506112a38161127f565b92915050565b5f602082840312156112be576112bd610d1a565b5b5f6112cb84828501611295565b91505092915050565b7f496e76616c6964207369676e65720000000000000000000000000000000000005f82015250565b5f611308600e83610c09565b9150611313826112d4565b602082019050919050565b5f6020820190508181035f830152611335816112fc565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f611370602083610c09565b915061137b8261133c565b602082019050919050565b5f6020820190508181035f83015261139d81611364565b9050919050565b7f45434453413a20696e76616c6964207369676e617475726500000000000000005f82015250565b5f6113d8601883610c09565b91506113e3826113a4565b602082019050919050565b5f6020820190508181035f830152611405816113cc565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e677468005f82015250565b5f611440601f83610c09565b915061144b8261140c565b602082019050919050565b5f6020820190508181035f83015261146d81611434565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c5f8201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b5f6114ce602283610c09565b91506114d982611474565b604082019050919050565b5f6020820190508181035f8301526114fb816114c2565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c5f8201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b5f61155c602283610c09565b915061156782611502565b604082019050919050565b5f6020820190508181035f83015261158981611550565b9050919050565b61159981610e56565b82525050565b6115a881611144565b82525050565b5f6080820190506115c15f830187611590565b6115ce602083018661159f565b6115db6040830185611590565b6115e86060830184611590565b9594505050505056fea164736f6c634300081e000a", } // BatchAuthenticatorABI is the input ABI used to generate the binding from. @@ -233,38 +233,6 @@ func (_BatchAuthenticator *BatchAuthenticatorCallerSession) ActiveIsTee() (bool, return _BatchAuthenticator.Contract.ActiveIsTee(&_BatchAuthenticator.CallOpts) } -// DecodeAttestationTbs is a free data retrieval call binding the contract method 0xa903a277. -// -// Solidity: function decodeAttestationTbs(bytes attestation) view returns(bytes, bytes) -func (_BatchAuthenticator *BatchAuthenticatorCaller) DecodeAttestationTbs(opts *bind.CallOpts, attestation []byte) ([]byte, []byte, error) { - var out []interface{} - err := _BatchAuthenticator.contract.Call(opts, &out, "decodeAttestationTbs", attestation) - - if err != nil { - return *new([]byte), *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - out1 := *abi.ConvertType(out[1], new([]byte)).(*[]byte) - - return out0, out1, err - -} - -// DecodeAttestationTbs is a free data retrieval call binding the contract method 0xa903a277. -// -// Solidity: function decodeAttestationTbs(bytes attestation) view returns(bytes, bytes) -func (_BatchAuthenticator *BatchAuthenticatorSession) DecodeAttestationTbs(attestation []byte) ([]byte, []byte, error) { - return _BatchAuthenticator.Contract.DecodeAttestationTbs(&_BatchAuthenticator.CallOpts, attestation) -} - -// DecodeAttestationTbs is a free data retrieval call binding the contract method 0xa903a277. -// -// Solidity: function decodeAttestationTbs(bytes attestation) view returns(bytes, bytes) -func (_BatchAuthenticator *BatchAuthenticatorCallerSession) DecodeAttestationTbs(attestation []byte) ([]byte, []byte, error) { - return _BatchAuthenticator.Contract.DecodeAttestationTbs(&_BatchAuthenticator.CallOpts, attestation) -} - // EspressoTEEVerifier is a free data retrieval call binding the contract method 0xfa14fe6d. // // Solidity: function espressoTEEVerifier() view returns(address) @@ -296,37 +264,6 @@ func (_BatchAuthenticator *BatchAuthenticatorCallerSession) EspressoTEEVerifier( return _BatchAuthenticator.Contract.EspressoTEEVerifier(&_BatchAuthenticator.CallOpts) } -// NitroValidator is a free data retrieval call binding the contract method 0x1b076a4c. -// -// Solidity: function nitroValidator() view returns(address) -func (_BatchAuthenticator *BatchAuthenticatorCaller) NitroValidator(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _BatchAuthenticator.contract.Call(opts, &out, "nitroValidator") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// NitroValidator is a free data retrieval call binding the contract method 0x1b076a4c. -// -// Solidity: function nitroValidator() view returns(address) -func (_BatchAuthenticator *BatchAuthenticatorSession) NitroValidator() (common.Address, error) { - return _BatchAuthenticator.Contract.NitroValidator(&_BatchAuthenticator.CallOpts) -} - -// NitroValidator is a free data retrieval call binding the contract method 0x1b076a4c. -// -// Solidity: function nitroValidator() view returns(address) -func (_BatchAuthenticator *BatchAuthenticatorCallerSession) NitroValidator() (common.Address, error) { - return _BatchAuthenticator.Contract.NitroValidator(&_BatchAuthenticator.CallOpts) -} - // NonTeeBatcher is a free data retrieval call binding the contract method 0xb1bd4285. // // Solidity: function nonTeeBatcher() view returns(address) @@ -524,27 +461,6 @@ func (_BatchAuthenticator *BatchAuthenticatorTransactorSession) RegisterSigner(a return _BatchAuthenticator.Contract.RegisterSigner(&_BatchAuthenticator.TransactOpts, attestationTbs, signature) } -// RegisterSignerWithoutAttestationVerification is a paid mutator transaction binding the contract method 0x02afd6e3. -// -// Solidity: function registerSignerWithoutAttestationVerification(bytes32 pcr0Hash, bytes attestationTbs, bytes signature, address enclaveAddress) returns() -func (_BatchAuthenticator *BatchAuthenticatorTransactor) RegisterSignerWithoutAttestationVerification(opts *bind.TransactOpts, pcr0Hash [32]byte, attestationTbs []byte, signature []byte, enclaveAddress common.Address) (*types.Transaction, error) { - return _BatchAuthenticator.contract.Transact(opts, "registerSignerWithoutAttestationVerification", pcr0Hash, attestationTbs, signature, enclaveAddress) -} - -// RegisterSignerWithoutAttestationVerification is a paid mutator transaction binding the contract method 0x02afd6e3. -// -// Solidity: function registerSignerWithoutAttestationVerification(bytes32 pcr0Hash, bytes attestationTbs, bytes signature, address enclaveAddress) returns() -func (_BatchAuthenticator *BatchAuthenticatorSession) RegisterSignerWithoutAttestationVerification(pcr0Hash [32]byte, attestationTbs []byte, signature []byte, enclaveAddress common.Address) (*types.Transaction, error) { - return _BatchAuthenticator.Contract.RegisterSignerWithoutAttestationVerification(&_BatchAuthenticator.TransactOpts, pcr0Hash, attestationTbs, signature, enclaveAddress) -} - -// RegisterSignerWithoutAttestationVerification is a paid mutator transaction binding the contract method 0x02afd6e3. -// -// Solidity: function registerSignerWithoutAttestationVerification(bytes32 pcr0Hash, bytes attestationTbs, bytes signature, address enclaveAddress) returns() -func (_BatchAuthenticator *BatchAuthenticatorTransactorSession) RegisterSignerWithoutAttestationVerification(pcr0Hash [32]byte, attestationTbs []byte, signature []byte, enclaveAddress common.Address) (*types.Transaction, error) { - return _BatchAuthenticator.Contract.RegisterSignerWithoutAttestationVerification(&_BatchAuthenticator.TransactOpts, pcr0Hash, attestationTbs, signature, enclaveAddress) -} - // RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. // // Solidity: function renounceOwnership() returns() diff --git a/op-batcher/bindings/batch_inbox.go b/op-batcher/bindings/batch_inbox.go index 7009f1b2330..944f9baf965 100644 --- a/op-batcher/bindings/batch_inbox.go +++ b/op-batcher/bindings/batch_inbox.go @@ -32,7 +32,7 @@ var ( // BatchInboxMetaData contains all meta data concerning the BatchInbox contract. var BatchInboxMetaData = &bind.MetaData{ ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"_batchAuthenticator\",\"type\":\"address\",\"internalType\":\"contractIBatchAuthenticator\"},{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"fallback\",\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"batchAuthenticator\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"contractIBatchAuthenticator\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"nonTeeBatcher\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false}]", - Bin: "0x60c060405234801561000f575f5ffd5b50604051610f9b380380610f9b8339818101604052810190610031919061029d565b61004d61004261013c60201b60201c565b61014360201b60201c565b5f8273ffffffffffffffffffffffffffffffffffffffff1663b1bd42856040518163ffffffff1660e01b8152600401602060405180830381865afa158015610097573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100bb91906102db565b90508073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508273ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff16815250506101348261014360201b60201c565b505050610306565b5f33905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61023182610208565b9050919050565b5f61024282610227565b9050919050565b61025281610238565b811461025c575f5ffd5b50565b5f8151905061026d81610249565b92915050565b61027c81610227565b8114610286575f5ffd5b50565b5f8151905061029781610273565b92915050565b5f5f604083850312156102b3576102b2610204565b5b5f6102c08582860161025f565b92505060206102d185828601610289565b9150509250929050565b5f602082840312156102f0576102ef610204565b5b5f6102fd84828501610289565b91505092915050565b60805160a051610c596103425f395f8181605c0152818161019a0152818161029401526104e101525f818161037201526104bd0152610c595ff3fe608060405234801561000f575f5ffd5b5060043610610059575f3560e01c8063715018a6146104015780638da5cb5b1461040b578063b1bd428514610429578063e758457314610447578063f2fde38b146104655761005a565b5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16637877a9ed6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100c3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100e79190610704565b15610370575f5f1b5f4914610277575f5f67ffffffffffffffff8111156101115761011061072f565b5b6040519080825280601f01601f1916602001820160405280156101435781602001600182028036833780820191505090505b5090505f5f90505b5f5f1b81491461018d578181496040516020016101699291906107d7565b6040516020818303038152906040529150808061018590610834565b91505061014b565b5f828051906020012090507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f81f2083826040518263ffffffff1660e01b81526004016101f1919061088a565b602060405180830381865afa15801561020c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102309190610704565b61026f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610266906108fd565b60405180910390fd5b50505061036b565b5f5f3660405161028892919061094d565b604051809103902090507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f81f2083826040518263ffffffff1660e01b81526004016102eb919061088a565b602060405180830381865afa158015610306573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061032a9190610704565b610369576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610360906109af565b60405180910390fd5b505b6103ff565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103f590610a17565b60405180910390fd5b5b005b610409610481565b005b610413610494565b6040516104209190610a74565b60405180910390f35b6104316104bb565b60405161043e9190610a74565b60405180910390f35b61044f6104df565b60405161045c9190610ae8565b60405180910390f35b61047f600480360381019061047a9190610b2b565b610503565b005b610489610585565b6104925f610603565b565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b61050b610585565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610579576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057090610bc6565b60405180910390fd5b61058281610603565b50565b61058d6106c4565b73ffffffffffffffffffffffffffffffffffffffff166105ab610494565b73ffffffffffffffffffffffffffffffffffffffff1614610601576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f890610c2e565b60405180910390fd5b565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f33905090565b5f5ffd5b5f8115159050919050565b6106e3816106cf565b81146106ed575f5ffd5b50565b5f815190506106fe816106da565b92915050565b5f60208284031215610719576107186106cb565b5b5f610726848285016106f0565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f81519050919050565b5f81905092915050565b8281835e5f83830152505050565b5f6107888261075c565b6107928185610766565b93506107a2818560208601610770565b80840191505092915050565b5f819050919050565b5f819050919050565b6107d16107cc826107ae565b6107b7565b82525050565b5f6107e2828561077e565b91506107ee82846107c0565b6020820191508190509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f819050919050565b5f61083e8261082b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036108705761086f6107fe565b5b600182019050919050565b610884816107ae565b82525050565b5f60208201905061089d5f83018461087b565b92915050565b5f82825260208201905092915050565b7f496e76616c696420626c6f6220626174636800000000000000000000000000005f82015250565b5f6108e76012836108a3565b91506108f2826108b3565b602082019050919050565b5f6020820190508181035f830152610914816108db565b9050919050565b828183375f83830152505050565b5f6109348385610766565b935061094183858461091b565b82840190509392505050565b5f610959828486610929565b91508190509392505050565b7f496e76616c69642063616c6c64617461206261746368000000000000000000005f82015250565b5f6109996016836108a3565b91506109a482610965565b602082019050919050565b5f6020820190508181035f8301526109c68161098d565b9050919050565b7f4261746368496e626f783a20756e617574686f72697a656420626174636865725f82015250565b5f610a016020836108a3565b9150610a0c826109cd565b602082019050919050565b5f6020820190508181035f830152610a2e816109f5565b9050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610a5e82610a35565b9050919050565b610a6e81610a54565b82525050565b5f602082019050610a875f830184610a65565b92915050565b5f819050919050565b5f610ab0610aab610aa684610a35565b610a8d565b610a35565b9050919050565b5f610ac182610a96565b9050919050565b5f610ad282610ab7565b9050919050565b610ae281610ac8565b82525050565b5f602082019050610afb5f830184610ad9565b92915050565b610b0a81610a54565b8114610b14575f5ffd5b50565b5f81359050610b2581610b01565b92915050565b5f60208284031215610b4057610b3f6106cb565b5b5f610b4d84828501610b17565b91505092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20615f8201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b5f610bb06026836108a3565b9150610bbb82610b56565b604082019050919050565b5f6020820190508181035f830152610bdd81610ba4565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f610c186020836108a3565b9150610c2382610be4565b602082019050919050565b5f6020820190508181035f830152610c4581610c0c565b905091905056fea164736f6c634300081c000a", + Bin: "0x60c060405234801561000f575f5ffd5b50604051610f9b380380610f9b8339818101604052810190610031919061029d565b61004d61004261013c60201b60201c565b61014360201b60201c565b5f8273ffffffffffffffffffffffffffffffffffffffff1663b1bd42856040518163ffffffff1660e01b8152600401602060405180830381865afa158015610097573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100bb91906102db565b90508073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508273ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff16815250506101348261014360201b60201c565b505050610306565b5f33905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61023182610208565b9050919050565b5f61024282610227565b9050919050565b61025281610238565b811461025c575f5ffd5b50565b5f8151905061026d81610249565b92915050565b61027c81610227565b8114610286575f5ffd5b50565b5f8151905061029781610273565b92915050565b5f5f604083850312156102b3576102b2610204565b5b5f6102c08582860161025f565b92505060206102d185828601610289565b9150509250929050565b5f602082840312156102f0576102ef610204565b5b5f6102fd84828501610289565b91505092915050565b60805160a051610c596103425f395f8181605c0152818161019a0152818161029401526104e101525f818161037201526104bd0152610c595ff3fe608060405234801561000f575f5ffd5b5060043610610059575f3560e01c8063715018a6146104015780638da5cb5b1461040b578063b1bd428514610429578063e758457314610447578063f2fde38b146104655761005a565b5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16637877a9ed6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100c3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100e79190610704565b15610370575f5f1b5f4914610277575f5f67ffffffffffffffff8111156101115761011061072f565b5b6040519080825280601f01601f1916602001820160405280156101435781602001600182028036833780820191505090505b5090505f5f90505b5f5f1b81491461018d578181496040516020016101699291906107d7565b6040516020818303038152906040529150808061018590610834565b91505061014b565b5f828051906020012090507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f81f2083826040518263ffffffff1660e01b81526004016101f1919061088a565b602060405180830381865afa15801561020c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102309190610704565b61026f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610266906108fd565b60405180910390fd5b50505061036b565b5f5f3660405161028892919061094d565b604051809103902090507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f81f2083826040518263ffffffff1660e01b81526004016102eb919061088a565b602060405180830381865afa158015610306573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061032a9190610704565b610369576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610360906109af565b60405180910390fd5b505b6103ff565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103f590610a17565b60405180910390fd5b5b005b610409610481565b005b610413610494565b6040516104209190610a74565b60405180910390f35b6104316104bb565b60405161043e9190610a74565b60405180910390f35b61044f6104df565b60405161045c9190610ae8565b60405180910390f35b61047f600480360381019061047a9190610b2b565b610503565b005b610489610585565b6104925f610603565b565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b61050b610585565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610579576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057090610bc6565b60405180910390fd5b61058281610603565b50565b61058d6106c4565b73ffffffffffffffffffffffffffffffffffffffff166105ab610494565b73ffffffffffffffffffffffffffffffffffffffff1614610601576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f890610c2e565b60405180910390fd5b565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f33905090565b5f5ffd5b5f8115159050919050565b6106e3816106cf565b81146106ed575f5ffd5b50565b5f815190506106fe816106da565b92915050565b5f60208284031215610719576107186106cb565b5b5f610726848285016106f0565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f81519050919050565b5f81905092915050565b8281835e5f83830152505050565b5f6107888261075c565b6107928185610766565b93506107a2818560208601610770565b80840191505092915050565b5f819050919050565b5f819050919050565b6107d16107cc826107ae565b6107b7565b82525050565b5f6107e2828561077e565b91506107ee82846107c0565b6020820191508190509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f819050919050565b5f61083e8261082b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036108705761086f6107fe565b5b600182019050919050565b610884816107ae565b82525050565b5f60208201905061089d5f83018461087b565b92915050565b5f82825260208201905092915050565b7f496e76616c696420626c6f6220626174636800000000000000000000000000005f82015250565b5f6108e76012836108a3565b91506108f2826108b3565b602082019050919050565b5f6020820190508181035f830152610914816108db565b9050919050565b828183375f83830152505050565b5f6109348385610766565b935061094183858461091b565b82840190509392505050565b5f610959828486610929565b91508190509392505050565b7f496e76616c69642063616c6c64617461206261746368000000000000000000005f82015250565b5f6109996016836108a3565b91506109a482610965565b602082019050919050565b5f6020820190508181035f8301526109c68161098d565b9050919050565b7f4261746368496e626f783a20756e617574686f72697a656420626174636865725f82015250565b5f610a016020836108a3565b9150610a0c826109cd565b602082019050919050565b5f6020820190508181035f830152610a2e816109f5565b9050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610a5e82610a35565b9050919050565b610a6e81610a54565b82525050565b5f602082019050610a875f830184610a65565b92915050565b5f819050919050565b5f610ab0610aab610aa684610a35565b610a8d565b610a35565b9050919050565b5f610ac182610a96565b9050919050565b5f610ad282610ab7565b9050919050565b610ae281610ac8565b82525050565b5f602082019050610afb5f830184610ad9565b92915050565b610b0a81610a54565b8114610b14575f5ffd5b50565b5f81359050610b2581610b01565b92915050565b5f60208284031215610b4057610b3f6106cb565b5b5f610b4d84828501610b17565b91505092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20615f8201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b5f610bb06026836108a3565b9150610bbb82610b56565b604082019050919050565b5f6020820190508181035f830152610bdd81610ba4565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f610c186020836108a3565b9150610c2382610be4565b602082019050919050565b5f6020820190508181035f830152610c4581610c0c565b905091905056fea164736f6c634300081e000a", } // BatchInboxABI is the input ABI used to generate the binding from. diff --git a/op-batcher/enclave-entrypoint.bash b/op-batcher/enclave-entrypoint.bash index b921883ed6a..8b1cadc8695 100644 --- a/op-batcher/enclave-entrypoint.bash +++ b/op-batcher/enclave-entrypoint.bash @@ -150,8 +150,7 @@ launch_socat() { } # URL argument regex pattern -URL_ARG_RE='^(--altda\.da-server|--espresso\.urls|--espresso\.l1-url|--espresso\.rollup-l1-url|--l1-eth-rpc|--l2-eth-rpc|--rollup-rpc|--signer\.endpoint)(=|$)' - +URL_ARG_RE='^(--altda\.da-server|--espresso\.espresso-attestation-service|--espresso\.urls|--espresso\.l1-url|--espresso\.rollup-l1-url|--l1-eth-rpc|--l2-eth-rpc|--rollup-rpc|--signer\.endpoint)(=|$)' # Process all arguments filtered_args=() url_args=() diff --git a/op-deployer/pkg/deployer/opcm/espresso.go b/op-deployer/pkg/deployer/opcm/espresso.go index d5c2dfef523..e0d0fe54b25 100644 --- a/op-deployer/pkg/deployer/opcm/espresso.go +++ b/op-deployer/pkg/deployer/opcm/espresso.go @@ -8,7 +8,8 @@ import ( ) type DeployAWSNitroVerifierInput struct { - EnclaveHash [32]byte + EnclaveHash [32]byte + NitroEnclaveVerifier common.Address } type DeployAWSNitroVerifierOutput struct { diff --git a/op-deployer/pkg/deployer/pipeline/espresso.go b/op-deployer/pkg/deployer/pipeline/espresso.go index 6b96c13d586..99c91663d85 100644 --- a/op-deployer/pkg/deployer/pipeline/espresso.go +++ b/op-deployer/pkg/deployer/pipeline/espresso.go @@ -28,9 +28,30 @@ func DeployEspresso(env *Env, intent *state.Intent, st *state.State, chainID com } lgr.Info("deploying espresso contracts") + // read the nitro enclaver verifier address from environment variable, fallback to empty address + var nitroEnclaveVerifierAddress common.Address + if envVar := os.Getenv("NITRO_ENCLAVE_VERIFIER_ADDRESS"); envVar != "" { + nitroEnclaveVerifierAddress = common.HexToAddress(envVar) + lgr.Info("Using nitro enclave verifier address from NITRO_ENCLAVE_VERIFIER_ADDRESS env var", "address", nitroEnclaveVerifierAddress.Hex()) + } else { + lgr.Info("NITRO_ENCLAVE_VERIFIER_ADDRESS env var not set, using empty address") + // this means we should deploy a mock verifier ( should only be used in dev / test environments + nitroEnclaveVerifierAddress = common.Address{} + } + + // get enclave hash from environment variable, fallback to zeroed hash + var enclaveHash [32]byte + if envVar := os.Getenv("ENCLAVE_HASH"); envVar != "" { + copy(enclaveHash[:], common.FromHex(envVar)) + lgr.Info("Using enclave hash from ENCLAVE_HASH env var", "hash", common.Bytes2Hex(enclaveHash[:])) + } else { + lgr.Info("ENCLAVE_HASH env var not set, using zeroed hash") + } + var nvo opcm.DeployAWSNitroVerifierOutput nvo, err = opcm.DeployAWSNitroVerifier(env.L1ScriptHost, opcm.DeployAWSNitroVerifierInput{ - EnclaveHash: [32]byte{}, + EnclaveHash: enclaveHash, + NitroEnclaveVerifier: nitroEnclaveVerifierAddress, }) if err != nil { return fmt.Errorf("failed to deploy nitro verifier contracts: %w", err) diff --git a/packages/contracts-bedrock/foundry.toml b/packages/contracts-bedrock/foundry.toml index c18a1f40ba7..f70f5566783 100644 --- a/packages/contracts-bedrock/foundry.toml +++ b/packages/contracts-bedrock/foundry.toml @@ -27,8 +27,6 @@ compilation_restrictions = [ { paths = "src/L1/OPContractsManagerStandardValidator.sol", optimizer_runs = 5000 }, { paths = "src/L1/StandardValidator.sol", optimizer_runs = 5000 }, { paths = "src/L1/OptimismPortal2.sol", optimizer_runs = 5000 }, - { paths = "lib/espresso-tee-contracts/lib/nitro-validator/**", via_ir = false }, - { paths = "lib/espresso-tee-contracts/lib/automata-dcap-attestation/**", via_ir = true }, ] extra_output = ['devdoc', 'userdoc', 'metadata', 'storageLayout'] @@ -40,6 +38,7 @@ remappings = [ '@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts', '@espresso-tee-contracts/=lib/espresso-tee-contracts/src', '@nitro-validator/=lib/espresso-tee-contracts/lib/nitro-validator/src', + 'aws-nitro-enclave-attestation/=lib/espresso-tee-contracts/lib/aws-nitro-enclave-attestation/contracts/src', 'lib/espresso-tee-contracts/:@openzeppelin/contracts/=lib/espresso-tee-contracts/lib/openzeppelin-contracts/contracts', 'lib/espresso-tee-contracts/:solady/=lib/solady/src', '@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts', @@ -151,8 +150,6 @@ compilation_restrictions = [ { paths = "src/L1/OPContractsManagerStandardValidator.sol", optimizer_runs = 5000 }, { paths = "src/L1/OptimismPortal2.sol", optimizer_runs = 5000 }, { paths = "src/L1/StandardValidator.sol", optimizer_runs = 5000 }, - { paths = "lib/espresso-tee-contracts/lib/nitro-validator/**", via_ir = false }, - { paths = "lib/espresso-tee-contracts/lib/automata-dcap-attestation/**", via_ir = true }, ] diff --git a/packages/contracts-bedrock/lib/espresso-tee-contracts b/packages/contracts-bedrock/lib/espresso-tee-contracts index 02a40281a40..0d73791be5d 160000 --- a/packages/contracts-bedrock/lib/espresso-tee-contracts +++ b/packages/contracts-bedrock/lib/espresso-tee-contracts @@ -1 +1 @@ -Subproject commit 02a40281a402d2684d8a056d1751474db9bd50a4 +Subproject commit 0d73791be5d5fc3549e7771a1aeee9939c56762e diff --git a/packages/contracts-bedrock/scripts/deploy/DeployAWSNitroVerifier.s.sol b/packages/contracts-bedrock/scripts/deploy/DeployAWSNitroVerifier.s.sol index 619a35d10e1..f396dbd6c19 100644 --- a/packages/contracts-bedrock/scripts/deploy/DeployAWSNitroVerifier.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/DeployAWSNitroVerifier.s.sol @@ -1,16 +1,39 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.22; +pragma solidity ^0.8.0; -import { CertManager } from "@nitro-validator/CertManager.sol"; import { IEspressoNitroTEEVerifier } from "@espresso-tee-contracts/interface/IEspressoNitroTEEVerifier.sol"; import { EspressoNitroTEEVerifier } from "@espresso-tee-contracts/EspressoNitroTEEVerifier.sol"; import { BaseDeployIO } from "scripts/deploy/BaseDeployIO.sol"; import { Script } from "forge-std/Script.sol"; import { Solarray } from "scripts/libraries/Solarray.sol"; import { DeployUtils } from "scripts/libraries/DeployUtils.sol"; +import { INitroEnclaveVerifier } from "aws-nitro-enclave-attestation/interfaces/INitroEnclaveVerifier.sol"; + +contract MockEspressoNitroTEEVerifier is IEspressoNitroTEEVerifier { + constructor() { } + + function registeredSigners(address signer) external pure override returns (bool) { + // Added this special condition for test TestE2eDevnetWithUnattestedBatcherKey + if (signer == address(0xe16d5c4080C0faD6D2Ef4eb07C657674a217271C)) { + return false; + } + return true; + } + + function registeredEnclaveHash(bytes32) external pure override returns (bool) { + return true; + } + + function registerSigner(bytes calldata, bytes calldata) external override { } + + function setEnclaveHash(bytes32, bool) external override { } + + function deleteRegisteredSigners(address[] memory) external override { } +} contract DeployAWSNitroVerifierInput is BaseDeployIO { bytes32 internal _enclaveHash; + address internal _nitroEnclaveVerifier; function set(bytes4 _sel, bytes32 _val) public { if (_sel == this.enclaveHash.selector) _enclaveHash = _val; @@ -18,9 +41,20 @@ contract DeployAWSNitroVerifierInput is BaseDeployIO { } function enclaveHash() public view returns (bytes32) { - require(_enclaveHash != 0, "DeployAWSNitroVerifierInput: enclaveHash not set"); return _enclaveHash; } + + function set(bytes4 _sel, address _val) public { + if (_sel == this.nitroEnclaveVerifier.selector) { + _nitroEnclaveVerifier = _val; + } else { + revert("DeployAWSNitroVerifierInput: unknown selector"); + } + } + + function nitroEnclaveVerifier() public view returns (address) { + return _nitroEnclaveVerifier; + } } contract DeployAWSNitroVerifierOutput is BaseDeployIO { @@ -43,34 +77,32 @@ contract DeployAWSNitroVerifierOutput is BaseDeployIO { contract DeployAWSNitroVerifier is Script { function run(DeployAWSNitroVerifierInput input, DeployAWSNitroVerifierOutput output) public { - CertManager manager = deployCertManager(); - deployNitroTEEVerifier(input, output, manager); + deployNitroTEEVerifier(input, output); checkOutput(output); } function deployNitroTEEVerifier( DeployAWSNitroVerifierInput input, - DeployAWSNitroVerifierOutput output, - CertManager certManager + DeployAWSNitroVerifierOutput output ) public returns (IEspressoNitroTEEVerifier) { - bytes32 enclaveHash = input.enclaveHash(); vm.broadcast(msg.sender); - IEspressoNitroTEEVerifier impl = new EspressoNitroTEEVerifier(enclaveHash, certManager); + bytes32 enclaveHash = input.enclaveHash(); + address nitroEnclaveVerifier = input.nitroEnclaveVerifier(); + + IEspressoNitroTEEVerifier impl; + if (nitroEnclaveVerifier == address(0)) { + impl = new MockEspressoNitroTEEVerifier(); + } else { + impl = new EspressoNitroTEEVerifier(enclaveHash, INitroEnclaveVerifier(nitroEnclaveVerifier)); + } vm.label(address(impl), "NitroTEEVerifierImpl"); output.set(output.nitroTEEVerifierAddress.selector, address(impl)); return impl; } - function deployCertManager() public returns (CertManager) { - vm.broadcast(msg.sender); - CertManager impl = new CertManager(); - vm.label(address(impl), "CertManagerImpl"); - return impl; - } - function checkOutput(DeployAWSNitroVerifierOutput output) public view { address[] memory addresses = Solarray.addresses(address(output.nitroTEEVerifierAddress())); DeployUtils.assertValidContractAddresses(addresses); diff --git a/packages/contracts-bedrock/src/L1/BatchAuthenticator.sol b/packages/contracts-bedrock/src/L1/BatchAuthenticator.sol index 26170f2a90c..77e76c95e38 100644 --- a/packages/contracts-bedrock/src/L1/BatchAuthenticator.sol +++ b/packages/contracts-bedrock/src/L1/BatchAuthenticator.sol @@ -1,18 +1,11 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.28; +pragma solidity ^0.8.0; import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { ISemver } from "interfaces/universal/ISemver.sol"; import { IEspressoTEEVerifier } from "@espresso-tee-contracts/interface/IEspressoTEEVerifier.sol"; -interface INitroValidator { - function decodeAttestationTbs(bytes memory attestation) - external - pure - returns (bytes memory attestationTbs, bytes memory signature); -} - contract BatchAuthenticator is ISemver, Ownable { /// @notice Semantic version. /// @custom:semver 1.0.0 @@ -28,7 +21,6 @@ contract BatchAuthenticator is ISemver, Ownable { address public immutable nonTeeBatcher; IEspressoTEEVerifier public immutable espressoTEEVerifier; - INitroValidator public immutable nitroValidator; /// @notice Flag indicating which batcher is currently active. /// @dev When true the TEE batcher is active; when false the non-TEE batcher is active. @@ -48,16 +40,11 @@ contract BatchAuthenticator is ISemver, Ownable { espressoTEEVerifier = _espressoTEEVerifier; teeBatcher = _teeBatcher; nonTeeBatcher = _nonTeeBatcher; - nitroValidator = INitroValidator(address(espressoTEEVerifier.espressoNitroTEEVerifier())); // By default, start with the TEE batcher active. activeIsTee = true; _transferOwnership(_owner); } - function decodeAttestationTbs(bytes memory attestation) external view returns (bytes memory, bytes memory) { - return nitroValidator.decodeAttestationTbs(attestation); - } - /// @notice Toggles the active batcher between the TEE and non-TEE batcher. function switchBatcher() external onlyOwner { activeIsTee = !activeIsTee; @@ -87,17 +74,4 @@ contract BatchAuthenticator is ISemver, Ownable { function registerSigner(bytes calldata attestationTbs, bytes calldata signature) external { espressoTEEVerifier.registerSigner(attestationTbs, signature, IEspressoTEEVerifier.TeeType.NITRO); } - - function registerSignerWithoutAttestationVerification( - bytes32 pcr0Hash, - bytes calldata attestationTbs, - bytes calldata signature, - address enclaveAddress - ) - external - { - espressoTEEVerifier.espressoNitroTEEVerifier().registerSignerWithoutAttestationVerification( - pcr0Hash, attestationTbs, signature, enclaveAddress - ); - } } diff --git a/packages/contracts-bedrock/src/L1/BatchInbox.sol b/packages/contracts-bedrock/src/L1/BatchInbox.sol index 8c29b66cdaa..3402a629ad7 100644 --- a/packages/contracts-bedrock/src/L1/BatchInbox.sol +++ b/packages/contracts-bedrock/src/L1/BatchInbox.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.28; +pragma solidity ^0.8.24; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { IBatchAuthenticator } from "interfaces/L1/IBatchAuthenticator.sol"; diff --git a/packages/contracts-bedrock/test/L1/BatchAuthenticator.t.sol b/packages/contracts-bedrock/test/L1/BatchAuthenticator.t.sol index 16a26434830..541f0765fea 100644 --- a/packages/contracts-bedrock/test/L1/BatchAuthenticator.t.sol +++ b/packages/contracts-bedrock/test/L1/BatchAuthenticator.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.28; +pragma solidity ^0.8.0; // Testing import { Test } from "forge-std/Test.sol"; @@ -23,25 +23,6 @@ contract MockNitroTEEVerifier is IEspressoNitroTEEVerifier { function registerSigner(bytes calldata, bytes calldata) external pure override { } - function registerSignerWithoutAttestationVerification( - bytes32, - bytes calldata, - bytes calldata, - address - ) - external - pure - override - { } - - function verifyCACert(bytes calldata, bytes32) external pure override { } - - function verifyClientCert(bytes calldata, bytes32) external pure override { } - - function certVerified(bytes32) external pure override returns (bool) { - return false; - } - function setEnclaveHash(bytes32, bool) external pure override { } function deleteRegisteredSigners(address[] memory) external pure override { } diff --git a/packages/contracts-bedrock/test/L1/BatchInbox.t.sol b/packages/contracts-bedrock/test/L1/BatchInbox.t.sol index 61b9d559dc2..ad4941145a9 100644 --- a/packages/contracts-bedrock/test/L1/BatchInbox.t.sol +++ b/packages/contracts-bedrock/test/L1/BatchInbox.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.28; +pragma solidity ^0.8.0; // Testing import { Test } from "forge-std/Test.sol";