diff --git a/pkg/compiler/native_test.go b/pkg/compiler/native_test.go index d964ecfc0..a57a343b5 100644 --- a/pkg/compiler/native_test.go +++ b/pkg/compiler/native_test.go @@ -260,7 +260,11 @@ func testContractCall(t *testing.T, hash util.Uint160, md interop.MethodAndPrice require.Equal(t, md.MD.Name, method) fs := callflag.CallFlag(int32(v.Estack().Pop().BigInt().Int64())) - require.Equal(t, md.RequiredFlags, fs) + extended := md.RequiredFlags // In some (all?) cases it's desirable to have Read permissions where Write is also allowed. + if md.RequiredFlags&callflag.WriteStates != 0 { + extended |= callflag.ReadStates + } + require.True(t, fs == md.RequiredFlags || fs == extended) args := v.Estack().Pop().Array() require.Equal(t, len(md.MD.Parameters), len(args)) diff --git a/pkg/interop/native/gas/gas.go b/pkg/interop/native/gas/gas.go index 289dd148a..226961c68 100644 --- a/pkg/interop/native/gas/gas.go +++ b/pkg/interop/native/gas/gas.go @@ -31,5 +31,5 @@ func BalanceOf(addr interop.Hash160) int { // Transfer represents `transfer` method of GAS native contract. func Transfer(from, to interop.Hash160, amount int, data interface{}) bool { return contract.Call(interop.Hash160(Hash), "transfer", - contract.WriteStates|contract.AllowCall|contract.AllowNotify, from, to, amount, data).(bool) + contract.All, from, to, amount, data).(bool) } diff --git a/pkg/interop/native/nameservice/name_service.go b/pkg/interop/native/nameservice/name_service.go index 445cd55a1..9d5e16e6c 100644 --- a/pkg/interop/native/nameservice/name_service.go +++ b/pkg/interop/native/nameservice/name_service.go @@ -65,7 +65,7 @@ func TokensOf(addr interop.Hash160) iterator.Iterator { // Transfer represents `transfer` method of NameService native contract. func Transfer(to interop.Hash160, tokenID string) bool { return contract.Call(interop.Hash160(Hash), "transfer", - contract.WriteStates|contract.AllowNotify, to, tokenID).(bool) + contract.ReadStates|contract.WriteStates|contract.AllowNotify, to, tokenID).(bool) } // AddRoot represents `addRoot` method of NameService native contract. diff --git a/pkg/interop/native/neo/neo.go b/pkg/interop/native/neo/neo.go index b0ff66f78..ce2760f92 100644 --- a/pkg/interop/native/neo/neo.go +++ b/pkg/interop/native/neo/neo.go @@ -31,7 +31,7 @@ func BalanceOf(addr interop.Hash160) int { // Transfer represents `transfer` method of NEO native contract. func Transfer(from, to interop.Hash160, amount int, data interface{}) bool { return contract.Call(interop.Hash160(Hash), "transfer", - contract.WriteStates|contract.AllowCall|contract.AllowNotify, from, to, amount, data).(bool) + contract.All, from, to, amount, data).(bool) } // GetCommittee represents `getCommittee` method of NEO native contract.