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

fix: adjust blockTime inside InboxTools.findFirstBlockBelow in v3 #475

Merged
merged 3 commits into from
Jun 12, 2024

Conversation

brtkx
Copy link
Contributor

@brtkx brtkx commented May 24, 2024

No description provided.

Copy link

vercel bot commented May 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
arbitrum-sdk ✅ Ready (Inspect) Visit Preview Jun 7, 2024 10:14am

@cla-bot cla-bot bot added the cla-signed label May 24, 2024
@brtkx brtkx changed the title fix: adjust blockTime inside InboxTools.findFirstBlockBelow in v3 fix: adjust blockTime inside InboxTools.findFirstBlockBelow in v3 May 24, 2024
@spsjvc spsjvc requested a review from gzeoneth June 3, 2024 16:07
this.l1Provider as JsonRpcProvider
)
const currentArbBlock = await arbProvider.getBlock(
await arbProvider.getBlockNumber()
Copy link
Member

Choose a reason for hiding this comment

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

I think we can use "latest" instead of making 2 calls?

@@ -183,7 +234,8 @@ export class InboxTools {
await multicall.multiCall(multicallInput, true)

const firstEligibleBlockNumber =
currentBlockNumber.toNumber() - maxTimeVariation.delayBlocks.toNumber()
(currentL1BlockNumber ?? currentBlockNumber.toNumber()) -
Copy link
Member

Choose a reason for hiding this comment

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

use isParentChainArbitrum ? instead of currentL1BlockNumber ??, doesn't matter too much tho

@@ -90,6 +95,38 @@ export class InboxTools {
blockNumber: number,
blockTimestamp: number
): Promise<Block> {
const isParentChainArbitrum = await isArbitrumChain(this.l1Provider)

const nodeInterface = NodeInterface__factory.connect(
Copy link
Member

Choose a reason for hiding this comment

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

can be defined within the next if

Copy link
Member

Choose a reason for hiding this comment

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

const diffBlocks = Math.max(Math.ceil(diff / this.l1Network.blockTime), 10)

I think we need to hardcode the blocktime here because we want to real "L1" block time here but l1Network.blockTime for a L3 chain can be the L2 block time?

@spsjvc spsjvc merged commit 9bc672b into main Jun 12, 2024
24 checks passed
@spsjvc spsjvc deleted the fix-blockTime-findFirstBlockBelow-v3 branch June 12, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants