op-erigon-lib

+314
-17

This is an overview of the changes in op-erigon-lib, a fork of erigon-lib,

diff --git ledgerwatch/erigon-lib/chain/chain_config.go testinprod-io/erigon-lib/chain/chain_config.go index 7b6aca5957b40dd8b81280ada3c8c91a0d1c14db..69a0bec1a1ca8e5fc33a4414d89d2a32b7af674e 100644 --- ledgerwatch/erigon-lib/chain/chain_config.go +++ testinprod-io/erigon-lib/chain/chain_config.go @@ -67,6 +67,9 @@ ShanghaiTime *big.Int `json:"shanghaiTime,omitempty"` CancunTime *big.Int `json:"cancunTime,omitempty"` PragueTime *big.Int `json:"pragueTime,omitempty"`   + BedrockBlock *big.Int `json:"bedrockBlock,omitempty"` // Bedrock switch block (nil = no fork, 0 = already on optimism bedrock) + RegolithTime *big.Int `json:"regolithTime,omitempty"` // Regolith switch time (nil = no fork, 0 = already on optimism regolith) + Eip1559FeeCollector *common.Address `json:"eip1559FeeCollector,omitempty"` // (Optional) Address where burnt EIP-1559 fees go to Eip1559FeeCollectorTransition *big.Int `json:"eip1559FeeCollectorTransition,omitempty"` // (Optional) Block from which burnt EIP-1559 fees go to the Eip1559FeeCollector   @@ -75,6 +78,20 @@ Ethash *EthashConfig `json:"ethash,omitempty"` Clique *CliqueConfig `json:"clique,omitempty"` Aura *AuRaConfig `json:"aura,omitempty"` Bor *BorConfig `json:"bor,omitempty"` + + // Optimism config + Optimism *OptimismConfig `json:"optimism,omitempty"` +} + +// OptimismConfig is the optimism config. +type OptimismConfig struct { + EIP1559Elasticity uint64 `json:"eip1559Elasticity"` + EIP1559Denominator uint64 `json:"eip1559Denominator"` +} + +// String implements the stringer interface, returning the optimism fee config details. +func (o *OptimismConfig) String() string { + return "optimism" }   func (c *Config) String() string { @@ -203,6 +220,50 @@ }   func (c *Config) IsEip1559FeeCollector(num uint64) bool { return c.Eip1559FeeCollector != nil && isForked(c.Eip1559FeeCollectorTransition, num) +} + +// IsBedrock returns whether num is either equal to the Bedrock fork block or greater. +func (c *Config) IsBedrock(num uint64) bool { + return isForked(c.BedrockBlock, num) +} + +func (c *Config) IsRegolith(time uint64) bool { + return isForked(c.RegolithTime, time) +} + +// IsOptimism returns whether the node is an optimism node or not. +func (c *Config) IsOptimism() bool { + return c.Optimism != nil +} + +// IsOptimismBedrock returns true iff this is an optimism node & bedrock is active +func (c *Config) IsOptimismBedrock(num uint64) bool { + return c.IsOptimism() && c.IsBedrock(num) +} + +func (c *Config) IsOptimismRegolith(time uint64) bool { + return c.IsOptimism() && c.IsRegolith(time) +} + +// IsOptimismPreBedrock returns true iff this is an optimism node & bedrock is not yet active +func (c *Config) IsOptimismPreBedrock(num uint64) bool { + return c.IsOptimism() && !c.IsBedrock(num) +} + +// BaseFeeChangeDenominator bounds the amount the base fee can change between blocks. +func (c *Config) BaseFeeChangeDenominator(defaultParam int) uint64 { + if c.IsOptimism() { + return c.Optimism.EIP1559Denominator + } + return uint64(defaultParam) +} + +// ElasticityMultiplier bounds the maximum gas limit an EIP-1559 block may have. +func (c *Config) ElasticityMultiplier(defaultParam int) uint64 { + if c.IsOptimism() { + return c.Optimism.EIP1559Elasticity + } + return uint64(defaultParam) }   // CheckCompatible checks whether scheduled fork transitions have been imported @@ -499,6 +560,7 @@ IsHomestead, IsTangerineWhistle, IsSpuriousDragon bool IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool IsBerlin, IsLondon, IsShanghai, IsCancun, IsPrague bool IsEip1559FeeCollector, IsAura bool + IsOptimismBedrock, IsOptimismRegolith bool }   // Rules ensures c's ChainID is not nil and returns a new Rules instance @@ -524,6 +586,8 @@ IsCancun: c.IsCancun(time), IsPrague: c.IsPrague(time), IsEip1559FeeCollector: c.IsEip1559FeeCollector(num), IsAura: c.Aura != nil, + IsOptimismBedrock: c.IsOptimismBedrock(num), + IsOptimismRegolith: c.IsOptimismRegolith(time), } }
diff --git ledgerwatch/erigon-lib/rlp/parse.go testinprod-io/erigon-lib/rlp/parse.go index a0dacfbcbc51bed01c1d70a47934ad0fe435635a..d611a94a96f4454264a55cf5a7df84d8391856c1 100644 --- ledgerwatch/erigon-lib/rlp/parse.go +++ testinprod-io/erigon-lib/rlp/parse.go @@ -235,6 +235,11 @@ copy(hashbuf, payload[pos:pos+32]) return pos + 32, nil }   +func SkipString(payload []byte, pos int) (nextPos, dataLen int, err error) { + dataPos, dataLen, err := String(payload, pos) + return dataPos + dataLen, dataLen, err +} + const ParseHashErrorPrefix = "parse hash payload"   const ParseAnnouncementsErrorPrefix = "parse announcement payload"
diff --git ledgerwatch/erigon-lib/txpool/pool.go testinprod-io/erigon-lib/txpool/pool.go index 417cc4a06b86ebc174eed13b33ba109dbc916039..7ccfc2c8dba775722e5ec4d602ee9d385f79a082 100644 --- ledgerwatch/erigon-lib/txpool/pool.go +++ testinprod-io/erigon-lib/txpool/pool.go @@ -32,6 +32,8 @@ "sync" "sync/atomic" "time"   + "github.com/ledgerwatch/erigon-lib/rlp" + "github.com/VictoriaMetrics/metrics" mapset "github.com/deckarep/golang-set/v2" "github.com/go-stack/stack" @@ -258,6 +260,8 @@ func calcProtocolBaseFee(baseFee uint64) uint64 { return 7 }   +type L1CostFn func(tx *types.TxSlot) *uint256.Int + // TxPool - holds all pool-related data structures and lock-based tiny methods // most of logic implemented by pure tests-friendly functions // @@ -297,6 +301,8 @@ pendingBaseFee atomic.Uint64 blockGasLimit atomic.Uint64 shanghaiTime *big.Int isPostShanghai atomic.Bool + + l1Cost L1CostFn }   func New(newTxs chan types.Announcements, coreDB kv.RoDB, cfg txpoolcfg.Config, cache kvcache.Cache, chainID uint256.Int, shanghaiTime *big.Int) (*TxPool, error) { @@ -341,6 +347,73 @@ shanghaiTime: shanghaiTime, }, nil }   +func RawRLPTxToOptimismL1CostFn(payload []byte) (L1CostFn, error) { + // skip prefix byte + if len(payload) == 0 { + return nil, fmt.Errorf("empty tx payload") + } + offset, _, err := rlp.String(payload, 0) + if err != nil { + return nil, fmt.Errorf("failed to parse rlp string: %w", err) + } + if payload[offset] != 0x7E { + return nil, fmt.Errorf("expected deposit tx type, but got %d", payload[offset]) + } + pos := offset + 1 + _, _, isList, err := rlp.Prefix(payload, pos) + if err != nil { + return nil, fmt.Errorf("failed to parse rlp prefix: %w", err) + } + if !isList { + return nil, fmt.Errorf("expected list") + } + dataPos, _, err := rlp.List(payload, pos) + if err != nil { + return nil, fmt.Errorf("bad tx rlp list start: %w", err) + } + pos = dataPos + + // skip 7 fields: + // source hash + // from + // to + // mint + // value + // gas + // isSystemTx + for i := 0; i < 7; i++ { + dataPos, dataLen, _, err := rlp.Prefix(payload, pos) + if err != nil { + return nil, fmt.Errorf("failed to skip rlp element of tx: %w", err) + } + pos = dataPos + dataLen + } + // data + dataPos, dataLen, _, err := rlp.Prefix(payload, pos) + if err != nil { + return nil, fmt.Errorf("failed to read tx data entry rlp prefix: %w", err) + } + txCalldata := payload[dataPos : dataPos+dataLen] + + if len(txCalldata) < 4+32*8 { // function selector + 8 arguments to setL1BlockValues + return nil, fmt.Errorf("expected more calldata to read L1 info from, but only got %d", len(txCalldata)) + } + l1Basefee := new(uint256.Int).SetBytes(txCalldata[4+32*2 : 4+32*3]) // arg index 2 + overhead := new(uint256.Int).SetBytes(txCalldata[4+32*6 : 4+32*7]) // arg index 6 + scalar := new(uint256.Int).SetBytes(txCalldata[4+32*7 : 4+32*8]) // arg index 7 + return func(tx *types.TxSlot) *uint256.Int { + return L1Cost(tx.RollupDataGas, l1Basefee, overhead, scalar) + }, nil +} + +func L1Cost(rollupDataGas uint64, l1BaseFee, overhead, scalar *uint256.Int) *uint256.Int { + l1GasUsed := new(uint256.Int).SetUint64(rollupDataGas) + l1GasUsed = l1GasUsed.Add(l1GasUsed, overhead) + l1Cost := l1GasUsed.Mul(l1GasUsed, l1BaseFee) + l1Cost = l1Cost.Mul(l1Cost, scalar) + return l1Cost.Div(l1Cost, uint256.NewInt(1_000_000)) +} + func (p *TxPool) OnNewBlock(ctx context.Context, stateChanges *remote.StateChangeBatch, unwindTxs, minedTxs types.TxSlots, tx kv.Tx) error { defer newBlockTimer.UpdateDuration(time.Now()) //t := time.Now() @@ -373,6 +446,17 @@ log.Error("AssertCheckValues", "err", err, "stack", stack.Trace().String()) } }   + if p.cfg.Optimism { + lastChangeBatch := stateChanges.ChangeBatch[len(stateChanges.ChangeBatch)-1] + if len(lastChangeBatch.Txs) > 0 { + l1CostFn, err := RawRLPTxToOptimismL1CostFn(lastChangeBatch.Txs[0]) + if err == nil { + p.l1Cost = l1CostFn + } else { + log.Error("Tx pool failed to prepare Optimism L1 cost function", "err", err, "block_number", lastChangeBatch.BlockHeight) + } + } + } if err := minedTxs.Valid(); err != nil { return err } @@ -419,7 +503,7 @@ //log.Debug("[txpool] new block", "unwinded", len(unwindTxs.txs), "mined", len(minedTxs.txs), "baseFee", baseFee, "blockHeight", blockHeight)   announcements, err := addTxsOnNewBlock(p.lastSeenBlock.Load(), cacheView, stateChanges, p.senders, unwindTxs, pendingBaseFee, stateChanges.BlockGasLimit, - p.pending, p.baseFee, p.queued, p.all, p.byHash, p.addLocked, p.discardLocked) + p.pending, p.baseFee, p.queued, p.all, p.byHash, p.addLocked, p.discardLocked, p.l1Cost) if err != nil { return err } @@ -483,7 +567,7 @@ return err }   announcements, _, err := addTxs(p.lastSeenBlock.Load(), cacheView, p.senders, newTxs, - p.pendingBaseFee.Load(), p.blockGasLimit.Load(), p.pending, p.baseFee, p.queued, p.all, p.byHash, p.addLocked, p.discardLocked, true) + p.pendingBaseFee.Load(), p.blockGasLimit.Load(), p.pending, p.baseFee, p.queued, p.all, p.byHash, p.addLocked, p.discardLocked, true, p.l1Cost) if err != nil { return err } @@ -898,7 +982,7 @@ return nil, err }   announcements, addReasons, err := addTxs(p.lastSeenBlock.Load(), cacheView, p.senders, newTxs, - p.pendingBaseFee.Load(), p.blockGasLimit.Load(), p.pending, p.baseFee, p.queued, p.all, p.byHash, p.addLocked, p.discardLocked, true) + p.pendingBaseFee.Load(), p.blockGasLimit.Load(), p.pending, p.baseFee, p.queued, p.all, p.byHash, p.addLocked, p.discardLocked, true, p.l1Cost) if err == nil { for i, reason := range addReasons { if reason != NotSet { @@ -945,7 +1029,7 @@ func addTxs(blockNum uint64, cacheView kvcache.CacheView, senders *sendersBatch, newTxs types.TxSlots, pendingBaseFee, blockGasLimit uint64, pending *PendingPool, baseFee, queued *SubPool, - byNonce *BySenderAndNonce, byHash map[string]*metaTx, add func(*metaTx, *types.Announcements) DiscardReason, discard func(*metaTx, DiscardReason), collect bool) (types.Announcements, []DiscardReason, error) { + byNonce *BySenderAndNonce, byHash map[string]*metaTx, add func(*metaTx, *types.Announcements) DiscardReason, discard func(*metaTx, DiscardReason), collect bool, l1CostFn L1CostFn) (types.Announcements, []DiscardReason, error) { protocolBaseFee := calcProtocolBaseFee(pendingBaseFee) if assert.Enable { for _, txn := range newTxs.Txs { @@ -993,7 +1077,7 @@ if err != nil { return announcements, discardReasons, err } onSenderStateChange(senderID, nonce, balance, byNonce, - protocolBaseFee, blockGasLimit, pending, baseFee, queued, discard) + protocolBaseFee, blockGasLimit, pending, baseFee, queued, discard, l1CostFn) }   promote(pending, baseFee, queued, pendingBaseFee, discard, &announcements) @@ -1004,7 +1088,7 @@ } func addTxsOnNewBlock(blockNum uint64, cacheView kvcache.CacheView, stateChanges *remote.StateChangeBatch, senders *sendersBatch, newTxs types.TxSlots, pendingBaseFee uint64, blockGasLimit uint64, pending *PendingPool, baseFee, queued *SubPool, - byNonce *BySenderAndNonce, byHash map[string]*metaTx, add func(*metaTx, *types.Announcements) DiscardReason, discard func(*metaTx, DiscardReason)) (types.Announcements, error) { + byNonce *BySenderAndNonce, byHash map[string]*metaTx, add func(*metaTx, *types.Announcements) DiscardReason, discard func(*metaTx, DiscardReason), l1CostFn L1CostFn) (types.Announcements, error) { protocolBaseFee := calcProtocolBaseFee(pendingBaseFee) if assert.Enable { for _, txn := range newTxs.Txs { @@ -1059,7 +1143,7 @@ if err != nil { return announcements, err } onSenderStateChange(senderID, nonce, balance, byNonce, - protocolBaseFee, blockGasLimit, pending, baseFee, queued, discard) + protocolBaseFee, blockGasLimit, pending, baseFee, queued, discard, l1CostFn) }   return announcements, nil @@ -1203,7 +1287,7 @@ // which sub pool they will need to go to. Sice this depends on other transactions from the same sender by with lower // nonces, and also affect other transactions from the same sender with higher nonce, it loops through all transactions // for a given senderID func onSenderStateChange(senderID uint64, senderNonce uint64, senderBalance uint256.Int, byNonce *BySenderAndNonce, - protocolBaseFee, blockGasLimit uint64, pending *PendingPool, baseFee, queued *SubPool, discard func(*metaTx, DiscardReason)) { + protocolBaseFee, blockGasLimit uint64, pending *PendingPool, baseFee, queued *SubPool, discard func(*metaTx, DiscardReason), l1CostFn L1CostFn) { noGapsNonce := senderNonce cumulativeRequiredBalance := uint256.NewInt(0) minFeeCap := uint256.NewInt(0).SetAllOne() @@ -1249,6 +1333,13 @@ // Sender has enough balance for: gasLimit x feeCap + transferred_value needBalance := uint256.NewInt(mt.Tx.Gas) needBalance.Mul(needBalance, &mt.Tx.FeeCap) needBalance.Add(needBalance, &mt.Tx.Value) + + if l1CostFn != nil { + if l1Cost := l1CostFn(mt.Tx); l1Cost != nil { + needBalance.Add(needBalance, l1Cost) + } + } + // 1. Minimum fee requirement. Set to 1 if feeCap of the transaction is no less than in-protocol // parameter of minimal base fee. Set to 0 if feeCap is less than minimum base fee, which means // this transaction will never be included into this particular chain. @@ -1695,7 +1786,7 @@ if err != nil { return err } if _, _, err := addTxs(p.lastSeenBlock.Load(), cacheView, p.senders, txs, - pendingBaseFee, math.MaxUint64 /* blockGasLimit */, p.pending, p.baseFee, p.queued, p.all, p.byHash, p.addLocked, p.discardLocked, false); err != nil { + pendingBaseFee, math.MaxUint64 /* blockGasLimit */, p.pending, p.baseFee, p.queued, p.all, p.byHash, p.addLocked, p.discardLocked, false, p.l1Cost); err != nil { return err } p.pendingBaseFee.Store(pendingBaseFee)
diff --git ledgerwatch/erigon-lib/types/txn.go testinprod-io/erigon-lib/types/txn.go index 71d011a651203c3d246569864212c852aa4723b7..5ac1a53973f8ca9124cb27349686a1fb6d5a11b9 100644 --- ledgerwatch/erigon-lib/types/txn.go +++ testinprod-io/erigon-lib/types/txn.go @@ -99,12 +99,15 @@ Traced bool // Whether transaction needs to be traced throughout transaction pool code and generate debug printing Creation bool // Set to true if "To" field of the transaction is not set Type byte // Transaction type Size uint32 // Size of the payload + + RollupDataGas uint64 // Translates into a L1 cost based on fee parameters }   const ( LegacyTxType byte = 0 AccessListTxType byte = 1 DynamicFeeTxType byte = 2 + DepositTxType byte = 126 )   var ErrParseTxn = fmt.Errorf("%w transaction", rlp.ErrParse) @@ -187,6 +190,82 @@ return p, err } }   + if slot.Type == DepositTxType { + // SourchHash + p, _, err = rlp.SkipString(payload, p) + if err != nil { + return 0, fmt.Errorf("%w: depostTx sourchHash: %s", ErrParseTxn, err) + } + // From + dataPos, dataLen, err = rlp.String(payload, p) + if err != nil { + return 0, fmt.Errorf("%w: depostTx from: %s", ErrParseTxn, err) + } + if ctx.withSender { + copy(sender, payload[dataPos:dataPos+dataLen]) + } + p = dataPos + dataLen + // To + p, dataLen, err = rlp.SkipString(payload, p) + if err != nil { + return 0, fmt.Errorf("%w: depostTx to: %s", ErrParseTxn, err) + } + slot.Creation = dataLen == 0 + // Mint + p, _, err = rlp.SkipString(payload, p) + if err != nil { + return 0, fmt.Errorf("%w: depostTx mint: %s", ErrParseTxn, err) + } + // Value + p, err = rlp.U256(payload, p, &slot.Value) + if err != nil { + return 0, fmt.Errorf("%w: depostTx value: %s", ErrParseTxn, err) + } + // Gas + p, slot.Gas, err = rlp.U64(payload, p) + if err != nil { + return 0, fmt.Errorf("%w: depositTx gas: %s", ErrParseTxn, err) + } + // Data + dataPos, dataLen, err = rlp.String(payload, p) + if err != nil { + return 0, fmt.Errorf("%w: depositTx data len: %s", ErrParseTxn, err) + } + slot.DataLen = dataLen + + // Zero and non-zero bytes are priced differently + slot.DataNonZeroLen = 0 + for _, byt := range payload[dataPos : dataPos+dataLen] { + if byt != 0 { + slot.DataNonZeroLen++ + } + } + { + // full tx contents count towards rollup data gas, not just tx data + var zeroes, ones uint64 + for _, byt := range payload { + if byt == 0 { + zeroes++ + } else { + ones++ + } + } + zeroesGas := zeroes * 4 + onesGas := (ones + 68) * 16 + slot.RollupDataGas = zeroesGas + onesGas + } + p = dataPos + dataLen + + // Set IDHash to slot + _, _ = ctx.Keccak1.(io.Reader).Read(slot.IDHash[:32]) + if validateHash != nil { + if err := validateHash(slot.IDHash[:32]); err != nil { + return p, err + } + } + return p, nil + } + // Remember where signing hash data begins (it will need to be wrapped in an RLP list) sigHashPos := p if !legacy { @@ -261,6 +340,20 @@ for _, byt := range payload[dataPos : dataPos+dataLen] { if byt != 0 { slot.DataNonZeroLen++ } + } + { + // full tx contents count towards rollup data gas, not just tx data + var zeroes, ones uint64 + for _, byt := range payload { + if byt == 0 { + zeroes++ + } else { + ones++ + } + } + zeroesGas := zeroes * 4 + onesGas := (ones + 68) * 16 + slot.RollupDataGas = zeroesGas + onesGas }   p = dataPos + dataLen
diff --git ledgerwatch/erigon-lib/gointerfaces/remote/ethbackend.pb.go testinprod-io/erigon-lib/gointerfaces/remote/ethbackend.pb.go index cff259a719725bf34ac761807a23e72d41822af7..aa46473192bece4de0565cbe57ce608b05713ffe 100644 --- ledgerwatch/erigon-lib/gointerfaces/remote/ethbackend.pb.go +++ testinprod-io/erigon-lib/gointerfaces/remote/ethbackend.pb.go @@ -554,6 +554,9 @@ Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` PrevRandao *types.H256 `protobuf:"bytes,3,opt,name=prev_randao,json=prevRandao,proto3" json:"prev_randao,omitempty"` SuggestedFeeRecipient *types.H160 `protobuf:"bytes,4,opt,name=suggested_fee_recipient,json=suggestedFeeRecipient,proto3" json:"suggested_fee_recipient,omitempty"` Withdrawals []*types.Withdrawal `protobuf:"bytes,5,rep,name=withdrawals,proto3" json:"withdrawals,omitempty"` + NoTxPool *bool `protobuf:"varint,6,opt,name=noTxPool,proto3,oneof" json:"noTxPool,omitempty"` + Transactions [][]byte `protobuf:"bytes,7,rep,name=transactions,proto3" json:"transactions,omitempty"` + GasLimit *uint64 `protobuf:"varint,8,opt,name=gasLimit,proto3,oneof" json:"gasLimit,omitempty"` }   func (x *EnginePayloadAttributes) Reset() { @@ -621,6 +624,27 @@ if x != nil { return x.Withdrawals } return nil +} + +func (x *EnginePayloadAttributes) GetNoTxPool() bool { + if x != nil && x.NoTxPool != nil { + return *x.NoTxPool + } + return false +} + +func (x *EnginePayloadAttributes) GetTransactions() [][]byte { + if x != nil { + return x.Transactions + } + return nil +} + +func (x *EnginePayloadAttributes) GetGasLimit() uint64 { + if x != nil && x.GasLimit != nil { + return *x.GasLimit + } + return 0 }   type EngineForkChoiceState struct { @@ -1884,7 +1908,7 @@ 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x0f, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x29, 0x0a, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xf9, 0x01, 0x0a, 0x17, 0x45, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xf9, 0x02, 0x0a, 0x17, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, @@ -1900,7 +1924,15 @@ 0x65, 0x73, 0x74, 0x65, 0x64, 0x46, 0x65, 0x65, 0x52, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x33, 0x0a, 0x0b, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x52, 0x0b, 0x77, 0x69, 0x74, 0x68, 0x64, - 0x72, 0x61, 0x77, 0x61, 0x6c, 0x73, 0x22, 0xc0, 0x01, 0x0a, 0x15, 0x45, 0x6e, 0x67, 0x69, 0x6e, + 0x72, 0x61, 0x77, 0x61, 0x6c, 0x73, 0x12, 0x1f, 0x0a, 0x08, 0x6e, 0x6f, 0x54, 0x78, 0x50, 0x6f, + 0x6f, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x08, 0x6e, 0x6f, 0x54, 0x78, + 0x50, 0x6f, 0x6f, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x22, 0x0a, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0c, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x08, 0x67, + 0x61, 0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, + 0x08, 0x67, 0x61, 0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, + 0x5f, 0x6e, 0x6f, 0x54, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x67, 0x61, + 0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0xc0, 0x01, 0x0a, 0x15, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x46, 0x6f, 0x72, 0x6b, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x33, 0x0a, 0x0f, 0x68, 0x65, 0x61, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, @@ -2682,6 +2714,7 @@ return nil } } } + file_remote_ethbackend_proto_msgTypes[9].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{
diff --git ledgerwatch/erigon-lib/.github/workflows/ci.yml testinprod-io/erigon-lib/.github/workflows/ci.yml index c1d2fbac54a32894f537c76b91b9abcbdaac1105..6d24f21951c4488ad9c3508a4c7089241da6bf58 100644 --- ledgerwatch/erigon-lib/.github/workflows/ci.yml +++ testinprod-io/erigon-lib/.github/workflows/ci.yml @@ -5,11 +5,13 @@ branches: - main - stable - alpha + - op-erigon pull_request: branches: - main - stable - alpha + - op-erigon env: CGO_ENABLED: "1" CGO_CXXFLAGS: "-g -O2 -std=c++17" @@ -45,15 +47,15 @@ run: | choco upgrade mingw -y --no-progress --version 11.2.0.07112021 choco install cmake -y --no-progress --version 3.23.1   - - name: Lint - if: matrix.os == 'ubuntu-20.04' - uses: golangci/golangci-lint-action@v3 - with: - version: v1.52 - - name: Test win if: matrix.os == 'windows-2022' run: make test-no-fuzz - name: Test if: matrix.os != 'windows-2022' run: make test + + - name: Lint + if: matrix.os == 'ubuntu-20.04' + uses: golangci/golangci-lint-action@v3 + with: + version: v1.52
diff --git ledgerwatch/erigon-lib/go.mod testinprod-io/erigon-lib/go.mod index 2b6aa50d1bc37be18687baabee05253455e67213..505626e3f3bfc9f9b9b3c6adb6b719097d303e15 100644 --- ledgerwatch/erigon-lib/go.mod +++ testinprod-io/erigon-lib/go.mod @@ -2,6 +2,11 @@ module github.com/ledgerwatch/erigon-lib   go 1.19   +replace github.com/ledgerwatch/interfaces v0.0.0-20230412092010-e1c4a1a4279e => github.com/testinprod-io/erigon-interfaces v0.0.0-20230510035441-34721174363e + +//for local dev: +//replace github.com/ledgerwatch/interfaces v0.0.0-20230412092010-e1c4a1a4279e => ../erigon-interfaces + require ( github.com/ledgerwatch/interfaces v0.0.0-20230412092010-e1c4a1a4279e github.com/ledgerwatch/log/v3 v3.7.0
diff --git ledgerwatch/erigon-lib/txpool/txpoolcfg/txpoolcfg.go testinprod-io/erigon-lib/txpool/txpoolcfg/txpoolcfg.go index 9eb2bbd45dad27f8734e2d1eb1cf124060065dc3..565ace827ffa0abc90d372fdb62028207a1bbfc5 100644 --- ledgerwatch/erigon-lib/txpool/txpoolcfg/txpoolcfg.go +++ testinprod-io/erigon-lib/txpool/txpoolcfg/txpoolcfg.go @@ -19,6 +19,8 @@ MinFeeCap uint64 AccountSlots uint64 // Number of executable transaction slots guaranteed per account PriceBump uint64 // Price bump percentage to replace an already existing transaction OverrideShanghaiTime *big.Int + + Optimism bool }   var DefaultConfig = Config{ @@ -35,4 +37,6 @@ MinFeeCap: 1, AccountSlots: 16, //TODO: to choose right value (16 to be compatible with Geth) PriceBump: 10, // Price bump percentage to replace an already existing transaction OverrideShanghaiTime: nil, + + Optimism: false, }
diff --git ledgerwatch/erigon-lib/go.sum testinprod-io/erigon-lib/go.sum index 189cc835774e44d48d8a5bed876d51aa8bd26ee1..3d13d3b8448c60712069d1af57676a564e572608 100644 --- ledgerwatch/erigon-lib/go.sum +++ testinprod-io/erigon-lib/go.sum @@ -228,8 +228,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/ledgerwatch/interfaces v0.0.0-20230412092010-e1c4a1a4279e h1:mT6GE/XsuUVQGTcZjrq0KoINds2fKa8VsHhGbe2PF54= -github.com/ledgerwatch/interfaces v0.0.0-20230412092010-e1c4a1a4279e/go.mod h1:ugQv1QllJzBny3cKZKxUrSnykkjkBgm27eQM6dnGAcc= github.com/ledgerwatch/log/v3 v3.7.0 h1:aFPEZdwZx4jzA3+/Pf8wNDN5tCI0cIolq/kfvgcM+og= github.com/ledgerwatch/log/v3 v3.7.0/go.mod h1:J2Jl6zV/58LeA6LTaVVnCGyf1/cYYSEOOLHY4ZN8S2A= github.com/ledgerwatch/secp256k1 v1.0.0 h1:Usvz87YoTG0uePIV8woOof5cQnLXGYa162rFf3YnwaQ= @@ -374,6 +372,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/testinprod-io/erigon-interfaces v0.0.0-20230510035441-34721174363e h1:g21YwDs32vw8PR/h/BJxU6ogmGSQOwAg4hJV1J7G8O0= +github.com/testinprod-io/erigon-interfaces v0.0.0-20230510035441-34721174363e/go.mod h1:ugQv1QllJzBny3cKZKxUrSnykkjkBgm27eQM6dnGAcc= github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=