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

Use different hardcoded redeemGas when connected to an Arbitrum network #2252

Merged
merged 2 commits into from
Feb 10, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- \#2222 Use L1 block number for Ticket Parameters and Round Initialization (@leszko)
- \#2240 Backfill always from the back last seen in DB (instead of the last round block) (@leszko)
- \#2171 Make transactions compatible with Arbitrum and fix setting max gas price (@leszko)
- \#2252 Use different hardcoded redeemGas when connected to an Arbitrum network (@leszko)

#### Broadcaster

Expand Down
14 changes: 12 additions & 2 deletions cmd/livepeer/livepeer.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ var (
// The maximum blocks for the block watcher to retain
blockWatcherRetentionLimit = 20

// Estimate of the gas required to redeem a PM ticket
redeemGas = 350000
// Estimate of the gas required to redeem a PM ticket on L1 Ethereum
redeemGasL1 = 350000
// Estimate of the gas required to redeem a PM ticket on L2 Arbitrum
redeemGasL2 = 1200000
// The multiplier on the transaction cost to use for PM ticket faceValue
txCostMultiplier = 100

Expand Down Expand Up @@ -210,20 +212,24 @@ func main() {
type NetworkConfig struct {
ethController string
minGasPrice int64
redeemGas int
}

ctx := context.Background()

configOptions := map[string]*NetworkConfig{
"rinkeby": {
ethController: "0x9a9827455911a858E55f07911904fACC0D66027E",
redeemGas: redeemGasL1,
},
"arbitrum-one-rinkeby": {
ethController: "0x9ceC649179e2C7Ab91688271bcD09fb707b3E574",
redeemGas: redeemGasL2,
},
"mainnet": {
ethController: "0xf96d54e490317c557a967abfa5d6e33006be69b3",
minGasPrice: int64(params.GWei),
redeemGas: redeemGasL1,
},
}

Expand All @@ -246,6 +252,7 @@ func main() {
}

// Setting config options based on specified network
var redeemGas int
if netw, ok := configOptions[*network]; ok {
if *ethController == "" {
*ethController = netw.ethController
Expand All @@ -255,8 +262,11 @@ func main() {
*minGasPrice = netw.minGasPrice
}

redeemGas = netw.redeemGas

glog.Infof("***Livepeer is running on the %v network: %v***", *network, *ethController)
} else {
redeemGas = redeemGasL1
glog.Infof("***Livepeer is running on the %v network***", *network)
}

Expand Down