aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm/vm_genesis_parse_test.go
diff options
context:
space:
mode:
authorStephen Buttolph <stephen@avalabs.org>2020-04-16 11:38:38 -0400
committerGitHub <noreply@github.com>2020-04-16 11:38:38 -0400
commit6a76dcccc5c5d9686b35595d3f9ab3a6cefd0446 (patch)
tree24ef681a6c846ba58ce2b8db2fa436c10404172b /plugin/evm/vm_genesis_parse_test.go
parent756aac82152ba5265f62d234d94a1926cf572b38 (diff)
parent7981c59502a99b6f7938a18b6ae5c3803cf0a794 (diff)
Merge pull request #5 from ava-labs/revert-4-revert-2-plugin
Added the EVM as a plugin
Diffstat (limited to 'plugin/evm/vm_genesis_parse_test.go')
-rw-r--r--plugin/evm/vm_genesis_parse_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/plugin/evm/vm_genesis_parse_test.go b/plugin/evm/vm_genesis_parse_test.go
new file mode 100644
index 0000000..9a113fb
--- /dev/null
+++ b/plugin/evm/vm_genesis_parse_test.go
@@ -0,0 +1,32 @@
+// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
+// See the file LICENSE for licensing terms.
+
+package evm
+
+import (
+ "encoding/json"
+ "testing"
+
+ "github.com/ava-labs/coreth/core"
+)
+
+func TestParseGenesis(t *testing.T) {
+ genesis := []byte(`{"config":{"chainId":43110,"homesteadBlock":0,"daoForkBlock":0,"daoForkSupport":true,"eip150Block":0,"eip150Hash":"0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0","eip155Block":0,"eip158Block":0,"byzantiumBlock":0,"constantinopleBlock":0,"petersburgBlock":0},"nonce":"0x0","timestamp":"0x0","extraData":"0x00","gasLimit":"0x5f5e100","difficulty":"0x0","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","coinbase":"0x0000000000000000000000000000000000000000","alloc":{"751a0b96e1042bee789452ecb20253fba40dbe85":{"balance":"0x33b2e3c9fd0804000000000"}},"number":"0x0","gasUsed":"0x0","parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000"}`)
+
+ genesisBlock := new(core.Genesis)
+ err := json.Unmarshal(genesis, genesisBlock)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ marshalledBytes, err := json.Marshal(genesisBlock)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ secondGenesisBlock := new(core.Genesis)
+ err = json.Unmarshal(marshalledBytes, secondGenesisBlock)
+ if err != nil {
+ t.Fatal(err)
+ }
+}