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

chore(core): disable 4844 transactions by default #28

Merged
merged 2 commits into from
Oct 9, 2024
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 core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ func (e *GenesisMismatchError) Error() string {
type ChainOverrides struct {
OverrideCancun *uint64
OverrideVerkle *uint64

// Story iliad
OverrideStoryNostoi *uint64
}
Expand Down
3 changes: 3 additions & 0 deletions core/txpool/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type ValidationOptions struct {
// This check is public to allow different transaction pools to check the basic
// rules without duplicating code and running the risk of missed updates.
func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types.Signer, opts *ValidationOptions) error {
if !opts.Config.Is4844Enabled() && tx.Type() == types.BlobTxType {
return core.ErrTxTypeNotSupported
Comment on lines +57 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is the part where blob tx is disabled and error is printed out without panic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

}
// Ensure transactions not implemented by the calling pool are rejected
if opts.Accept&(1<<tx.Type()) == 0 {
return fmt.Errorf("%w: tx type %v not supported by this pool", core.ErrTxTypeNotSupported, tx.Type())
Expand Down
4 changes: 2 additions & 2 deletions core/types/transaction_signing.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type sigCache struct {
func MakeSigner(config *params.ChainConfig, blockNumber *big.Int, blockTime uint64) Signer {
var signer Signer
switch {
case config.IsCancun(blockNumber, blockTime):
case config.IsCancun(blockNumber, blockTime) && config.Is4844Enabled():
signer = NewCancunSigner(config.ChainID)
case config.IsLondon(blockNumber):
signer = NewLondonSigner(config.ChainID)
Expand All @@ -65,7 +65,7 @@ func MakeSigner(config *params.ChainConfig, blockNumber *big.Int, blockTime uint
// have the current block number available, use MakeSigner instead.
func LatestSigner(config *params.ChainConfig) Signer {
if config.ChainID != nil {
if config.CancunTime != nil {
if config.CancunTime != nil && config.Is4844Enabled() {
return NewCancunSigner(config.ChainID)
}
if config.LondonBlock != nil {
Expand Down
3 changes: 3 additions & 0 deletions eth/api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ func (b *EthAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscri
}

func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error {
if !b.ChainConfig().Is4844Enabled() && signedTx.Type() == types.BlobTxType {
return types.ErrTxTypeNotSupported
}
return b.eth.txPool.Add([]*types.Transaction{signedTx}, true, false)[0]
}

Expand Down
11 changes: 9 additions & 2 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
if config.OverrideStoryNostoi != nil {
overrides.OverrideStoryNostoi = config.OverrideStoryNostoi
}

// TODO (MariusVanDerWijden) get rid of shouldPreserve in a follow-up PR
shouldPreserve := func(header *types.Header) bool {
return false
Expand All @@ -233,14 +234,20 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
if config.BlobPool.Datadir != "" {
config.BlobPool.Datadir = stack.ResolvePath(config.BlobPool.Datadir)
}
blobPool := blobpool.New(config.BlobPool, eth.blockchain)

if config.TxPool.Journal != "" {
config.TxPool.Journal = stack.ResolvePath(config.TxPool.Journal)
}
legacyPool := legacypool.New(config.TxPool, eth.blockchain)

eth.txPool, err = txpool.New(config.TxPool.PriceLimit, eth.blockchain, []txpool.SubPool{legacyPool, blobPool})
txPools := []txpool.SubPool{legacyPool}
if eth.BlockChain().Config().Is4844Enabled() {
blobPool := blobpool.New(config.BlobPool, eth.blockchain)
txPools = append(txPools, blobPool)
}
priceLimit := uint64(config.TxPool.PriceLimit)
eth.txPool, err = txpool.New(priceLimit, eth.blockchain, txPools)

if err != nil {
return nil, err
}
Expand Down
5 changes: 5 additions & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,11 @@ func (c *ChainConfig) ElasticityMultiplier() uint64 {
return DefaultElasticityMultiplier
}

// Is4844Enabled checks whether blob transactions are supported.
func (c *ChainConfig) Is4844Enabled() bool {
return false
}
Comment on lines +823 to +826
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we directly remove it? We want to minimize the changes in geth repo so it is easier for us to incorporate changes from geth main repo.


// LatestFork returns the latest time-based fork that would be active for the given time.
func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
// Assume last non-time-based fork has passed.
Expand Down