Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tee proof badge #381

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/api/src/batch/batchDetails.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,12 @@ export class BatchDetailsDto extends BatchDto {
example: "100000000",
})
public readonly l2FairGasPrice: string;

@ApiProperty({
type: Date,
description: "Date when the batch was TEE proven",
example: new Date("2022-09-15T15:13:57.035Z"),
examples: [new Date("2022-09-15T15:13:57.035Z"), null],
})
public readonly teeProvenAt?: Date;
}
3 changes: 3 additions & 0 deletions packages/api/src/batch/batchDetails.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ export class BatchDetails extends Batch {

@Column({ type: "varchar", length: 128 })
public readonly l2FairGasPrice: string;

@Column({ type: "timestamp", nullable: true })
public readonly teeProvenAt?: Date;
}
7 changes: 7 additions & 0 deletions packages/api/test/batch.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe("BatchController (e2e)", () => {
batchRepository = app.get<Repository<BatchDetails>>(getRepositoryToken(BatchDetails));

for (let i = 0; i < 40; i++) {
const isTeeProven = i >= 5 && i < 20;
const isCommitted = i < 30;
const isProven = i < 20;
const isExecuted = i < 10;
Expand All @@ -43,6 +44,7 @@ describe("BatchController (e2e)", () => {
committedAt: isCommitted ? new Date("2022-11-10T14:44:06.000Z") : null,
provenAt: isProven ? new Date("2022-11-10T14:44:07.000Z") : null,
executedAt: isExecuted ? new Date("2022-11-10T14:44:08.000Z") : null,
teeProvenAt: isTeeProven ? new Date("2022-11-10T14:44:09.000Z") : null,
});
}
});
Expand Down Expand Up @@ -75,6 +77,7 @@ describe("BatchController (e2e)", () => {
committedAt: "2022-11-10T14:44:06.000Z",
provenAt: "2022-11-10T14:44:07.000Z",
executedAt: "2022-11-10T14:44:08.000Z",
teeProvenAt: null,
})
);
});
Expand All @@ -92,6 +95,7 @@ describe("BatchController (e2e)", () => {
committedAt: "2022-11-10T14:44:06.000Z",
provenAt: "2022-11-10T14:44:07.000Z",
executedAt: "2022-11-10T14:44:08.000Z",
teeProvenAt: null,
})
);
});
Expand All @@ -109,6 +113,7 @@ describe("BatchController (e2e)", () => {
committedAt: "2022-11-10T14:44:06.000Z",
provenAt: "2022-11-10T14:44:07.000Z",
executedAt: null,
teeProvenAt: "2022-11-10T14:44:09.000Z",
})
);
});
Expand All @@ -126,6 +131,7 @@ describe("BatchController (e2e)", () => {
committedAt: "2022-11-10T14:44:06.000Z",
provenAt: null,
executedAt: null,
teeProvenAt: null,
})
);
});
Expand All @@ -143,6 +149,7 @@ describe("BatchController (e2e)", () => {
committedAt: null,
provenAt: null,
executedAt: null,
teeProvenAt: null,
})
);
});
Expand Down
8 changes: 8 additions & 0 deletions packages/app/src/components/common/Title.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<Badge v-if="isEvmLike" color="primary" class="verified-badge" :tooltip="t('contract.evmTooltip')">
{{ t("contract.evm") }}
</Badge>
<Badge v-if="isTeeVerified" color="dark-success" class="verified-badge" :tooltip="t('batches.teeTooltip')">
{{ t("batches.tee") }}
</Badge>
</div>
</h1>
</template>
Expand Down Expand Up @@ -40,6 +43,11 @@ defineProps({
default: false,
required: false,
},
isTeeVerified: {
type: Boolean,
default: false,
required: false,
},
});

const { t } = useI18n();
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/composables/common/Api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ declare namespace Api {
provenAt: string | null;
l1GasPrice: string;
l2FairGasPrice: string;
teeProvenAt?: string | null;
};

type Log = {
Expand Down
2 changes: 2 additions & 0 deletions packages/app/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@
"executedAtTooltip": "The date and time at which L1 Batch is executed on Ethereum",
"notYetExecuted": "Not yet executed",
"notYetSealed": "This batch is not sealed yet",
"tee": "Verified by TEE",
"teeTooltip": "Verified by TEE",
"transactionTable": {
"title": "Batch Transactions",
"error": "Something went wrong",
Expand Down
7 changes: 6 additions & 1 deletion packages/app/src/views/BatchView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
<Breadcrumbs :items="breadcrumbItems" />
<SearchForm class="search-form" />
</div>
<Title v-if="!batchPending" :title="t('batches.batchNumber')" :value="id">
<Title
v-if="!batchPending"
:title="t('batches.batchNumber')"
:value="id"
:is-tee-verified="!!batchItem?.teeProvenAt"
>
{{ parseInt(id) }}
</Title>
<Spinner v-else size="md" />
Expand Down
5 changes: 5 additions & 0 deletions packages/worker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ WAIT_FOR_BLOCKS_INTERVAL=1000
BLOCKS_PROCESSING_BATCH_SIZE=10
NUMBER_OF_BLOCKS_PER_DB_TRANSACTION=10

# Tee proof block start for:
# mainnet 490556
# testnet 10559
# staging 583000
TEE_PROOF_START_BATCH_NUMBER=490556
BATCHES_PROCESSING_POLLING_INTERVAL=60000
DELETE_BALANCES_INTERVAL=300000

Expand Down
Loading
Loading