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: update L1 origin block hash handling and add full L1 origin block hash field #631

Open
wants to merge 1 commit 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
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 + "...",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've found Ox several times repeated as a raw string. I would create a const for it

},
{
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}
Copy link
Member

Choose a reason for hiding this comment

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

Let's extract this to a constant?

</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 @@
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 @@
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
Loading