diff --git a/consensus/oasys/contract.go b/consensus/oasys/contract.go index fcabba5d0..1423df2aa 100644 --- a/consensus/oasys/contract.go +++ b/consensus/oasys/contract.go @@ -253,7 +253,7 @@ func (c *Oasys) IsSystemTransaction(tx *types.Transaction, header *types.Header) } if sender, err := types.Sender(c.txSigner, tx); err != nil { - return false, errors.New("unauthorized transaction") + return false, fmt.Errorf("unauthorized transaction: %w", err) } else if sender != header.Coinbase { // not created by validator return false, nil diff --git a/consensus/oasys/oasys.go b/consensus/oasys/oasys.go index 8d41f36ba..58a0e3c2d 100644 --- a/consensus/oasys/oasys.go +++ b/consensus/oasys/oasys.go @@ -217,7 +217,7 @@ func New(chainConfig *params.ChainConfig, config *params.OasysConfig, db ethdb.D signatures: signatures, proposals: make(map[common.Address]bool), ethAPI: ethAPI, - txSigner: types.MakeSigner(chainConfig, common.Big0, 0), + txSigner: types.LatestSigner(chainConfig), } } diff --git a/core/rawdb/chain_freezer.go b/core/rawdb/chain_freezer.go index 16337fc0b..24b4863a6 100644 --- a/core/rawdb/chain_freezer.go +++ b/core/rawdb/chain_freezer.go @@ -341,13 +341,9 @@ func (f *chainFreezer) freezeRangeWithBlobs(nfdb *nofreezedb, number, limit uint } // freeze pre cancun - if cancunNumber == 0 { - // case of development - } else { - preHashes, err = f.freezeRange(nfdb, number, cancunNumber-1) - if err != nil { - return preHashes, err - } + preHashes, err = f.freezeRange(nfdb, number, cancunNumber-1) + if err != nil { + return preHashes, err } if err = ResetEmptyBlobAncientTable(f, cancunNumber); err != nil { @@ -391,7 +387,7 @@ func (f *chainFreezer) freezeRange(nfdb *nofreezedb, number, limit uint64) (hash } // blobs is nil before cancun fork var sidecars rlp.RawValue - if isCancun(env, h.Number, h.Time) && number != 0 { // except genesis block in case of development + if isCancun(env, h.Number, h.Time) { sidecars = ReadBlobSidecarsRLP(nfdb, hash, number) if len(sidecars) == 0 { return fmt.Errorf("block blobs missing, can't freeze block %d", number) @@ -414,7 +410,7 @@ func (f *chainFreezer) freezeRange(nfdb *nofreezedb, number, limit uint64) (hash if err := op.AppendRaw(ChainFreezerDifficultyTable, number, td); err != nil { return fmt.Errorf("can't write td to Freezer: %v", err) } - if isCancun(env, h.Number, h.Time) && number != 0 { // except genesis block in case of development + if isCancun(env, h.Number, h.Time) { if err := op.AppendRaw(ChainFreezerBlobSidecarTable, number, sidecars); err != nil { return fmt.Errorf("can't write blobs to Freezer: %v", err) } diff --git a/eth/backend.go b/eth/backend.go index c4ac0e0f4..14ef4c942 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -155,6 +155,17 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { if err != nil { return nil, err } + // Override the chain config with provided settings. + var overrides core.ChainOverrides + if config.OverrideCancun != nil { + chainConfig.CancunTime = config.OverrideCancun + overrides.OverrideCancun = config.OverrideCancun + } + if config.OverrideVerkle != nil { + chainConfig.VerkleTime = config.OverrideVerkle + overrides.OverrideVerkle = config.OverrideVerkle + } + // startup ancient freeze if err = chainDb.SetupFreezerEnv(ðdb.FreezerEnv{ ChainCfg: chainConfig, @@ -225,14 +236,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { StateScheme: scheme, } ) - // Override the chain config with provided settings. - var overrides core.ChainOverrides - if config.OverrideCancun != nil { - overrides.OverrideCancun = config.OverrideCancun - } - if config.OverrideVerkle != nil { - overrides.OverrideVerkle = config.OverrideVerkle - } eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, eth.engine, vmConfig, eth.shouldPreserve, &config.TransactionHistory) if err != nil { return nil, err diff --git a/params/config.go b/params/config.go index 0e6d124fa..a3fc67d75 100644 --- a/params/config.go +++ b/params/config.go @@ -744,6 +744,10 @@ func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64, time u // CheckConfigForkOrder checks that we don't "skip" any forks, geth isn't pluggable enough // to guarantee that forks can be implemented in a different order than on official networks func (c *ChainConfig) CheckConfigForkOrder() error { + // skip checking for non-Oasys egine + if c.Oasys == nil { + return nil + } type fork struct { name string block *big.Int // forks up to - and including the merge - were defined with block numbers