diff --git a/manager/burrow-mint/evm/native.go b/manager/burrow-mint/evm/native.go index ab4e32074c1eb459da62275a78778d6b01a2c17e..17478055c1ad61d55ec150cbf1f8028c900370f3 100644 --- a/manager/burrow-mint/evm/native.go +++ b/manager/burrow-mint/evm/native.go @@ -24,8 +24,8 @@ import ( var registeredNativeContracts = make(map[Word256]NativeContract) -func RegisteredNativeContract(addr Word256) bool { - _, ok := registeredNativeContracts[addr] +func RegisteredNativeContract(address Word256) bool { + _, ok := registeredNativeContracts[address] return ok } diff --git a/manager/burrow-mint/evm/snative.go b/manager/burrow-mint/evm/snative.go index 37e1031c34ced1480c53a39ccbb26fdec475d42b..ab7e68a432374030f512d88d8c91129ba940358d 100644 --- a/manager/burrow-mint/evm/snative.go +++ b/manager/burrow-mint/evm/snative.go @@ -165,7 +165,7 @@ func SNativeContracts() map[string]*SNativeContractDescription { []abi.Arg{ arg("_account", abi.AddressTypeName), arg("_permission", permFlagTypeName)}, - ret("result", permFlagTypeName), + ret("result", abi.BoolTypeName), ptypes.HasBase, hasBase}, diff --git a/manager/burrow-mint/pipe.go b/manager/burrow-mint/pipe.go index e81fa8a3c4a9e16202b8a107c317d87520d4bc13..7091058285a45cb2f1de36770d1910bffc0449f6 100644 --- a/manager/burrow-mint/pipe.go +++ b/manager/burrow-mint/pipe.go @@ -409,6 +409,11 @@ func (pipe *burrowMintPipe) DumpStorage(address []byte) (*rpc_tm_types.ResultDum // TODO: [ben] resolve incompatibilities in byte representation for 0.12.0 release func (pipe *burrowMintPipe) Call(fromAddress, toAddress, data []byte) (*rpc_tm_types.ResultCall, error) { + if vm.RegisteredNativeContract(word256.LeftPadWord256(toAddress)) { + return nil, fmt.Errorf("Attempt to call native contract at address "+ + "%X, but native contracts can not be called directly. Use a deployed "+ + "contract that calls the native function instead.", toAddress) + } st := pipe.burrowMint.GetState() cache := state.NewBlockCache(st) outAcc := cache.GetAccount(toAddress) diff --git a/manager/burrow-mint/state/execution.go b/manager/burrow-mint/state/execution.go index 9fc20e55dcfdfea1d91a4c43ba4ec26e21fb7a28..edda1cb7f0cf5d227d751c56b0391708982ef5bf 100644 --- a/manager/burrow-mint/state/execution.go +++ b/manager/burrow-mint/state/execution.go @@ -431,7 +431,10 @@ func ExecTx(blockCache *BlockCache, tx txs.Tx, runCall bool, evc events.Fireable } // check if its a native contract if vm.RegisteredNativeContract(LeftPadWord256(tx.Address)) { - return fmt.Errorf("NativeContracts can not be called using CallTx. Use a contract or the appropriate tx type (eg. PermissionsTx, NameTx)") + return fmt.Errorf("Attempt to call a native contract at %X, "+ + "but native contracts cannot be called using CallTx. Use a "+ + "contract that calls the native contract or the appropriate tx "+ + "type (eg. PermissionsTx, NameTx).", tx.Address) } // Output account may be nil if we are still in mempool and contract was created in same block as this tx