aboutsummaryrefslogtreecommitdiffstats
path: root/common/compiler
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-06-23 22:48:33 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-07-07 16:43:31 +0800
commit83ee39448e0f23d42dff27bccde27f828afa3707 (patch)
tree429fa8f20a4bc017a58ffc4c7c0ed8596d1d206f /common/compiler
parentd764bd058457cd9eb91d205d1ac187d40c4866d6 (diff)
downloaddexon-83ee39448e0f23d42dff27bccde27f828afa3707.tar
dexon-83ee39448e0f23d42dff27bccde27f828afa3707.tar.gz
dexon-83ee39448e0f23d42dff27bccde27f828afa3707.tar.bz2
dexon-83ee39448e0f23d42dff27bccde27f828afa3707.tar.lz
dexon-83ee39448e0f23d42dff27bccde27f828afa3707.tar.xz
dexon-83ee39448e0f23d42dff27bccde27f828afa3707.tar.zst
dexon-83ee39448e0f23d42dff27bccde27f828afa3707.zip
Registrar and contractInfo handling
* resolver -> common/registrar * global registrar name registry interface * add Call to resolver backend interface * the hashReg and UrlHing contracts now initialised from global registry * initialization of contracts uniform * improve errors and more econsistent method names * common/registrar/ethreg: versioned registrar * integrate new naming and registrar in natspec * js console api: setGlobalRegistrar, setHashReg, setUrlHint * js test TestContract uses mining - tests fixed all pass * eth/backend: allow PoW test mode (small ethash DAG) * console jsre refers to resolver.abi/addr, * cmd/geth/contracts.go moved to common/registrar
Diffstat (limited to 'common/compiler')
-rw-r--r--common/compiler/solidity.go8
-rw-r--r--common/compiler/solidity_test.go8
2 files changed, 6 insertions, 10 deletions
diff --git a/common/compiler/solidity.go b/common/compiler/solidity.go
index caf86974e..4d5ffb473 100644
--- a/common/compiler/solidity.go
+++ b/common/compiler/solidity.go
@@ -185,12 +185,12 @@ func (sol *Solidity) Compile(source string) (contracts map[string]*Contract, err
return
}
-func ExtractInfo(contract *Contract, filename string) (contenthash common.Hash, err error) {
- contractInfo, err := json.Marshal(contract.Info)
+func SaveInfo(info *ContractInfo, filename string) (contenthash common.Hash, err error) {
+ infojson, err := json.Marshal(info)
if err != nil {
return
}
- contenthash = common.BytesToHash(crypto.Sha3(contractInfo))
- err = ioutil.WriteFile(filename, contractInfo, 0600)
+ contenthash = common.BytesToHash(crypto.Sha3(infojson))
+ err = ioutil.WriteFile(filename, infojson, 0600)
return
}
diff --git a/common/compiler/solidity_test.go b/common/compiler/solidity_test.go
index 59b6b6cd6..b493d6be3 100644
--- a/common/compiler/solidity_test.go
+++ b/common/compiler/solidity_test.go
@@ -72,19 +72,15 @@ func TestNoCompiler(t *testing.T) {
}
}
-func TestExtractInfo(t *testing.T) {
+func TestSaveInfo(t *testing.T) {
var cinfo ContractInfo
err := json.Unmarshal([]byte(info), &cinfo)
if err != nil {
t.Errorf("%v", err)
}
- contract := &Contract{
- Code: "",
- Info: cinfo,
- }
filename := "/tmp/solctest.info.json"
os.Remove(filename)
- cinfohash, err := ExtractInfo(contract, filename)
+ cinfohash, err := SaveInfo(&cinfo, filename)
if err != nil {
t.Errorf("error extracting info: %v", err)
}