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

Sort txs in worker by gasPrice (remove efficiency sort) #2392

Merged
merged 3 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
40 changes: 0 additions & 40 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,42 +100,6 @@ func Test_Defaults(t *testing.T) {
path: "Sequencer.MaxTxLifetime",
expectedValue: types.NewDuration(3 * time.Hour),
},
{
path: "Sequencer.WeightBatchBytesSize",
expectedValue: 1,
},
{
path: "Sequencer.WeightCumulativeGasUsed",
expectedValue: 1,
},
{
path: "Sequencer.WeightKeccakHashes",
expectedValue: 1,
},
{
path: "Sequencer.WeightPoseidonHashes",
expectedValue: 1,
},
{
path: "Sequencer.WeightPoseidonPaddings",
expectedValue: 1,
},
{
path: "Sequencer.WeightMemAligns",
expectedValue: 1,
},
{
path: "Sequencer.WeightArithmetics",
expectedValue: 1,
},
{
path: "Sequencer.WeightBinaries",
expectedValue: 1,
},
{
path: "Sequencer.WeightSteps",
expectedValue: 1,
},
{
path: "Sequencer.Finalizer.GERDeadlineTimeout",
expectedValue: types.NewDuration(5 * time.Second),
Expand Down Expand Up @@ -208,10 +172,6 @@ func Test_Defaults(t *testing.T) {
path: "Sequencer.DBManager.L2ReorgRetrievalInterval",
expectedValue: types.NewDuration(5 * time.Second),
},
{
path: "Sequencer.Worker.ResourceCostMultiplier",
expectedValue: float64(1000),
},
{
path: "SequenceSender.WaitPeriodSendSequence",
expectedValue: types.NewDuration(5 * time.Second),
Expand Down
11 changes: 0 additions & 11 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@ MaxMemAligns = 236585
MaxArithmetics = 236585
MaxBinaries = 473170
MaxSteps = 7570538
WeightBatchBytesSize = 1
WeightCumulativeGasUsed = 1
WeightKeccakHashes = 1
WeightPoseidonHashes = 1
WeightPoseidonPaddings = 1
WeightMemAligns = 1
WeightArithmetics = 1
WeightBinaries = 1
WeightSteps = 1
TxLifetimeCheckTimeout = "10m"
MaxTxLifetime = "3h"
[Sequencer.Finalizer]
Expand All @@ -111,8 +102,6 @@ MaxTxLifetime = "3h"
[Sequencer.DBManager]
PoolRetrievalInterval = "500ms"
L2ReorgRetrievalInterval = "5s"
[Sequencer.Worker]
ResourceCostMultiplier = 1000
[Sequencer.EffectiveGasPrice]
MaxBreakEvenGasPriceDeviationPercentage = 10
L1GasPriceFactor = 0.25
Expand Down
11 changes: 0 additions & 11 deletions config/environments/local/local.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,6 @@ MaxMemAligns = 236585
MaxArithmetics = 236585
MaxBinaries = 473170
MaxSteps = 7570538
WeightBatchBytesSize = 1
WeightCumulativeGasUsed = 1
WeightKeccakHashes = 1
WeightPoseidonHashes = 1
WeightPoseidonPaddings = 1
WeightMemAligns = 1
WeightArithmetics = 1
WeightBinaries = 1
WeightSteps = 1
TxLifetimeCheckTimeout = "10m"
MaxTxLifetime = "3h"
[Sequencer.Finalizer]
Expand All @@ -95,8 +86,6 @@ MaxTxLifetime = "3h"
[Sequencer.DBManager]
PoolRetrievalInterval = "500ms"
L2ReorgRetrievalInterval = "5s"
[Sequencer.Worker]
ResourceCostMultiplier = 1000
[Sequencer.EffectiveGasPrice]
MaxBreakEvenGasPriceDeviationPercentage = 10
L1GasPriceFactor = 0.25
Expand Down
57 changes: 0 additions & 57 deletions docs/config-file/node-config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -454,51 +454,6 @@
"description": "MaxSteps is max steps batch can handle",
"default": 7570538
},
"WeightBatchBytesSize": {
"type": "integer",
"description": "WeightBatchBytesSize is the cost weight for the BatchBytesSize batch resource",
"default": 1
},
"WeightCumulativeGasUsed": {
"type": "integer",
"description": "WeightCumulativeGasUsed is the cost weight for the CumulativeGasUsed batch resource",
"default": 1
},
"WeightKeccakHashes": {
"type": "integer",
"description": "WeightKeccakHashes is the cost weight for the KeccakHashes batch resource",
"default": 1
},
"WeightPoseidonHashes": {
"type": "integer",
"description": "WeightPoseidonHashes is the cost weight for the PoseidonHashes batch resource",
"default": 1
},
"WeightPoseidonPaddings": {
"type": "integer",
"description": "WeightPoseidonPaddings is the cost weight for the PoseidonPaddings batch resource",
"default": 1
},
"WeightMemAligns": {
"type": "integer",
"description": "WeightMemAligns is the cost weight for the MemAligns batch resource",
"default": 1
},
"WeightArithmetics": {
"type": "integer",
"description": "WeightArithmetics is the cost weight for the Arithmetics batch resource",
"default": 1
},
"WeightBinaries": {
"type": "integer",
"description": "WeightBinaries is the cost weight for the Binaries batch resource",
"default": 1
},
"WeightSteps": {
"type": "integer",
"description": "WeightSteps is the cost weight for the Steps batch resource",
"default": 1
},
"TxLifetimeCheckTimeout": {
"type": "string",
"title": "Duration",
Expand Down Expand Up @@ -641,18 +596,6 @@
"type": "object",
"description": "DBManager's specific config properties"
},
"Worker": {
"properties": {
"ResourceCostMultiplier": {
"type": "number",
"description": "ResourceCostMultiplier is the multiplier for the resource cost",
"default": 1000
}
},
"additionalProperties": false,
"type": "object",
"description": "Worker's specific config properties"
},
"EffectiveGasPrice": {
"properties": {
"MaxBreakEvenGasPriceDeviationPercentage": {
Expand Down
16 changes: 3 additions & 13 deletions sequencer/addrqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,29 +201,19 @@ func (a *addrQueue) updateCurrentNonceBalance(nonce *uint64, balance *big.Int) (
}

// UpdateTxZKCounters updates the ZKCounters for the given tx (txHash)
// If the updated tx is the readyTx it returns a copy of the previous readyTx, nil otherwise
func (a *addrQueue) UpdateTxZKCounters(txHash common.Hash, counters state.ZKCounters, constraints batchConstraintsFloat64, weights batchResourceWeights) (newReadyTx, prevReadyTx *TxTracker) {
func (a *addrQueue) UpdateTxZKCounters(txHash common.Hash, counters state.ZKCounters) {
txHashStr := txHash.String()

if (a.readyTx != nil) && (a.readyTx.HashStr == txHashStr) {
// We need to assign the new readyTx as a new TxTracker copy of the previous one with the updated efficiency
// We need to do in this way because the efficiency value is changed and we use this value as key field to
// add/delete TxTrackers in the efficiencyList
prevReadyTx := a.readyTx
newReadyTx := *a.readyTx
newReadyTx.updateZKCounters(counters, constraints, weights)
a.readyTx = &newReadyTx
log.Debugf("Updating readyTx %s with new ZKCounters from addrQueue %s", txHashStr, a.fromStr)
return a.readyTx, prevReadyTx
a.readyTx.updateZKCounters(counters)
} else {
txHashStr := txHash.String()
for _, txTracker := range a.notReadyTxs {
if txTracker.HashStr == txHashStr {
log.Debugf("Updating notReadyTx %s with new ZKCounters from addrQueue %s", txHashStr, a.fromStr)
txTracker.updateZKCounters(counters, constraints, weights)
txTracker.updateZKCounters(counters)
break
}
}
return nil, nil
}
}
36 changes: 0 additions & 36 deletions sequencer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,6 @@ type Config struct {
// MaxSteps is max steps batch can handle
MaxSteps uint32 `mapstructure:"MaxSteps"`

// WeightBatchBytesSize is the cost weight for the BatchBytesSize batch resource
WeightBatchBytesSize int `mapstructure:"WeightBatchBytesSize"`

// WeightCumulativeGasUsed is the cost weight for the CumulativeGasUsed batch resource
WeightCumulativeGasUsed int `mapstructure:"WeightCumulativeGasUsed"`

// WeightKeccakHashes is the cost weight for the KeccakHashes batch resource
WeightKeccakHashes int `mapstructure:"WeightKeccakHashes"`

// WeightPoseidonHashes is the cost weight for the PoseidonHashes batch resource
WeightPoseidonHashes int `mapstructure:"WeightPoseidonHashes"`

// WeightPoseidonPaddings is the cost weight for the PoseidonPaddings batch resource
WeightPoseidonPaddings int `mapstructure:"WeightPoseidonPaddings"`

// WeightMemAligns is the cost weight for the MemAligns batch resource
WeightMemAligns int `mapstructure:"WeightMemAligns"`

// WeightArithmetics is the cost weight for the Arithmetics batch resource
WeightArithmetics int `mapstructure:"WeightArithmetics"`

// WeightBinaries is the cost weight for the Binaries batch resource
WeightBinaries int `mapstructure:"WeightBinaries"`

// WeightSteps is the cost weight for the Steps batch resource
WeightSteps int `mapstructure:"WeightSteps"`

// TxLifetimeCheckTimeout is the time the sequencer waits to check txs lifetime
TxLifetimeCheckTimeout types.Duration `mapstructure:"TxLifetimeCheckTimeout"`

Expand All @@ -86,9 +59,6 @@ type Config struct {
// DBManager's specific config properties
DBManager DBManagerCfg `mapstructure:"DBManager"`

// Worker's specific config properties
Worker WorkerCfg `mapstructure:"Worker"`

// EffectiveGasPrice is the config for the gas price
EffectiveGasPrice EffectiveGasPriceCfg `mapstructure:"EffectiveGasPrice"`
}
Expand Down Expand Up @@ -129,12 +99,6 @@ type FinalizerCfg struct {
StopSequencerOnBatchNum uint64 `mapstructure:"StopSequencerOnBatchNum"`
}

// WorkerCfg contains the Worker's configuration properties
type WorkerCfg struct {
// ResourceCostMultiplier is the multiplier for the resource cost
ResourceCostMultiplier float64 `mapstructure:"ResourceCostMultiplier"`
}

// DBManagerCfg contains the DBManager's configuration properties
type DBManagerCfg struct {
PoolRetrievalInterval types.Duration `mapstructure:"PoolRetrievalInterval"`
Expand Down
126 changes: 0 additions & 126 deletions sequencer/efficiencylist.go

This file was deleted.

Loading