From 45676382b6cdf3720600647bdd76e4a89fa4495f Mon Sep 17 00:00:00 2001 From: zelig Date: Tue, 31 Mar 2015 00:51:51 +0100 Subject: natspec integrated to console frontend confirmTransaction --- cmd/geth/js.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/geth/js.go b/cmd/geth/js.go index 0061f20cf..0ac2e319e 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -25,6 +25,7 @@ import ( "strings" "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/common/natspec" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" re "github.com/ethereum/go-ethereum/jsre" @@ -140,8 +141,16 @@ var net = web3.net; } func (self *jsre) ConfirmTransaction(tx *types.Transaction) bool { - p := fmt.Sprintf("Confirm Transaction %v\n[y/n] ", tx) - answer, _ := self.Prompt(p) + var notice string + nat, err := natspec.New() + if err == nil { + notice, err = nat.Notice(tx) + } + if err != nil { + notice = fmt.Sprintf("About to submit transaction: %v") + } + fmt.Println(notice) + answer, _ := self.Prompt("Confirm Transaction\n[y/n] ") return strings.HasPrefix(strings.Trim(answer, " "), "y") } -- cgit v1.2.3 From 3136bae4a5f08820d3116b61b783c100c169717c Mon Sep 17 00:00:00 2001 From: zsfelfoldi Date: Tue, 31 Mar 2015 08:28:12 +0200 Subject: NatSpec, URL register storage retrieval fixed 2/3 tests --- cmd/geth/js.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'cmd') diff --git a/cmd/geth/js.go b/cmd/geth/js.go index 0ac2e319e..d63ac1015 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -26,7 +26,6 @@ import ( "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/common/natspec" - "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" re "github.com/ethereum/go-ethereum/jsre" "github.com/ethereum/go-ethereum/rpc" @@ -140,11 +139,11 @@ var net = web3.net; js.re.Eval(globalRegistrar + "registrar = new GlobalRegistrar(\"" + globalRegistrarAddr + "\");") } -func (self *jsre) ConfirmTransaction(tx *types.Transaction) bool { +func (self *jsre) ConfirmTransaction(tx string) bool { var notice string - nat, err := natspec.New() + nat, err := natspec.New(self.xeth, tx) if err == nil { - notice, err = nat.Notice(tx) + notice, err = nat.Notice() } if err != nil { notice = fmt.Sprintf("About to submit transaction: %v") -- cgit v1.2.3 From ac0e5e8b6de43a40bbc25f541aa2399202bbe420 Mon Sep 17 00:00:00 2001 From: zelig Date: Wed, 1 Apr 2015 12:29:16 +0100 Subject: resolver tests - add resolver tests and fix resolver to pass - statereg constructor fixed - comments added to natspec plus docserver integration for natspec userdoc fetching --- cmd/geth/js.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/geth/js.go b/cmd/geth/js.go index d63ac1015..9931b3a21 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -25,6 +25,7 @@ import ( "strings" "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/common/docserver" "github.com/ethereum/go-ethereum/common/natspec" "github.com/ethereum/go-ethereum/eth" re "github.com/ethereum/go-ethereum/jsre" @@ -139,9 +140,11 @@ var net = web3.net; js.re.Eval(globalRegistrar + "registrar = new GlobalRegistrar(\"" + globalRegistrarAddr + "\");") } +var ds, _ = docserver.New(utils.JSpathFlag.String()) + func (self *jsre) ConfirmTransaction(tx string) bool { var notice string - nat, err := natspec.New(self.xeth, tx) + nat, err := natspec.New(self.xeth, tx, ds) if err == nil { notice, err = nat.Notice() } -- cgit v1.2.3 From b46e15217131e4ebe64e1ee55594c3ab0620395c Mon Sep 17 00:00:00 2001 From: zsfelfoldi Date: Wed, 8 Apr 2015 12:35:02 +0200 Subject: default fallback NatSpec messages --- cmd/geth/js.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'cmd') diff --git a/cmd/geth/js.go b/cmd/geth/js.go index 9931b3a21..d5deea93f 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -143,14 +143,7 @@ var net = web3.net; var ds, _ = docserver.New(utils.JSpathFlag.String()) func (self *jsre) ConfirmTransaction(tx string) bool { - var notice string - nat, err := natspec.New(self.xeth, tx, ds) - if err == nil { - notice, err = nat.Notice() - } - if err != nil { - notice = fmt.Sprintf("About to submit transaction: %v") - } + notice := natspec.GetNotice(self.xeth, tx, ds) fmt.Println(notice) answer, _ := self.Prompt("Confirm Transaction\n[y/n] ") return strings.HasPrefix(strings.Trim(answer, " "), "y") -- cgit v1.2.3 From c4b7d4d3f77160fba1ab3d8366cb2657a90e2282 Mon Sep 17 00:00:00 2001 From: zsfelfoldi Date: Wed, 8 Apr 2015 13:22:31 +0200 Subject: NatSpec cli option, resolver tests passing --- cmd/geth/js.go | 12 ++++++++---- cmd/geth/main.go | 1 + cmd/utils/flags.go | 43 +++++++++++++++++++++++-------------------- 3 files changed, 32 insertions(+), 24 deletions(-) (limited to 'cmd') diff --git a/cmd/geth/js.go b/cmd/geth/js.go index d5deea93f..6e5a6f1c7 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -143,10 +143,14 @@ var net = web3.net; var ds, _ = docserver.New(utils.JSpathFlag.String()) func (self *jsre) ConfirmTransaction(tx string) bool { - notice := natspec.GetNotice(self.xeth, tx, ds) - fmt.Println(notice) - answer, _ := self.Prompt("Confirm Transaction\n[y/n] ") - return strings.HasPrefix(strings.Trim(answer, " "), "y") + if self.ethereum.NatSpec { + notice := natspec.GetNotice(self.xeth, tx, ds) + fmt.Println(notice) + answer, _ := self.Prompt("Confirm Transaction\n[y/n] ") + return strings.HasPrefix(strings.Trim(answer, " "), "y") + } else { + return true + } } func (self *jsre) UnlockAccount(addr []byte) bool { diff --git a/cmd/geth/main.go b/cmd/geth/main.go index dab167bbb..5b523da3e 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -231,6 +231,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso utils.MinerThreadsFlag, utils.MiningEnabledFlag, utils.NATFlag, + utils.NatspecEnabledFlag, utils.NodeKeyFileFlag, utils.NodeKeyHexFlag, utils.RPCEnabledFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index a1d9eedda..974fabbdc 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -93,6 +93,10 @@ var ( Name: "identity", Usage: "node name", } + NatspecEnabledFlag = cli.BoolFlag{ + Name: "natspec", + Usage: "Enable NatSpec confirmation notice", + } // miner settings MinerThreadsFlag = cli.IntFlag{ @@ -252,26 +256,25 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config { } return ð.Config{ - Name: common.MakeName(clientID, version), - DataDir: ctx.GlobalString(DataDirFlag.Name), - ProtocolVersion: ctx.GlobalInt(ProtocolVersionFlag.Name), - BlockChainVersion: ctx.GlobalInt(BlockchainVersionFlag.Name), - SkipBcVersionCheck: false, - NetworkId: ctx.GlobalInt(NetworkIdFlag.Name), - LogFile: ctx.GlobalString(LogFileFlag.Name), - LogLevel: ctx.GlobalInt(LogLevelFlag.Name), - LogJSON: ctx.GlobalString(LogJSONFlag.Name), - Etherbase: ctx.GlobalString(EtherbaseFlag.Name), - MinerThreads: ctx.GlobalInt(MinerThreadsFlag.Name), - AccountManager: GetAccountManager(ctx), - VmDebug: ctx.GlobalBool(VMDebugFlag.Name), - MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name), - Port: ctx.GlobalString(ListenPortFlag.Name), - NAT: GetNAT(ctx), - NodeKey: GetNodeKey(ctx), - Shh: true, - Dial: true, - BootNodes: ctx.GlobalString(BootnodesFlag.Name), + Name: common.MakeName(clientID, version), + DataDir: ctx.GlobalString(DataDirFlag.Name), + ProtocolVersion: ctx.GlobalInt(ProtocolVersionFlag.Name), + NetworkId: ctx.GlobalInt(NetworkIdFlag.Name), + LogFile: ctx.GlobalString(LogFileFlag.Name), + LogLevel: ctx.GlobalInt(LogLevelFlag.Name), + LogJSON: ctx.GlobalString(LogJSONFlag.Name), + Etherbase: ctx.GlobalString(EtherbaseFlag.Name), + MinerThreads: ctx.GlobalInt(MinerThreadsFlag.Name), + AccountManager: GetAccountManager(ctx), + VmDebug: ctx.GlobalBool(VMDebugFlag.Name), + MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name), + Port: ctx.GlobalString(ListenPortFlag.Name), + NAT: GetNAT(ctx), + NatSpec: ctx.GlobalBool(NatspecEnabledFlag.Name), + NodeKey: GetNodeKey(ctx), + Shh: true, + Dial: true, + BootNodes: ctx.GlobalString(BootnodesFlag.Name), } } -- cgit v1.2.3 From bb793c829f9ed82bfbb03d6f3cf669977cfc9548 Mon Sep 17 00:00:00 2001 From: zsfelfoldi Date: Tue, 14 Apr 2015 16:12:35 +0200 Subject: fixed incomplete merge --- cmd/utils/flags.go | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'cmd') diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 974fabbdc..f70f4243e 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -256,25 +256,27 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config { } return ð.Config{ - Name: common.MakeName(clientID, version), - DataDir: ctx.GlobalString(DataDirFlag.Name), - ProtocolVersion: ctx.GlobalInt(ProtocolVersionFlag.Name), - NetworkId: ctx.GlobalInt(NetworkIdFlag.Name), - LogFile: ctx.GlobalString(LogFileFlag.Name), - LogLevel: ctx.GlobalInt(LogLevelFlag.Name), - LogJSON: ctx.GlobalString(LogJSONFlag.Name), - Etherbase: ctx.GlobalString(EtherbaseFlag.Name), - MinerThreads: ctx.GlobalInt(MinerThreadsFlag.Name), - AccountManager: GetAccountManager(ctx), - VmDebug: ctx.GlobalBool(VMDebugFlag.Name), - MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name), - Port: ctx.GlobalString(ListenPortFlag.Name), - NAT: GetNAT(ctx), - NatSpec: ctx.GlobalBool(NatspecEnabledFlag.Name), - NodeKey: GetNodeKey(ctx), - Shh: true, - Dial: true, - BootNodes: ctx.GlobalString(BootnodesFlag.Name), + Name: common.MakeName(clientID, version), + DataDir: ctx.GlobalString(DataDirFlag.Name), + ProtocolVersion: ctx.GlobalInt(ProtocolVersionFlag.Name), + BlockChainVersion: ctx.GlobalInt(BlockchainVersionFlag.Name), + SkipBcVersionCheck: false, + NetworkId: ctx.GlobalInt(NetworkIdFlag.Name), + LogFile: ctx.GlobalString(LogFileFlag.Name), + LogLevel: ctx.GlobalInt(LogLevelFlag.Name), + LogJSON: ctx.GlobalString(LogJSONFlag.Name), + Etherbase: ctx.GlobalString(EtherbaseFlag.Name), + MinerThreads: ctx.GlobalInt(MinerThreadsFlag.Name), + AccountManager: GetAccountManager(ctx), + VmDebug: ctx.GlobalBool(VMDebugFlag.Name), + MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name), + Port: ctx.GlobalString(ListenPortFlag.Name), + NAT: GetNAT(ctx), + NatSpec: ctx.GlobalBool(NatspecEnabledFlag.Name), + NodeKey: GetNodeKey(ctx), + Shh: true, + Dial: true, + BootNodes: ctx.GlobalString(BootnodesFlag.Name), } } -- cgit v1.2.3