Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2 from silasdavis/fixesSNativeCallsFromSolc
Browse files Browse the repository at this point in the history
Add error on EXTCODECOPY native contract and fix One256 push
  • Loading branch information
RJ Catalano authored Feb 8, 2017
2 parents e76a92f + a26f913 commit 8dcb9d0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions manager/eris-mint/evm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
ErrDataStackOverflow = errors.New("Data stack overflow")
ErrDataStackUnderflow = errors.New("Data stack underflow")
ErrInvalidContract = errors.New("Invalid contract")
ErrNativeContractCodeCopy = errors.New("Tried to copy native contract code, but this is not supported")
ErrNativeContractCodeCopy = errors.New("Tried to copy native contract code")
)

type ErrPermission struct {
Expand Down Expand Up @@ -569,8 +569,8 @@ func (vm *VM) call(caller, callee *Account, code, input []byte, value int64, gas
if _, ok := registeredNativeContracts[addr]; !ok {
return nil, firstErr(err, ErrUnknownAddress)
}
stack.Push64(int64(One256))
dbg.Printf(" => Hit native contract\n\n")
dbg.Printf(" => returning code size of 1 to indicated existence of native contract at %X\n", addr)
stack.Push(One256)
} else {
code := acc.Code
l := int64(len(code))
Expand All @@ -584,10 +584,11 @@ func (vm *VM) call(caller, callee *Account, code, input []byte, value int64, gas
}
acc := vm.appState.GetAccount(addr)
if acc == nil {
if _, ok := registeredNativeContracts[addr]; !ok {
return nil, firstErr(err, ErrUnknownAddress)
if _, ok := registeredNativeContracts[addr]; ok {
dbg.Printf(" => attempted to copy native contract at %X but this is not supported\n", addr)
return nil, firstErr(err, ErrNativeContractCodeCopy)
}
return nil, firstErr(err, ErrNativeContractCodeCopy)
return nil, firstErr(err, ErrUnknownAddress)
}
code := acc.Code
memOff := stack.Pop64()
Expand Down

0 comments on commit 8dcb9d0

Please sign in to comment.