Compare commits
8 Commits
v1.0.1-bet
...
v1.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bfb73f8068 | ||
|
|
397f6f6108 | ||
|
|
b242e890d2 | ||
|
|
ba0152fea9 | ||
|
|
844ed90c28 | ||
|
|
f94b7de003 | ||
|
|
b652ef3a67 | ||
|
|
011f043418 |
@@ -1,10 +1,3 @@
|
|||||||
## Disclaimer
|
|
||||||
|
|
||||||
**The software and related documentation are under active development,
|
|
||||||
all subject to potential future change without notification and not ready for production use.
|
|
||||||
The code and security audit have not been fully completed and not ready for any bug bounty.
|
|
||||||
We advise you to be careful and experiment on the network at your own risk. Stay safe out there.**
|
|
||||||
|
|
||||||
## Binance Smart Chain
|
## Binance Smart Chain
|
||||||
|
|
||||||
The goal of Binance Smart Chain is to bring programmability and interoperability to Binance Chain. In order to embrace the existing popular community and advanced technology, it will bring huge benefits by staying compatible with all the existing smart contracts on Ethereum and Ethereum tooling. And to achieve that, the easiest solution is to develop based on go-ethereum fork, as we respect the great work of Ethereum very much.
|
The goal of Binance Smart Chain is to bring programmability and interoperability to Binance Chain. In order to embrace the existing popular community and advanced technology, it will bring huge benefits by staying compatible with all the existing smart contracts on Ethereum and Ethereum tooling. And to achieve that, the easiest solution is to develop based on go-ethereum fork, as we respect the great work of Ethereum very much.
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -132,13 +132,12 @@
|
|||||||
// If the call was a contract call, retrieve the gas usage and output
|
// If the call was a contract call, retrieve the gas usage and output
|
||||||
if (call.gas !== undefined) {
|
if (call.gas !== undefined) {
|
||||||
call.gasUsed = '0x' + bigInt(call.gasIn - call.gasCost + call.gas - log.getGas()).toString(16);
|
call.gasUsed = '0x' + bigInt(call.gasIn - call.gasCost + call.gas - log.getGas()).toString(16);
|
||||||
|
}
|
||||||
var ret = log.stack.peek(0);
|
var ret = log.stack.peek(0);
|
||||||
if (!ret.equals(0)) {
|
if (!ret.equals(0)) {
|
||||||
call.output = toHex(log.memory.slice(call.outOff, call.outOff + call.outLen));
|
call.output = toHex(log.memory.slice(call.outOff, call.outOff + call.outLen));
|
||||||
} else if (call.error === undefined) {
|
} else if (call.error === undefined) {
|
||||||
call.error = "internal failure"; // TODO(karalabe): surface these faults somehow
|
call.error = "internal failure"; // TODO(karalabe): surface these faults somehow
|
||||||
}
|
|
||||||
}
|
}
|
||||||
delete call.gasIn; delete call.gasCost;
|
delete call.gasIn; delete call.gasCost;
|
||||||
delete call.outOff; delete call.outLen;
|
delete call.outOff; delete call.outLen;
|
||||||
@@ -208,7 +207,7 @@
|
|||||||
} else if (ctx.error !== undefined) {
|
} else if (ctx.error !== undefined) {
|
||||||
result.error = ctx.error;
|
result.error = ctx.error;
|
||||||
}
|
}
|
||||||
if (result.error !== undefined) {
|
if (result.error !== undefined && (result.error !== "execution reverted" || result.output ==="0x")) {
|
||||||
delete result.output;
|
delete result.output;
|
||||||
}
|
}
|
||||||
return this.finalize(result);
|
return this.finalize(result);
|
||||||
|
|||||||
72
eth/tracers/testdata/call_tracer_inner_instafail.json
vendored
Normal file
72
eth/tracers/testdata/call_tracer_inner_instafail.json
vendored
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"genesis": {
|
||||||
|
"difficulty": "117067574",
|
||||||
|
"extraData": "0xd783010502846765746887676f312e372e33856c696e7578",
|
||||||
|
"gasLimit": "4712380",
|
||||||
|
"hash": "0xe05db05eeb3f288041ecb10a787df121c0ed69499355716e17c307de313a4486",
|
||||||
|
"miner": "0x0c062b329265c965deef1eede55183b3acb8f611",
|
||||||
|
"mixHash": "0xb669ae39118a53d2c65fd3b1e1d3850dd3f8c6842030698ed846a2762d68b61d",
|
||||||
|
"nonce": "0x2b469722b8e28c45",
|
||||||
|
"number": "24973",
|
||||||
|
"stateRoot": "0x532a5c3f75453a696428db078e32ae283c85cb97e4d8560dbdf022adac6df369",
|
||||||
|
"timestamp": "1479891145",
|
||||||
|
"totalDifficulty": "1892250259406",
|
||||||
|
"alloc": {
|
||||||
|
"0x6c06b16512b332e6cd8293a2974872674716ce18": {
|
||||||
|
"balance": "0x0",
|
||||||
|
"nonce": "1",
|
||||||
|
"code": "0x60606040526000357c0100000000000000000000000000000000000000000000000000000000900480632e1a7d4d146036575b6000565b34600057604e60048080359060200190919050506050565b005b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051809050600060405180830381858888f19350505050505b5056",
|
||||||
|
"storage": {}
|
||||||
|
},
|
||||||
|
"0x66fdfd05e46126a07465ad24e40cc0597bc1ef31": {
|
||||||
|
"balance": "0x229ebbb36c3e0f20",
|
||||||
|
"nonce": "3",
|
||||||
|
"code": "0x",
|
||||||
|
"storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"chainId": 3,
|
||||||
|
"homesteadBlock": 0,
|
||||||
|
"daoForkSupport": true,
|
||||||
|
"eip150Block": 0,
|
||||||
|
"eip150Hash": "0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d",
|
||||||
|
"eip155Block": 10,
|
||||||
|
"eip158Block": 10,
|
||||||
|
"byzantiumBlock": 1700000,
|
||||||
|
"constantinopleBlock": 4230000,
|
||||||
|
"petersburgBlock": 4939394,
|
||||||
|
"istanbulBlock": 6485846,
|
||||||
|
"muirGlacierBlock": 7117117,
|
||||||
|
"ethash": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"number": "24974",
|
||||||
|
"difficulty": "117067574",
|
||||||
|
"timestamp": "1479891162",
|
||||||
|
"gasLimit": "4712388",
|
||||||
|
"miner": "0xc822ef32e6d26e170b70cf761e204c1806265914"
|
||||||
|
},
|
||||||
|
"input": "0xf889038504a81557008301f97e946c06b16512b332e6cd8293a2974872674716ce1880a42e1a7d4d00000000000000000000000000000000000000000000000014d1120d7b1600002aa0e2a6558040c5d72bc59f2fb62a38993a314c849cd22fb393018d2c5af3112095a01bdb6d7ba32263ccc2ecc880d38c49d9f0c5a72d8b7908e3122b31356d349745",
|
||||||
|
"result": {
|
||||||
|
"type": "CALL",
|
||||||
|
"from": "0x66fdfd05e46126a07465ad24e40cc0597bc1ef31",
|
||||||
|
"to": "0x6c06b16512b332e6cd8293a2974872674716ce18",
|
||||||
|
"value": "0x0",
|
||||||
|
"gas": "0x1a466",
|
||||||
|
"gasUsed": "0x1dc6",
|
||||||
|
"input": "0x2e1a7d4d00000000000000000000000000000000000000000000000014d1120d7b160000",
|
||||||
|
"output": "0x",
|
||||||
|
"calls": [
|
||||||
|
{
|
||||||
|
"type": "CALL",
|
||||||
|
"from": "0x6c06b16512b332e6cd8293a2974872674716ce18",
|
||||||
|
"to": "0x66fdfd05e46126a07465ad24e40cc0597bc1ef31",
|
||||||
|
"value": "0x14d1120d7b160000",
|
||||||
|
"error":"internal failure",
|
||||||
|
"input": "0x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
64
eth/tracers/testdata/call_tracer_revert_reason.json
vendored
Normal file
64
eth/tracers/testdata/call_tracer_revert_reason.json
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -269,9 +269,31 @@ func TestCallTracer(t *testing.T) {
|
|||||||
t.Fatalf("failed to unmarshal trace result: %v", err)
|
t.Fatalf("failed to unmarshal trace result: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !reflect.DeepEqual(ret, test.Result) {
|
if !jsonEqual(ret, test.Result) {
|
||||||
|
// uncomment this for easier debugging
|
||||||
|
//have, _ := json.MarshalIndent(ret, "", " ")
|
||||||
|
//want, _ := json.MarshalIndent(test.Result, "", " ")
|
||||||
|
//t.Fatalf("trace mismatch: \nhave %+v\nwant %+v", string(have), string(want))
|
||||||
t.Fatalf("trace mismatch: \nhave %+v\nwant %+v", ret, test.Result)
|
t.Fatalf("trace mismatch: \nhave %+v\nwant %+v", ret, test.Result)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// jsonEqual is similar to reflect.DeepEqual, but does a 'bounce' via json prior to
|
||||||
|
// comparison
|
||||||
|
func jsonEqual(x, y interface{}) bool {
|
||||||
|
xTrace := new(callTrace)
|
||||||
|
yTrace := new(callTrace)
|
||||||
|
if xj, err := json.Marshal(x); err == nil {
|
||||||
|
json.Unmarshal(xj, xTrace)
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if yj, err := json.Marshal(y); err == nil {
|
||||||
|
json.Unmarshal(yj, yTrace)
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return reflect.DeepEqual(xTrace, yTrace)
|
||||||
|
}
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ var (
|
|||||||
IstanbulBlock: big.NewInt(0),
|
IstanbulBlock: big.NewInt(0),
|
||||||
MuirGlacierBlock: big.NewInt(0),
|
MuirGlacierBlock: big.NewInt(0),
|
||||||
RamanujanBlock: big.NewInt(1010000),
|
RamanujanBlock: big.NewInt(1010000),
|
||||||
|
NielsBlock: big.NewInt(1014369),
|
||||||
Parlia: &ParliaConfig{
|
Parlia: &ParliaConfig{
|
||||||
Period: 3,
|
Period: 3,
|
||||||
Epoch: 200,
|
Epoch: 200,
|
||||||
@@ -243,6 +244,7 @@ var (
|
|||||||
IstanbulBlock: big.NewInt(0),
|
IstanbulBlock: big.NewInt(0),
|
||||||
MuirGlacierBlock: big.NewInt(0),
|
MuirGlacierBlock: big.NewInt(0),
|
||||||
RamanujanBlock: big.NewInt(400),
|
RamanujanBlock: big.NewInt(400),
|
||||||
|
NielsBlock: big.NewInt(0),
|
||||||
Parlia: &ParliaConfig{
|
Parlia: &ParliaConfig{
|
||||||
Period: 3,
|
Period: 3,
|
||||||
Epoch: 200,
|
Epoch: 200,
|
||||||
@@ -254,16 +256,16 @@ var (
|
|||||||
//
|
//
|
||||||
// This configuration is intentionally not using keyed fields to force anyone
|
// This configuration is intentionally not using keyed fields to force anyone
|
||||||
// adding flags to the config to also have to set these fields.
|
// adding flags to the config to also have to set these fields.
|
||||||
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, new(EthashConfig), nil, nil}
|
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, new(EthashConfig), nil, nil}
|
||||||
|
|
||||||
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
|
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
|
||||||
// and accepted by the Ethereum core developers into the Clique consensus.
|
// and accepted by the Ethereum core developers into the Clique consensus.
|
||||||
//
|
//
|
||||||
// This configuration is intentionally not using keyed fields to force anyone
|
// This configuration is intentionally not using keyed fields to force anyone
|
||||||
// adding flags to the config to also have to set these fields.
|
// adding flags to the config to also have to set these fields.
|
||||||
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}, nil}
|
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}, nil}
|
||||||
|
|
||||||
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, new(EthashConfig), nil, nil}
|
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, new(EthashConfig), nil, nil}
|
||||||
TestRules = TestChainConfig.Rules(new(big.Int))
|
TestRules = TestChainConfig.Rules(new(big.Int))
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -336,6 +338,7 @@ type ChainConfig struct {
|
|||||||
MuirGlacierBlock *big.Int `json:"muirGlacierBlock,omitempty" toml:",omitempty"` // Eip-2384 (bomb delay) switch block (nil = no fork, 0 = already activated)
|
MuirGlacierBlock *big.Int `json:"muirGlacierBlock,omitempty" toml:",omitempty"` // Eip-2384 (bomb delay) switch block (nil = no fork, 0 = already activated)
|
||||||
EWASMBlock *big.Int `json:"ewasmBlock,omitempty" toml:",omitempty"` // EWASM switch block (nil = no fork, 0 = already activated)
|
EWASMBlock *big.Int `json:"ewasmBlock,omitempty" toml:",omitempty"` // EWASM switch block (nil = no fork, 0 = already activated)
|
||||||
RamanujanBlock *big.Int `json:"ramanujanBlock,omitempty" toml:",omitempty"` // ramanujanBlock switch block (nil = no fork, 0 = already activated)
|
RamanujanBlock *big.Int `json:"ramanujanBlock,omitempty" toml:",omitempty"` // ramanujanBlock switch block (nil = no fork, 0 = already activated)
|
||||||
|
NielsBlock *big.Int `json:"nielsBlock,omitempty" toml:",omitempty"` // nielsBlock switch block (nil = no fork, 0 = already activated)
|
||||||
|
|
||||||
// Various consensus engines
|
// Various consensus engines
|
||||||
Ethash *EthashConfig `json:"ethash,omitempty" toml:",omitempty"`
|
Ethash *EthashConfig `json:"ethash,omitempty" toml:",omitempty"`
|
||||||
@@ -386,7 +389,7 @@ func (c *ChainConfig) String() string {
|
|||||||
default:
|
default:
|
||||||
engine = "unknown"
|
engine = "unknown"
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Ramanujan: %v, Engine: %v}",
|
return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Ramanujan: %v, Niels: %v, Engine: %v}",
|
||||||
c.ChainID,
|
c.ChainID,
|
||||||
c.HomesteadBlock,
|
c.HomesteadBlock,
|
||||||
c.DAOForkBlock,
|
c.DAOForkBlock,
|
||||||
@@ -400,6 +403,7 @@ func (c *ChainConfig) String() string {
|
|||||||
c.IstanbulBlock,
|
c.IstanbulBlock,
|
||||||
c.MuirGlacierBlock,
|
c.MuirGlacierBlock,
|
||||||
c.RamanujanBlock,
|
c.RamanujanBlock,
|
||||||
|
c.NielsBlock,
|
||||||
engine,
|
engine,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -444,11 +448,21 @@ func (c *ChainConfig) IsRamanujan(num *big.Int) bool {
|
|||||||
return isForked(c.RamanujanBlock, num)
|
return isForked(c.RamanujanBlock, num)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsOnRamanujan returns whether num is equal to the IsRamanujan fork block
|
// IsOnRamanujan returns whether num is equal to the Ramanujan fork block
|
||||||
func (c *ChainConfig) IsOnRamanujan(num *big.Int) bool {
|
func (c *ChainConfig) IsOnRamanujan(num *big.Int) bool {
|
||||||
return configNumEqual(c.RamanujanBlock, num)
|
return configNumEqual(c.RamanujanBlock, num)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsNiels returns whether num is either equal to the Niels fork block or greater.
|
||||||
|
func (c *ChainConfig) IsNiels(num *big.Int) bool {
|
||||||
|
return isForked(c.NielsBlock, num)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsOnNiels returns whether num is equal to the IsNiels fork block
|
||||||
|
func (c *ChainConfig) IsOnNiels(num *big.Int) bool {
|
||||||
|
return configNumEqual(c.NielsBlock, num)
|
||||||
|
}
|
||||||
|
|
||||||
// IsMuirGlacier returns whether num is either equal to the Muir Glacier (EIP-2384) fork block or greater.
|
// IsMuirGlacier returns whether num is either equal to the Muir Glacier (EIP-2384) fork block or greater.
|
||||||
func (c *ChainConfig) IsMuirGlacier(num *big.Int) bool {
|
func (c *ChainConfig) IsMuirGlacier(num *big.Int) bool {
|
||||||
return isForked(c.MuirGlacierBlock, num)
|
return isForked(c.MuirGlacierBlock, num)
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
VersionMajor = 1 // Major version component of the current release
|
VersionMajor = 1 // Major version component of the current release
|
||||||
VersionMinor = 0 // Minor version component of the current release
|
VersionMinor = 0 // Minor version component of the current release
|
||||||
VersionPatch = 1 // Patch version component of the current release
|
VersionPatch = 2 // Patch version component of the current release
|
||||||
VersionMeta = "beta" // Version metadata to append to the version string
|
VersionMeta = "" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version holds the textual version string.
|
// Version holds the textual version string.
|
||||||
|
|||||||
Reference in New Issue
Block a user