diff --git a/cmd/devp2p/nodesetcmd.go b/cmd/devp2p/nodesetcmd.go index b10f00d149..216f1fd71e 100644 --- a/cmd/devp2p/nodesetcmd.go +++ b/cmd/devp2p/nodesetcmd.go @@ -229,12 +229,8 @@ func ethFilter(args []string) (nodeFilter, error) { switch args[0] { case "mainnet": filter = forkid.NewStaticFilter(params.MainnetChainConfig, params.MainnetGenesisHash) - case "PulseChain": - filter = forkid.NewStaticFilter(params.PulseChainConfig, params.MainnetGenesisHash) case "WhaleChain": filter = forkid.NewStaticFilter(params.WhaleChainConfig, params.MainnetGenesisHash) - case "PulseChainTestnetV4": - filter = forkid.NewStaticFilter(params.PulseChainTestnetV4Config, params.MainnetGenesisHash) case "WhaleChainTestnetV4": filter = forkid.NewStaticFilter(params.WhaleChainTestnetV4Config, params.MainnetGenesisHash) case "goerli": diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 35e914b53e..138c189783 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -266,8 +266,6 @@ func main() { func prepare(ctx *cli.Context) { // If we're running a known preset, log it for convenience. switch { - case ctx.IsSet(utils.PulseChainFlag.Name): - log.Info("Starting Geth on PulseChain mainnet...") case ctx.IsSet(utils.WhaleChainFlag.Name): log.Info("Starting Geth on WhaleChain mainnet...") @@ -278,9 +276,6 @@ func prepare(ctx *cli.Context) { case ctx.IsSet(utils.SepoliaFlag.Name): log.Info("Starting Geth on Sepolia testnet...") - case ctx.IsSet(utils.PulseChainTestnetV4Flag.Name): - log.Info("Starting Geth on PulseChain Testnet V4...") - case ctx.IsSet(utils.WhaleChainTestnetV4Flag.Name): log.Info("Starting Geth on WhaleChain Testnet V4...") @@ -311,7 +306,7 @@ func prepare(ctx *cli.Context) { if !ctx.IsSet(utils.SepoliaFlag.Name) && !ctx.IsSet(utils.GoerliFlag.Name) && !ctx.IsSet(utils.DeveloperFlag.Name) { - // Nope, we're really on mainnet or PulseChain. Bump that cache up! + // Nope, we're really on mainnet or WhaleChain. Bump that cache up! log.Info("Bumping default cache on mainnet", "provided", ctx.Int(utils.CacheFlag.Name), "updated", 4096) ctx.Set(utils.CacheFlag.Name, strconv.Itoa(4096)) } diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 756caaa497..5b6141bdbe 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -945,13 +945,11 @@ var ( TestnetFlags = []cli.Flag{ GoerliFlag, SepoliaFlag, - PulseChainTestnetV4Flag, WhaleChainTestnetV4Flag, } // NetworkFlags is the flag group of all built-in supported networks. NetworkFlags = append([]cli.Flag{ MainnetFlag, - PulseChainFlag, WhaleChainFlag, }, TestnetFlags...) @@ -1033,16 +1031,12 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) { switch { case ctx.IsSet(BootnodesFlag.Name): urls = SplitAndTrim(ctx.String(BootnodesFlag.Name)) - case ctx.Bool(PulseChainFlag.Name): - urls = params.PulseChainBootnodes case ctx.Bool(WhaleChainFlag.Name): urls = params.WhaleChainBootnodes case ctx.Bool(SepoliaFlag.Name): urls = params.SepoliaBootnodes case ctx.Bool(GoerliFlag.Name): urls = params.GoerliBootnodes - case ctx.Bool(PulseChainTestnetV4Flag.Name): - urls = params.PulseChainTestnetV4Bootnodes case ctx.Bool(WhaleChainTestnetV4Flag.Name): urls = params.WhaleChainTestnetV4Bootnodes } @@ -1653,7 +1647,7 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) { // SetEthConfig applies eth-related command line flags to the config. func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { // Avoid conflicting network flags - CheckExclusive(ctx, MainnetFlag, PulseChainFlag, WhaleChainFlag, DeveloperFlag, GoerliFlag, SepoliaFlag, PulseChainTestnetV4Flag, WhaleChainTestnetV4Flag) + CheckExclusive(ctx, MainnetFlag, WhaleChainFlag, DeveloperFlag, GoerliFlag, SepoliaFlag, WhaleChainTestnetV4Flag) CheckExclusive(ctx, LightServeFlag, SyncModeFlag, "light") CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer if ctx.String(GCModeFlag.Name) == "archive" && ctx.Uint64(TxLookupLimitFlag.Name) != 0 { @@ -1783,12 +1777,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { } cfg.Genesis = core.DefaultGenesisBlock() SetDNSDiscoveryDefaults(cfg, params.MainnetGenesisHash) - case ctx.Bool(PulseChainFlag.Name): - if !ctx.IsSet(NetworkIdFlag.Name) { - cfg.NetworkId = 369 - } - cfg.Genesis = core.DefaultPulseChainGenesisBlock() - SetDNSDiscoveryDefaults(cfg, params.MainnetGenesisHash) case ctx.Bool(WhaleChainFlag.Name): if !ctx.IsSet(NetworkIdFlag.Name) { cfg.NetworkId = 370 @@ -1807,12 +1795,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { } cfg.Genesis = core.DefaultGoerliGenesisBlock() SetDNSDiscoveryDefaults(cfg, params.GoerliGenesisHash) - case ctx.Bool(PulseChainTestnetV4Flag.Name): - if !ctx.IsSet(NetworkIdFlag.Name) { - cfg.NetworkId = 943 - } - cfg.Genesis = core.DefaultPulseChainTestnetV4GenesisBlock() - SetDNSDiscoveryDefaults(cfg, params.MainnetGenesisHash) case ctx.Bool(WhaleChainTestnetV4Flag.Name): if !ctx.IsSet(NetworkIdFlag.Name) { cfg.NetworkId = 944 @@ -2135,16 +2117,12 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis { switch { case ctx.Bool(MainnetFlag.Name): genesis = core.DefaultGenesisBlock() - case ctx.Bool(PulseChainFlag.Name): - genesis = core.DefaultPulseChainGenesisBlock() case ctx.Bool(WhaleChainFlag.Name): genesis = core.DefaultWhaleChainGenesisBlock() case ctx.Bool(SepoliaFlag.Name): genesis = core.DefaultSepoliaGenesisBlock() case ctx.Bool(GoerliFlag.Name): genesis = core.DefaultGoerliGenesisBlock() - case ctx.Bool(PulseChainTestnetV4Flag.Name): - genesis = core.DefaultPulseChainTestnetV4GenesisBlock() case ctx.Bool(WhaleChainTestnetV4Flag.Name): genesis = core.DefaultWhaleChainTestnetV4GenesisBlock() case ctx.Bool(DeveloperFlag.Name): diff --git a/consensus/beacon/consensus.go b/consensus/beacon/consensus.go index 221cc46556..f510ef0cc1 100644 --- a/consensus/beacon/consensus.go +++ b/consensus/beacon/consensus.go @@ -131,9 +131,9 @@ func (beacon *Beacon) splitHeaders(chain consensus.ChainHeaderReader, headers [] postHeaders []*types.Header ) for i, header := range headers { - // PulseChain Special Case: + // WhaleChain Special Case: // Partition based on header difficulty (IsPoSHeader) instead of TTD being reached - // so we can properly handle ETH Beacon blocks below the increased PulseChain TTD. + // so we can properly handle ETH Beacon blocks below the increased WhaleChain TTD. if beacon.IsPoSHeader(header) { preHeaders = headers[:i] postHeaders = headers[i:] @@ -153,7 +153,7 @@ func (beacon *Beacon) splitHeaders(chain consensus.ChainHeaderReader, headers [] // 2. x * POS blocks // 3. x * POW blocks => y * POS blocks // -// Special Cases for PulseChain: +// Special Cases for WhaleChain: // 4. x * POS blocks[eth] => POW fork block[pls] // 5. x * POS blocks[eth] => POW fork block[pls] => y * POS blocks[pls] func (beacon *Beacon) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header) (chan<- struct{}, <-chan error) { @@ -166,16 +166,12 @@ func (beacon *Beacon) VerifyHeaders(chain consensus.ChainHeaderReader, headers [ return beacon.ethone.VerifyHeaders(chain, headers) } chainCfg := chain.Config() - primordialPulseIndex := 0 - if chainCfg.PrimordialPulseAhead(postHeaders[0].Number) && !chainCfg.PrimordialPulseAhead(postHeaders[len(postHeaders)-1].Number) { - primordialPulseIndex = int(new(big.Int).Sub(chainCfg.PrimordialPulseBlock, postHeaders[0].Number).Uint64()) - } primordialWhaleIndex := 0 if chainCfg.PrimordialWhaleAhead(postHeaders[0].Number) && !chainCfg.PrimordialWhaleAhead(postHeaders[len(postHeaders)-1].Number) { primordialWhaleIndex = int(new(big.Int).Sub(chainCfg.PrimordialWhaleBlock, postHeaders[0].Number).Uint64()) } // Case 2 - if len(preHeaders) == 0 && primordialPulseIndex == 0 && primordialWhaleIndex == 0 { + if len(preHeaders) == 0 && primordialWhaleIndex == 0 { return beacon.verifyHeaders(chain, headers, nil) } // The transition point exists in the middle, separate the headers @@ -310,7 +306,7 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa } // Verify existence / non-existence of withdrawalsHash. shanghai := chain.Config().IsShanghai(header.Number, header.Time) - if chain.Config().PrimordialPulseAhead(header.Number) { + if chain.Config().PrimordialWhaleAhead(header.Number) { shanghai = params.MainnetChainConfig.IsShanghai(header.Number, header.Time) } if shanghai && header.WithdrawalsHash == nil { diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index e88f12472c..dbc3c2cd12 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -40,7 +40,7 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" - "github.com/WhaleChain/go-ethereum/whale" + "github.com/ethereum/go-ethereum/pulse" "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/trie" @@ -573,9 +573,9 @@ func (c *Clique) Prepare(chain consensus.ChainHeaderReader, header *types.Header // Finalize implements consensus.Engine. There is no post-transaction // consensus rules in clique, do nothing here. func (c *Clique) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, withdrawals []*types.Withdrawal) { - // Apply fork changes on PrimordialPulse block - if cfg := chain.Config(); cfg.IsPrimordialPulseBlock(header.Number) { - pulse.PrimordialPulseFork(state, cfg.Treasury, cfg.ChainID) + // Apply fork changes on PrimordialWhale block + if cfg := chain.Config(); cfg.IsPrimordialWhaleBlock(header.Number) { + whale.PrimordialWhaleFork(state, cfg.Treasury, cfg.ChainID) } // No block rewards in PoA, so the state remains as is diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index 5bb1bb379f..a9447c42f7 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -31,7 +31,7 @@ import ( "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/pulse" + "github.com/WhaleChain/go-ethereum-whale/whale" "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/trie" "golang.org/x/crypto/sha3" @@ -299,8 +299,6 @@ func (ethash *Ethash) CalcDifficulty(chain consensus.ChainHeaderReader, time uin func CalcDifficulty(config *params.ChainConfig, time uint64, parent *types.Header) *big.Int { next := new(big.Int).Add(parent.Number, big1) switch { - case config.IsPrimordialPulseBlock(next): - return params.PulseChainTTDOffset case config.IsPrimordialWhaleBlock(next): return params.WhaleChainTTDOffset case config.IsGrayGlacier(next): @@ -495,9 +493,9 @@ func (ethash *Ethash) Prepare(chain consensus.ChainHeaderReader, header *types.H // Finalize implements consensus.Engine, accumulating the block and uncle rewards. func (ethash *Ethash) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, withdrawals []*types.Withdrawal) { - // Apply fork changes on PrimordialPulse block - if cfg := chain.Config(); cfg.IsPrimordialPulseBlock(header.Number) { - pulse.PrimordialPulseFork(state, cfg.Treasury, cfg.ChainID) + // Apply fork changes on PrimordialWhale block + if cfg := chain.Config(); cfg.IsPrimordialWhaleBlock(header.Number) { + whale.PrimordialWhaleFork(state, cfg.Treasury, cfg.ChainID) } // Accumulate any block and uncle rewards diff --git a/core/forkchoice.go b/core/forkchoice.go index dfc13b88b0..da574442ca 100644 --- a/core/forkchoice.go +++ b/core/forkchoice.go @@ -108,7 +108,7 @@ func (f *ForkChoice) ReorgNeeded(current *types.Header, extern *types.Header) (b currentPreserve, externPreserve = f.preserve(current), f.preserve(extern) } reorg = !currentPreserve && (externPreserve || f.rand.Float64() < 0.5) - } else if f.chain.Config().PrimordialPulseAhead(extern.Number) { + } else if f.chain.Config().PrimordialWhaleAhead(extern.Number) { // Pre-fork ethereum mainnet pos blocks have a difficulty of 0. // These blocks should be accepted onto the chain head. reorg = true diff --git a/core/genesis.go b/core/genesis.go index a1237f3eda..68632a1ea2 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -345,8 +345,8 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen // Assume mainnet chainId first chainId := params.MainnetChainConfig.ChainID.Uint64() // Note: The `genesis` argument will be one of: - // - nil: if running without the `init` command and without providing a network flag (--pulsechain, --ropsten, etc..) - // - defaulted: when a network flag is provided (--pulsechain, --ropsten, etc..), genesis will hold the defaults + // - nil: if running without the `init` command and without providing a network flag (--whalechain, --ropsten, etc..) + // - defaulted: when a network flag is provided (--whalechain, --ropsten, etc..), genesis will hold the defaults // - custom: if running with the `init` command supplying a custom genesis.json file, genesis will hold the file contents // Check whether the genesis block is already written. if genesis != nil { @@ -374,9 +374,9 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen // chain config as that would be AllProtocolChanges (applying any new fork // on top of an existing private network genesis block). In that case, only // apply the overrides. - // Added: support custom config for PrimordialPulse fork with mainnet genesis + // Added: support custom config for PrimordialWhale fork with mainnet genesis // and non-standard chain id. - if genesis == nil && (storedcfg.PrimordialPulseBlock != nil || + if genesis == nil && (storedcfg.PrimordialWhaleBlock != nil || stored != params.MainnetGenesisHash) { newcfg = storedcfg applyOverrides(newcfg) @@ -437,12 +437,8 @@ func (g *Genesis) configOrDefault(ghash common.Hash, chainId uint64) *params.Cha return g.Config case ghash == params.MainnetGenesisHash: switch chainId { - case params.PulseChainConfig.ChainID.Uint64(): - return params.PulseChainConfig case params.WhaleChainConfig.ChainID.Uint64(): return params.WhaleChainConfig - case params.PulseChainTestnetV4Config.ChainID.Uint64(): - return params.PulseChainTestnetV4Config case params.WhaleChainTestnetV4Config.ChainID.Uint64(): return params.WhaleChainTestnetV4Config default: @@ -569,18 +565,6 @@ func DefaultGenesisBlock() *Genesis { } } -// DefaultPulseChainGenesisBlock returns the PulseChain mainnet genesis block. -func DefaultPulseChainGenesisBlock() *Genesis { - return &Genesis{ - Config: params.PulseChainConfig, - Nonce: 66, - ExtraData: hexutil.MustDecode("0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"), - GasLimit: 5000, - Difficulty: big.NewInt(17179869184), - Alloc: decodePrealloc(mainnetAllocData), - } -} - // DefaultWhaleChainGenesisBlock returns the WhaleChain mainnet genesis block. func DefaultWhaleChainGenesisBlock() *Genesis { return &Genesis{ @@ -618,18 +602,6 @@ func DefaultSepoliaGenesisBlock() *Genesis { } } -// DefaultPulseChainTestnetV4GenesisBlock returns the PulseChain Testnet V4 genesis block. -func DefaultPulseChainTestnetV4GenesisBlock() *Genesis { - return &Genesis{ - Config: params.PulseChainTestnetV4Config, - Nonce: 66, - ExtraData: hexutil.MustDecode("0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"), - GasLimit: 5000, - Difficulty: big.NewInt(17179869184), - Alloc: decodePrealloc(mainnetAllocData), - } -} - // DefaultWhaleChainTestnetV4GenesisBlock returns the WhaleChain Testnet V4 genesis block. func DefaultWhaleChainTestnetV4GenesisBlock() *Genesis { return &Genesis{ diff --git a/core/state_processor.go b/core/state_processor.go index 5e2c1bd605..4a55e2e19d 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -93,7 +93,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg // Fail if Shanghai not enabled and len(withdrawals) is non-zero. withdrawals := block.Withdrawals() shanghai := p.config.IsShanghai(blockNumber, block.Time()) - if p.config.PrimordialPulseAhead(blockNumber) { + if p.config.PrimordialWhaleAhead(blockNumber) { shanghai = params.MainnetChainConfig.IsShanghai(blockNumber, block.Time()) } if len(withdrawals) > 0 && !shanghai { diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index ef42eb2d57..d309c03a53 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -41,7 +41,7 @@ func MakeSigner(config *params.ChainConfig, blockNumber *big.Int, blockTime uint var signer Signer chainID := config.ChainID - if config.PrimordialPulseAhead(blockNumber) { + if config.PrimordialWhaleAhead(blockNumber) { // Use ethereum mainnet chainid for pre-fork transactions chainID = big.NewInt(1) } diff --git a/core/vm/evm.go b/core/vm/evm.go index debf8c4e06..4ad71975a3 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -126,7 +126,7 @@ type EVM struct { // only ever be used *once*. func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig *params.ChainConfig, config Config) *EVM { flexChainConfig := chainConfig - if chainConfig.PrimordialPulseAhead(blockCtx.BlockNumber) { + if chainConfig.PrimordialWhaleAhead(blockCtx.BlockNumber) { // Create a shallow of chainConfig struct and set to ethereum mainnet chainCfgCpy := *chainConfig chainCfgCpy.ChainID = big.NewInt(1) diff --git a/go.mod b/go.mod index d62f4ebfd5..6990079fd1 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/ethereum/go-ethereum +module github.com/WhaleChain/go-ethereum-whale go 1.19 diff --git a/params/bootnodes.go b/params/bootnodes.go index f83047cd52..738ea3489b 100644 --- a/params/bootnodes.go +++ b/params/bootnodes.go @@ -28,14 +28,6 @@ var MainnetBootnodes = []string{ "enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303", // bootnode-hetzner-fsn } -// PulseChainBootnodes are the enode URLs of the P2P bootstrap nodes running on -// the main PulseChain network. -var PulseChainBootnodes = []string{ - "enode://ba55e4342cdf8b4d45a0da26ed0575f96c8422400930bfde0ec7b241dd60d55651eb6a7010c2275ea63475dd77dbf431ae24b7b0f12453bc5120007e815b85f1@18.216.186.49:30303", // bootnode-aws-us-east-2-001 - "enode://c4c8889c0d4bdc2cff9502e8dba81ab855772767ef023088dfd6d393328c1b3931304672d5fc722cd11b6141ecf0868f86d823748edd1bebd129b4c541509a27@18.188.89.119:30303", // bootnode-aws-us-east-2-002 - "enode://345b8ef4dad4013b994ff664ec3a6b3f0438221794c4946b756bcae7fd0a1eb373a15035d3f032c039b5e3a69884b01774a3ca19c91081058cd05fcd02f93450@18.216.221.152:30303", // bootnode-aws-us-east-2-003 -} - // WhaleChainBootnodes are the enode URLs of the P2P bootstrap nodes running on // the main WhaleChain network. var WhaleChainBootnodes = []string{ @@ -44,14 +36,6 @@ var WhaleChainBootnodes = []string{ "enode://345b8ef4dad4013b994ff664ec3a6b3f0438221794c4946b756bcae7fd0a1eb373a15035d3f032c039b5e3a69884b01774a3ca19c91081058cd05fcd02f93450@18.216.221.152:30303", // bootnode-aws-us-east-2-003 } -// PulseChainTestnetV4Bootnodes are the enode URLs of the P2P bootstrap nodes running on -// the PulseChain Testnet V4 network. -var PulseChainTestnetV4Bootnodes = []string{ - "enode://499f821836b8fec272c0664e79b95e8ec50b4320d201e02ac83c5bf63bcff33869c411e8290b1774d74ed01b7a53e838e3689cfe46992243094886a0980a9c60@3.142.166.203:30303", // bootnode-aws-us-east-2-001 - "enode://133f45485d3b5221d10e5ed288bf1da827d5adbe454a9a9ae3cd4ae15d14b65d0b6d937b0a1a0ba3b9b2ebbf50c40e379573293f1ff51b553e997d843faa2c4b@18.118.188.165:30303", // bootnode-aws-us-east-2-002 - "enode://ef4bf6197515e2aa3290f5bf5e43e2b99022254fcbd540507d325d2de40e9c6fd87581d88e9affe97bc7c099946a84ca66de0c7752a1ab616c7b51ef1f10b2fb@3.138.107.144:30303", // bootnode-aws-us-east-2-003 -} - // WhaleChainTestnetV4Bootnodes are the enode URLs of the P2P bootstrap nodes running on // the WhaleChain Testnet V4 network. var WhaleChainTestnetV4Bootnodes = []string{ @@ -114,11 +98,6 @@ func KnownDNSNetwork(genesis common.Hash, networkId uint64, protocol string) str var dnsPrefix = "enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@" var tld = ".ethdisco.net" - if networkId == PulseChainConfig.ChainID.Uint64() || networkId == PulseChainTestnetV4Config.ChainID.Uint64() { - tld = ".pulsedisco.net" - dnsPrefix = "enrtree://APFXO36RU3TWV7XFGWI2TYF5IDA3WM2GPTRL3TCZINWHZX4R6TAOK@" - } - if networkId == WhaleChainConfig.ChainID.Uint64() || networkId == WhaleChainTestnetV4Config.ChainID.Uint64() { tld = ".whaledisco.net" dnsPrefix = "enrtree://APFXO36RU3TWV7XFGWI2TYF5IDA3WM2GPTRL3TCZINWHZX4R6TAOK@" @@ -127,8 +106,6 @@ func KnownDNSNetwork(genesis common.Hash, networkId uint64, protocol string) str switch genesis { case MainnetGenesisHash: switch networkId { - case PulseChainTestnetV4Config.ChainID.Uint64(): - net = "testnet-v4" case WhaleChainTestnetV4Config.ChainID.Uint64(): net = "testnet-v4" default: diff --git a/params/config.go b/params/config.go index 89cdf0a2a8..9886ec6f95 100644 --- a/params/config.go +++ b/params/config.go @@ -305,9 +305,9 @@ type ChainConfig struct { Clique *CliqueConfig `json:"clique,omitempty"` IsDevMode bool `json:"isDev,omitempty"` - // PulseChain modifications - PrimordialPulseBlock *big.Int `json:"primordialPulseBlock,omitempty"` // PrimordialPulseBlock switch block (nil = no fork, 0 = already activated) - Treasury *Treasury `json:"treasury,omitempty"` // An optional treasury which will receive allocations during the PrimordialPulseBlock + // WhaleChain modifications + PrimordialWhaleBlock *big.Int `json:"primordialWhaleBlock,omitempty"` // PrimordialWhaleBlock switch block (nil = no fork, 0 = already activated) + Treasury *Treasury `json:"treasury,omitempty"` // An optional treasury which will receive allocations during the PrimordialWhaleBlock } // EthashConfig is the consensus engine configs for proof-of-work based sealing. @@ -387,8 +387,8 @@ func (c *ChainConfig) Description() string { if c.GrayGlacierBlock != nil { banner += fmt.Sprintf(" - Gray Glacier: #%-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/gray-glacier.md)\n", c.GrayGlacierBlock) } - if c.PrimordialPulseBlock != nil { - banner += fmt.Sprintf(" - Primordial Pulse: #%-8v (https://gitlab.com/pulsechaincom/go-pulse)\n", c.PrimordialPulseBlock) + if c.PrimordialWhaleBlock != nil { + banner += fmt.Sprintf(" - Primordial Whale: #%-8v (https://github.com/WhaleChain/go-ethereum)\n", c.PrimordialWhaleBlock) } banner += "\n" @@ -524,15 +524,15 @@ func (c *ChainConfig) IsVerkle(num *big.Int, time uint64) bool { return c.IsLondon(num) && isTimestampForked(c.VerkleTime, time) } -// IsPrimordialPulseBlock returns whether or not the given block is the primordial pulse block. -func (c *ChainConfig) IsPrimordialPulseBlock(num *big.Int) bool { - // Returns whether or not the given block is the PrimordialPulseBlock. - return c.PrimordialPulseBlock != nil && c.PrimordialPulseBlock.Cmp(num) == 0 +// IsPrimordialWhaleBlock returns whether or not the given block is the primordial whale block. +func (c *ChainConfig) IsPrimordialWhaleBlock(num *big.Int) bool { + // Returns whether or not the given block is the PrimordialWhaleBlock. + return c.PrimordialWhaleBlock != nil && c.PrimordialWhaleBlock.Cmp(num) == 0 } -// Returns true if there is a PrimordialPulse block in the future. -func (c *ChainConfig) PrimordialPulseAhead(num *big.Int) bool { - return c.PrimordialPulseBlock != nil && c.PrimordialPulseBlock.Cmp(num) > 0 +// Returns true if there is a PrimordialWhale block in the future. +func (c *ChainConfig) PrimordialWhaleAhead(num *big.Int) bool { + return c.PrimordialWhaleBlock != nil && c.PrimordialWhaleBlock.Cmp(num) > 0 } // CheckCompatible checks whether scheduled fork transitions have been imported @@ -647,8 +647,8 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int, if isForkBlockIncompatible(c.EIP158Block, newcfg.EIP158Block, headNumber) { return newBlockCompatError("EIP158 fork block", c.EIP158Block, newcfg.EIP158Block) } - // allow mismatching ChainID if there is a PrimordialPulse block ahead - if c.IsEIP158(headNumber) && !configBlockEqual(c.ChainID, newcfg.ChainID) && !newcfg.PrimordialPulseAhead(headNumber) { + // allow mismatching ChainID if there is a PrimordialWhale block ahead + if c.IsEIP158(headNumber) && !configBlockEqual(c.ChainID, newcfg.ChainID) && !newcfg.PrimordialWhaleAhead(headNumber) { return newBlockCompatError("EIP158 chain ID", c.EIP158Block, newcfg.EIP158Block) } if isForkBlockIncompatible(c.ByzantiumBlock, newcfg.ByzantiumBlock, headNumber) { @@ -685,8 +685,8 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int, if isForkBlockIncompatible(c.MergeNetsplitBlock, newcfg.MergeNetsplitBlock, headNumber) { return newBlockCompatError("Merge netsplit fork block", c.MergeNetsplitBlock, newcfg.MergeNetsplitBlock) } - // allow mismatching Shanghai time if we're on the PrimordialPulse block or if there is a PrimordialPulse block ahead - if isForkTimestampIncompatible(c.ShanghaiTime, newcfg.ShanghaiTime, headTimestamp) && !newcfg.IsPrimordialPulseBlock(headNumber) && !newcfg.PrimordialPulseAhead(headNumber) { + // allow mismatching Shanghai time if we're on the PrimordialWhale block or if there is a PrimordialWhale block ahead + if isForkTimestampIncompatible(c.ShanghaiTime, newcfg.ShanghaiTime, headTimestamp) && !newcfg.IsPrimordialWhaleBlock(headNumber) && !newcfg.PrimordialWhaleAhead(headNumber) { return newTimestampCompatError("Shanghai fork timestamp", c.ShanghaiTime, newcfg.ShanghaiTime) } if isForkTimestampIncompatible(c.CancunTime, newcfg.CancunTime, headTimestamp) { @@ -698,8 +698,8 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int, if isForkTimestampIncompatible(c.VerkleTime, newcfg.VerkleTime, headTimestamp) { return newTimestampCompatError("Verkle fork timestamp", c.VerkleTime, newcfg.VerkleTime) } - if isForkBlockIncompatible(c.PrimordialPulseBlock, newcfg.PrimordialPulseBlock, headNumber) { - return newBlockCompatError("PrimordialPulse fork block", c.PrimordialPulseBlock, newcfg.PrimordialPulseBlock) + if isForkBlockIncompatible(c.PrimordialWhaleBlock, newcfg.PrimordialWhaleBlock, headNumber) { + return newBlockCompatError("PrimordialWhale fork block", c.PrimordialWhaleBlock, newcfg.PrimordialWhaleBlock) } return nil } @@ -856,7 +856,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules chainID = new(big.Int) } isShanghai := c.IsShanghai(num, timestamp) - if c.PrimordialPulseAhead(num) { + if c.PrimordialWhaleAhead(num) { isShanghai = MainnetChainConfig.IsShanghai(num, timestamp) } return Rules{ diff --git a/params/pulse.go b/params/pulse.go deleted file mode 100644 index aad724ef11..0000000000 --- a/params/pulse.go +++ /dev/null @@ -1,82 +0,0 @@ -package params - -import ( - "math/big" - - "github.com/ethereum/go-ethereum/common/math" -) - -// Optional treasury for launching PulseChain testnets -type Treasury struct { - Addr string `json:"addr"` - Balance *math.HexOrDecimal256 `json:"balance"` -} - -// A trivially small amount of work to add to the Ethereum Mainnet TTD -// to allow for un-merging and merging with the PulseChain beacon chain -var PulseChainTTDOffset = big.NewInt(131_072) - -// This value is defined as LAST_ACTUAL_MAINNET_TTD + PulseChainTTDOffset -// where LAST_ACTUAL_MAINNET_TTD = 58_750_003_716_598_352_816_469 -var PulseChainTerminalTotalDifficulty, _ = new(big.Int).SetString("58_750_003_716_598_352_947_541", 0) - -var ( - PulseChainConfig = &ChainConfig{ - ChainID: big.NewInt(369), - HomesteadBlock: big.NewInt(1_150_000), - DAOForkBlock: big.NewInt(1_920_000), - DAOForkSupport: true, - EIP150Block: big.NewInt(2_463_000), - EIP155Block: big.NewInt(2_675_000), - EIP158Block: big.NewInt(2_675_000), - ByzantiumBlock: big.NewInt(4_370_000), - ConstantinopleBlock: big.NewInt(7_280_000), - PetersburgBlock: big.NewInt(7_280_000), - IstanbulBlock: big.NewInt(9_069_000), - MuirGlacierBlock: big.NewInt(9_200_000), - BerlinBlock: big.NewInt(12_244_000), - LondonBlock: big.NewInt(12_965_000), - ArrowGlacierBlock: big.NewInt(13_773_000), - GrayGlacierBlock: big.NewInt(15_050_000), - TerminalTotalDifficulty: PulseChainTerminalTotalDifficulty, - TerminalTotalDifficultyPassed: true, - Ethash: new(EthashConfig), - PrimordialPulseBlock: big.NewInt(17_233_000), - ShanghaiTime: newUint64(1683786515), - } - - PulseChainTestnetV4Config = &ChainConfig{ - ChainID: big.NewInt(943), - HomesteadBlock: big.NewInt(1_150_000), - DAOForkBlock: big.NewInt(1_920_000), - DAOForkSupport: true, - EIP150Block: big.NewInt(2_463_000), - EIP155Block: big.NewInt(2_675_000), - EIP158Block: big.NewInt(2_675_000), - ByzantiumBlock: big.NewInt(4_370_000), - ConstantinopleBlock: big.NewInt(7_280_000), - PetersburgBlock: big.NewInt(7_280_000), - IstanbulBlock: big.NewInt(9_069_000), - MuirGlacierBlock: big.NewInt(9_200_000), - BerlinBlock: big.NewInt(12_244_000), - LondonBlock: big.NewInt(12_965_000), - ArrowGlacierBlock: big.NewInt(13_773_000), - GrayGlacierBlock: big.NewInt(15_050_000), - TerminalTotalDifficulty: PulseChainTerminalTotalDifficulty, - TerminalTotalDifficultyPassed: true, - Ethash: new(EthashConfig), - PrimordialPulseBlock: big.NewInt(16_492_700), - Treasury: testnetTreasury(), - ShanghaiTime: newUint64(1682700369), - } -) - -func testnetTreasury() *Treasury { - var pulseChainTestnetTreasuryBalance math.HexOrDecimal256 - pulseChainTestnetTreasuryBalance.UnmarshalText([]byte("0x314DC6448D9338C15B0A00000000")) - - return &Treasury{ - Addr: "0xA592ED65885bcbCeb30442F4902a0D1Cf3AcB8fC", - Balance: &pulseChainTestnetTreasuryBalance, - } -} diff --git a/params/version.go b/params/version.go index 55d56817d5..9fb3904162 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ const ( VersionMajor = 3 // Major version component of the current release VersionMinor = 0 // Minor version component of the current release VersionPatch = 1 // Patch version component of the current release - VariantMeta = "pulse" // Variant metadata to append to the version string + VariantMeta = "whale" // Variant metadata to append to the version string VersionMeta = "stable" // Version metadata to append to the version string ) diff --git a/params/whale.go b/params/whale.go index 93478d048f..71a554aa78 100644 --- a/params/whale.go +++ b/params/whale.go @@ -6,17 +6,17 @@ import ( "github.com/ethereum/go-ethereum/common/math" ) -// Optional treasury for launching PulseChain testnets +// Optional treasury for launching WhaleChain testnets type Treasury struct { Addr string `json:"addr"` Balance *math.HexOrDecimal256 `json:"balance"` } // A trivially small amount of work to add to the Ethereum Mainnet TTD -// to allow for un-merging and merging with the PulseChain beacon chain +// to allow for un-merging and merging with the WhaleChain beacon chain var WhaleChainTTDOffset = big.NewInt(131_072) -// This value is defined as LAST_ACTUAL_MAINNET_TTD + PulseChainTTDOffset +// This value is defined as LAST_ACTUAL_MAINNET_TTD + WhaleChainTTDOffset // where LAST_ACTUAL_MAINNET_TTD = 58_750_003_716_598_352_816_469 var WhaleChainTerminalTotalDifficulty, _ = new(big.Int).SetString("58_750_003_716_598_352_947_541", 0) @@ -38,10 +38,10 @@ var ( LondonBlock: big.NewInt(12_965_000), ArrowGlacierBlock: big.NewInt(13_773_000), GrayGlacierBlock: big.NewInt(15_050_000), - TerminalTotalDifficulty: PulseChainTerminalTotalDifficulty, + TerminalTotalDifficulty: WhaleChainTerminalTotalDifficulty, TerminalTotalDifficultyPassed: true, Ethash: new(EthashConfig), - PrimordialPulseBlock: big.NewInt(17_233_000), + PrimordialWhaleBlock: big.NewInt(17_233_000), ShanghaiTime: newUint64(1683786515), } @@ -62,10 +62,10 @@ var ( LondonBlock: big.NewInt(12_965_000), ArrowGlacierBlock: big.NewInt(13_773_000), GrayGlacierBlock: big.NewInt(15_050_000), - TerminalTotalDifficulty: PulseChainTerminalTotalDifficulty, + TerminalTotalDifficulty: WhaleChainTerminalTotalDifficulty, TerminalTotalDifficultyPassed: true, Ethash: new(EthashConfig), - PrimordialPulseBlock: big.NewInt(16_492_700), + PrimordialWhaleBlock: big.NewInt(16_492_700), Treasury: testnetTreasury(), ShanghaiTime: newUint64(1682700369), } diff --git a/pulse/deposit_contract.go b/pulse/deposit_contract.go deleted file mode 100644 index ce8dbfb9a9..0000000000 --- a/pulse/deposit_contract.go +++ /dev/null @@ -1,72 +0,0 @@ -package pulse - -import ( - "math/big" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/log" -) - -var ( - ethereumDepositContractAddr = common.HexToAddress("0x00000000219ab540356cBB839Cbe05303d7705Fa") - pulseDepositContractAddr = common.HexToAddress("0x3693693693693693693693693693693693693693") - - depositContractBytes = common.Hex2Bytes("60806040526004361061003f5760003560e01c806301ffc9a714610044578063228951181461008c578063621fd130146101a2578063c5f2892f1461022c575b600080fd5b34801561005057600080fd5b506100786004803603602081101561006757600080fd5b50356001600160e01b031916610253565b604080519115158252519081900360200190f35b6101a0600480360360808110156100a257600080fd5b8101906020810181356401000000008111156100bd57600080fd5b8201836020820111156100cf57600080fd5b803590602001918460018302840111640100000000831117156100f157600080fd5b91939092909160208101903564010000000081111561010f57600080fd5b82018360208201111561012157600080fd5b8035906020019184600183028401116401000000008311171561014357600080fd5b91939092909160208101903564010000000081111561016157600080fd5b82018360208201111561017357600080fd5b8035906020019184600183028401116401000000008311171561019557600080fd5b91935091503561028a565b005b3480156101ae57600080fd5b506101b7610ce6565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023857600080fd5b50610241610cf8565b60408051918252519081900360200190f35b60006001600160e01b031982166301ffc9a760e01b148061028457506001600160e01b03198216638564090760e01b145b92915050565b603086146102c95760405162461bcd60e51b81526004018080602001828103825260268152602001806112516026913960400191505060405180910390fd5b602084146103085760405162461bcd60e51b81526004018080602001828103825260368152602001806111e86036913960400191505060405180910390fd5b606082146103475760405162461bcd60e51b81526004018080602001828103825260298152602001806112c46029913960400191505060405180910390fd5b670de0b6b3a764000034101561038e5760405162461bcd60e51b815260040180806020018281038252602681526020018061129e6026913960400191505060405180910390fd5b633b9aca003406156103d15760405162461bcd60e51b815260040180806020018281038252603381526020018061121e6033913960400191505060405180910390fd5b633b9aca00340467ffffffffffffffff81111561041f5760405162461bcd60e51b81526004018080602001828103825260278152602001806112776027913960400191505060405180910390fd5b606061042a82610fc6565b90507f649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c589898989858a8a61045f602054610fc6565b6040805160a0808252810189905290819060208201908201606083016080840160c085018e8e80828437600083820152601f01601f191690910187810386528c815260200190508c8c808284376000838201819052601f909101601f191690920188810386528c5181528c51602091820193918e019250908190849084905b838110156104f65781810151838201526020016104de565b50505050905090810190601f1680156105235780820380516001836020036101000a031916815260200191505b5086810383528881526020018989808284376000838201819052601f909101601f19169092018881038452895181528951602091820193918b019250908190849084905b8381101561057f578181015183820152602001610567565b50505050905090810190601f1680156105ac5780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390a1600060028a8a600060801b604051602001808484808284376fffffffffffffffffffffffffffffffff199094169190930190815260408051600f19818403018152601090920190819052815191955093508392506020850191508083835b602083106106415780518252601f199092019160209182019101610622565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610680573d6000803e3d6000fd5b5050506040513d602081101561069557600080fd5b5051905060006002806106ab6040848a8c61114a565b6040516020018083838082843780830192505050925050506040516020818303038152906040526040518082805190602001908083835b602083106107015780518252601f1990920191602091820191016106e2565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610740573d6000803e3d6000fd5b5050506040513d602081101561075557600080fd5b50516002610766896040818d61114a565b60405160009060200180848480828437919091019283525050604080518083038152602092830191829052805190945090925082918401908083835b602083106107c15780518252601f1990920191602091820191016107a2565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610800573d6000803e3d6000fd5b5050506040513d602081101561081557600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b6020831061086b5780518252601f19909201916020918201910161084c565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156108aa573d6000803e3d6000fd5b5050506040513d60208110156108bf57600080fd5b50516040805160208101858152929350600092600292839287928f928f92018383808284378083019250505093505050506040516020818303038152906040526040518082805190602001908083835b6020831061092e5780518252601f19909201916020918201910161090f565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561096d573d6000803e3d6000fd5b5050506040513d602081101561098257600080fd5b50516040518651600291889160009188916020918201918291908601908083835b602083106109c25780518252601f1990920191602091820191016109a3565b6001836020036101000a0380198251168184511680821785525050505050509050018367ffffffffffffffff191667ffffffffffffffff1916815260180182815260200193505050506040516020818303038152906040526040518082805190602001908083835b60208310610a495780518252601f199092019160209182019101610a2a565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610a88573d6000803e3d6000fd5b5050506040513d6020811015610a9d57600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610af35780518252601f199092019160209182019101610ad4565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610b32573d6000803e3d6000fd5b5050506040513d6020811015610b4757600080fd5b50519050858114610b895760405162461bcd60e51b81526004018080602001828103825260548152602001806111946054913960600191505060405180910390fd5b60205463ffffffff11610bcd5760405162461bcd60e51b81526004018080602001828103825260218152602001806111736021913960400191505060405180910390fd5b602080546001019081905560005b6020811015610cda578160011660011415610c0d578260008260208110610bfe57fe5b015550610cdd95505050505050565b600260008260208110610c1c57fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610c745780518252601f199092019160209182019101610c55565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610cb3573d6000803e3d6000fd5b5050506040513d6020811015610cc857600080fd5b50519250600282049150600101610bdb565b50fe5b50505050505050565b6060610cf3602054610fc6565b905090565b6020546000908190815b6020811015610ea9578160011660011415610ddb57600260008260208110610d2657fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610d7e5780518252601f199092019160209182019101610d5f565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610dbd573d6000803e3d6000fd5b5050506040513d6020811015610dd257600080fd5b50519250610e9b565b60028360218360208110610deb57fe5b015460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610e425780518252601f199092019160209182019101610e23565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610e81573d6000803e3d6000fd5b5050506040513d6020811015610e9657600080fd5b505192505b600282049150600101610d02565b50600282610eb8602054610fc6565b600060401b6040516020018084815260200183805190602001908083835b60208310610ef55780518252601f199092019160209182019101610ed6565b51815160209384036101000a600019018019909216911617905267ffffffffffffffff199590951692019182525060408051808303600719018152601890920190819052815191955093508392850191508083835b60208310610f695780518252601f199092019160209182019101610f4a565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610fa8573d6000803e3d6000fd5b5050506040513d6020811015610fbd57600080fd5b50519250505090565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b8260008151811061100057fe5b60200101906001600160f81b031916908160001a9053508060061a60f81b8260018151811061102b57fe5b60200101906001600160f81b031916908160001a9053508060051a60f81b8260028151811061105657fe5b60200101906001600160f81b031916908160001a9053508060041a60f81b8260038151811061108157fe5b60200101906001600160f81b031916908160001a9053508060031a60f81b826004815181106110ac57fe5b60200101906001600160f81b031916908160001a9053508060021a60f81b826005815181106110d757fe5b60200101906001600160f81b031916908160001a9053508060011a60f81b8260068151811061110257fe5b60200101906001600160f81b031916908160001a9053508060001a60f81b8260078151811061112d57fe5b60200101906001600160f81b031916908160001a90535050919050565b60008085851115611159578182fd5b83861115611165578182fd5b505082019391909203915056fe4465706f736974436f6e74726163743a206d65726b6c6520747265652066756c6c4465706f736974436f6e74726163743a207265636f6e7374727563746564204465706f7369744461746120646f6573206e6f74206d6174636820737570706c696564206465706f7369745f646174615f726f6f744465706f736974436f6e74726163743a20696e76616c6964207769746864726177616c5f63726564656e7469616c73206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c7565206e6f74206d756c7469706c65206f6620677765694465706f736974436f6e74726163743a20696e76616c6964207075626b6579206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f20686967684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f206c6f774465706f736974436f6e74726163743a20696e76616c6964207369676e6174757265206c656e677468a26469706673582212208f21786c1e781f4cb4c6429b6be517fbc015929c8692077b28fbd343c5c085a064736f6c634300060b0033") - - depositContractStorage = [][]string{ - {"0x22", "0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b"}, - {"0x23", "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71"}, - {"0x24", "0xc78009fdf07fc56a11f122370658a353aaa542ed63e44c4bc15ff4cd105ab33c"}, - {"0x25", "0x536d98837f2dd165a55d5eeae91485954472d56f246df256bf3cae19352a123c"}, - {"0x26", "0x9efde052aa15429fae05bad4d0b1d7c64da64d03d7a1854a588c2cb8430c0d30"}, - {"0x27", "0xd88ddfeed400a8755596b21942c1497e114c302e6118290f91e6772976041fa1"}, - {"0x28", "0x87eb0ddba57e35f6d286673802a4af5975e22506c7cf4c64bb6be5ee11527f2c"}, - {"0x29", "0x26846476fd5fc54a5d43385167c95144f2643f533cc85bb9d16b782f8d7db193"}, - {"0x2a", "0x506d86582d252405b840018792cad2bf1259f1ef5aa5f887e13cb2f0094f51e1"}, - {"0x2b", "0xffff0ad7e659772f9534c195c815efc4014ef1e1daed4404c06385d11192e92b"}, - {"0x2c", "0x6cf04127db05441cd833107a52be852868890e4317e6a02ab47683aa75964220"}, - {"0x2d", "0xb7d05f875f140027ef5118a2247bbb84ce8f2f0f1123623085daf7960c329f5f"}, - {"0x2e", "0xdf6af5f5bbdb6be9ef8aa618e4bf8073960867171e29676f8b284dea6a08a85e"}, - {"0x2f", "0xb58d900f5e182e3c50ef74969ea16c7726c549757cc23523c369587da7293784"}, - {"0x30", "0xd49a7502ffcfb0340b1d7885688500ca308161a7f96b62df9d083b71fcc8f2bb"}, - {"0x31", "0x8fe6b1689256c0d385f42f5bbe2027a22c1996e110ba97c171d3e5948de92beb"}, - {"0x32", "0x8d0d63c39ebade8509e0ae3c9c3876fb5fa112be18f905ecacfecb92057603ab"}, - {"0x33", "0x95eec8b2e541cad4e91de38385f2e046619f54496c2382cb6cacd5b98c26f5a4"}, - {"0x34", "0xf893e908917775b62bff23294dbbe3a1cd8e6cc1c35b4801887b646a6f81f17f"}, - {"0x35", "0xcddba7b592e3133393c16194fac7431abf2f5485ed711db282183c819e08ebaa"}, - {"0x36", "0x8a8d7fe3af8caa085a7639a832001457dfb9128a8061142ad0335629ff23ff9c"}, - {"0x37", "0xfeb3c337d7a51a6fbf00b9e34c52e1c9195c969bd4e7a0bfd51d5c5bed9c1167"}, - {"0x38", "0xe71f0aa83cc32edfbefa9f4d3e0174ca85182eec9f3a09f6a6c0df6377a510d7"}, - {"0x39", "0x31206fa80a50bb6abe29085058f16212212a60eec8f049fecb92d8c8e0a84bc0"}, - {"0x3a", "0x21352bfecbeddde993839f614c3dac0a3ee37543f9b412b16199dc158e23b544"}, - {"0x3b", "0x619e312724bb6d7c3153ed9de791d764a366b389af13c58bf8a8d90481a46765"}, - {"0x3c", "0x7cdd2986268250628d0c10e385c58c6191e6fbe05191bcc04f133f2cea72c1c4"}, - {"0x3d", "0x848930bd7ba8cac54661072113fb278869e07bb8587f91392933374d017bcbe1"}, - {"0x3e", "0x8869ff2c22b28cc10510d9853292803328be4fb0e80495e8bb8d271f5b889636"}, - {"0x3f", "0xb5fe28e79f1b850f8658246ce9b6a1e7b49fc06db7143e8fe0b4f2b0c5523a5c"}, - {"0x40", "0x985e929f70af28d0bdd1a90a808f977f597c7c778c489e98d3bd8910d31ac0f7"}, - } - - // This empty contract has no receive() or fallback() function, preventing users/contracts from sending PLS to this address - nilContractBytes = common.Hex2Bytes("6080604052600080fdfea2646970667358221220d10eb20cd2b73b968672d3bce97dff1eb0797edc10179828d6039dc6b4eda2fe64736f6c634300060b0033") -) - -// Destroys & disables the Ethereum deposit contract and deploys the PulseChain deposit contract. -func replaceDepositContract(state *state.StateDB) { - // Destroy the old contract - state.SelfDestruct(ethereumDepositContractAddr) - state.SetCode(ethereumDepositContractAddr, nilContractBytes) - log.Info("ETH2 deposit contract destroyed 💀") - - // Initialize the new contract - state.SetBalance(pulseDepositContractAddr, big.NewInt(0)) - state.SetCode(pulseDepositContractAddr, depositContractBytes) - state.SetNonce(pulseDepositContractAddr, 0) - for i := 0; i < len(depositContractStorage); i++ { - hash := common.HexToHash(depositContractStorage[i][0]) - value := common.HexToHash(depositContractStorage[i][1]) - state.SetState(pulseDepositContractAddr, hash, value) - } - log.Info("Deployed new beacon deposit contract ✨", "address", pulseDepositContractAddr) -} diff --git a/pulse/deposit_contract_test.go b/pulse/deposit_contract_test.go deleted file mode 100644 index a0e6d9ca71..0000000000 --- a/pulse/deposit_contract_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package pulse - -import ( - "testing" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/trie" -) - -func TestReplaceDepositContract(t *testing.T) { - // Init - db := rawdb.NewMemoryDatabase() - state, _ := state.New(common.Hash{}, state.NewDatabaseWithConfig(db, &trie.Config{Preimages: true}), nil) - - // Exec - replaceDepositContract(state) - - // Verify - balance := state.GetBalance(pulseDepositContractAddr) - if balance.Cmp(common.Big0) != 0 { - t.Errorf("Found unexpected deposit contract balance: %d", balance) - } - - actualCode := state.GetCode(pulseDepositContractAddr) - for i, b := range actualCode { - if b != depositContractBytes[i] { - t.Errorf("Invalid deposit contract code at index %d", i) - } - } - - // Verify Storage - for i, store := range depositContractStorage { - actualStorage := state.GetState(pulseDepositContractAddr, common.HexToHash(store[0])) - expectedStorage := common.HexToHash(store[1]) - if actualStorage != expectedStorage { - t.Errorf("Invalid storage entry %d, actual: %d, expected: %d", i, actualStorage, expectedStorage) - } else { - t.Log("Valid Storage entry") - } - } -} diff --git a/pulse/pulse.go b/pulse/pulse.go deleted file mode 100644 index c3054738a0..0000000000 --- a/pulse/pulse.go +++ /dev/null @@ -1,15 +0,0 @@ -// Package pulse implements the PulseChain fork -package pulse - -import ( - "math/big" - - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/params" -) - -// Apply PrimordialPulse fork changes -func PrimordialPulseFork(state *state.StateDB, treasury *params.Treasury, chainID *big.Int) { - applySacrificeCredits(state, treasury, chainID) - replaceDepositContract(state) -} diff --git a/pulse/sacrifice_credits.go b/pulse/sacrifice_credits.go deleted file mode 100644 index b6fee4ff21..0000000000 --- a/pulse/sacrifice_credits.go +++ /dev/null @@ -1,49 +0,0 @@ -package pulse - -import ( - _ "embed" - "math/big" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" -) - -// see https://gitlab.com/pulsechaincom/compressed-allocations/-/tags/Mainnet -// -//go:embed sacrifice_credits_mainnet.bin -var mainnetRawCredits []byte - -// see https://gitlab.com/pulsechaincom/compressed-allocations/-/tags/Testnet-V4 -// -//go:embed sacrifice_credits_testnet_v4.bin -var testnetV4RawCredits []byte - -// Applies the sacrifice credits for the PrimordialPulse fork. -func applySacrificeCredits(state *state.StateDB, treasury *params.Treasury, chainID *big.Int) { - rawCredits := mainnetRawCredits - if chainID.Cmp(params.PulseChainTestnetV4Config.ChainID) == 0 { - rawCredits = testnetV4RawCredits - } - - if treasury != nil { - log.Info("Applying PrimordialPulse treasury allocation 💸") - state.AddBalance(common.HexToAddress(treasury.Addr), (*big.Int)(treasury.Balance)) - } - - log.Info("Applying PrimordialPulse sacrifice credits 💸") - for ptr := 0; ptr < len(rawCredits); { - byteCount := int(rawCredits[ptr]) - ptr++ - - record := rawCredits[ptr : ptr+byteCount] - ptr += byteCount - - addr := common.BytesToAddress(record[:20]) - credit := new(big.Int).SetBytes(record[20:]) - state.AddBalance(addr, credit) - } - - log.Info("Finished applying PrimordialPulse sacrifice credits 🤑") -} diff --git a/pulse/sacrifice_credits_mainnet.bin b/pulse/sacrifice_credits_mainnet.bin deleted file mode 100644 index 9c55359848..0000000000 Binary files a/pulse/sacrifice_credits_mainnet.bin and /dev/null differ diff --git a/pulse/sacrifice_credits_test.go b/pulse/sacrifice_credits_test.go deleted file mode 100644 index 7917179d54..0000000000 --- a/pulse/sacrifice_credits_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package pulse - -import ( - "math/big" - "testing" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" -) - -func TestApplySacrificeCredits(t *testing.T) { - // Init - var pulseChainTestnetTreasuryBalance math.HexOrDecimal256 - pulseChainTestnetTreasuryBalance.UnmarshalText([]byte("0xC9F2C9CD04674EDEA40000000")) - - db := rawdb.NewMemoryDatabase() - state, _ := state.New(common.Hash{}, state.NewDatabaseWithConfig(db, &trie.Config{Preimages: true}), nil) - treasury := ¶ms.Treasury{ - Addr: "0xceB59257450820132aB274ED61C49E5FD96E8868", - Balance: &pulseChainTestnetTreasuryBalance, - } - - // Exec - applySacrificeCredits(state, treasury, params.PulseChainConfig.ChainID) - - // Verify - actual := state.GetBalance(common.HexToAddress(treasury.Addr)) - expected := (*big.Int)(treasury.Balance) - if actual.Cmp(expected) != 0 { - t.Errorf("Invalid treasury balance, actual: %d, expected: %d", actual, expected) - } else { - t.Log("Treasury allocating successful") - } - - // from the credits.csv file in compressed-allocations - actual = state.GetBalance(common.HexToAddress("0x000000005dCEE11e13fb536Fa40d65450F53c5a8")) - expected, _ = new(big.Int).SetString("64000000000000000000", 10) - - if actual.Cmp(expected) != 0 { - t.Errorf("Invalid sacrifice credit balance, actual: %d, expected: %d", actual, expected) - } else { - t.Log("Sacrifice allocation successful") - } -} diff --git a/pulse/sacrifice_credits_testnet_v4.bin b/pulse/sacrifice_credits_testnet_v4.bin deleted file mode 100644 index 469660a79e..0000000000 Binary files a/pulse/sacrifice_credits_testnet_v4.bin and /dev/null differ