Skip to content
Merged
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: 13 additions & 3 deletions packages/sdk/src/cross-chain-messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1003,9 +1003,19 @@ export class CrossChainMessenger {
* @returns Current challenge period in seconds.
*/
public async getChallengePeriodSeconds(): Promise<number> {
const challengePeriod = this.bedrock
? await this.contracts.l1.L2OutputOracle.FINALIZATION_PERIOD_SECONDS()
: await this.contracts.l1.StateCommitmentChain.FRAUD_PROOF_WINDOW()
if (!this.bedrock) {
return (await this.contracts.l1.StateCommitmentChain.FRAUD_PROOF_WINDOW()).toNumber()
}

const oracleVersion = await this.contracts.l1.L2OutputOracle.version()
const challengePeriod = oracleVersion === '1.0.0'
// The ABI in the SDK does not contain FINALIZATION_PERIOD_SECONDS
// in OptimismPortal, so making an explicit call instead.
? BigNumber.from(await this.contracts.l1.OptimismPortal.provider.call({
to: this.contracts.l1.OptimismPortal.address,
data: '0xf4daa291' // FINALIZATION_PERIOD_SECONDS
}))
: await this.contracts.l1.L2OutputOracle.FINALIZATION_PERIOD_SECONDS()
return challengePeriod.toNumber()
}

Expand Down