Commit 2f5c062b authored by QM's avatar QM

Merge remote-tracking branch 'upstream/master' into bridgevmxgo_bsc_1201

parents 40754db8 a94f7b0c
...@@ -33,6 +33,7 @@ jobs: ...@@ -33,6 +33,7 @@ jobs:
make largefile-check make largefile-check
make checkgofmt && make fmt_go make checkgofmt && make fmt_go
make linter make linter
make
unit-test: unit-test:
name: unit-test name: unit-test
......
...@@ -204,7 +204,7 @@ protobuf: ## Generate protbuf file of types package ...@@ -204,7 +204,7 @@ protobuf: ## Generate protbuf file of types package
@find ./plugin/dapp -maxdepth 2 -type d -name proto -exec make -C {} \; @find ./plugin/dapp -maxdepth 2 -type d -name proto -exec make -C {} \;
depends: ## Generate depends file of types package depends: ## Generate depends file of types package
@find ./plugin/dapp -maxdepth 2 -type d -name cmd -exec make -C {} OUT="$(MKDIR)build/ci" FLAG= \; @find ./plugin/dapp -maxdepth 2 -print -type d -name cmd -exec make -C {} OUT="$(MKDIR)build/ci" FLAG= \;
help: ## Display this help screen help: ## Display this help screen
......
...@@ -17,13 +17,13 @@ require ( ...@@ -17,13 +17,13 @@ require (
github.com/coreos/etcd v3.3.15+incompatible github.com/coreos/etcd v3.3.15+incompatible
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
github.com/davecgh/go-spew v1.1.1 github.com/davecgh/go-spew v1.1.1
github.com/ethereum/go-ethereum v1.10.0 github.com/ethereum/go-ethereum v1.10.13
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/protobuf v1.5.2 github.com/golang/protobuf v1.5.2
github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 github.com/golang/snappy v0.0.4
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
github.com/holiman/uint256 v1.1.1 github.com/holiman/uint256 v1.2.0
github.com/huin/goupnp v1.0.2 github.com/huin/goupnp v1.0.2
github.com/jackpal/go-nat-pmp v1.0.2 github.com/jackpal/go-nat-pmp v1.0.2
github.com/mr-tron/base58 v1.2.0 github.com/mr-tron/base58 v1.2.0
......
This diff is collapsed.
...@@ -4,8 +4,8 @@ strpwd=$(pwd) ...@@ -4,8 +4,8 @@ strpwd=$(pwd)
strcmd=${strpwd##*dapp/} strcmd=${strpwd##*dapp/}
strapp=${strcmd%/cmd*} strapp=${strcmd%/cmd*}
OUT_DIR="${1}/system/$strapp" OUT_DIR="${1}/$strapp"
#FLAG=$2 #FLAG=$2
mkdir -p "${OUT_DIR}" mkdir -p "${OUT_DIR}"
cp ./build/* "${OUT_DIR}" #cp ./build/* "${OUT_DIR}"
...@@ -25,7 +25,7 @@ func PrepareTestEnv() (*ethinterface.SimExtend, *ethtxs.DeployPara) { ...@@ -25,7 +25,7 @@ func PrepareTestEnv() (*ethinterface.SimExtend, *ethtxs.DeployPara) {
alloc := make(core.GenesisAlloc) alloc := make(core.GenesisAlloc)
genesisAddr := crypto.PubkeyToAddress(genesiskey.PublicKey) genesisAddr := crypto.PubkeyToAddress(genesiskey.PublicKey)
genesisAccount := core.GenesisAccount{ genesisAccount := core.GenesisAccount{
Balance: big.NewInt(10000000000 * 10000), Balance: big.NewInt(1000000000000 * 10000),
PrivateKey: crypto.FromECDSA(genesiskey), PrivateKey: crypto.FromECDSA(genesiskey),
} }
alloc[genesisAddr] = genesisAccount alloc[genesisAddr] = genesisAccount
...@@ -39,7 +39,7 @@ func PrepareTestEnv() (*ethinterface.SimExtend, *ethtxs.DeployPara) { ...@@ -39,7 +39,7 @@ func PrepareTestEnv() (*ethinterface.SimExtend, *ethtxs.DeployPara) {
ValidatorPriKey = append(ValidatorPriKey, key) ValidatorPriKey = append(ValidatorPriKey, key)
account := core.GenesisAccount{ account := core.GenesisAccount{
Balance: big.NewInt(100000000 * 100), Balance: big.NewInt(1000000000000 * 10000),
PrivateKey: crypto.FromECDSA(key), PrivateKey: crypto.FromECDSA(key),
} }
alloc[addr] = account alloc[addr] = account
......
...@@ -209,7 +209,7 @@ func Test_CreateBridgeToken(t *testing.T) { ...@@ -209,7 +209,7 @@ func Test_CreateBridgeToken(t *testing.T) {
balance, err := ethRelayer.GetBalance("", para.InitValidators[0].String()) balance, err := ethRelayer.GetBalance("", para.InitValidators[0].String())
require.Nil(t, err) require.Nil(t, err)
assert.Equal(t, balance, "10000000000") assert.Equal(t, balance, "10000000000000000")
tokenAddrbty, err := ethRelayer.CreateBridgeToken("BTY") tokenAddrbty, err := ethRelayer.CreateBridgeToken("BTY")
require.Nil(t, err) require.Nil(t, err)
......
...@@ -232,7 +232,7 @@ func PrepareTestEnv() (*ethinterface.SimExtend, *DeployPara) { ...@@ -232,7 +232,7 @@ func PrepareTestEnv() (*ethinterface.SimExtend, *DeployPara) {
alloc := make(core.GenesisAlloc) alloc := make(core.GenesisAlloc)
genesisAddr := crypto.PubkeyToAddress(genesiskey.PublicKey) genesisAddr := crypto.PubkeyToAddress(genesiskey.PublicKey)
genesisAccount := core.GenesisAccount{ genesisAccount := core.GenesisAccount{
Balance: big.NewInt(10000000000 * 10000), Balance: big.NewInt(1000000000000 * 10000),
PrivateKey: crypto.FromECDSA(genesiskey), PrivateKey: crypto.FromECDSA(genesiskey),
} }
alloc[genesisAddr] = genesisAccount alloc[genesisAddr] = genesisAccount
...@@ -246,7 +246,7 @@ func PrepareTestEnv() (*ethinterface.SimExtend, *DeployPara) { ...@@ -246,7 +246,7 @@ func PrepareTestEnv() (*ethinterface.SimExtend, *DeployPara) {
ValidatorPriKey = append(ValidatorPriKey, key) ValidatorPriKey = append(ValidatorPriKey, key)
account := core.GenesisAccount{ account := core.GenesisAccount{
Balance: big.NewInt(100000000 * 100), Balance: big.NewInt(1000000000000 * 10000),
PrivateKey: crypto.FromECDSA(key), PrivateKey: crypto.FromECDSA(key),
} }
alloc[addr] = account alloc[addr] = account
......
...@@ -49,7 +49,7 @@ func Test_GetAddressFromBridgeRegistry(t *testing.T) { ...@@ -49,7 +49,7 @@ func Test_GetAddressFromBridgeRegistry(t *testing.T) {
alloc := make(core.GenesisAlloc) alloc := make(core.GenesisAlloc)
genesisAddr := crypto.PubkeyToAddress(genesiskey.PublicKey) genesisAddr := crypto.PubkeyToAddress(genesiskey.PublicKey)
genesisAccount := core.GenesisAccount{ genesisAccount := core.GenesisAccount{
Balance: big.NewInt(10000000000 * 10000), Balance: big.NewInt(1000000000000 * 10000),
PrivateKey: crypto.FromECDSA(genesiskey), PrivateKey: crypto.FromECDSA(genesiskey),
} }
alloc[genesisAddr] = genesisAccount alloc[genesisAddr] = genesisAccount
...@@ -138,7 +138,7 @@ func PrepareTestEnvironment(deployerPrivateKey string, ethValidatorAddrKeys []st ...@@ -138,7 +138,7 @@ func PrepareTestEnvironment(deployerPrivateKey string, ethValidatorAddrKeys []st
alloc := make(core.GenesisAlloc) alloc := make(core.GenesisAlloc)
genesisAddr := crypto.PubkeyToAddress(genesiskey.PublicKey) genesisAddr := crypto.PubkeyToAddress(genesiskey.PublicKey)
genesisAccount := core.GenesisAccount{ genesisAccount := core.GenesisAccount{
Balance: big.NewInt(10000000000 * 10000), Balance: big.NewInt(1000000000000 * 10000),
PrivateKey: crypto.FromECDSA(genesiskey), PrivateKey: crypto.FromECDSA(genesiskey),
} }
alloc[genesisAddr] = genesisAccount alloc[genesisAddr] = genesisAccount
...@@ -152,7 +152,7 @@ func PrepareTestEnvironment(deployerPrivateKey string, ethValidatorAddrKeys []st ...@@ -152,7 +152,7 @@ func PrepareTestEnvironment(deployerPrivateKey string, ethValidatorAddrKeys []st
ValidatorPriKey = append(ValidatorPriKey, key) ValidatorPriKey = append(ValidatorPriKey, key)
account := core.GenesisAccount{ account := core.GenesisAccount{
Balance: big.NewInt(100000000 * 100), Balance: big.NewInt(1000000000000 * 10000),
PrivateKey: crypto.FromECDSA(key), PrivateKey: crypto.FromECDSA(key),
} }
alloc[addr] = account alloc[addr] = account
......
...@@ -90,7 +90,7 @@ func TestMethodPack(t *testing.T) { ...@@ -90,7 +90,7 @@ func TestMethodPack(t *testing.T) {
t.Errorf("expected %x got %x", sig, packed) t.Errorf("expected %x got %x", sig, packed)
} }
var addrA, addrB = common.Uint256ToAddress(uint256.NewInt().SetUint64(1)), common.Uint256ToAddress(uint256.NewInt().SetUint64(1)) var addrA, addrB = common.Uint256ToAddress(uint256.NewInt(1)), common.Uint256ToAddress(uint256.NewInt(1))
sig = abi.Methods["sliceAddress"].ID sig = abi.Methods["sliceAddress"].ID
sig = append(sig, common.LeftPadBytes([]byte{32}, 32)...) sig = append(sig, common.LeftPadBytes([]byte{32}, 32)...)
sig = append(sig, common.LeftPadBytes([]byte{2}, 32)...) sig = append(sig, common.LeftPadBytes([]byte{2}, 32)...)
...@@ -105,7 +105,7 @@ func TestMethodPack(t *testing.T) { ...@@ -105,7 +105,7 @@ func TestMethodPack(t *testing.T) {
t.Errorf("expected %x got %x", sig, packed) t.Errorf("expected %x got %x", sig, packed)
} }
var addrC, addrD = common.Uint256ToAddress(uint256.NewInt().SetUint64(3)), common.Uint256ToAddress(uint256.NewInt().SetUint64(4)) var addrC, addrD = common.Uint256ToAddress(uint256.NewInt(3)), common.Uint256ToAddress(uint256.NewInt(4))
sig = abi.Methods["sliceMultiAddress"].ID sig = abi.Methods["sliceMultiAddress"].ID
sig = append(sig, common.LeftPadBytes([]byte{64}, 32)...) sig = append(sig, common.LeftPadBytes([]byte{64}, 32)...)
sig = append(sig, common.LeftPadBytes([]byte{160}, 32)...) sig = append(sig, common.LeftPadBytes([]byte{160}, 32)...)
......
...@@ -422,7 +422,7 @@ func opExtCodeHash(pc *uint64, evm *EVM, callContext *callCtx) ([]byte, error) { ...@@ -422,7 +422,7 @@ func opExtCodeHash(pc *uint64, evm *EVM, callContext *callCtx) ([]byte, error) {
// 获取当前区块的GasPrice // 获取当前区块的GasPrice
func opGasprice(pc *uint64, evm *EVM, callContext *callCtx) ([]byte, error) { func opGasprice(pc *uint64, evm *EVM, callContext *callCtx) ([]byte, error) {
v := uint256.NewInt().SetUint64(uint64(evm.GasPrice)) v := uint256.NewInt(uint64(evm.GasPrice))
callContext.stack.push(v) callContext.stack.push(v)
return nil, nil return nil, nil
} }
...@@ -954,7 +954,7 @@ func makeSwap(size int64) executionFunc { ...@@ -954,7 +954,7 @@ func makeSwap(size int64) executionFunc {
// 获取自身余额 // 获取自身余额
func opSelfBalance(pc *uint64, evm *EVM, callContext *callCtx) ([]byte, error) { func opSelfBalance(pc *uint64, evm *EVM, callContext *callCtx) ([]byte, error) {
balance := uint256.NewInt().SetUint64(evm.StateDB.GetBalance(callContext.contract.Address().String())) balance := uint256.NewInt(evm.StateDB.GetBalance(callContext.contract.Address().String()))
callContext.stack.push(balance) callContext.stack.push(balance)
return nil, nil return nil, nil
} }
......
...@@ -574,11 +574,11 @@ func BenchmarkOpSHA3(bench *testing.B) { ...@@ -574,11 +574,11 @@ func BenchmarkOpSHA3(bench *testing.B) {
//env.interpreter = evmInterpreter //env.interpreter = evmInterpreter
mem.Resize(32) mem.Resize(32)
pc := uint64(0) pc := uint64(0)
start := uint256.NewInt() start := uint256.NewInt(0)
bench.ResetTimer() bench.ResetTimer()
for i := 0; i < bench.N; i++ { for i := 0; i < bench.N; i++ {
stack.pushN(*uint256.NewInt().SetUint64(32), *start) stack.pushN(*uint256.NewInt(32), *start)
opSha3(&pc, env, &callCtx{mem, stack, nil}) opSha3(&pc, env, &callCtx{mem, stack, nil})
} }
} }
......
...@@ -8,4 +8,4 @@ OUT_DIR="${1}/$strapp" ...@@ -8,4 +8,4 @@ OUT_DIR="${1}/$strapp"
#FLAG=$2 #FLAG=$2
mkdir -p "${OUT_DIR}" mkdir -p "${OUT_DIR}"
cp ./build/* "${OUT_DIR}" #cp ./build/* "${OUT_DIR}"
...@@ -22,7 +22,7 @@ func PrepareTestEnv() (*ethinterface.SimExtend, *ethtxs.DeployPara) { ...@@ -22,7 +22,7 @@ func PrepareTestEnv() (*ethinterface.SimExtend, *ethtxs.DeployPara) {
alloc := make(core.GenesisAlloc) alloc := make(core.GenesisAlloc)
genesisAddr := crypto.PubkeyToAddress(genesiskey.PublicKey) genesisAddr := crypto.PubkeyToAddress(genesiskey.PublicKey)
genesisAccount := core.GenesisAccount{ genesisAccount := core.GenesisAccount{
Balance: big.NewInt(10000000000 * 10000), Balance: big.NewInt(1000000000000 * 10000),
PrivateKey: crypto.FromECDSA(genesiskey), PrivateKey: crypto.FromECDSA(genesiskey),
} }
alloc[genesisAddr] = genesisAccount alloc[genesisAddr] = genesisAccount
...@@ -36,7 +36,7 @@ func PrepareTestEnv() (*ethinterface.SimExtend, *ethtxs.DeployPara) { ...@@ -36,7 +36,7 @@ func PrepareTestEnv() (*ethinterface.SimExtend, *ethtxs.DeployPara) {
ValidatorPriKey = append(ValidatorPriKey, key) ValidatorPriKey = append(ValidatorPriKey, key)
account := core.GenesisAccount{ account := core.GenesisAccount{
Balance: big.NewInt(100000000 * 100), Balance: big.NewInt(1000000000000 * 10000),
PrivateKey: crypto.FromECDSA(key), PrivateKey: crypto.FromECDSA(key),
} }
alloc[addr] = account alloc[addr] = account
...@@ -64,7 +64,7 @@ func PrepareTestEnvironment(deployerPrivateKey string, ethValidatorAddrKeys []st ...@@ -64,7 +64,7 @@ func PrepareTestEnvironment(deployerPrivateKey string, ethValidatorAddrKeys []st
alloc := make(core.GenesisAlloc) alloc := make(core.GenesisAlloc)
genesisAddr := crypto.PubkeyToAddress(genesiskey.PublicKey) genesisAddr := crypto.PubkeyToAddress(genesiskey.PublicKey)
genesisAccount := core.GenesisAccount{ genesisAccount := core.GenesisAccount{
Balance: big.NewInt(10000000000 * 10000), Balance: big.NewInt(1000000000000 * 10000),
PrivateKey: crypto.FromECDSA(genesiskey), PrivateKey: crypto.FromECDSA(genesiskey),
} }
alloc[genesisAddr] = genesisAccount alloc[genesisAddr] = genesisAccount
...@@ -78,7 +78,7 @@ func PrepareTestEnvironment(deployerPrivateKey string, ethValidatorAddrKeys []st ...@@ -78,7 +78,7 @@ func PrepareTestEnvironment(deployerPrivateKey string, ethValidatorAddrKeys []st
ValidatorPriKey = append(ValidatorPriKey, key) ValidatorPriKey = append(ValidatorPriKey, key)
account := core.GenesisAccount{ account := core.GenesisAccount{
Balance: big.NewInt(100000000 * 100), Balance: big.NewInt(1000000000000 * 10000),
PrivateKey: crypto.FromECDSA(key), PrivateKey: crypto.FromECDSA(key),
} }
alloc[addr] = account alloc[addr] = account
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment