mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 13:41:37 +00:00
Merge pull request #1520 from nspcc-dev/tune-some-limits
Tune some limits
This commit is contained in:
commit
bdd073aad7
16 changed files with 31 additions and 13 deletions
|
@ -1,5 +1,6 @@
|
|||
ProtocolConfiguration:
|
||||
Magic: 5195086
|
||||
MaxTraceableBlocks: 2102400
|
||||
SecondsPerBlock: 15
|
||||
MemPoolSize: 50000
|
||||
StandbyCommittee:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
ProtocolConfiguration:
|
||||
Magic: 56753
|
||||
MaxTraceableBlocks: 200000
|
||||
SecondsPerBlock: 15
|
||||
MemPoolSize: 50000
|
||||
StandbyCommittee:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
ProtocolConfiguration:
|
||||
Magic: 56753
|
||||
MaxTraceableBlocks: 200000
|
||||
SecondsPerBlock: 15
|
||||
MemPoolSize: 50000
|
||||
StandbyCommittee:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
ProtocolConfiguration:
|
||||
Magic: 56753
|
||||
MaxTraceableBlocks: 200000
|
||||
SecondsPerBlock: 1
|
||||
MemPoolSize: 50000
|
||||
StandbyCommittee:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
ProtocolConfiguration:
|
||||
Magic: 56753
|
||||
MaxTraceableBlocks: 200000
|
||||
SecondsPerBlock: 15
|
||||
MemPoolSize: 50000
|
||||
StandbyCommittee:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
ProtocolConfiguration:
|
||||
Magic: 56753
|
||||
MaxTraceableBlocks: 200000
|
||||
SecondsPerBlock: 15
|
||||
MemPoolSize: 50000
|
||||
StandbyCommittee:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
ProtocolConfiguration:
|
||||
Magic: 56753
|
||||
MaxTraceableBlocks: 200000
|
||||
SecondsPerBlock: 15
|
||||
MemPoolSize: 50000
|
||||
StandbyCommittee:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
ProtocolConfiguration:
|
||||
Magic: 1951352142
|
||||
MaxTraceableBlocks: 2102400
|
||||
SecondsPerBlock: 15
|
||||
MemPoolSize: 50000
|
||||
StandbyCommittee:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
ProtocolConfiguration:
|
||||
Magic: 42
|
||||
MaxTraceableBlocks: 200000
|
||||
SecondsPerBlock: 1
|
||||
MemPoolSize: 100
|
||||
StandbyCommittee:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
ProtocolConfiguration:
|
||||
Magic: 42
|
||||
MaxTraceableBlocks: 200000
|
||||
SecondsPerBlock: 15
|
||||
MemPoolSize: 50000
|
||||
StandbyCommittee:
|
||||
|
|
|
@ -9,6 +9,8 @@ type (
|
|||
ProtocolConfiguration struct {
|
||||
Magic netmode.Magic `yaml:"Magic"`
|
||||
MemPoolSize int `yaml:"MemPoolSize"`
|
||||
// MaxTraceableBlocks is the length of the chain accessible to smart contracts.
|
||||
MaxTraceableBlocks uint32 `yaml:"MaxTraceableBlocks"`
|
||||
// P2PSigExtensions enables additional signature-related transaction attributes
|
||||
P2PSigExtensions bool `yaml:"P2PSigExtensions"`
|
||||
// ReservedAttributes allows to have reserved attributes range for experimental or private purposes.
|
||||
|
|
|
@ -40,8 +40,9 @@ const (
|
|||
headerBatchCount = 2000
|
||||
version = "0.1.0"
|
||||
|
||||
defaultMemPoolSize = 50000
|
||||
verificationGasLimit = 100000000 // 1 GAS
|
||||
defaultMemPoolSize = 50000
|
||||
defaultMaxTraceableBlocks = 2102400 // 1 year of 15s blocks
|
||||
verificationGasLimit = 100000000 // 1 GAS
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -148,6 +149,10 @@ func NewBlockchain(s storage.Store, cfg config.ProtocolConfiguration, log *zap.L
|
|||
cfg.MemPoolSize = defaultMemPoolSize
|
||||
log.Info("mempool size is not set or wrong, setting default value", zap.Int("MemPoolSize", cfg.MemPoolSize))
|
||||
}
|
||||
if cfg.MaxTraceableBlocks == 0 {
|
||||
cfg.MaxTraceableBlocks = defaultMaxTraceableBlocks
|
||||
log.Info("MaxTraceableBlocks is not set or wrong, using default value", zap.Uint32("MaxTraceableBlocks", cfg.MaxTraceableBlocks))
|
||||
}
|
||||
committee, err := committeeFromConfig(cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -924,7 +924,7 @@ func TestSubscriptions(t *testing.T) {
|
|||
txGood1 := transaction.New(netmode.UnitTestNet, script.Bytes(), 0)
|
||||
txGood1.Signers = []transaction.Signer{{Account: neoOwner}}
|
||||
txGood1.Nonce = 1
|
||||
txGood1.ValidUntilBlock = 100500
|
||||
txGood1.ValidUntilBlock = 1024
|
||||
require.NoError(t, signTx(bc, txGood1))
|
||||
|
||||
// Reset() reuses the script buffer and we need to keep scripts.
|
||||
|
@ -936,7 +936,7 @@ func TestSubscriptions(t *testing.T) {
|
|||
txBad := transaction.New(netmode.UnitTestNet, script.Bytes(), 0)
|
||||
txBad.Signers = []transaction.Signer{{Account: neoOwner}}
|
||||
txBad.Nonce = 2
|
||||
txBad.ValidUntilBlock = 100500
|
||||
txBad.ValidUntilBlock = 1024
|
||||
require.NoError(t, signTx(bc, txBad))
|
||||
|
||||
script = io.NewBufBinWriter()
|
||||
|
@ -946,7 +946,7 @@ func TestSubscriptions(t *testing.T) {
|
|||
txGood2 := transaction.New(netmode.UnitTestNet, script.Bytes(), 0)
|
||||
txGood2.Signers = []transaction.Signer{{Account: neoOwner}}
|
||||
txGood2.Nonce = 3
|
||||
txGood2.ValidUntilBlock = 100500
|
||||
txGood2.ValidUntilBlock = 1024
|
||||
require.NoError(t, signTx(bc, txGood2))
|
||||
|
||||
invBlock := newBlock(bc.config, bc.BlockHeight()+1, bc.CurrentHeaderHash(), txGood1, txBad, txGood2)
|
||||
|
|
|
@ -26,9 +26,6 @@ const (
|
|||
// MaxStorageValueLen is the maximum length of a value for storage items.
|
||||
// It is set to be the maximum value for uint16.
|
||||
MaxStorageValueLen = 65535
|
||||
// MaxTraceableBlocks is the maximum number of blocks before current chain
|
||||
// height we're able to give information about.
|
||||
MaxTraceableBlocks = transaction.MaxValidUntilBlockIncrement
|
||||
// MaxEventNameLen is the maximum length of a name for event.
|
||||
MaxEventNameLen = 32
|
||||
// MaxNotificationSize is the maximum length of a runtime log message.
|
||||
|
@ -155,6 +152,7 @@ func getTransactionAndHeight(cd *dao.Cached, v *vm.VM) (*transaction.Transaction
|
|||
// the block with index specified.
|
||||
func isTraceableBlock(ic *interop.Context, index uint32) bool {
|
||||
height := ic.Chain.BlockHeight()
|
||||
MaxTraceableBlocks := ic.Chain.GetConfig().MaxTraceableBlocks
|
||||
return index <= height && index+MaxTraceableBlocks > height
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package transaction
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"math"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/io"
|
||||
)
|
||||
|
@ -16,7 +17,8 @@ type OracleResponse struct {
|
|||
Result []byte `json:"result"`
|
||||
}
|
||||
|
||||
const maxResultSize = 1024
|
||||
// MaxOracleResultSize is the maximum allowed oracle answer size.
|
||||
const MaxOracleResultSize = math.MaxUint16
|
||||
|
||||
// Enumeration of possible oracle response types.
|
||||
const (
|
||||
|
@ -46,7 +48,7 @@ func (r *OracleResponse) DecodeBinary(br *io.BinReader) {
|
|||
br.Err = ErrInvalidResponseCode
|
||||
return
|
||||
}
|
||||
r.Result = br.ReadVarBytes(maxResultSize)
|
||||
r.Result = br.ReadVarBytes(MaxOracleResultSize)
|
||||
if r.Code != Success && len(r.Result) > 0 {
|
||||
br.Err = ErrInvalidResult
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@ const (
|
|||
// MaxTransactionSize is the upper limit size in bytes that a transaction can reach. It is
|
||||
// set to be 102400.
|
||||
MaxTransactionSize = 102400
|
||||
// MaxValidUntilBlockIncrement is the upper increment size of blockhain height in blocs after
|
||||
// exceeding that a transaction should fail validation. It is set to be 2102400.
|
||||
MaxValidUntilBlockIncrement = 2102400
|
||||
// MaxValidUntilBlockIncrement is the upper increment size of blockhain height in blocks
|
||||
// exceeding that a transaction should fail validation. It is set to estimated daily number
|
||||
// of blocks with 15s interval.
|
||||
MaxValidUntilBlockIncrement = 5760
|
||||
// MaxAttributes is maximum number of attributes including signers that can be contained
|
||||
// within a transaction. It is set to be 16.
|
||||
MaxAttributes = 16
|
||||
|
|
Loading…
Reference in a new issue