Merge pull request #1538 from nspcc-dev/core/opcodes-prices

core: update opcodes prices
This commit is contained in:
Roman Khimov 2020-11-12 14:30:55 +03:00 committed by GitHub
commit e664657c8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View file

@ -89,7 +89,7 @@ var prices = map[opcode.Opcode]int64{
opcode.REVERSE4: 60,
opcode.REVERSEN: 400,
opcode.INITSSLOT: 400,
opcode.INITSLOT: 800,
opcode.INITSLOT: 1600,
opcode.LDSFLD0: 60,
opcode.LDSFLD1: 60,
opcode.LDSFLD2: 60,
@ -148,8 +148,8 @@ var prices = map[opcode.Opcode]int64{
opcode.AND: 200,
opcode.OR: 200,
opcode.XOR: 200,
opcode.EQUAL: 200,
opcode.NOTEQUAL: 200,
opcode.EQUAL: 1000,
opcode.NOTEQUAL: 1000,
opcode.SIGN: 100,
opcode.ABS: 100,
opcode.NEGATE: 100,
@ -175,8 +175,8 @@ var prices = map[opcode.Opcode]int64{
opcode.MIN: 200,
opcode.MAX: 200,
opcode.WITHIN: 200,
opcode.PACK: 7000,
opcode.UNPACK: 7000,
opcode.PACK: 15000,
opcode.UNPACK: 15000,
opcode.NEWARRAY0: 400,
opcode.NEWARRAY: 15000,
opcode.NEWARRAYT: 15000,
@ -186,11 +186,11 @@ var prices = map[opcode.Opcode]int64{
opcode.SIZE: 150,
opcode.HASKEY: 270000,
opcode.KEYS: 500,
opcode.VALUES: 7000,
opcode.VALUES: 270000,
opcode.PICKITEM: 270000,
opcode.APPEND: 15000,
opcode.APPEND: 270000,
opcode.SETITEM: 270000,
opcode.REVERSEITEMS: 500,
opcode.REVERSEITEMS: 270000,
opcode.REMOVE: 500,
opcode.CLEARITEMS: 400,
opcode.ISNULL: 60,

View file

@ -175,15 +175,15 @@ func TestNativeContract_Invoke(t *testing.T) {
w := io.NewBufBinWriter()
emit.AppCallWithOperationAndArgs(w.BinWriter, tn.Metadata().Hash, "sum", int64(14), int64(28))
script := w.Bytes()
// System.Contract.Call + "sum" itself + opcodes for pushing arguments (PACK is 7000)
tx := transaction.New(chain.GetConfig().Magic, script, testSumPrice*2+10000)
// System.Contract.Call + "sum" itself + opcodes for pushing arguments (PACK is 15000)
tx := transaction.New(chain.GetConfig().Magic, script, testSumPrice*2+18000)
validUntil := chain.blockHeight + 1
tx.ValidUntilBlock = validUntil
addSigners(tx)
require.NoError(t, signTx(chain, tx))
// Enough for Call and other opcodes, but not enough for "sum" call.
tx2 := transaction.New(chain.GetConfig().Magic, script, testSumPrice*2)
tx2 := transaction.New(chain.GetConfig().Magic, script, testSumPrice*2+8000)
tx2.ValidUntilBlock = chain.blockHeight + 1
addSigners(tx2)
require.NoError(t, signTx(chain, tx2))
@ -290,7 +290,7 @@ func TestNativeContract_InvokeOtherContract(t *testing.T) {
emit.AppCallWithOperationAndArgs(w.BinWriter, tn.Metadata().Hash, "callOtherContractWithArg", chain.contracts.Policy.Hash, "setFeePerByte", int64(500))
require.NoError(t, w.Err)
script := w.Bytes()
tx := transaction.New(chain.GetConfig().Magic, script, testSumPrice*5+10000)
tx := transaction.New(chain.GetConfig().Magic, script, testSumPrice*5+18000)
validUntil := chain.blockHeight + 1
tx.ValidUntilBlock = validUntil
addSigners(tx)
@ -368,7 +368,7 @@ func TestAllContractsHaveName(t *testing.T) {
emit.AppCallWithOperationAndArgs(w.BinWriter, c.Metadata().Hash, "name")
require.NoError(t, w.Err)
tx := transaction.New(netmode.UnitTestNet, w.Bytes(), 1007570)
tx := transaction.New(netmode.UnitTestNet, w.Bytes(), 1015570)
tx.ValidUntilBlock = bc.blockHeight + 1
addSigners(tx)
require.NoError(t, signTx(bc, tx))