aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2016-06-18 17:17:57 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-06-22 16:38:25 +0800
commit7a5b571c671e70e0e4807cf971c15e2d1e09d33d (patch)
tree4ae6b6e4be80171e26aab26b88124cd87a3c53d4 /cmd/utils
parent599e3c7b3f22b157c4f643a48d391cf972384099 (diff)
downloadgo-tangerine-7a5b571c671e70e0e4807cf971c15e2d1e09d33d.tar.gz
go-tangerine-7a5b571c671e70e0e4807cf971c15e2d1e09d33d.tar.zst
go-tangerine-7a5b571c671e70e0e4807cf971c15e2d1e09d33d.zip
test, cmd/evm, core, core/vm: illegal code hash implementation
This implements a generic approach to enabling soft forks by allowing anyone to put in hashes of contracts that should not be interacted from. This will help "The DAO" in their endevour to stop any whithdrawals from any DAO contract by convincing the mining community to accept their code hash.
Diffstat (limited to 'cmd/utils')
-rw-r--r--cmd/utils/flags.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 14898b987..802e54c73 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -163,6 +163,10 @@ var (
}
// Miner settings
// TODO: refactor CPU vs GPU mining flags
+ IllegalCodeHashesFlag = cli.StringFlag{
+ Name: "illegal-code-hashes",
+ Usage: "Comma separated list of code-hashes to ignore any interaction from",
+ }
MiningEnabledFlag = cli.BoolFlag{
Name: "mine",
Usage: "Enable mining",
@@ -640,6 +644,16 @@ func MakePasswordList(ctx *cli.Context) []string {
return lines
}
+// ParseIllegalCodeHashes parses a comma separated list of hashes.
+func ParseIllegalCodeHashes(ctx *cli.Context) map[common.Hash]struct{} {
+ splittedHexHashes := strings.Split(ctx.GlobalString(IllegalCodeHashesFlag.Name), ",")
+ illegalCodeHashes := make(map[common.Hash]struct{})
+ for _, hexHash := range splittedHexHashes {
+ illegalCodeHashes[common.HexToHash(strings.TrimSpace(hexHash))] = struct{}{}
+ }
+ return illegalCodeHashes
+}
+
// MakeSystemNode sets up a local node, configures the services to launch and
// assembles the P2P protocol stack.
func MakeSystemNode(name, version string, relconf release.Config, extra []byte, ctx *cli.Context) *node.Node {
@@ -676,6 +690,8 @@ func MakeSystemNode(name, version string, relconf release.Config, extra []byte,
}
// Configure the Ethereum service
accman := MakeAccountManager(ctx)
+ // parse the illegal code hashes and set them to the core package.
+ core.IllegalCodeHashes = ParseIllegalCodeHashes(ctx)
// initialise new random number generator
rand := rand.New(rand.NewSource(time.Now().UnixNano()))