diff --git a/pkg/compiler/interop_test.go b/pkg/compiler/interop_test.go index 7bbebe18d..449d45ccb 100644 --- a/pkg/compiler/interop_test.go +++ b/pkg/compiler/interop_test.go @@ -15,7 +15,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/core/dao" "github.com/nspcc-dev/neo-go/pkg/core/interop" "github.com/nspcc-dev/neo-go/pkg/core/native" - "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" + "github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes" "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/storage" "github.com/nspcc-dev/neo-go/pkg/core/transaction" @@ -610,7 +610,7 @@ func TestCallWithVersion(t *testing.T) { e.DeployContract(t, ctr, nil) c := e.CommitteeInvoker(ctr.Hash) - policyH := state.CreateNativeContractHash(nativenames.Policy) + policyH := nativehashes.Policy t.Run("good", func(t *testing.T) { c.Invoke(t, e.Chain.GetBaseExecFee(), "callWithVersion", policyH.BytesBE(), 0, "getExecFeeFactor") }) diff --git a/pkg/core/blockchain_neotest_test.go b/pkg/core/blockchain_neotest_test.go index de7f157f8..2226106f2 100644 --- a/pkg/core/blockchain_neotest_test.go +++ b/pkg/core/blockchain_neotest_test.go @@ -24,6 +24,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/core/interop/interopnames" "github.com/nspcc-dev/neo-go/pkg/core/mempool" "github.com/nspcc-dev/neo-go/pkg/core/native" + "github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes" "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" "github.com/nspcc-dev/neo-go/pkg/core/native/nativeprices" "github.com/nspcc-dev/neo-go/pkg/core/native/noderoles" @@ -2460,7 +2461,7 @@ func TestBlockchain_GenesisTransactionExtension(t *testing.T) { emit.Syscall(script.BinWriter, interopnames.SystemRuntimeCheckWitness) emit.Bytes(script.BinWriter, to.BytesBE()) emit.Syscall(script.BinWriter, interopnames.SystemRuntimeCheckWitness) - emit.AppCall(script.BinWriter, state.CreateNativeContractHash(nativenames.Neo), "transfer", callflag.All, from, to, amount, nil) + emit.AppCall(script.BinWriter, nativehashes.Neo, "transfer", callflag.All, from, to, amount, nil) emit.Opcodes(script.BinWriter, opcode.ASSERT) var sysFee int64 = 1_0000_0000 diff --git a/pkg/rpcclient/gas/gas.go b/pkg/rpcclient/gas/gas.go index 0ea2ca5d4..16f1bb53d 100644 --- a/pkg/rpcclient/gas/gas.go +++ b/pkg/rpcclient/gas/gas.go @@ -8,13 +8,12 @@ package for more details on NEP-17 interface. package gas import ( - "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" - "github.com/nspcc-dev/neo-go/pkg/core/state" + "github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes" "github.com/nspcc-dev/neo-go/pkg/rpcclient/nep17" ) // Hash stores the hash of the native GAS contract. -var Hash = state.CreateNativeContractHash(nativenames.Gas) +var Hash = nativehashes.Gas // NewReader creates a NEP-17 reader for the GAS contract. func NewReader(invoker nep17.Invoker) *nep17.TokenReader { diff --git a/pkg/rpcclient/management/management.go b/pkg/rpcclient/management/management.go index 4862cd8b6..5cc6691fe 100644 --- a/pkg/rpcclient/management/management.go +++ b/pkg/rpcclient/management/management.go @@ -13,7 +13,7 @@ import ( "math/big" "github.com/google/uuid" - "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" + "github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes" "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/neorpc/result" @@ -75,7 +75,7 @@ type HashesIterator struct { } // Hash stores the hash of the native ContractManagement contract. -var Hash = state.CreateNativeContractHash(nativenames.Management) +var Hash = nativehashes.Management // Event is the event emitted on contract deployment/update/destroy. // Even though these events are different they all have the same field inside. diff --git a/pkg/rpcclient/neo/neo.go b/pkg/rpcclient/neo/neo.go index ccb209001..4d8a54aab 100644 --- a/pkg/rpcclient/neo/neo.go +++ b/pkg/rpcclient/neo/neo.go @@ -12,7 +12,7 @@ import ( "math/big" "github.com/google/uuid" - "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" + "github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes" "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" @@ -97,7 +97,7 @@ type ValidatorIterator struct { } // Hash stores the hash of the native NEOToken contract. -var Hash = state.CreateNativeContractHash(nativenames.Neo) +var Hash = nativehashes.Neo // NewReader creates an instance of ContractReader to get data from the NEO // contract. diff --git a/pkg/rpcclient/notary/contract.go b/pkg/rpcclient/notary/contract.go index 7aee271bc..5cd88ff4f 100644 --- a/pkg/rpcclient/notary/contract.go +++ b/pkg/rpcclient/notary/contract.go @@ -13,8 +13,7 @@ import ( "math" "math/big" - "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" - "github.com/nspcc-dev/neo-go/pkg/core/state" + "github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/neorpc/result" "github.com/nspcc-dev/neo-go/pkg/rpcclient/unwrap" @@ -76,7 +75,7 @@ type OnNEP17PaymentData struct { var _ = stackitem.Convertible(&OnNEP17PaymentData{}) // Hash stores the hash of the native Notary contract. -var Hash = state.CreateNativeContractHash(nativenames.Notary) +var Hash = nativehashes.Notary // NewReader creates an instance of ContractReader to get data from the Notary // contract. diff --git a/pkg/rpcclient/oracle/oracle.go b/pkg/rpcclient/oracle/oracle.go index 39a12e023..b3727f36e 100644 --- a/pkg/rpcclient/oracle/oracle.go +++ b/pkg/rpcclient/oracle/oracle.go @@ -9,8 +9,7 @@ package oracle import ( "math/big" - "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" - "github.com/nspcc-dev/neo-go/pkg/core/state" + "github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/neorpc/result" "github.com/nspcc-dev/neo-go/pkg/rpcclient/unwrap" @@ -32,7 +31,7 @@ type Actor interface { } // Hash stores the hash of the native OracleContract contract. -var Hash = state.CreateNativeContractHash(nativenames.Oracle) +var Hash = nativehashes.Oracle const priceSetter = "setPrice" diff --git a/pkg/rpcclient/policy/policy.go b/pkg/rpcclient/policy/policy.go index d578f6273..b2bb59f0a 100644 --- a/pkg/rpcclient/policy/policy.go +++ b/pkg/rpcclient/policy/policy.go @@ -7,8 +7,7 @@ various methods to perform PolicyContract state-changing calls. package policy import ( - "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" - "github.com/nspcc-dev/neo-go/pkg/core/state" + "github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/neorpc/result" "github.com/nspcc-dev/neo-go/pkg/rpcclient/unwrap" @@ -34,7 +33,7 @@ type Actor interface { } // Hash stores the hash of the native PolicyContract contract. -var Hash = state.CreateNativeContractHash(nativenames.Policy) +var Hash = nativehashes.Policy const ( execFeeSetter = "setExecFeeFactor" diff --git a/pkg/rpcclient/rolemgmt/roles.go b/pkg/rpcclient/rolemgmt/roles.go index 5bb8dbb91..770665c8d 100644 --- a/pkg/rpcclient/rolemgmt/roles.go +++ b/pkg/rpcclient/rolemgmt/roles.go @@ -7,9 +7,8 @@ various methods to perform the only RoleManagement state-changing call. package rolemgmt import ( - "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" + "github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes" "github.com/nspcc-dev/neo-go/pkg/core/native/noderoles" - "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/neorpc/result" @@ -32,7 +31,7 @@ type Actor interface { } // Hash stores the hash of the native RoleManagement contract. -var Hash = state.CreateNativeContractHash(nativenames.Designation) +var Hash = nativehashes.Designation const designateMethod = "designateAsRole" diff --git a/pkg/services/rpcsrv/client_test.go b/pkg/services/rpcsrv/client_test.go index f09c43cf3..7b47859f3 100644 --- a/pkg/services/rpcsrv/client_test.go +++ b/pkg/services/rpcsrv/client_test.go @@ -25,6 +25,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/core/block" "github.com/nspcc-dev/neo-go/pkg/core/fee" "github.com/nspcc-dev/neo-go/pkg/core/native" + "github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes" "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" "github.com/nspcc-dev/neo-go/pkg/core/native/noderoles" "github.com/nspcc-dev/neo-go/pkg/core/state" @@ -825,7 +826,7 @@ func TestCalculateNetworkFee(t *testing.T) { require.NoError(t, err) // Set fee per Conflicts attribute. - script, err := smartcontract.CreateCallScript(state.CreateNativeContractHash(nativenames.Policy), "setAttributeFee", byte(transaction.ConflictsT), conflictsFee) + script, err := smartcontract.CreateCallScript(nativehashes.Policy, "setAttributeFee", byte(transaction.ConflictsT), conflictsFee) require.NoError(t, err) txSetFee := transaction.New(script, 1_0000_0000) txSetFee.ValidUntilBlock = chain.BlockHeight() + 1