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