Skip to content

Commit b773943

Browse files
committed
changes
1 parent 519f859 commit b773943

File tree

12 files changed

+47
-56
lines changed

12 files changed

+47
-56
lines changed

scripts/config.template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const config = {
2424
delaySeconds: ethers.BigNumber.from('86400'),
2525
futureSeconds: ethers.BigNumber.from('3600'),
2626
},
27-
espressoTEEVerifier: '0x8354db765810dF8F24f1477B06e91E5b17a408bF',
27+
decentralizedTimeboostKeyManager: '0x8354db765810dF8F24f1477B06e91E5b17a408bF',
2828
},
2929
validators: [
3030
'AN_OWNED_ADDRESS',

scripts/config.ts.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const config = {
3333
max: ethers.BigNumber.from('14400'),
3434
replenishRateInBasis: ethers.BigNumber.from('833'),
3535
}
36-
espressoTEEVerifier: '0xb562622f2D76F355D673560CB88c1dF6088702f1',
36+
decentralizedTimeboostKeyManager: '0xb562622f2D76F355D673560CB88c1dF6088702f1',
3737
},
3838
validators: [
3939
'0x1234123412341234123412341234123412341234',

scripts/rollupCreation.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export async function createRollup(
6767
rollupCreatorAddress: string,
6868
feeToken: string,
6969
feeTokenPricer: string,
70-
stakeToken: string
71-
espressoTEEVerifierAddress: string,
70+
stakeToken: string,
71+
decentralizedTimeboostKeyManager: string,
7272
): Promise<{
7373
rollupCreationResult: RollupCreationResult
7474
chainInfo: ChainInfo
@@ -113,7 +113,8 @@ export async function createRollup(
113113
feeToken,
114114
feeTokenPricer,
115115
validatorWalletCreator,
116-
stakeToken
116+
stakeToken,
117+
decentralizedTimeboostKeyManager
117118
)
118119
: {
119120
config: config.config,
@@ -237,7 +238,7 @@ async function _getDevRollupConfig(
237238
feeTokenPricer: string,
238239
validatorWalletCreator: string,
239240
stakeToken: string,
240-
espressoTEEVerifierAddress: string
241+
decentralizedTimeboostKeyManager: string
241242
): Promise<RollupCreator.RollupDeploymentParamsStruct> {
242243
// set up owner address
243244
const ownerAddress =
@@ -347,7 +348,7 @@ async function _getDevRollupConfig(
347348
futureSeconds: ethers.BigNumber.from('3600'),
348349
},
349350
anyTrustFastConfirmer: ethers.constants.AddressZero,
350-
espressoTEEVerifier: espressoTEEVerifierAddress,
351+
decentralizedTimeboostKeyManager: decentralizedTimeboostKeyManager,
351352
}
352353

353354
return {

src/bridge/SequencerInbox.sol

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
156156
// True if the SequencerInbox is delay bufferable
157157
bool public immutable isDelayBufferable;
158158

159-
IEspressoTEEVerifier public espressoTEEVerifier;
159+
KeyManager public timeboostKeyManager;
160160

161161
constructor(
162162
uint256 _maxDataSize,
@@ -221,7 +221,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
221221
ISequencerInbox.MaxTimeVariation calldata maxTimeVariation_,
222222
BufferConfig memory bufferConfig_,
223223
IFeeTokenPricer feeTokenPricer_,
224-
address _espressoTEEVerifier
224+
address _timeboostKeyManager
225225
) external onlyDelegated {
226226
if (bridge != IBridge(address(0))) revert AlreadyInit();
227227
if (bridge_ == IBridge(address(0))) revert HadZeroInit();
@@ -252,7 +252,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
252252

253253
feeTokenPricer = feeTokenPricer_;
254254

255-
espressoTEEVerifier = IEspressoTEEVerifier(_espressoTEEVerifier);
255+
timeboostKeyManager = KeyManager(_timeboostKeyManager);
256256
}
257257

258258
/// @notice Allows the rollup owner to sync the rollup address
@@ -435,7 +435,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
435435
IGasRefunder gasRefunder,
436436
uint256 prevMessageCount,
437437
uint256 newMessageCount,
438-
bytes memory espressoMetadata
438+
bytes memory signatures
439439
) external refundsGas(gasRefunder, IReader4844(address(0))) {
440440
if (!CallerChecker.isCallerCodelessOrigin()) revert NotCodelessOrigin();
441441
if (!isBatchPoster[msg.sender]) revert NotBatchPoster();
@@ -445,11 +445,6 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
445445
// Question for Espresso Team
446446
// Should we check the quote here?
447447

448-
(uint256 hotshotHeight, bytes memory signature, IEspressoTEEVerifier.TeeType teeType) = abi.decode(
449-
espressoMetadata,
450-
(uint256, bytes, IEspressoTEEVerifier.TeeType)
451-
);
452-
453448
// take keccak2256 hash of all the function arguments
454449
// along with the hotshot height
455450
bytes32 reportDataHash = keccak256(
@@ -459,16 +454,17 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
459454
afterDelayedMessagesRead,
460455
address(gasRefunder),
461456
prevMessageCount,
462-
newMessageCount,
463-
hotshotHeight
457+
newMessageCount
464458
)
465459
);
466460
// verify the the reportDataHash was signed by the a registered ephemeral key
467461
// generated inside a registered TEE
468-
espressoTEEVerifier.verify(signature, reportDataHash, teeType);
462+
if (!timeboostKeyManager.verifyBatchSignatures(reportDataHash, signatures)) {
463+
revert("invalid signatures");
464+
}
469465
// signature from a registered ephemeral key generated inside TEE
470466
// was verified over the batch data hash
471-
emit TEESignatureVerified(sequenceNumber, hotshotHeight);
467+
emit TEESignatureVerified(sequenceNumber, newMessageCount);
472468

473469
addSequencerL2BatchFromCalldataImpl(
474470
sequenceNumber,
@@ -498,19 +494,14 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
498494
IGasRefunder gasRefunder,
499495
uint256 prevMessageCount,
500496
uint256 newMessageCount,
501-
bytes memory espressoMetadata
497+
bytes memory signatures
502498
) external refundsGas(gasRefunder, reader4844) {
503499
if (!isBatchPoster[msg.sender]) revert NotBatchPoster();
504500
if (isDelayProofRequired(afterDelayedMessagesRead))
505501
revert DelayProofRequired();
506502

507503
bytes32[] memory dataHashes = reader4844.getDataHashes();
508504
if (dataHashes.length == 0) revert MissingDataHashes();
509-
510-
(uint256 hotshotHeight, bytes memory signature, IEspressoTEEVerifier.TeeType teeType) = abi.decode(
511-
espressoMetadata,
512-
(uint256, bytes, IEspressoTEEVerifier.TeeType)
513-
);
514505
// take keccak2256 hash of all the function arguments and encode packed blob hashes
515506
// except the quote
516507
bytes32 reportDataHash = keccak256(
@@ -520,13 +511,14 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
520511
address(gasRefunder),
521512
prevMessageCount,
522513
newMessageCount,
523-
abi.encode(dataHashes),
524-
hotshotHeight
514+
abi.encode(dataHashes)
525515
)
526516
);
527517
// verify the quote for the batch poster running in the TEE
528-
espressoTEEVerifier.verify(signature, reportDataHash, teeType);
529-
emit TEESignatureVerified(sequenceNumber, hotshotHeight);
518+
if (!timeboostKeyManager.verifyBatchSignatures(reportDataHash, signatures)) {
519+
revert("invalid signatures");
520+
}
521+
emit TEESignatureVerified(sequenceNumber, newMessageCount);
530522
addSequencerL2BatchFromBlobsImpl(
531523
sequenceNumber,
532524
afterDelayedMessagesRead,
@@ -713,7 +705,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
713705
* @param gasRefunder - the gas refunder contract
714706
* @param prevMessageCount - the number of messages in the previous batch
715707
* @param newMessageCount - the number of messages in the new batch
716-
* @param espressoMetadata - the signature, the hotshot height, and TeeType
708+
* @param signatures - the signature, the hotshot height, and TeeType
717709
*/
718710
function addSequencerL2Batch(
719711
uint256 sequenceNumber,
@@ -722,7 +714,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
722714
IGasRefunder gasRefunder,
723715
uint256 prevMessageCount,
724716
uint256 newMessageCount,
725-
bytes memory espressoMetadata
717+
bytes memory signatures
726718
) external override refundsGas(gasRefunder, IReader4844(address(0))) {
727719
if (!isBatchPoster[msg.sender] && msg.sender != address(rollup))
728720
revert NotBatchPoster();
@@ -735,10 +727,6 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
735727
// Only check the attestation quote if the batch has been posted by the
736728
// batch poster
737729
if (isBatchPoster[msg.sender]) {
738-
(uint256 hotshotHeight, bytes memory signature, IEspressoTEEVerifier.TeeType teeType) = abi.decode(
739-
espressoMetadata,
740-
(uint256, bytes, IEspressoTEEVerifier.TeeType)
741-
);
742730
// take keccak2256 hash of all the function arguments
743731
// along with the hotshot height
744732
bytes32 reportDataHash = keccak256(
@@ -748,15 +736,16 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
748736
afterDelayedMessagesRead,
749737
address(gasRefunder),
750738
prevMessageCount,
751-
newMessageCount,
752-
hotshotHeight
739+
newMessageCount
753740
)
754741
);
755742

756-
espressoTEEVerifier.verify(signature, reportDataHash, teeType);
743+
if (!timeboostKeyManager.verifyBatchSignatures(reportDataHash, signatures)) {
744+
revert("invalid signatures");
745+
}
757746
// signature from a registered ephemeral key generated inside a registered TEE
758747
// was verified over the batch data hash
759-
emit TEESignatureVerified(sequenceNumber, hotshotHeight);
748+
emit TEESignatureVerified(sequenceNumber, newMessageCount);
760749
}
761750

762751
addSequencerL2BatchFromCalldataImpl(
@@ -1192,10 +1181,10 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
11921181
emit BufferConfigSet(bufferConfig_);
11931182
}
11941183

1195-
function setEspressoTEEVerifier(
1196-
address _espressoTEEVerifier
1184+
function setTimeboostKeyManager(
1185+
address _timeboostKeyManager
11971186
) external onlyRollupOwner {
1198-
espressoTEEVerifier = IEspressoTEEVerifier(_espressoTEEVerifier);
1187+
timeboostKeyManager = KeyManager(_timeboostKeyManager);
11991188
emit OwnerFunctionCalled(6);
12001189
}
12011190

src/mocks/SequencerInboxStub.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pragma solidity ^0.8.0;
77
import '../bridge/SequencerInbox.sol';
88
import '../bridge/IEthBridge.sol';
99
import { INITIALIZATION_MSG_TYPE } from '../libraries/MessageTypes.sol';
10+
import {KeyManager} from "timeboost-contracts/KeyManager.sol";
1011

1112
contract SequencerInboxStub is SequencerInbox {
1213
constructor(
@@ -17,7 +18,7 @@ contract SequencerInboxStub is SequencerInbox {
1718
IReader4844 reader4844_,
1819
bool isUsingFeeToken_,
1920
bool isDelayBufferable_,
20-
address espressoTEEVerifier_
21+
address timeboostKeyManager_
2122
)
2223
SequencerInbox(
2324
maxDataSize_,
@@ -33,7 +34,7 @@ contract SequencerInboxStub is SequencerInbox {
3334
delaySeconds = uint64(maxTimeVariation_.delaySeconds);
3435
futureSeconds = uint64(maxTimeVariation_.futureSeconds);
3536
isBatchPoster[sequencer_] = true;
36-
espressoTEEVerifier = IEspressoTEEVerifier(espressoTEEVerifier_);
37+
timeboostKeyManager = KeyManager(timeboostKeyManager_);
3738
}
3839

3940
function addInitMessage(uint256 chainId) external {

src/rollup/BOLDUpgradeAction.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ contract BOLDUpgradeAction {
391391
// this isnt used during rollup creation, so we can pass in empty
392392
ISequencerInbox.MaxTimeVariation memory maxTimeVariation;
393393
BufferConfig memory bufferConfig;
394-
address espressoTEEVerifier;
394+
address decentralizedTimeboostKeyManager;
395395
return
396396
Config({
397397
confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS,
@@ -416,7 +416,7 @@ contract BOLDUpgradeAction {
416416
numBigStepLevel: NUM_BIGSTEP_LEVEL,
417417
challengeGracePeriodBlocks: CHALLENGE_GRACE_PERIOD_BLOCKS,
418418
bufferConfig: bufferConfig,
419-
espressoTEEVerifier: espressoTEEVerifier
419+
decentralizedTimeboostKeyManager: decentralizedTimeboostKeyManager
420420
});
421421
}
422422

src/rollup/BridgeCreator.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ contract BridgeCreator is Ownable {
130130
ISequencerInbox.MaxTimeVariation calldata maxTimeVariation,
131131
BufferConfig calldata bufferConfig,
132132
IFeeTokenPricer feeTokenPricer,
133-
address espressoTEEVerifier
133+
address decentralizedTimeboostKeyManager
134134
) external returns (BridgeContracts memory) {
135135
// use create2 salt to ensure deterministic addresses
136136
bytes32 create2Salt = keccak256(abi.encode(msg.data, msg.sender));
@@ -159,7 +159,7 @@ contract BridgeCreator is Ownable {
159159
maxTimeVariation,
160160
bufferConfig,
161161
feeTokenPricer,
162-
espressoTEEVerifier
162+
decentralizedTimeboostKeyManager
163163
);
164164
frame.inbox.initialize(frame.bridge, frame.sequencerInbox);
165165
frame.rollupEventInbox.initialize(frame.bridge);

src/rollup/Config.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct Config {
3939
uint64 challengeGracePeriodBlocks;
4040
BufferConfig bufferConfig;
4141
// address of the TEE verifier contract
42-
address espressoTEEVerifier;
42+
address decentralizedTimeboostKeyManager;
4343
}
4444

4545
struct ContractDependencies {

src/rollup/RollupCreator.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ contract RollupCreator is Ownable {
201201
deployParams.config.sequencerInboxMaxTimeVariation,
202202
deployParams.config.bufferConfig,
203203
deployParams.feeTokenPricer,
204-
deployParams.config.espressoTEEVerifier
204+
deployParams.config.decentralizedTimeboostKeyManager
205205
);
206206

207207
IEdgeChallengeManager challengeManager = createChallengeManager(

test/Rollup.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ contract RollupTest is Test {
215215
max: 14400,
216216
replenishRateInBasis: 500
217217
}),
218-
espressoTEEVerifier: address(espressoTEEVerifier)
218+
decentralizedTimeboostKeyManager: address(espressoTEEVerifier)
219219
});
220220

221221
vm.expectEmit(false, false, false, false);

0 commit comments

Comments
 (0)