mirror of https://github.com/ethereum/go-ethereum
parent
a3fd415c0f
commit
8698fbabf6
@ -0,0 +1,91 @@ |
||||
package main |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"fmt" |
||||
"io/ioutil" |
||||
"reflect" |
||||
"strings" |
||||
"testing" |
||||
|
||||
"github.com/davecgh/go-spew/spew" |
||||
"github.com/ethereum/go-ethereum/core" |
||||
) |
||||
|
||||
func TestConverter_AlethStureby(t *testing.T) { |
||||
blob, err := ioutil.ReadFile("testdata/stureby_geth.json") |
||||
if err != nil { |
||||
t.Fatalf("could not read file: %v", err) |
||||
} |
||||
var genesis core.Genesis |
||||
if err := json.Unmarshal(blob, &genesis); err != nil { |
||||
t.Fatalf("failed parsing genesis: %v", err) |
||||
} |
||||
spec, err := newAlethGenesisSpec("stureby", &genesis) |
||||
if err != nil { |
||||
t.Fatalf("failed creating chainspec: %v", err) |
||||
} |
||||
|
||||
expBlob, err := ioutil.ReadFile("testdata/stureby_aleth.json") |
||||
if err != nil { |
||||
t.Fatalf("could not read file: %v", err) |
||||
} |
||||
expspec := &alethGenesisSpec{} |
||||
if err := json.Unmarshal(expBlob, expspec); err != nil { |
||||
t.Fatalf("failed parsing genesis: %v", err) |
||||
} |
||||
if !reflect.DeepEqual(expspec, spec) { |
||||
t.Errorf("chainspec mismatch") |
||||
c := spew.ConfigState{ |
||||
DisablePointerAddresses: true, |
||||
SortKeys: true, |
||||
} |
||||
exp := strings.Split(c.Sdump(expspec), "\n") |
||||
got := strings.Split(c.Sdump(spec), "\n") |
||||
for i := 0; i < len(exp) && i < len(got); i++ { |
||||
if exp[i] != got[i] { |
||||
fmt.Printf("got: %v\nexp: %v\n", exp[i], got[i]) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
func TestConverter_ParityStureby(t *testing.T) { |
||||
blob, err := ioutil.ReadFile("testdata/stureby_geth.json") |
||||
if err != nil { |
||||
t.Fatalf("could not read file: %v", err) |
||||
} |
||||
var genesis core.Genesis |
||||
if err := json.Unmarshal(blob, &genesis); err != nil { |
||||
t.Fatalf("failed parsing genesis: %v", err) |
||||
} |
||||
spec, err := newParityChainSpec("Stureby", &genesis, []string{}) |
||||
if err != nil { |
||||
t.Fatalf("failed creating chainspec: %v", err) |
||||
} |
||||
|
||||
expBlob, err := ioutil.ReadFile("testdata/stureby_parity.json") |
||||
if err != nil { |
||||
t.Fatalf("could not read file: %v", err) |
||||
} |
||||
expspec := &parityChainSpec{} |
||||
if err := json.Unmarshal(expBlob, expspec); err != nil { |
||||
t.Fatalf("failed parsing genesis: %v", err) |
||||
} |
||||
expspec.Nodes = []string{} |
||||
|
||||
if !reflect.DeepEqual(expspec, spec) { |
||||
t.Errorf("chainspec mismatch") |
||||
c := spew.ConfigState{ |
||||
DisablePointerAddresses: true, |
||||
SortKeys: true, |
||||
} |
||||
exp := strings.Split(c.Sdump(expspec), "\n") |
||||
got := strings.Split(c.Sdump(spec), "\n") |
||||
for i := 0; i < len(exp) && i < len(got); i++ { |
||||
if exp[i] != got[i] { |
||||
fmt.Printf("got: %v\nexp: %v\n", exp[i], got[i]) |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,112 @@ |
||||
{ |
||||
"sealEngine":"Ethash", |
||||
"params":{ |
||||
"accountStartNonce":"0x00", |
||||
"maximumExtraDataSize":"0x20", |
||||
"homesteadForkBlock":"0x2710", |
||||
"daoHardforkBlock":"0x00", |
||||
"EIP150ForkBlock":"0x3a98", |
||||
"EIP158ForkBlock":"0x59d8", |
||||
"byzantiumForkBlock":"0x7530", |
||||
"constantinopleForkBlock":"0x9c40", |
||||
"minGasLimit":"0x1388", |
||||
"maxGasLimit":"0x7fffffffffffffff", |
||||
"tieBreakingGas":false, |
||||
"gasLimitBoundDivisor":"0x0400", |
||||
"minimumDifficulty":"0x20000", |
||||
"difficultyBoundDivisor":"0x0800", |
||||
"durationLimit":"0x0d", |
||||
"blockReward":"0x4563918244F40000", |
||||
"networkID":"0x4cb2e", |
||||
"chainID":"0x4cb2e", |
||||
"allowFutureBlocks":false |
||||
}, |
||||
"genesis":{ |
||||
"nonce":"0x0000000000000000", |
||||
"difficulty":"0x20000", |
||||
"mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000", |
||||
"author":"0x0000000000000000000000000000000000000000", |
||||
"timestamp":"0x59a4e76d", |
||||
"parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000", |
||||
"extraData":"0x0000000000000000000000000000000000000000000000000000000b4dc0ffee", |
||||
"gasLimit":"0x47b760" |
||||
}, |
||||
"accounts":{ |
||||
"0000000000000000000000000000000000000001":{ |
||||
"balance":"1", |
||||
"precompiled":{ |
||||
"name":"ecrecover", |
||||
"linear":{ |
||||
"base":3000, |
||||
"word":0 |
||||
} |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000002":{ |
||||
"balance":"1", |
||||
"precompiled":{ |
||||
"name":"sha256", |
||||
"linear":{ |
||||
"base":60, |
||||
"word":12 |
||||
} |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000003":{ |
||||
"balance":"1", |
||||
"precompiled":{ |
||||
"name":"ripemd160", |
||||
"linear":{ |
||||
"base":600, |
||||
"word":120 |
||||
} |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000004":{ |
||||
"balance":"1", |
||||
"precompiled":{ |
||||
"name":"identity", |
||||
"linear":{ |
||||
"base":15, |
||||
"word":3 |
||||
} |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000005":{ |
||||
"balance":"1", |
||||
"precompiled":{ |
||||
"name":"modexp", |
||||
"startingBlock":"0x7530" |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000006":{ |
||||
"balance":"1", |
||||
"precompiled":{ |
||||
"name":"alt_bn128_G1_add", |
||||
"startingBlock":"0x7530", |
||||
"linear":{ |
||||
"base":500, |
||||
"word":0 |
||||
} |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000007":{ |
||||
"balance":"1", |
||||
"precompiled":{ |
||||
"name":"alt_bn128_G1_mul", |
||||
"startingBlock":"0x7530", |
||||
"linear":{ |
||||
"base":40000, |
||||
"word":0 |
||||
} |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000008":{ |
||||
"balance":"1", |
||||
"precompiled":{ |
||||
"name":"alt_bn128_pairing_product", |
||||
"startingBlock":"0x7530" |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,47 @@ |
||||
{ |
||||
"config": { |
||||
"ethash":{}, |
||||
"chainId": 314158, |
||||
"homesteadBlock": 10000, |
||||
"eip150Block": 15000, |
||||
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", |
||||
"eip155Block": 23000, |
||||
"eip158Block": 23000, |
||||
"byzantiumBlock": 30000, |
||||
"constantinopleBlock": 40000 |
||||
}, |
||||
"nonce": "0x0", |
||||
"timestamp": "0x59a4e76d", |
||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", |
||||
"extraData": "0x0000000000000000000000000000000000000000000000000000000b4dc0ffee", |
||||
"gasLimit": "0x47b760", |
||||
"difficulty": "0x20000", |
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", |
||||
"coinbase": "0x0000000000000000000000000000000000000000", |
||||
"alloc": { |
||||
"0000000000000000000000000000000000000001": { |
||||
"balance": "0x01" |
||||
}, |
||||
"0000000000000000000000000000000000000002": { |
||||
"balance": "0x01" |
||||
}, |
||||
"0000000000000000000000000000000000000003": { |
||||
"balance": "0x01" |
||||
}, |
||||
"0000000000000000000000000000000000000004": { |
||||
"balance": "0x01" |
||||
}, |
||||
"0000000000000000000000000000000000000005": { |
||||
"balance": "0x01" |
||||
}, |
||||
"0000000000000000000000000000000000000006": { |
||||
"balance": "0x01" |
||||
}, |
||||
"0000000000000000000000000000000000000007": { |
||||
"balance": "0x01" |
||||
}, |
||||
"0000000000000000000000000000000000000008": { |
||||
"balance": "0x01" |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,181 @@ |
||||
{ |
||||
"name":"Stureby", |
||||
"dataDir":"stureby", |
||||
"engine":{ |
||||
"Ethash":{ |
||||
"params":{ |
||||
"minimumDifficulty":"0x20000", |
||||
"difficultyBoundDivisor":"0x800", |
||||
"durationLimit":"0xd", |
||||
"blockReward":{ |
||||
"0x0":"0x4563918244f40000", |
||||
"0x7530":"0x29a2241af62c0000", |
||||
"0x9c40":"0x1bc16d674ec80000" |
||||
}, |
||||
"homesteadTransition":"0x2710", |
||||
"eip100bTransition":"0x7530", |
||||
"difficultyBombDelays":{ |
||||
"0x7530":"0x2dc6c0", |
||||
"0x9c40":"0x1e8480" |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"params":{ |
||||
"accountStartNonce":"0x0", |
||||
"maximumExtraDataSize":"0x20", |
||||
"gasLimitBoundDivisor":"0x400", |
||||
"minGasLimit":"0x1388", |
||||
"networkID":"0x4cb2e", |
||||
"chainID":"0x4cb2e", |
||||
"maxCodeSize":"0x6000", |
||||
"maxCodeSizeTransition":"0x0", |
||||
"eip98Transition": "0x7fffffffffffffff", |
||||
"eip150Transition":"0x3a98", |
||||
"eip160Transition":"0x59d8", |
||||
"eip161abcTransition":"0x59d8", |
||||
"eip161dTransition":"0x59d8", |
||||
"eip155Transition":"0x59d8", |
||||
"eip140Transition":"0x7530", |
||||
"eip211Transition":"0x7530", |
||||
"eip214Transition":"0x7530", |
||||
"eip658Transition":"0x7530", |
||||
"eip145Transition":"0x9c40", |
||||
"eip1014Transition":"0x9c40", |
||||
"eip1052Transition":"0x9c40", |
||||
"eip1283Transition":"0x9c40" |
||||
}, |
||||
"genesis":{ |
||||
"seal":{ |
||||
"ethereum":{ |
||||
"nonce":"0x0000000000000000", |
||||
"mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000" |
||||
} |
||||
}, |
||||
"difficulty":"0x20000", |
||||
"author":"0x0000000000000000000000000000000000000000", |
||||
"timestamp":"0x59a4e76d", |
||||
"parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000", |
||||
"extraData":"0x0000000000000000000000000000000000000000000000000000000b4dc0ffee", |
||||
"gasLimit":"0x47b760" |
||||
}, |
||||
"nodes":[ |
||||
"enode://dfa7aca3f5b635fbfe7d0b20575f25e40d9e27b4bfbb3cf74364a42023ad9f25c1a4383bcc8cced86ee511a7d03415345a4df05be37f1dff040e4c780699f1c0@168.61.153.255:31303", |
||||
"enode://ef441b20dd70aeabf0eac35c3b8a2854e5ce04db0e30be9152ea9fd129359dcbb3f803993303ff5781c755dfd7223f3fe43505f583cccb740949407677412ba9@40.74.91.252:31303", |
||||
"enode://953b5ea1c8987cf46008232a0160324fd00d41320ecf00e23af86ec8f5396b19eb57ddab37c78141be56f62e9077de4f4dfa0747fa768ed8c8531bbfb1046237@40.70.214.166:31303", |
||||
"enode://276e613dd4b277a66591e565711e6c8bb107f0905248a9f8f8228c1a87992e156e5114bb9937c02824a9d9d25f76340442cf86e2028bf5293cae19904fb2b98e@35.178.251.52:30303", |
||||
"enode://064c820d41e52ed7d426ac64b60506c2998235bedc7e67cb497c6faf7bb4fc54fe56fc82d0add3180b747c0c4f40a1108a6f84d7d0629ed606d504528e61cc57@3.8.5.3:30303", |
||||
"enode://90069fdabcc5e684fa5d59430bebbb12755d9362dfe5006a1485b13d71a78a3812d36e74dd7d88e50b51add01e097ea80f16263aeaa4f0230db6c79e2a97e7ca@217.29.191.142:30303", |
||||
"enode://0aac74b7fd28726275e466acb5e03bc88a95927e9951eb66b5efb239b2f798ada0690853b2f2823fe4efa408f0f3d4dd258430bc952a5ff70677b8625b3e3b14@40.115.33.57:40404", |
||||
"enode://0b96415a10f835106d83e090a0528eed5e7887e5c802a6d084e9f1993a9d0fc713781e6e4101f6365e9b91259712f291acc0a9e6e667e22023050d602c36fbe2@40.115.33.57:40414" |
||||
], |
||||
"accounts":{ |
||||
"0000000000000000000000000000000000000001":{ |
||||
"balance":"1", |
||||
"nonce":"0", |
||||
"builtin":{ |
||||
"name":"ecrecover", |
||||
"pricing":{ |
||||
"linear":{ |
||||
"base":3000, |
||||
"word":0 |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000002":{ |
||||
"balance":"1", |
||||
"nonce":"0", |
||||
"builtin":{ |
||||
"name":"sha256", |
||||
"pricing":{ |
||||
"linear":{ |
||||
"base":60, |
||||
"word":12 |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000003":{ |
||||
"balance":"1", |
||||
"nonce":"0", |
||||
"builtin":{ |
||||
"name":"ripemd160", |
||||
"pricing":{ |
||||
"linear":{ |
||||
"base":600, |
||||
"word":120 |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000004":{ |
||||
"balance":"1", |
||||
"nonce":"0", |
||||
"builtin":{ |
||||
"name":"identity", |
||||
"pricing":{ |
||||
"linear":{ |
||||
"base":15, |
||||
"word":3 |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000005":{ |
||||
"balance":"1", |
||||
"nonce":"0", |
||||
"builtin":{ |
||||
"name":"modexp", |
||||
"activate_at":"0x7530", |
||||
"pricing":{ |
||||
"modexp":{ |
||||
"divisor":20 |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000006":{ |
||||
"balance":"1", |
||||
"nonce":"0", |
||||
"builtin":{ |
||||
"name":"alt_bn128_add", |
||||
"activate_at":"0x7530", |
||||
"pricing":{ |
||||
"linear":{ |
||||
"base":500, |
||||
"word":0 |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000007":{ |
||||
"balance":"1", |
||||
"nonce":"0", |
||||
"builtin":{ |
||||
"name":"alt_bn128_mul", |
||||
"activate_at":"0x7530", |
||||
"pricing":{ |
||||
"linear":{ |
||||
"base":40000, |
||||
"word":0 |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"0000000000000000000000000000000000000008":{ |
||||
"balance":"1", |
||||
"nonce":"0", |
||||
"builtin":{ |
||||
"name":"alt_bn128_pairing", |
||||
"activate_at":"0x7530", |
||||
"pricing":{ |
||||
"alt_bn128_pairing":{ |
||||
"base":100000, |
||||
"pair":80000 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue