From aae312d408fff87eaef69a51159b5713e8c6b54a Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 16 Jun 2020 11:00:19 +0300 Subject: [PATCH] core,vm: adjust prices for iterator/enumerator syscalls Closes #1027. --- pkg/core/interops.go | 18 +++++++++--------- pkg/vm/interop.go | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pkg/core/interops.go b/pkg/core/interops.go index 12e7761cb..326b5f3c4 100644 --- a/pkg/core/interops.go +++ b/pkg/core/interops.go @@ -92,19 +92,19 @@ var systemInterops = []interop.Function{ AllowedTriggers: trigger.Application, RequiredFlags: smartcontract.AllowModifyStates}, {Name: "System.Contract.Update", Func: contractUpdate, Price: 0, AllowedTriggers: trigger.Application, RequiredFlags: smartcontract.AllowModifyStates}, - {Name: "System.Enumerator.Concat", Func: enumerator.Concat, Price: 1}, - {Name: "System.Enumerator.Create", Func: enumerator.Create, Price: 1}, - {Name: "System.Enumerator.Next", Func: enumerator.Next, Price: 1}, - {Name: "System.Enumerator.Value", Func: enumerator.Value, Price: 1}, + {Name: "System.Enumerator.Concat", Func: enumerator.Concat, Price: 400}, + {Name: "System.Enumerator.Create", Func: enumerator.Create, Price: 400}, + {Name: "System.Enumerator.Next", Func: enumerator.Next, Price: 1000000}, + {Name: "System.Enumerator.Value", Func: enumerator.Value, Price: 400}, {Name: "System.ExecutionEngine.GetCallingScriptHash", Func: engineGetCallingScriptHash, Price: 1}, {Name: "System.ExecutionEngine.GetEntryScriptHash", Func: engineGetEntryScriptHash, Price: 1}, {Name: "System.ExecutionEngine.GetExecutingScriptHash", Func: engineGetExecutingScriptHash, Price: 1}, {Name: "System.ExecutionEngine.GetScriptContainer", Func: engineGetScriptContainer, Price: 1}, - {Name: "System.Iterator.Concat", Func: iterator.Concat, Price: 1}, - {Name: "System.Iterator.Create", Func: iterator.Create, Price: 1}, - {Name: "System.Iterator.Key", Func: iterator.Key, Price: 1}, - {Name: "System.Iterator.Keys", Func: iterator.Keys, Price: 1}, - {Name: "System.Iterator.Values", Func: iterator.Values, Price: 1}, + {Name: "System.Iterator.Concat", Func: iterator.Concat, Price: 400}, + {Name: "System.Iterator.Create", Func: iterator.Create, Price: 400}, + {Name: "System.Iterator.Key", Func: iterator.Key, Price: 400}, + {Name: "System.Iterator.Keys", Func: iterator.Keys, Price: 400}, + {Name: "System.Iterator.Values", Func: iterator.Values, Price: 400}, {Name: "System.Runtime.CheckWitness", Func: runtime.CheckWitness, Price: 200, RequiredFlags: smartcontract.AllowStates}, {Name: "System.Runtime.GetTime", Func: runtimeGetTime, Price: 1, AllowedTriggers: trigger.Application, RequiredFlags: smartcontract.AllowStates}, diff --git a/pkg/vm/interop.go b/pkg/vm/interop.go index 70526f85a..7020124bb 100644 --- a/pkg/vm/interop.go +++ b/pkg/vm/interop.go @@ -44,23 +44,23 @@ var defaultVMInterops = []interopIDFuncPrice{ {emit.InteropNameToID([]byte("System.Runtime.Notify")), InteropFuncPrice{Func: runtimeNotify, Price: 1}}, {emit.InteropNameToID([]byte("System.Enumerator.Create")), - InteropFuncPrice{Func: EnumeratorCreate, Price: 1}}, + InteropFuncPrice{Func: EnumeratorCreate, Price: 400}}, {emit.InteropNameToID([]byte("System.Enumerator.Next")), - InteropFuncPrice{Func: EnumeratorNext, Price: 1}}, + InteropFuncPrice{Func: EnumeratorNext, Price: 1000000}}, {emit.InteropNameToID([]byte("System.Enumerator.Concat")), - InteropFuncPrice{Func: EnumeratorConcat, Price: 1}}, + InteropFuncPrice{Func: EnumeratorConcat, Price: 400}}, {emit.InteropNameToID([]byte("System.Enumerator.Value")), - InteropFuncPrice{Func: EnumeratorValue, Price: 1}}, + InteropFuncPrice{Func: EnumeratorValue, Price: 400}}, {emit.InteropNameToID([]byte("System.Iterator.Create")), - InteropFuncPrice{Func: IteratorCreate, Price: 1}}, + InteropFuncPrice{Func: IteratorCreate, Price: 400}}, {emit.InteropNameToID([]byte("System.Iterator.Concat")), - InteropFuncPrice{Func: IteratorConcat, Price: 1}}, + InteropFuncPrice{Func: IteratorConcat, Price: 400}}, {emit.InteropNameToID([]byte("System.Iterator.Key")), - InteropFuncPrice{Func: IteratorKey, Price: 1}}, + InteropFuncPrice{Func: IteratorKey, Price: 400}}, {emit.InteropNameToID([]byte("System.Iterator.Keys")), - InteropFuncPrice{Func: IteratorKeys, Price: 1}}, + InteropFuncPrice{Func: IteratorKeys, Price: 400}}, {emit.InteropNameToID([]byte("System.Iterator.Values")), - InteropFuncPrice{Func: IteratorValues, Price: 1}}, + InteropFuncPrice{Func: IteratorValues, Price: 400}}, } func getDefaultVMInterop(id uint32) *InteropFuncPrice {