Skip to content

Commit b4ef5e7

Browse files
dailinsubjamEC2 Default User
andauthored
Skip attestation verification (#263)
* Update espresso-tee-contracts submodule to sishan/skip-attestation-verification * Skip attestation verification to reduce gas costs * Reduce L1 gas limit from 45M to 16M * Update snapshots for registerSignerWithoutAttestationVerification * Ignore lib/automate submodule directory * fix CI * Update espresso-tee-contracts submodule Remove onlyOwner modifier from registerSignerWithoutAttestationVerification * keep large gasLimit * circleci: Enable workflow on all branches via API trigger Allow CircleCI main workflow to run on any branch when triggered via API, not just webhook triggers. This enables go-lint and go-tests to run on feature branches. * Regenerate semver-lock.json after rebase The initCodeHash for BatchAuthenticator needed to be regenerated after rebasing onto celo-integration-rebase-14.1. --------- Co-authored-by: EC2 Default User <[email protected]>
1 parent ad2ed8b commit b4ef5e7

File tree

9 files changed

+81
-8
lines changed

9 files changed

+81
-8
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,9 +1779,11 @@ jobs:
17791779

17801780
workflows:
17811781
main:
1782+
# Run on all branches via webhook or API
17821783
when:
17831784
or:
17841785
- equal: ["webhook", << pipeline.trigger_source >>]
1786+
- equal: ["api", << pipeline.trigger_source >>]
17851787
- and:
17861788
- equal: [true, <<pipeline.parameters.main_dispatch>>]
17871789
- equal: ["api", << pipeline.trigger_source >>]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ gha-creds-*.json
6767
# Ignore keys
6868
*.pem
6969

70+
packages/contracts-bedrock/lib/automate/

op-batcher/batcher/espresso.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,9 +1082,17 @@ func (l *BatchSubmitter) registerBatcher(ctx context.Context) error {
10821082
return fmt.Errorf("failed to get Batch Authenticator ABI: %w", err)
10831083
}
10841084

1085-
txData, err = abi.Pack("registerSigner", l.Attestation.COSESign1, l.Attestation.Signature)
1085+
// Extract PCR0 hash from attestation document
1086+
pcr0Hash := crypto.Keccak256Hash(l.Attestation.Document.PCRs[0])
1087+
1088+
// Extract enclave address from attestation document public key
1089+
// The publicKey's first byte 0x04 determines if the public key is compressed or not, so we ignore it
1090+
publicKeyHash := crypto.Keccak256Hash(l.Attestation.Document.PublicKey[1:])
1091+
enclaveAddress := common.BytesToAddress(publicKeyHash[12:])
1092+
1093+
txData, err = abi.Pack("registerSignerWithoutAttestationVerification", pcr0Hash, l.Attestation.COSESign1, l.Attestation.Signature, enclaveAddress)
10861094
if err != nil {
1087-
return fmt.Errorf("failed to create RegisterSigner transaction: %w", err)
1095+
return fmt.Errorf("failed to create RegisterSignerWithoutAttestationVerification transaction: %w", err)
10881096
}
10891097

10901098
candidate := txmgr.TxCandidate{

op-batcher/bindings/batch_authenticator.go

Lines changed: 23 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-batcher/bindings/batch_inbox.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/contracts-bedrock/snapshots/abi/BatchAuthenticator.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,34 @@
127127
"stateMutability": "nonpayable",
128128
"type": "function"
129129
},
130+
{
131+
"inputs": [
132+
{
133+
"internalType": "bytes32",
134+
"name": "pcr0Hash",
135+
"type": "bytes32"
136+
},
137+
{
138+
"internalType": "bytes",
139+
"name": "attestationTbs",
140+
"type": "bytes"
141+
},
142+
{
143+
"internalType": "bytes",
144+
"name": "signature",
145+
"type": "bytes"
146+
},
147+
{
148+
"internalType": "address",
149+
"name": "enclaveAddress",
150+
"type": "address"
151+
}
152+
],
153+
"name": "registerSignerWithoutAttestationVerification",
154+
"outputs": [],
155+
"stateMutability": "nonpayable",
156+
"type": "function"
157+
},
130158
{
131159
"inputs": [],
132160
"name": "renounceOwnership",

packages/contracts-bedrock/snapshots/semver-lock.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"src/L1/BatchAuthenticator.sol:BatchAuthenticator": {
3-
"initCodeHash": "0x886ad73f143db896806140ccb2a64c353c4822bcc6021e1e6bb48497da478d1c",
4-
"sourceCodeHash": "0xb0769be04670274b46231d81eb19b7bac6f2f8d4b4989ad9dda4aea85ef6166d"
3+
"initCodeHash": "0xe6ba63f419d207f6e940b5561bc8dd5f04ca68db90958e162ef4ad5aea742bca",
4+
"sourceCodeHash": "0x35ef276cc6c8e33b09c957f3636c6dc98a961429d1cba4ca219b93fb1afb5864"
55
},
66
"src/L1/DataAvailabilityChallenge.sol:DataAvailabilityChallenge": {
77
"initCodeHash": "0xacbae98cc7c0f7ecbf36dc44bbf7cb0a011e6e6b781e28b9dbf947e31482b30d",

packages/contracts-bedrock/src/L1/BatchAuthenticator.sol

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,17 @@ contract BatchAuthenticator is ISemver, OwnableUpgradeable {
6161
function registerSigner(bytes calldata attestationTbs, bytes calldata signature) external {
6262
espressoTEEVerifier.registerSigner(attestationTbs, signature, IEspressoTEEVerifier.TeeType.NITRO);
6363
}
64+
65+
function registerSignerWithoutAttestationVerification(
66+
bytes32 pcr0Hash,
67+
bytes calldata attestationTbs,
68+
bytes calldata signature,
69+
address enclaveAddress
70+
)
71+
external
72+
{
73+
espressoTEEVerifier.espressoNitroTEEVerifier().registerSignerWithoutAttestationVerification(
74+
pcr0Hash, attestationTbs, signature, enclaveAddress
75+
);
76+
}
6477
}

0 commit comments

Comments
 (0)