diff --git a/Makefile b/Makefile index cfbb1bb41..1903e1f44 100644 --- a/Makefile +++ b/Makefile @@ -172,6 +172,7 @@ xgo: go get github.com/karalabe/xgo setup: dep-install lint-install mock-install ##@other Prepare project for first build + go get -u github.com/kevinburke/go-bindata/go-bindata generate: ##@other Regenerate assets and other auto-generated stuff go generate ./static diff --git a/static/bindata.go b/static/bindata.go index c226f71f5..ee635cbe5 100644 --- a/static/bindata.go +++ b/static/bindata.go @@ -1,25 +1,24 @@ -// Code generated by go-bindata. +// Code generated by go-bindata. DO NOT EDIT. // sources: -// config/public-chain-accounts.json -// config/status-chain-accounts.json -// config/status-chain-genesis.json -// config/test-data.json -// keys/bootnode.key -// keys/firebaseauthkey -// keys/test-account1-status-chain.pk -// keys/test-account1.pk -// keys/test-account2-status-chain.pk -// keys/test-account2.pk -// keys/test-account3-before-eip55.pk -// keys/wnodepassword -// testdata/node/test.sol -// DO NOT EDIT! +// config/public-chain-accounts.json (165B) +// config/status-chain-accounts.json (330B) +// config/status-chain-genesis.json (612B) +// config/test-data.json (84B) +// keys/bootnode.key (65B) +// keys/firebaseauthkey (153B) +// keys/test-account1-status-chain.pk (489B) +// keys/test-account1.pk (491B) +// keys/test-account2-status-chain.pk (489B) +// keys/test-account2.pk (491B) +// keys/test-account3-before-eip55.pk (489B) +// keys/wnodepassword (21B) package static import ( "bytes" "compress/gzip" + "crypto/sha256" "fmt" "io" "io/ioutil" @@ -50,8 +49,9 @@ func bindataRead(data []byte, name string) ([]byte, error) { } type asset struct { - bytes []byte - info os.FileInfo + bytes []byte + info os.FileInfo + digest [sha256.Size]byte } type bindataFileInfo struct { @@ -95,8 +95,8 @@ func configPublicChainAccountsJson() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "config/public-chain-accounts.json", size: 165, mode: os.FileMode(420), modTime: time.Unix(1513173072, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "config/public-chain-accounts.json", size: 165, mode: os.FileMode(420), modTime: time.Unix(1531118119, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf6, 0xa7, 0xf7, 0xe4, 0xdd, 0x94, 0xb2, 0x97, 0x99, 0x13, 0xd1, 0xc0, 0x5f, 0xf9, 0x63, 0x13, 0x14, 0xc0, 0xe1, 0xde, 0x56, 0x3f, 0x14, 0x1b, 0x37, 0xf1, 0x87, 0x5d, 0xda, 0xc8, 0xd4, 0x1c}} return a, nil } @@ -115,8 +115,8 @@ func configStatusChainAccountsJson() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "config/status-chain-accounts.json", size: 330, mode: os.FileMode(420), modTime: time.Unix(1513173072, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "config/status-chain-accounts.json", size: 330, mode: os.FileMode(420), modTime: time.Unix(1531118119, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3d, 0x4a, 0x37, 0x3b, 0x7f, 0xee, 0x4b, 0x1b, 0x5, 0x9e, 0xc5, 0x5d, 0xbf, 0x31, 0x12, 0xf5, 0xa, 0xd2, 0xcf, 0xec, 0xee, 0xe4, 0x90, 0x42, 0x5, 0xba, 0x71, 0xce, 0x84, 0x98, 0xd1, 0xd6}} return a, nil } @@ -135,8 +135,8 @@ func configStatusChainGenesisJson() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "config/status-chain-genesis.json", size: 612, mode: os.FileMode(420), modTime: time.Unix(1513173072, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "config/status-chain-genesis.json", size: 612, mode: os.FileMode(420), modTime: time.Unix(1531118119, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb, 0xf0, 0xc, 0x1, 0x95, 0x65, 0x6, 0x55, 0x48, 0x8f, 0x83, 0xa0, 0xb4, 0x81, 0xda, 0xad, 0x30, 0x6d, 0xb2, 0x78, 0x1b, 0x26, 0x4, 0x13, 0x12, 0x9, 0x6, 0xae, 0x3a, 0x2c, 0x1, 0x71}} return a, nil } @@ -155,8 +155,8 @@ func configTestDataJson() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "config/test-data.json", size: 84, mode: os.FileMode(420), modTime: time.Unix(1513173072, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "config/test-data.json", size: 84, mode: os.FileMode(420), modTime: time.Unix(1531118119, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xce, 0x9d, 0x80, 0xf5, 0x87, 0xfa, 0x57, 0x1d, 0xa1, 0xd5, 0x7a, 0x10, 0x3, 0xac, 0xd7, 0xf4, 0x64, 0x32, 0x96, 0x2b, 0xb7, 0x21, 0xb7, 0xa6, 0x80, 0x40, 0xe9, 0x65, 0xe3, 0xd6, 0xbd, 0x40}} return a, nil } @@ -175,8 +175,8 @@ func keysBootnodeKey() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "keys/bootnode.key", size: 65, mode: os.FileMode(420), modTime: time.Unix(1517499040, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "keys/bootnode.key", size: 65, mode: os.FileMode(420), modTime: time.Unix(1531118119, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x31, 0xcf, 0x27, 0xd4, 0x96, 0x2e, 0x32, 0xcd, 0x58, 0x96, 0x2a, 0xe5, 0x8c, 0xa0, 0xf1, 0x73, 0x1f, 0xd6, 0xd6, 0x8b, 0xb, 0x73, 0xd3, 0x2c, 0x84, 0x1a, 0x56, 0xa4, 0x74, 0xb6, 0x95, 0x20}} return a, nil } @@ -195,8 +195,8 @@ func keysFirebaseauthkey() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "keys/firebaseauthkey", size: 153, mode: os.FileMode(420), modTime: time.Unix(1513071176, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "keys/firebaseauthkey", size: 153, mode: os.FileMode(420), modTime: time.Unix(1531118119, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe, 0x69, 0x23, 0x64, 0x7d, 0xf9, 0x14, 0x37, 0x6f, 0x2b, 0x1, 0xf0, 0xb0, 0xa4, 0xb2, 0xd0, 0x18, 0xcd, 0xf9, 0xeb, 0x57, 0xa3, 0xfd, 0x79, 0x25, 0xa7, 0x9c, 0x3, 0xce, 0x26, 0xec, 0xe1}} return a, nil } @@ -215,8 +215,8 @@ func keysTestAccount1StatusChainPk() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "keys/test-account1-status-chain.pk", size: 489, mode: os.FileMode(420), modTime: time.Unix(1513173072, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "keys/test-account1-status-chain.pk", size: 489, mode: os.FileMode(420), modTime: time.Unix(1531118119, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x8f, 0xba, 0x35, 0x1, 0x2b, 0x9d, 0xad, 0xf0, 0x2d, 0x3c, 0x4d, 0x6, 0xb5, 0x22, 0x2, 0x47, 0xd4, 0x1c, 0xf4, 0x31, 0x2f, 0xb, 0x5b, 0x27, 0x5d, 0x43, 0x97, 0x58, 0x2d, 0xf0, 0xe1, 0xbe}} return a, nil } @@ -235,8 +235,8 @@ func keysTestAccount1Pk() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "keys/test-account1.pk", size: 491, mode: os.FileMode(420), modTime: time.Unix(1513173072, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "keys/test-account1.pk", size: 491, mode: os.FileMode(420), modTime: time.Unix(1531118119, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9, 0x43, 0xc2, 0xf4, 0x8c, 0xc6, 0x64, 0x25, 0x8c, 0x7, 0x8c, 0xa8, 0x89, 0x2b, 0x7b, 0x9b, 0x4f, 0x81, 0xcb, 0xce, 0x3d, 0xef, 0x82, 0x9c, 0x27, 0x27, 0xa9, 0xc5, 0x46, 0x70, 0x30, 0x38}} return a, nil } @@ -255,8 +255,8 @@ func keysTestAccount2StatusChainPk() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "keys/test-account2-status-chain.pk", size: 489, mode: os.FileMode(420), modTime: time.Unix(1513173072, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "keys/test-account2-status-chain.pk", size: 489, mode: os.FileMode(420), modTime: time.Unix(1531118119, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9, 0xf8, 0x5c, 0xe9, 0x92, 0x96, 0x2d, 0x88, 0x2b, 0x8e, 0x42, 0x3f, 0xa4, 0x93, 0x6c, 0xad, 0xe9, 0xc0, 0x1b, 0x8a, 0x8, 0x8c, 0x5e, 0x7a, 0x84, 0xa2, 0xf, 0x9f, 0x77, 0x58, 0x2c, 0x2c}} return a, nil } @@ -275,8 +275,8 @@ func keysTestAccount2Pk() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "keys/test-account2.pk", size: 491, mode: os.FileMode(420), modTime: time.Unix(1513173072, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "keys/test-account2.pk", size: 491, mode: os.FileMode(420), modTime: time.Unix(1531118119, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9f, 0x72, 0xd5, 0x95, 0x5c, 0x5a, 0x99, 0x9d, 0x2f, 0x21, 0x83, 0xd7, 0x10, 0x17, 0x4a, 0x3d, 0x65, 0xc9, 0x26, 0x1a, 0x2c, 0x9d, 0x65, 0x63, 0xd2, 0xa0, 0xfc, 0x7c, 0x0, 0x87, 0x38, 0x9f}} return a, nil } @@ -295,8 +295,8 @@ func keysTestAccount3BeforeEip55Pk() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "keys/test-account3-before-eip55.pk", size: 489, mode: os.FileMode(420), modTime: time.Unix(1513173072, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "keys/test-account3-before-eip55.pk", size: 489, mode: os.FileMode(420), modTime: time.Unix(1531118119, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x81, 0x40, 0x56, 0xc1, 0x5e, 0x10, 0x6e, 0x28, 0x15, 0x3, 0x4e, 0xc4, 0xc4, 0x71, 0x4d, 0x16, 0x99, 0xcc, 0x1b, 0x63, 0xee, 0x10, 0x20, 0xe4, 0x59, 0x52, 0x3f, 0xc0, 0xad, 0x15, 0x13, 0x72}} return a, nil } @@ -315,28 +315,8 @@ func keysWnodepassword() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "keys/wnodepassword", size: 21, mode: os.FileMode(420), modTime: time.Unix(1513173072, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _testdataNodeTestSol = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2c\xcb\x31\x0a\xc2\x40\x10\x85\xe1\x7e\x4f\xf1\x4a\x63\x11\x44\x6c\x24\xd7\xb0\x16\xc6\xcd\x2a\x0b\x71\x46\x66\xde\x16\x22\xb9\xbb\xac\xe6\x2f\x3f\xf8\x5f\x2e\x8f\xa7\x20\x6c\xa9\x73\xe5\x1b\xd7\xc3\x78\x1a\xcf\x53\x4a\xd9\x94\x2e\x99\xb8\x94\x20\x3e\x09\x00\xee\x4d\x33\xab\x29\x66\x6b\xb7\xa5\xec\xaa\x12\x32\x20\x9b\x06\x45\x09\x2f\x6c\xae\xd1\x7d\xd8\x96\xde\x9f\x71\xdc\xcb\xf4\xb3\x35\xad\xdf\x00\x00\x00\xff\xff\x5a\xcc\x10\x28\x77\x00\x00\x00") - -func testdataNodeTestSolBytes() ([]byte, error) { - return bindataRead( - _testdataNodeTestSol, - "testdata/node/test.sol", - ) -} - -func testdataNodeTestSol() (*asset, error) { - bytes, err := testdataNodeTestSolBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "testdata/node/test.sol", size: 119, mode: os.FileMode(420), modTime: time.Unix(1513071176, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "keys/wnodepassword", size: 21, mode: os.FileMode(420), modTime: time.Unix(1531118119, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x94, 0x4b, 0xc5, 0xc1, 0xf, 0x43, 0x6b, 0xab, 0xa2, 0x7d, 0x66, 0xae, 0xf8, 0x31, 0x63, 0xd0, 0x7b, 0xec, 0x4d, 0xd6, 0x91, 0x2, 0x29, 0x12, 0x9b, 0x43, 0x43, 0xba, 0x6a, 0x84, 0x4f, 0x25}} return a, nil } @@ -344,8 +324,8 @@ func testdataNodeTestSol() (*asset, error) { // It returns an error if the asset could not be found or // could not be loaded. func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) @@ -355,6 +335,12 @@ func Asset(name string) ([]byte, error) { return nil, fmt.Errorf("Asset %s not found", name) } +// AssetString returns the asset contents as a string (instead of a []byte). +func AssetString(name string) (string, error) { + data, err := Asset(name) + return string(data), err +} + // MustAsset is like Asset but panics when Asset would return an error. // It simplifies safe initialization of global variables. func MustAsset(name string) []byte { @@ -366,12 +352,18 @@ func MustAsset(name string) []byte { return a } +// MustAssetString is like AssetString but panics when Asset would return an +// error. It simplifies safe initialization of global variables. +func MustAssetString(name string) string { + return string(MustAsset(name)) +} + // AssetInfo loads and returns the asset info for the given name. // It returns an error if the asset could not be found or // could not be loaded. func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) @@ -381,6 +373,33 @@ func AssetInfo(name string) (os.FileInfo, error) { return nil, fmt.Errorf("AssetInfo %s not found", name) } +// AssetDigest returns the digest of the file with the given name. It returns an +// error if the asset could not be found or the digest could not be loaded. +func AssetDigest(name string) ([sha256.Size]byte, error) { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { + a, err := f() + if err != nil { + return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) + } + return a.digest, nil + } + return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) +} + +// Digests returns a map of all known files and their checksums. +func Digests() (map[string][sha256.Size]byte, error) { + mp := make(map[string][sha256.Size]byte, len(_bindata)) + for name := range _bindata { + a, err := _bindata[name]() + if err != nil { + return nil, err + } + mp[name] = a.digest + } + return mp, nil +} + // AssetNames returns the names of the assets. func AssetNames() []string { names := make([]string, 0, len(_bindata)) @@ -393,18 +412,28 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ "config/public-chain-accounts.json": configPublicChainAccountsJson, + "config/status-chain-accounts.json": configStatusChainAccountsJson, + "config/status-chain-genesis.json": configStatusChainGenesisJson, + "config/test-data.json": configTestDataJson, + "keys/bootnode.key": keysBootnodeKey, + "keys/firebaseauthkey": keysFirebaseauthkey, + "keys/test-account1-status-chain.pk": keysTestAccount1StatusChainPk, + "keys/test-account1.pk": keysTestAccount1Pk, + "keys/test-account2-status-chain.pk": keysTestAccount2StatusChainPk, + "keys/test-account2.pk": keysTestAccount2Pk, + "keys/test-account3-before-eip55.pk": keysTestAccount3BeforeEip55Pk, + "keys/wnodepassword": keysWnodepassword, - "testdata/node/test.sol": testdataNodeTestSol, } // AssetDir returns the file names below a certain @@ -416,15 +445,15 @@ var _bindata = map[string]func() (*asset, error){ // img/ // a.png // b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// then AssetDir("data") would return []string{"foo.txt", "img"}, +// AssetDir("data/img") would return []string{"a.png", "b.png"}, +// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and // AssetDir("") will return []string{"data"}. func AssetDir(name string) ([]string, error) { node := _bintree if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") + canonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(canonicalName, "/") for _, p := range pathList { node = node.Children[p] if node == nil { @@ -446,31 +475,27 @@ type bintree struct { Func func() (*asset, error) Children map[string]*bintree } + var _bintree = &bintree{nil, map[string]*bintree{ "config": &bintree{nil, map[string]*bintree{ "public-chain-accounts.json": &bintree{configPublicChainAccountsJson, map[string]*bintree{}}, "status-chain-accounts.json": &bintree{configStatusChainAccountsJson, map[string]*bintree{}}, - "status-chain-genesis.json": &bintree{configStatusChainGenesisJson, map[string]*bintree{}}, - "test-data.json": &bintree{configTestDataJson, map[string]*bintree{}}, + "status-chain-genesis.json": &bintree{configStatusChainGenesisJson, map[string]*bintree{}}, + "test-data.json": &bintree{configTestDataJson, map[string]*bintree{}}, }}, "keys": &bintree{nil, map[string]*bintree{ - "bootnode.key": &bintree{keysBootnodeKey, map[string]*bintree{}}, - "firebaseauthkey": &bintree{keysFirebaseauthkey, map[string]*bintree{}}, + "bootnode.key": &bintree{keysBootnodeKey, map[string]*bintree{}}, + "firebaseauthkey": &bintree{keysFirebaseauthkey, map[string]*bintree{}}, "test-account1-status-chain.pk": &bintree{keysTestAccount1StatusChainPk, map[string]*bintree{}}, - "test-account1.pk": &bintree{keysTestAccount1Pk, map[string]*bintree{}}, + "test-account1.pk": &bintree{keysTestAccount1Pk, map[string]*bintree{}}, "test-account2-status-chain.pk": &bintree{keysTestAccount2StatusChainPk, map[string]*bintree{}}, - "test-account2.pk": &bintree{keysTestAccount2Pk, map[string]*bintree{}}, + "test-account2.pk": &bintree{keysTestAccount2Pk, map[string]*bintree{}}, "test-account3-before-eip55.pk": &bintree{keysTestAccount3BeforeEip55Pk, map[string]*bintree{}}, - "wnodepassword": &bintree{keysWnodepassword, map[string]*bintree{}}, - }}, - "testdata": &bintree{nil, map[string]*bintree{ - "node": &bintree{nil, map[string]*bintree{ - "test.sol": &bintree{testdataNodeTestSol, map[string]*bintree{}}, - }}, + "wnodepassword": &bintree{keysWnodepassword, map[string]*bintree{}}, }}, }} -// RestoreAsset restores an asset under the given directory +// RestoreAsset restores an asset under the given directory. func RestoreAsset(dir, name string) error { data, err := Asset(name) if err != nil { @@ -488,14 +513,10 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil + return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) } -// RestoreAssets restores an asset under the given directory recursively +// RestoreAssets restores an asset under the given directory recursively. func RestoreAssets(dir, name string) error { children, err := AssetDir(name) // File @@ -513,7 +534,6 @@ func RestoreAssets(dir, name string) error { } func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) + canonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) } - diff --git a/static/testdata/node/test.sol b/static/testdata/node/test.sol deleted file mode 100644 index 49f83a8c6..000000000 --- a/static/testdata/node/test.sol +++ /dev/null @@ -1,7 +0,0 @@ -pragma solidity ^0.4.9; - -contract Test { - function double(int a) constant returns(int) { - return 2*a; - } -} \ No newline at end of file