Skip to content

Commit

Permalink
feat: update L1 origin block hash handling and add full L1 origin blo…
Browse files Browse the repository at this point in the history
…ck hash field
  • Loading branch information
luis-herasme committed Nov 12, 2024
1 parent ce843d4 commit 88055e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
16 changes: 7 additions & 9 deletions apps/web/src/pages/tx/[hash].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,30 +281,28 @@ const Tx: NextPage = () => {
},
{
name: "Parent L2 block hash",
value: (
<div className="flex items-center gap-2">
{"0x" + decodedData.parentL2BlockHash + "..."}
</div>
),
value: "0x" + decodedData.parentL2BlockHash + "...",
},
{
name: "L1 origin block hash",
value: (
value: decodedData.fullL1OriginBlockHash ? (
<div className="flex items-center gap-2">
<Link
href={
"https://etherscan.io/block/" +
"0x" +
decodedData.l1OriginBlockHash
decodedData.fullL1OriginBlockHash
}
>
{"0x" + decodedData.l1OriginBlockHash}
{"0x" + decodedData.fullL1OriginBlockHash}
</Link>
<CopyToClipboard
value={"0x" + decodedData.l1OriginBlockHash}
value={"0x" + decodedData.fullL1OriginBlockHash}
label="Copy L1 origin block hash"
/>
</div>
) : (
"0x" + decodedData.l1OriginBlockHash + "..."
),
},
{
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/blob-parse/optimism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const OptimismDecodedDataSchema = z.object({
changedByL1Origin: z.number(),
totalTxs: z.number(),
contractCreationTxsNumber: z.number(),
fullL1OriginBlockHash: z.string().optional(),
});

type OptimismDecodedData = z.infer<typeof OptimismDecodedDataSchema>;
Expand All @@ -37,7 +38,7 @@ export async function parseOptimismDecodedData(
const hash = await autocompleteBlockHash(decoded.data.l1OriginBlockHash);

if (hash) {
decoded.data.l1OriginBlockHash = hash;
decoded.data.fullL1OriginBlockHash = hash;

Check warning on line 41 in packages/api/src/blob-parse/optimism.ts

View check run for this annotation

Codecov / codecov/patch

packages/api/src/blob-parse/optimism.ts#L41

Added line #L41 was not covered by tests
} else {
logger.error(
`Failed to get full block hash for L1 origin block hash: ${decoded.data.l1OriginBlockHash}`
Expand Down

0 comments on commit 88055e2

Please sign in to comment.