Merge pull request #1703 from nspcc-dev/initials_for_natives

core: store native contracts' initial values in the DB
This commit is contained in:
Roman Khimov 2021-02-05 15:32:05 +03:00 committed by GitHub
commit cdfc7fc8fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 180 additions and 123 deletions

View file

@ -195,23 +195,23 @@ func TestStoragePut(t *testing.T) {
}
t.Run("create, not enough gas", func(t *testing.T) {
initVM(t, []byte{1}, []byte{2, 3}, 2*native.StoragePrice)
initVM(t, []byte{1}, []byte{2, 3}, 2*native.DefaultStoragePrice)
err := storagePut(ic)
require.True(t, errors.Is(err, errGasLimitExceeded), "got: %v", err)
})
initVM(t, []byte{4}, []byte{5, 6}, 3*native.StoragePrice)
initVM(t, []byte{4}, []byte{5, 6}, 3*native.DefaultStoragePrice)
require.NoError(t, storagePut(ic))
t.Run("update", func(t *testing.T) {
t.Run("not enough gas", func(t *testing.T) {
initVM(t, []byte{4}, []byte{5, 6, 7, 8}, native.StoragePrice)
initVM(t, []byte{4}, []byte{5, 6, 7, 8}, native.DefaultStoragePrice)
err := storagePut(ic)
require.True(t, errors.Is(err, errGasLimitExceeded), "got: %v", err)
})
initVM(t, []byte{4}, []byte{5, 6, 7, 8}, 3*native.StoragePrice)
initVM(t, []byte{4}, []byte{5, 6, 7, 8}, 3*native.DefaultStoragePrice)
require.NoError(t, storagePut(ic))
initVM(t, []byte{4}, []byte{5, 6}, native.StoragePrice)
initVM(t, []byte{4}, []byte{5, 6}, native.DefaultStoragePrice)
require.NoError(t, storagePut(ic))
})