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

partly rollback PlatON #2200 #2212

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
9 changes: 5 additions & 4 deletions accounts/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ import (
"fmt"
"math/big"

"golang.org/x/crypto/sha3"

ethereum "github.com/PlatONnetwork/PlatON-Go"
"github.com/PlatONnetwork/PlatON-Go/common"
"github.com/PlatONnetwork/PlatON-Go/core/types"
"github.com/PlatONnetwork/PlatON-Go/event"
"golang.org/x/crypto/sha3"
)

// Account represents an Ethereum account located at a specific location defined
Expand Down Expand Up @@ -178,7 +177,8 @@ type Backend interface {
// safely used to calculate a signature from.
//
// The hash is calculated as
// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
//
// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
//
// This gives context to the signed message and prevents signing of transactions.
func TextHash(data []byte) []byte {
Expand All @@ -190,7 +190,8 @@ func TextHash(data []byte) []byte {
// safely used to calculate a signature from.
//
// The hash is calculated as
// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
//
// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
//
// This gives context to the signed message and prevents signing of transactions.
func TextAndHash(data []byte) ([]byte, string) {
Expand Down
2 changes: 1 addition & 1 deletion accounts/hd.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var LegacyLedgerBaseDerivationPath = DerivationPath{0x80000000 + 44, 0x80000000
// The BIP-32 spec https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
// defines derivation paths to be of the form:
//
// m / purpose' / coin_type' / account' / change / address_index
// m / purpose' / coin_type' / account' / change / address_index
//
// The BIP-44 spec https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
// defines that the `purpose` be 44' (or 0x8000002C) for crypto currencies, and
Expand Down
7 changes: 3 additions & 4 deletions accounts/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@ func (u *URL) UnmarshalJSON(input []byte) error {

// Cmp compares x and y and returns:
//
// -1 if x < y
// 0 if x == y
// +1 if x > y
//
// -1 if x < y
// 0 if x == y
// +1 if x > y
func (u URL) Cmp(url URL) int {
if u.Scheme == url.Scheme {
return strings.Compare(u.Path, url.Path)
Expand Down
9 changes: 3 additions & 6 deletions cmd/ctool/core/bytes_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with PlatON-Go. If not, see <http://www.gnu.org/licenses/>.


package core

import (
Expand All @@ -26,9 +25,8 @@ import (
)

func Int32ToBytes(n int32) []byte {
tmp := int32(n)
bytesBuffer := bytes.NewBuffer([]byte{})
binary.Write(bytesBuffer, binary.BigEndian, tmp)
binary.Write(bytesBuffer, binary.BigEndian, n)
return bytesBuffer.Bytes()
}

Expand All @@ -40,17 +38,16 @@ func BytesToInt32(b []byte) int32 {
}

func Int64ToBytes(n int64) []byte {
tmp := int64(n)
bytesBuffer := bytes.NewBuffer([]byte{})
binary.Write(bytesBuffer, binary.BigEndian, tmp)
binary.Write(bytesBuffer, binary.BigEndian, n)
return bytesBuffer.Bytes()
}

func BytesToInt64(b []byte) int64 {
bytesBuffer := bytes.NewBuffer(b)
var tmp int64
binary.Read(bytesBuffer, binary.BigEndian, &tmp)
return int64(tmp)
return tmp
}

func Float32ToBytes(float float32) []byte {
Expand Down
2 changes: 1 addition & 1 deletion cmd/keytool/genkeypair.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type outputGenkeypair struct {
PublicKey string
}

var commandGenkeypair = cli.Command{
var commandGenkeypair = &cli.Command{
Name: "genkeypair",
Usage: "generate new private key pair",
ArgsUsage: "[ ]",
Expand Down
6 changes: 5 additions & 1 deletion cmd/keytool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ package main

import (
"fmt"
"github.com/PlatONnetwork/PlatON-Go/internal/flags"
"os"

"github.com/PlatONnetwork/PlatON-Go/internal/flags"

"github.com/urfave/cli/v2"
)

Expand All @@ -42,6 +43,9 @@ func init() {
commandChangePassphrase,
commandSignMessage,
commandVerifyMessage,
commandGenkeypair,
commandGenblskeypair,
commandAddressHexToBech32,
}
}

Expand Down
5 changes: 2 additions & 3 deletions cmd/p2psim/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,17 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/PlatONnetwork/PlatON-Go/internal/flags"
"io"
"os"
"strings"
"text/tabwriter"

"github.com/PlatONnetwork/PlatON-Go/p2p/enode"

"github.com/urfave/cli/v2"

"github.com/PlatONnetwork/PlatON-Go/crypto"
"github.com/PlatONnetwork/PlatON-Go/internal/flags"
"github.com/PlatONnetwork/PlatON-Go/p2p"
"github.com/PlatONnetwork/PlatON-Go/p2p/enode"
"github.com/PlatONnetwork/PlatON-Go/p2p/simulations"
"github.com/PlatONnetwork/PlatON-Go/p2p/simulations/adapters"
"github.com/PlatONnetwork/PlatON-Go/rpc"
Expand Down
25 changes: 10 additions & 15 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,18 @@
package utils

import (
"math"
"math/big"
"os"
"path/filepath"
godebug "runtime/debug"
"strconv"
"strings"
"time"

"crypto/ecdsa"
"fmt"

"github.com/PlatONnetwork/PlatON-Go/accounts"
"github.com/PlatONnetwork/PlatON-Go/accounts/keystore"
"github.com/PlatONnetwork/PlatON-Go/common"
Expand Down Expand Up @@ -48,7 +58,6 @@ import (
"github.com/PlatONnetwork/PlatON-Go/metrics"
"github.com/PlatONnetwork/PlatON-Go/metrics/exp"
"github.com/PlatONnetwork/PlatON-Go/metrics/influxdb"
"github.com/PlatONnetwork/PlatON-Go/miner"
"github.com/PlatONnetwork/PlatON-Go/node"
"github.com/PlatONnetwork/PlatON-Go/p2p"
"github.com/PlatONnetwork/PlatON-Go/p2p/enode"
Expand All @@ -57,14 +66,6 @@ import (
"github.com/PlatONnetwork/PlatON-Go/params"
"github.com/PlatONnetwork/PlatON-Go/rpc"
gopsutil "github.com/shirou/gopsutil/mem"
"math"
"math/big"
"os"
"path/filepath"
godebug "runtime/debug"
"strconv"
"strings"
"time"

"github.com/urfave/cli/v2"
)
Expand Down Expand Up @@ -1334,12 +1335,6 @@ func setTxPool(ctx *cli.Context, cfg *core.TxPoolConfig) {
}
}

func setMiner(ctx *cli.Context, cfg *miner.Config) {
if ctx.IsSet(MinerGasPriceFlag.Name) {
cfg.GasPrice = flags.GlobalBig(ctx, MinerGasPriceFlag.Name)
}
}

// 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
Expand Down
1 change: 1 addition & 0 deletions cmd/utils/flags_legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package utils

import (
"fmt"

"github.com/PlatONnetwork/PlatON-Go/internal/flags"
"github.com/urfave/cli/v2"
)
Expand Down
2 changes: 1 addition & 1 deletion eth/api_tx_maker.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func (txg *TxGenAPI) DeployContracts(prikey string, configPath string) error {
if err != nil {
return err
}
if err := txg.eth.TxPool().AddRemotes([]*types.Transaction{newTx}); err != nil {
if err := txg.eth.TxPool().AddRemotes([]*types.Transaction{newTx}); err[0] != nil {
return fmt.Errorf("DeployContracts fail,err:%v,input:%v", err, config.Type)
}
config.DeployTxHash = newTx.Hash().String()
Expand Down
Loading