Skip to content

Commit

Permalink
Fix/mantle preverification (#337)
Browse files Browse the repository at this point in the history
* mantle calculations

* refactor

* rename to TimedQueue

* cleanup gasPriceManager

* split into different files

* cleanup

---------

Co-authored-by: mouseless <[email protected]>
  • Loading branch information
mouseless0x and mouseless0x authored Oct 21, 2024
1 parent 1900e42 commit da149ac
Show file tree
Hide file tree
Showing 11 changed files with 613 additions and 383 deletions.
8 changes: 7 additions & 1 deletion src/cli/config/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,13 @@ export const bundlerArgsSchema = z.object({
})

export const compatibilityArgsSchema = z.object({
"chain-type": z.enum(["default", "op-stack", "arbitrum", "hedera"]),
"chain-type": z.enum([
"default",
"op-stack",
"arbitrum",
"hedera",
"mantle"
]),
"legacy-transactions": z.boolean(),
"api-version": z
.string()
Expand Down
2 changes: 1 addition & 1 deletion src/cli/config/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export const compatibilityOptions: CliCommandOptions<ICompatibilityArgsInput> =
description:
"Indicates weather the chain is a OP stack chain, arbitrum chain, or default EVM chain",
type: "string",
choices: ["default", "op-stack", "arbitrum", "hedera"],
choices: ["default", "op-stack", "arbitrum", "hedera", "mantle"],
default: "default"
},
"legacy-transactions": {
Expand Down
36 changes: 36 additions & 0 deletions src/handlers/arbitrumGasPriceManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { maxUint128 } from "viem"
import { TimedQueue } from "../utils/timedQueue"

export class ArbitrumManager {
private l1BaseFeeQueue: TimedQueue
private l2BaseFeeQueue: TimedQueue

constructor(maxQueueSize: number) {
const queueValidity = 15_000
this.l1BaseFeeQueue = new TimedQueue(maxQueueSize, queueValidity)
this.l2BaseFeeQueue = new TimedQueue(maxQueueSize, queueValidity)
}

public saveL1BaseFee(baseFee: bigint) {
this.l1BaseFeeQueue.saveValue(baseFee)
}

public saveL2BaseFee(baseFee: bigint) {
this.l2BaseFeeQueue.saveValue(baseFee)
}

public getMinL1BaseFee() {
let minL1BaseFee = this.l1BaseFeeQueue.getMinValue() || 1n
return minL1BaseFee
}

public getMaxL1BaseFee() {
let maxL1BaseFee = this.l1BaseFeeQueue.getMaxValue() || maxUint128
return maxL1BaseFee
}

public getMaxL2BaseFee() {
let maxL2BaseFee = this.l2BaseFeeQueue.getMaxValue() || maxUint128
return maxL2BaseFee
}
}
Loading

0 comments on commit da149ac

Please sign in to comment.