From 61be78b42af875b43e58eaea502835715600ed64 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Mon, 18 Mar 2019 14:20:47 +0100 Subject: [PATCH 1/3] Adding populus gotcha covering storage costs --- docs/introduction-to-smart-contracts.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst index bfce0d5a3..8675474a7 100644 --- a/docs/introduction-to-smart-contracts.rst +++ b/docs/introduction-to-smart-contracts.rst @@ -388,7 +388,9 @@ Each account has a data area called **storage**, which is persistent between fun and transactions. Storage is a key-value store that maps 256-bit words to 256-bit words. It is not possible to enumerate storage from within a contract and it is -comparatively costly to read, and even more to modify storage. +comparatively costly to read, and even more to modify storage. Because of this cost, +you should minimise what you store in persistent storage to what the contract needs to run. +Store data like derived calculations, caching, and aggregates outside of the contract. A contract can neither read nor write to any storage apart from its own. The second data area is called **memory**, of which a contract obtains From 855555e9414d00a3f48b4f5e18023eb22365643b Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Mon, 18 Mar 2019 14:37:47 +0100 Subject: [PATCH 2/3] Add mention of initialisation cost of storage --- docs/introduction-to-smart-contracts.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst index 8675474a7..087365290 100644 --- a/docs/introduction-to-smart-contracts.rst +++ b/docs/introduction-to-smart-contracts.rst @@ -387,8 +387,8 @@ paragraphs. Each account has a data area called **storage**, which is persistent between function calls and transactions. Storage is a key-value store that maps 256-bit words to 256-bit words. -It is not possible to enumerate storage from within a contract and it is -comparatively costly to read, and even more to modify storage. Because of this cost, +It is not possible to enumerate storage from within a contract, it is +comparatively costly to read, and even more to initialise and modify storage. Because of this cost, you should minimise what you store in persistent storage to what the contract needs to run. Store data like derived calculations, caching, and aggregates outside of the contract. A contract can neither read nor write to any storage apart from its own. From 7f8957c9ea0db9406be31e5cd882982ea9bfbddd Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Mon, 25 Mar 2019 10:59:49 +0100 Subject: [PATCH 3/3] Change to US spelling --- docs/introduction-to-smart-contracts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst index 087365290..0a7ea861e 100644 --- a/docs/introduction-to-smart-contracts.rst +++ b/docs/introduction-to-smart-contracts.rst @@ -389,7 +389,7 @@ and transactions. Storage is a key-value store that maps 256-bit words to 256-bit words. It is not possible to enumerate storage from within a contract, it is comparatively costly to read, and even more to initialise and modify storage. Because of this cost, -you should minimise what you store in persistent storage to what the contract needs to run. +you should minimize what you store in persistent storage to what the contract needs to run. Store data like derived calculations, caching, and aggregates outside of the contract. A contract can neither read nor write to any storage apart from its own.