Skip to content

6.2 Batcher tests in enclave#144

Merged
QuentinI merged 15 commits intocelo-integration-rebase-13from
ag/batchertests-enclave
May 28, 2025
Merged

6.2 Batcher tests in enclave#144
QuentinI merged 15 commits intocelo-integration-rebase-13from
ag/batchertests-enclave

Conversation

@QuentinI
Copy link
Copy Markdown
Collaborator

@QuentinI QuentinI commented May 21, 2025

Closes #<ISSUE_NUMBER>

This PR:

  • Pulls docker image for enclave back into the main dockerfile
  • Adds infrastructure for building and starting enclaver EIF images to espresso/environment
  • Adds infrastructure for batcher-in-enclave tests to espresso/environment, which builds the batcher EIF, registers its PCR0 with attestation verifier and starts the EIF.
  • Adds a smoke test for batcher in enclave, which mirrors TestE2eDevNetWithEspressoSimpleTransactions, just with batcher in enclave

This PR does not:

  • Fix gas limit issues
  • Add any other tests

Key places to review:

How to test this PR:

On a EC2 machine with enclave support:

  • cd kurtosis-devnet/
  • just op-batcher-enclave-image
  • cd ../
  • export ESPRESSO_RUN_ENCLAVE_TESTS=true
  • go test ./espresso/enclave-tests/... -v -count 1

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is mostly just reformatting according to nixfmt, the only real change is adding enclaver to the devShell.

@QuentinI QuentinI marked this pull request as ready for review May 21, 2025 18:25
@dailinsubjam
Copy link
Copy Markdown

Amazing! The test could pass on my ec2 machine. Let's add the test instructions also to the comment on top of the test.

Copy link
Copy Markdown

@dailinsubjam dailinsubjam left a comment

Choose a reason for hiding this comment

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

I haven't had a chance to review all the code yet, will continue later.

Copy link
Copy Markdown
Member

@shenkeyao shenkeyao left a comment

Choose a reason for hiding this comment

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

Haven't tested this on an EC2 machine yet, but the changes look good!

Comment on lines +78 to +82
// TODO(AG): currently op-batcher calls `registerSigner` directly,
// which on the first run results in verifying the full certificate
// chain in a single transaction, which runs over gas limit. This is
// a workaround for the issue, real solution will invole verifying
// each cerficiate separately before calling `registerSigner`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add the task link to the comment as well? https://app.asana.com/1/1208976916964769/project/1209392461754458/task/1210016054362985?focus=true (I think this is the corresponding task?).

@philippecamacho
Copy link
Copy Markdown
Collaborator

philippecamacho commented May 22, 2025

Amazing! The test could pass on my ec2 machine. Let's add the test instructions also to the comment on top of the test.

@dailinsubjam Great indeed. Could you help @QuentinI document how to set up an EC2 instance with an enclave in the Espresso README.md, so that everyone can run the tests on her own?

@dailinsubjam
Copy link
Copy Markdown

dailinsubjam commented May 24, 2025

@philippecamacho Sure! Instruction on how to setup an enclave-enabled EC2 instance added in https://github.com/EspressoSystems/optimism-espresso-integration/pull/152/files.

Copy link
Copy Markdown

@dailinsubjam dailinsubjam left a comment

Choose a reason for hiding this comment

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

LGTM, there's just too much code for me to go through every detail lol.

@QuentinI QuentinI force-pushed the ag/batchertests-enclave branch from 9ff1b53 to 8bfdf54 Compare May 27, 2025 17:57
@QuentinI QuentinI changed the base branch from celo-integration to celo-integration-rebase-13 May 27, 2025 17:57
@philippecamacho
Copy link
Copy Markdown
Collaborator

I get this error

[ec2-user@ip-172-31-42-29 kurtosis-devnet]$ just op-batcher-enclave-image
error: Variable `KURTOSIS_PACKAGE` has multiple definitions
  ——▶ justfile:51:1
   │
51 │ KURTOSIS_PACKAGE := "github.com/ethpandaops/optimism-package"

@QuentinI
Copy link
Copy Markdown
Collaborator Author

I get this error

[ec2-user@ip-172-31-42-29 kurtosis-devnet]$ just op-batcher-enclave-image
error: Variable `KURTOSIS_PACKAGE` has multiple definitions
  ——▶ justfile:51:1
   │
51 │ KURTOSIS_PACKAGE := "github.com/ethpandaops/optimism-package"

Oh, this was an uncaught merge error after rebasing onto celo's updates. Fixed.

@philippecamacho
Copy link
Copy Markdown
Collaborator

philippecamacho commented May 28, 2025

I get this error now. Maybe I did not configure my EC2 instance correctly.
( I followed Sishan's README.md)

 INFO  enclaver::run > starting egress proxy on vsock port 17002
 INFO  enclaver::vsock > Listening on vsock port 17002
 INFO  enclaver::run   > starting enclave
 ERROR enclaver::nitro_cli > nitro-cli failed (exit status: 39)
 ERROR enclaver::nitro_cli > stderr:
[ E22 ] Insufficient CPUs available in the pool. User provided `cpu-count` is 2, which is more than the configured CPU pool size.
You can increase the CPU pool size by editing the `cpu_count` value from '/etc/nitro_enclaves/allocator.yaml' and then enable the nitro-enclaves-allocator.service.

For more details, please visit https://docs.aws.amazon.com/enclaves/latest/user/cli-errors.html#E22

If you open a support ticket, please provide the error log found at "/var/log/nitro_enclaves/err2025-05-28T14:39:18.206963221+00:00.log"
Failed connections: 1
[ E39 ] Enclave process connection failure. Such error appears when the enclave manager fails to connect to at least one enclave process for retrieving the description information.

For more details, please visit https://docs.aws.amazon.com/enclaves/latest/user/cli-errors.html#E39

If you open a support ticket, please provide the error log found at "/var/log/nitro_enclaves/err2025-05-28T14:39:18.207121071+00:00.log"

 ERROR enclaver::nitro_cli > /var/log/nitro_enclaves/err2025-05-28T14:39:18.206963221+00:00.log:
  Action: Run Enclave
  Subactions:
    Failed to execute command `Run`
    Failed to trigger enclave run
    Failed to get CPU configuration
    Insufficient CPUs available (requested 2, but maximum is 0)
  Root error file: src/enclave_proc/cpu_info.rs
  Root error line: 70
  Version: 1.3.1
 ERROR enclaver::nitro_cli > /var/log/nitro_enclaves/err2025-05-28T14:39:18.207121071+00:00.log:
  Action: Run Enclave
  Subactions:
    Failed to handle all enclave process replies
    Failed to connect to 1 enclave processes
  Root error file: src/enclave_proc_comm.rs
  Root error line: 358
  Version: 1.3.1
Error: failed to run enclave
panic: enclave exited with an error: exit status 1

goroutine 186464 [running]:
github.com/ethereum-optimism/optimism/espresso/environment.(*EnclaverCli).RunEnclave.func1()
	/home/ec2-user/optimism-espresso-integration/espresso/environment/enclave_helpers.go:413 +0x65
created by github.com/ethereum-optimism/optimism/espresso/environment.(*EnclaverCli).RunEnclave in goroutine 157890
	/home/ec2-user/optimism-espresso-integration/espresso/environment/enclave_helpers.go:410 +0x2a5
FAIL	github.com/ethereum-optimism/optimism/espresso/enclave-tests	50.544s

@QuentinI QuentinI force-pushed the ag/batchertests-enclave branch from 6ffa2a2 to 0e10cfe Compare May 28, 2025 15:25
Copy link
Copy Markdown
Collaborator

@philippecamacho philippecamacho left a comment

Choose a reason for hiding this comment

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

All tests (enclave and no-enclave) passing.
LGTM

@QuentinI QuentinI merged commit f9ff63e into celo-integration-rebase-13 May 28, 2025
21 of 29 checks passed
@QuentinI QuentinI deleted the ag/batchertests-enclave branch May 28, 2025 17:47
QuentinI added a commit that referenced this pull request Jun 18, 2025
QuentinI added a commit that referenced this pull request Jun 20, 2025
QuentinI added a commit that referenced this pull request Jun 20, 2025
QuentinI added a commit that referenced this pull request Jun 20, 2025
QuentinI added a commit that referenced this pull request Jun 20, 2025
shenkeyao pushed a commit that referenced this pull request Jul 18, 2025
shenkeyao pushed a commit that referenced this pull request Jul 18, 2025
dailinsubjam pushed a commit that referenced this pull request Oct 4, 2025
dailinsubjam pushed a commit that referenced this pull request Oct 7, 2025
shenkeyao pushed a commit that referenced this pull request Jan 15, 2026
shenkeyao pushed a commit that referenced this pull request Feb 2, 2026
shenkeyao pushed a commit that referenced this pull request Feb 10, 2026
shenkeyao pushed a commit that referenced this pull request Feb 12, 2026
QuentinI added a commit that referenced this pull request Feb 20, 2026
shenkeyao pushed a commit that referenced this pull request Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants