Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #31 from Musicoin/UBISignal
Browse files Browse the repository at this point in the history
Ubi signal final
  • Loading branch information
immartian authored Aug 23, 2017
2 parents 39ccc31 + 651983c commit c937d2e
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 45 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.18
1.5.0
2 changes: 1 addition & 1 deletion cmd/gmc/consolecmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestIPCAttachWelcome(t *testing.T) {
} else {
ws := tmpdir(t)
defer os.RemoveAll(ws)
ipc = filepath.Join(ws, "geth.ipc")
ipc = filepath.Join(ws, "gmc.ipc")
}
// Note: we need --shh because testAttachWelcome checks for default
// list of ipc modules and shh is included there.
Expand Down
4 changes: 2 additions & 2 deletions cmd/gmc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ import (
const (
clientIdentifier = "GMC" // Client identifier to advertise over the network
versionMajor = 1 // Major version component of the current release
versionMinor = 4 // Minor version component of the current release
versionPatch = 18 // Patch version component of the current release
versionMinor = 5 // Minor version component of the current release
versionPatch = 0 // Patch version component of the current release
versionMeta = "stable" // Version metadata to append to the version string

versionOracle = "0xfa7b9770ca4cb04296cac84f37736d4041251cdf" // Ethereum address of the Geth release oracle
Expand Down
31 changes: 13 additions & 18 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ func MustMakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *core.ChainC
} else {
config.DAOForkBlock = params.MainNetDAOForkBlock
}
config.DAOForkSupport = true
config.DAOForkSupport = false
}
if config.HomesteadGasRepriceBlock == nil {
if ctx.GlobalBool(TestNetFlag.Name) {
Expand All @@ -819,27 +819,22 @@ func MustMakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *core.ChainC
// Force override any existing configs if explicitly requested
switch {
case ctx.GlobalBool(SupportDAOFork.Name):
config.DAOForkSupport = true
config.DAOForkSupport = false
case ctx.GlobalBool(OpposeDAOFork.Name):
config.DAOForkSupport = false
}
// Temporarilly display a proper message so the user knows which fork its on
if !ctx.GlobalBool(TestNetFlag.Name) && (genesis == nil || genesis.Hash() == common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3")) {
choice := "SUPPORT"
if !config.DAOForkSupport {
choice = "OPPOSE"
}
current := fmt.Sprintf("Geth is currently configured to %s the DAO hard-fork!", choice)
howtoswap := fmt.Sprintf("You can change your choice prior to block #%v with --support-dao-fork or --oppose-dao-fork.", config.DAOForkBlock)
howtosync := fmt.Sprintf("After the hard-fork block #%v passed, changing chains requires a resync from scratch!", config.DAOForkBlock)
separator := strings.Repeat("-", len(howtoswap))
config.UBIForkBlock = params.UBIForkBlock

// Display UBI messages here
current := fmt.Sprintf("GMC is ready to config with UBI!")
howtosync := fmt.Sprintf("After the hard-fork block #%v passed, changing chains requires a resync from scratch!", config.UBIForkBlock)
separator := strings.Repeat("-", len(howtosync))

glog.V(logger.Warn).Info(separator)
glog.V(logger.Warn).Info(current)
glog.V(logger.Warn).Info(howtosync)
glog.V(logger.Warn).Info(separator)

glog.V(logger.Warn).Info(separator)
glog.V(logger.Warn).Info(current)
glog.V(logger.Warn).Info(howtoswap)
glog.V(logger.Warn).Info(howtosync)
glog.V(logger.Warn).Info(separator)
}
return config
}

Expand Down
2 changes: 1 addition & 1 deletion common/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
)

const (
DefaultIPCSocket = "geth.ipc" // Default (relative) name of the IPC RPC socket
DefaultIPCSocket = "gmc.ipc" // Default (relative) name of the IPC RPC socket
DefaultHTTPHost = "localhost" // Default host interface for the HTTP RPC server
DefaultHTTPPort = 8545 // Default TCP port for the HTTP RPC server
DefaultWSHost = "localhost" // Default host interface for the websocket RPC server
Expand Down
2 changes: 1 addition & 1 deletion console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func (c *Console) AutoCompleteInput(line string, pos int) (string, []string, str
// console's available modules.
func (c *Console) Welcome() {
// Print some generic Geth metadata
fmt.Fprintf(c.printer, "Welcome to the Geth JavaScript console!\n\n")
fmt.Fprintf(c.printer, "Welcome to the GMC JavaScript console!\n\n")
c.jsre.Run(`
console.log("instance: " + web3.version.node);
console.log("coinbase: " + eth.coinbase);
Expand Down
2 changes: 2 additions & 0 deletions core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ type ChainConfig struct {
DAOForkBlock *big.Int `json:"daoForkBlock"` // TheDAO hard-fork switch block (nil = no fork)
DAOForkSupport bool `json:"daoForkSupport"` // Whether the nodes supports or opposes the DAO hard-fork

UBIForkBlock *big.Int `json:"ubiForkBlock"` // UBI hard-fork switch block, can't be nil

HomesteadGasRepriceBlock *big.Int `json:"homesteadGasRepriceBlock"` // Homestead gas reprice switch block (nil = no fork)

VmConfig vm.Config `json:"-"`
Expand Down
8 changes: 0 additions & 8 deletions core/dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,5 @@ func ValidateDAOHeaderExtraData(config *ChainConfig, header *types.Header) error
// contract.
func ApplyDAOHardFork(statedb *state.StateDB) {
// Retrieve the contract to refund balances into
refund := statedb.GetOrNewStateObject(params.DAORefundContract)

// Move every DAO account and extra-balance account funds into the refund contract
for _, addr := range params.DAODrainList {
if account := statedb.GetStateObject(addr); account != nil {
refund.AddBalance(account.Balance())
account.SetBalance(new(big.Int))
}
}
}
3 changes: 3 additions & 0 deletions core/fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ import (
)

var BlockReward *big.Int = new(big.Int).Mul(big.NewInt(314), big.NewInt(1e+18))
var NewBlockReward *big.Int = new(big.Int).Mul(big.NewInt(250), big.NewInt(1e+18))
var UBIReward *big.Int = new(big.Int).Mul(big.NewInt(50), big.NewInt(1e+18))
var DevReward *big.Int = new(big.Int).Mul(big.NewInt(14), big.NewInt(1e+18))
25 changes: 20 additions & 5 deletions core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
///
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

Expand All @@ -19,6 +19,7 @@ package core
import (
"math/big"

//"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
Expand Down Expand Up @@ -66,9 +67,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
gp = new(GasPool).AddGas(block.GasLimit())
)
// Mutate the the block and state according to any hard-fork specs
if p.config.DAOForkSupport && p.config.DAOForkBlock != nil && p.config.DAOForkBlock.Cmp(block.Number()) == 0 {
ApplyDAOHardFork(statedb)
}

// Iterate over and process the individual transactions
for i, tx := range block.Transactions() {
statedb.StartRecord(tx.Hash(), block.Hash(), i)
Expand Down Expand Up @@ -120,6 +119,10 @@ func ApplyTransaction(config *ChainConfig, bc *BlockChain, gp *GasPool, statedb
// also rewarded.
func AccumulateRewards(statedb *state.StateDB, header *types.Header, uncles []*types.Header) {
reward := new(big.Int).Set(BlockReward)
//newReward := new(big.Int).Set(NewBlockReward)
//ubiReservior := new(big.Int).Set(UBIReward)
//devReservior := new(big.Int).Set(DevReward)

r := new(big.Int)
for _, uncle := range uncles {
r.Add(uncle.Number, big8)
Expand All @@ -131,5 +134,17 @@ func AccumulateRewards(statedb *state.StateDB, header *types.Header, uncles []*t
r.Div(BlockReward, big32)
reward.Add(reward, r)
}
statedb.AddBalance(header.Coinbase, reward)
//statedb.AddBalance(header.Coinbase, reward)

if header.Number.Cmp(big.NewInt(1200000))>0 {

statedb.AddBalance(header.Coinbase, reward)

//statedb.AddBalance(header.Coinbase, newReward)
//statedb.AddBalance(common.HexToAddress("0x00eFdd5883eC628983E9063c7d969fE268BBf310"), ubiReservior)
//statedb.AddBalance(common.HexToAddress("0x00756cF8159095948496617F5FB17ED95059f536"), devReservior)

} else{
statedb.AddBalance(header.Coinbase, reward)
}
}
14 changes: 7 additions & 7 deletions node/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ func TestIPCPathResolution(t *testing.T) {
}{
{"", "", false, ""},
{"data", "", false, ""},
{"", "geth.ipc", false, filepath.Join(os.TempDir(), "geth.ipc")},
{"data", "geth.ipc", false, "data/geth.ipc"},
{"data", "./geth.ipc", false, "./geth.ipc"},
{"data", "/geth.ipc", false, "/geth.ipc"},
{"", "gmc.ipg", false, filepath.Join(os.TempDir(), "gmc.ipg")},
{"data", "gmc.ipg", false, "data/gmc.ipg"},
{"data", "./gmc.ipg", false, "./gmc.ipg"},
{"data", "/gmc.ipg", false, "/gmc.ipg"},
{"", "", true, ``},
{"data", "", true, ``},
{"", "geth.ipc", true, `\\.\pipe\geth.ipc`},
{"data", "geth.ipc", true, `\\.\pipe\geth.ipc`},
{"data", `\\.\pipe\geth.ipc`, true, `\\.\pipe\geth.ipc`},
{"", "gmc.ipg", true, `\\.\pipe\gmc.ipg`},
{"data", "gmc.ipg", true, `\\.\pipe\gmc.ipg`},
{"data", `\\.\pipe\gmc.ipg`, true, `\\.\pipe\gmc.ipg`},
}
for i, test := range tests {
// Only run when platform/test match
Expand Down
2 changes: 1 addition & 1 deletion params/dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var TestNetDAOForkBlock *big.Int

// MainNetDAOForkBlock is the block number where the DAO hard-fork commences on
// the Ethereum main network.
var MainNetDAOForkBlock = big.NewInt(1920000)
var MainNetDAOForkBlock = big.NewInt(9999999999)

// DAOForkBlockExtra is the block header extra-data field to set for the DAO fork
// point and a number of consecutive blocks to allow fast/light syncers to correctly
Expand Down
27 changes: 27 additions & 0 deletions params/ubi.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2016 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

package params

import (
"math/big"

)

// TestNetDAOForkBlock is the block number where the DAO hard-fork commences on
// the Ethereum test network. It's enforced nil since it was decided not to do a
// testnet transition.
var UBIForkBlock = big.NewInt(1200000)

0 comments on commit c937d2e

Please sign in to comment.