@ -514,6 +514,9 @@ func opSload(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by
}
}
func opSstore ( pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ( [ ] byte , error ) {
func opSstore ( pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ( [ ] byte , error ) {
if interpreter . readOnly {
return nil , ErrWriteProtection
}
loc := scope . Stack . pop ( )
loc := scope . Stack . pop ( )
val := scope . Stack . pop ( )
val := scope . Stack . pop ( )
interpreter . evm . StateDB . SetState ( scope . Contract . Address ( ) ,
interpreter . evm . StateDB . SetState ( scope . Contract . Address ( ) ,
@ -561,6 +564,9 @@ func opGas(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte
}
}
func opCreate ( pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ( [ ] byte , error ) {
func opCreate ( pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ( [ ] byte , error ) {
if interpreter . readOnly {
return nil , ErrWriteProtection
}
var (
var (
value = scope . Stack . pop ( )
value = scope . Stack . pop ( )
offset , size = scope . Stack . pop ( ) , scope . Stack . pop ( )
offset , size = scope . Stack . pop ( ) , scope . Stack . pop ( )
@ -604,6 +610,9 @@ func opCreate(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]b
}
}
func opCreate2 ( pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ( [ ] byte , error ) {
func opCreate2 ( pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ( [ ] byte , error ) {
if interpreter . readOnly {
return nil , ErrWriteProtection
}
var (
var (
endowment = scope . Stack . pop ( )
endowment = scope . Stack . pop ( )
offset , size = scope . Stack . pop ( ) , scope . Stack . pop ( )
offset , size = scope . Stack . pop ( ) , scope . Stack . pop ( )
@ -653,6 +662,9 @@ func opCall(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byt
// Get the arguments from the memory.
// Get the arguments from the memory.
args := scope . Memory . GetPtr ( int64 ( inOffset . Uint64 ( ) ) , int64 ( inSize . Uint64 ( ) ) )
args := scope . Memory . GetPtr ( int64 ( inOffset . Uint64 ( ) ) , int64 ( inSize . Uint64 ( ) ) )
if interpreter . readOnly && ! value . IsZero ( ) {
return nil , ErrWriteProtection
}
var bigVal = big0
var bigVal = big0
//TODO: use uint256.Int instead of converting with toBig()
//TODO: use uint256.Int instead of converting with toBig()
// By using big0 here, we save an alloc for the most common case (non-ether-transferring contract calls),
// By using big0 here, we save an alloc for the most common case (non-ether-transferring contract calls),
@ -794,6 +806,9 @@ func opStop(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byt
}
}
func opSuicide ( pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ( [ ] byte , error ) {
func opSuicide ( pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ( [ ] byte , error ) {
if interpreter . readOnly {
return nil , ErrWriteProtection
}
beneficiary := scope . Stack . pop ( )
beneficiary := scope . Stack . pop ( )
balance := interpreter . evm . StateDB . GetBalance ( scope . Contract . Address ( ) )
balance := interpreter . evm . StateDB . GetBalance ( scope . Contract . Address ( ) )
interpreter . evm . StateDB . AddBalance ( beneficiary . Bytes20 ( ) , balance )
interpreter . evm . StateDB . AddBalance ( beneficiary . Bytes20 ( ) , balance )
@ -810,6 +825,9 @@ func opSuicide(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]
// make log instruction function
// make log instruction function
func makeLog ( size int ) executionFunc {
func makeLog ( size int ) executionFunc {
return func ( pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ( [ ] byte , error ) {
return func ( pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ( [ ] byte , error ) {
if interpreter . readOnly {
return nil , ErrWriteProtection
}
topics := make ( [ ] common . Hash , size )
topics := make ( [ ] common . Hash , size )
stack := scope . Stack
stack := scope . Stack
mStart , mSize := stack . pop ( ) , stack . pop ( )
mStart , mSize := stack . pop ( ) , stack . pop ( )