Skip to content
Snippets Groups Projects
Unverified Commit 9e141fa0 authored by Silas Davis's avatar Silas Davis Committed by RJ Catalano
Browse files

add error on EXTCODECOPY native contract and fix One256 push

parent fed9a153
No related branches found
No related tags found
No related merge requests found
......@@ -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 {
......@@ -571,8 +571,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))
......@@ -586,10 +586,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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment