mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 19:42:23 +00:00
core: adjust System.Storage.Put interop
Part of #1055. Maximum storage key len has been changed. Also added maximum storage value len restriction.
This commit is contained in:
parent
b5185d5d1a
commit
47eadcdf2a
1 changed files with 7 additions and 1 deletions
|
@ -23,7 +23,10 @@ import (
|
|||
|
||||
const (
|
||||
// MaxStorageKeyLen is the maximum length of a key for storage items.
|
||||
MaxStorageKeyLen = 1024
|
||||
MaxStorageKeyLen = 64
|
||||
// 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
|
||||
|
@ -363,6 +366,9 @@ func putWithContextAndFlags(ic *interop.Context, v *vm.VM, stc *StorageContext,
|
|||
if len(key) > MaxStorageKeyLen {
|
||||
return errors.New("key is too big")
|
||||
}
|
||||
if len(value) > MaxStorageValueLen {
|
||||
return errors.New("value is too big")
|
||||
}
|
||||
if stc.ReadOnly {
|
||||
return errors.New("StorageContext is read only")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue