From e2d333d2095edb349388433c28f4d6a381b1df62 Mon Sep 17 00:00:00 2001 From: zsfelfoldi Date: Fri, 3 Apr 2015 17:37:59 +0200 Subject: NatSpec contracts in genesis block, end to end test (unfinished) --- core/contracts.go | 33 +++++++++++++++++++++++++++++++++ core/genesis.go | 8 ++++++++ 2 files changed, 41 insertions(+) create mode 100644 core/contracts.go (limited to 'core') diff --git a/core/contracts.go b/core/contracts.go new file mode 100644 index 000000000..a8da85f58 --- /dev/null +++ b/core/contracts.go @@ -0,0 +1,33 @@ +package core + +const ( // built-in contracts address and code + ContractAddrURLhint = "0000000000000000000000000000000000000008" + ContractCodeURLhint = "0x60bd80600c6000396000f30060003560e060020a900480632f92673214601557005b60216004356024356027565b60006000f35b6000805490816001019055506001600083815260200190815260200160002054600160a060020a0316600014806081575033600160a060020a03166001600084815260200190815260200160002054600160a060020a0316145b60885760b9565b3360016000848152602001908152602001600020819055508060026000848152602001908152602001600020819055505b505056" + //"0x60b180600c6000396000f30060003560e060020a900480632f92673214601557005b60216004356024356027565b60006000f35b6000600083815260200190815260200160002054600160a060020a0316600014806075575033600160a060020a03166000600084815260200190815260200160002054600160a060020a0316145b607c5760ad565b3360006000848152602001908152602001600020819055508060016000848152602001908152602001600020819055505b505056" + /* + contract URLhint { + function register(bytes32 _hash, bytes32 _url) { + testcnt++; + if (owner[_hash] == 0 || owner[_hash] == msg.sender) { + owner[_hash] = msg.sender; + url[_hash] = _url; + } + } + uint32 testcnt; + mapping (bytes32 => address) owner; + mapping (bytes32 => bytes32) url; + } + */ + + ContractAddrHashReg = "0000000000000000000000000000000000000009" + ContractCodeHashReg = "0x3360008190555060628060136000396000f30060003560e060020a900480632f92673214601557005b60216004356024356027565b60006000f35b600054600160a060020a031633600160a060020a031614604557605e565b8060016000848152602001908152602001600020819055505b505056" + /* + import "owned"; + contract HashReg is owned { + function register(bytes32 _code, bytes32 _abi) onlyowner { + abis[_code] = _abi; + } + mapping (bytes32 => bytes32) abis; + } + */ +) diff --git a/core/genesis.go b/core/genesis.go index 8ef1e140f..14ac2ec0f 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -56,7 +56,15 @@ func GenesisBlock(db common.Database) *types.Block { return genesis } +const ( + TestAccount = "e273f01c99144c438695e10f24926dc1f9fbf62d" + TestBalance = "1000000000000000000" +) + var genesisData = []byte(`{ + "` + TestAccount + `": {"balance": "` + TestBalance + `"}, + "` + ContractAddrURLhint + `": {"balance": "` + TestBalance + `", "code": "` + ContractCodeURLhint + `" }, + "` + ContractAddrHashReg + `": {"balance": "` + TestBalance + `", "code": "` + ContractCodeHashReg + `" }, "0000000000000000000000000000000000000001": {"balance": "1"}, "0000000000000000000000000000000000000002": {"balance": "1"}, "0000000000000000000000000000000000000003": {"balance": "1"}, -- cgit v1.2.3