aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorzsfelfoldi <zsfelfoldi@gmail.com>2015-04-07 17:50:17 +0800
committerzelig <viktor.tron@gmail.com>2015-04-20 03:57:49 +0800
commitb635cad9fe127e6b0ca6d993ce9a3b6c61ce79c6 (patch)
tree81d44673f4510e13f85f9aa9d5e0009b6638eacd /core
parent94489b2269133c545aa3e9580737b2bd93f3ead0 (diff)
downloadgo-tangerine-b635cad9fe127e6b0ca6d993ce9a3b6c61ce79c6.tar.gz
go-tangerine-b635cad9fe127e6b0ca6d993ce9a3b6c61ce79c6.tar.zst
go-tangerine-b635cad9fe127e6b0ca6d993ce9a3b6c61ce79c6.zip
NatSpec passing end to end test
Diffstat (limited to 'core')
-rw-r--r--core/contracts.go42
-rw-r--r--core/genesis.go5
2 files changed, 28 insertions, 19 deletions
diff --git a/core/contracts.go b/core/contracts.go
index ffd98da98..9d63e4043 100644
--- a/core/contracts.go
+++ b/core/contracts.go
@@ -2,33 +2,43 @@ package core
const ( // built-in contracts address and code
ContractAddrURLhint = "0000000000000000000000000000000000000008"
- //ContractCodeURLhint = "0x60bd80600c6000396000f30060003560e060020a900480632f92673214601557005b60216004356024356027565b60006000f35b6000805490816001019055506001600083815260200190815260200160002054600160a060020a0316600014806081575033600160a060020a03166001600084815260200190815260200160002054600160a060020a0316145b60885760b9565b3360016000848152602001908152602001600020819055508060026000848152602001908152602001600020819055505b505056"
- ContractCodeURLhint = "0x60003560e060020a900480632f92673214601557005b60216004356024356027565b60006000f35b6000805490816001019055506001600083815260200190815260200160002054600160a060020a0316600014806081575033600160a060020a03166001600084815260200190815260200160002054600160a060020a0316145b60885760b9565b3360016000848152602001908152602001600020819055508060026000848152602001908152602001600020819055505b505056"
- //"0x60b180600c6000396000f30060003560e060020a900480632f92673214601557005b60216004356024356027565b60006000f35b6000600083815260200190815260200160002054600160a060020a0316600014806075575033600160a060020a03166000600084815260200190815260200160002054600160a060020a0316145b607c5760ad565b3360006000848152602001908152602001600020819055508060016000848152602001908152602001600020819055505b505056"
+ //ContractCodeURLhint = "0x60b180600c6000396000f30060003560e060020a90048063d66d6c1014601557005b60216004356024356027565b60006000f35b6000600083815260200190815260200160002054600160a060020a0316600014806075575033600160a060020a03166000600084815260200190815260200160002054600160a060020a0316145b607c5760ad565b3360006000848152602001908152602001600020819055508060016000848152602001908152602001600020819055505b505056"
+ ContractCodeURLhint = "0x60003560e060020a90048063d66d6c1014601557005b60216004356024356027565b60006000f35b6000600083815260200190815260200160002054600160a060020a0316600014806075575033600160a060020a03166000600084815260200190815260200160002054600160a060020a0316145b607c5760ad565b3360006000848152602001908152602001600020819055508060016000848152602001908152602001600020819055505b505056"
/*
contract URLhint {
- function register(bytes32 _hash, bytes32 _url) {
- testcnt++;
+ function register(uint256 _hash, uint256 _url) {
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;
+ mapping (uint256 => address) owner;
+ mapping (uint256 => uint256) url;
}
*/
ContractAddrHashReg = "0000000000000000000000000000000000000009"
- ContractCodeHashReg = "0x3360008190555060628060136000396000f30060003560e060020a900480632f92673214601557005b60216004356024356027565b60006000f35b600054600160a060020a031633600160a060020a031614604557605e565b8060016000848152602001908152602001600020819055505b505056"
+ ContractCodeHashReg = "0x60003560e060020a9004806331e12c2014601f578063d66d6c1014602b57005b6025603d565b60006000f35b6037600435602435605d565b60006000f35b600054600160a060020a0316600014605357605b565b336000819055505b565b600054600160a060020a031633600160a060020a031614607b576094565b8060016000848152602001908152602001600020819055505b505056"
+ //ContractCodeHashReg = "0x609880600c6000396000f30060003560e060020a9004806331e12c2014601f578063d66d6c1014602b57005b6025603d565b60006000f35b6037600435602435605d565b60006000f35b600054600160a060020a0316600014605357605b565b336000819055505b565b600054600160a060020a031633600160a060020a031614607b576094565b8060016000848152602001908152602001600020819055505b505056"
/*
- import "owned";
- contract HashReg is owned {
- function register(bytes32 _code, bytes32 _abi) onlyowner {
- abis[_code] = _abi;
- }
- mapping (bytes32 => bytes32) abis;
- }
+ contract HashReg {
+ function setowner() {
+ if (owner == 0) {
+ owner = msg.sender;
+ }
+ }
+ function register(uint256 _key, uint256 _content) {
+ if (msg.sender == owner) {
+ content[_key] = _content;
+ }
+ }
+ address owner;
+ mapping (uint256 => uint256) content;
+ }
*/
+
+ BuiltInContracts = `
+ "` + ContractAddrURLhint + `": {"balance": "0", "code": "` + ContractCodeURLhint + `" },
+ "` + ContractAddrHashReg + `": {"balance": "0", "code": "` + ContractCodeHashReg + `" },
+ `
)
diff --git a/core/genesis.go b/core/genesis.go
index 14ac2ec0f..c475ca637 100644
--- a/core/genesis.go
+++ b/core/genesis.go
@@ -58,13 +58,12 @@ func GenesisBlock(db common.Database) *types.Block {
const (
TestAccount = "e273f01c99144c438695e10f24926dc1f9fbf62d"
- TestBalance = "1000000000000000000"
+ TestBalance = "1000000000000"
)
var genesisData = []byte(`{
"` + TestAccount + `": {"balance": "` + TestBalance + `"},
- "` + ContractAddrURLhint + `": {"balance": "` + TestBalance + `", "code": "` + ContractCodeURLhint + `" },
- "` + ContractAddrHashReg + `": {"balance": "` + TestBalance + `", "code": "` + ContractCodeHashReg + `" },
+ ` + BuiltInContracts + `
"0000000000000000000000000000000000000001": {"balance": "1"},
"0000000000000000000000000000000000000002": {"balance": "1"},
"0000000000000000000000000000000000000003": {"balance": "1"},