Skip to content
Merged
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
2 changes: 1 addition & 1 deletion packages/contracts/src/deployment/contract-deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const deployContract = async (

const deployResult = await config.signer.sendTransaction({
data: rawTx.data,
gasLimit: 9_500_000,
gasLimit: 7_500_000,
Copy link
Contributor

Choose a reason for hiding this comment

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

👍👍

gasPrice: 2_000_000_000,
value: 0,
nonce: await config.signer.getTransactionCount('pending'),
Expand Down
29 changes: 23 additions & 6 deletions packages/core-db/src/app/ethereum/ethereum-block-processor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* External Imports */
import { getLogger, logError } from '@eth-optimism/core-utils'
import { getLogger, logError, sleep } from '@eth-optimism/core-utils'
import { Block, Provider, TransactionReceipt } from 'ethers/providers'

/* Internal Imports */
Expand Down Expand Up @@ -112,11 +112,28 @@ export class EthereumBlockProcessor {
`Waiting for ${this.confirmsUntilFinal} confirms before disseminating block ${blockNumber}`
)
try {
const receipt: TransactionReceipt = await provider.waitForTransaction(
(block.transactions[0] as any).hash,
this.confirmsUntilFinal
)
if (receipt.blockHash !== block.hash) {
let refetchedHash: string
if (block.transactions.length > 0) {
const receipt: TransactionReceipt = await provider.waitForTransaction(
(block.transactions[0] as any).hash,
this.confirmsUntilFinal
)
refetchedHash = receipt.blockHash
} else {
while (
(await provider.getBlockNumber()) <
blockNumber + this.confirmsUntilFinal
) {
log.debug(
`Waiting for empty block ${blockNumber} to be final. Sleeping...`
)
await sleep(15_000)
}
Comment on lines +123 to +131
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need both cases or can we just keep this one?

Copy link
Author

@willmeister willmeister Sep 19, 2020

Choose a reason for hiding this comment

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

No, don't need to. Was thinking maaaaaybe ethers does something better than just polling, so that's better than this? Happy to consolidate if you think though. Eventually we'll go with the "this block finalizes the block X blocks ago" approach vs the "I got a block, now wait a bunch of blocks for this block to be final" approach.

Copy link
Author

Choose a reason for hiding this comment

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

Going to ship for now but happy to change it post-merge if you'd like!

const refetched = await provider.getBlock(blockNumber)
refetchedHash = refetched.hash
}

if (refetchedHash !== block.hash) {
log.info(
`Re-org processing block number ${blockNumber}. Re-fetching block.`
)
Expand Down