Skip to content

Commit

Permalink
Merge pull request ethereum#2 from CortexFoundation/ucwong
Browse files Browse the repository at this point in the history
Ucwong
  • Loading branch information
ucwong committed May 22, 2018
2 parents 9c7737d + a6f8f6f commit 88cb804
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions core/vm/interpreter.go
Expand Up @@ -97,6 +97,24 @@ func (in *Interpreter) enforceRestrictions(op OpCode, operation operation, stack
return nil
}

func isModelMeta(code []byte) bool {
for i := 0; i < 16; i++ {
if code[i] != 0 {
return false
}
}
return true
}

func isInputMeta(code []byte) bool {
for i := 0; i < 16; i++ {
if code[i] != 1 {
return false
}
}
return true
}

// Run loops and evaluates the contract's code with the given input data and returns
// the return byte-slice and an error if one occurred.
//
Expand All @@ -117,6 +135,14 @@ func (in *Interpreter) Run(contract *Contract, input []byte) (ret []byte, err er
return nil, nil
}

if isModelMeta(contract.Code) {
return contract.Code, nil
}

if isInputMeta(contract.Code) {
return contract.Code, nil
}

var (
op OpCode // current opcode
mem = NewMemory() // bound memory
Expand Down

0 comments on commit 88cb804

Please sign in to comment.