From c6262351eb0076734db20cba9fe9998a204560c9 Mon Sep 17 00:00:00 2001 From: jagdeep sidhu Date: Mon, 7 Oct 2024 12:15:04 -0700 Subject: [PATCH] fix tests --- cmd/utils/flags.go | 2 -- consensus/beacon/consensus.go | 23 +++++++++++++++++------ eth/backend.go | 2 -- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 3c9a4b47ad..f9d100ddc0 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1327,8 +1327,6 @@ func setEtherbase(ctx *cli.Context, cfg *ethconfig.Config) { log.Warn("Option --miner.etherbase is deprecated") } if !ctx.IsSet(MinerPendingFeeRecipientFlag.Name) { - // SYSCOIN - log.Warn("Option --miner.pending.feeRecipient is missing") return } addr := ctx.String(MinerPendingFeeRecipientFlag.Name) diff --git a/consensus/beacon/consensus.go b/consensus/beacon/consensus.go index 43d62e758a..e1902a7749 100644 --- a/consensus/beacon/consensus.go +++ b/consensus/beacon/consensus.go @@ -38,7 +38,7 @@ import ( // Proof-of-stake protocol constants. var ( - beaconDifficulty = common.Big1 // The default block difficulty in the beacon consensus + beaconDifficulty = common.Big0 // The default block difficulty in the beacon consensus beaconNonce = types.EncodeNonce(0) // The default block nonce in the beacon consensus // SYSCOIN SyscoinBlockReward, _ = new(big.Int).SetString("10550000000000000000", 10) // 10.55 Block reward for successfully mining a block upward from Syscoin @@ -253,17 +253,28 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa return consensus.ErrFutureBlock } if !chain.HasNEVMMapping(header.Hash()) { - return errors.New("Block not found in NEVM mapping") + return errors.New("block not found in NEVM mapping") + } + // Verify the block's difficulty to ensure it's the default constant + if !chain.Config().IsNexus(header.Number) { + if beaconDifficulty.Cmp(new(big.Int).SetInt64(1)) != 0 { + return fmt.Errorf("invalid difficulty: have %v, want %v", header.Difficulty, new(big.Int).SetInt64(1)) + } + } else { + if beaconDifficulty.Cmp(header.Difficulty) != 0 { + return fmt.Errorf("invalid difficulty: have %v, want %v", header.Difficulty, beaconDifficulty) + } + } + } else { + if beaconDifficulty.Cmp(header.Difficulty) != 0 { + return fmt.Errorf("invalid difficulty: have %v, want %v", header.Difficulty, beaconDifficulty) } } // Verify the timestamp if header.Time <= parent.Time { return errInvalidTimestamp } - // Verify the block's difficulty to ensure it's the default constant - if beaconDifficulty.Cmp(header.Difficulty) != 0 { - return fmt.Errorf("invalid difficulty: have %v, want %v", header.Difficulty, beaconDifficulty) - } + // Verify that the gas limit is <= 2^63-1 if header.GasLimit > params.MaxGasLimit { return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, params.MaxGasLimit) diff --git a/eth/backend.go b/eth/backend.go index badbb47b34..3eb130b71d 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -114,7 +114,6 @@ type Ethereum struct { // SYSCOIN wgNEVM sync.WaitGroup zmqRep *ZMQRep - node *node.Node timeLastBlock int64 } @@ -291,7 +290,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { // Successful startup; push a marker and check previous unclean shutdowns. eth.shutdownTracker.MarkStartup() // SYSCOIN - eth.node = stack createBlock := func(eth *Ethereum) *types.Block { eth.wgNEVM.Add(1) defer eth.wgNEVM.Done()