mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Refactor storageSizeUpperBound.
This commit is contained in:
@@ -59,7 +59,6 @@ using BoolResult = util::Result<bool>;
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
bigint storageSizeUpperBound(frontend::Type const& _type);
|
||||
std::vector<frontend::Type const*> oversizedSubtypes(frontend::Type const& _type);
|
||||
|
||||
inline rational makeRational(bigint const& _numerator, bigint const& _denominator)
|
||||
@@ -251,6 +250,10 @@ public:
|
||||
/// @returns the number of storage slots required to hold this value in storage.
|
||||
/// For dynamically "allocated" types, it returns the size of the statically allocated head,
|
||||
virtual u256 storageSize() const { return 1; }
|
||||
/// @returns an upper bound on the total storage size required by this type, descending
|
||||
/// into structs and statically-sized arrays. This is mainly to ensure that the storage
|
||||
/// slot allocation algorithm does not overflow, it is not a protection against collisions.
|
||||
virtual bigint storageSizeUpperBound() const { return 1; }
|
||||
/// Multiple small types can be packed into a single storage slot. If such a packing is possible
|
||||
/// this function @returns the size in bytes smaller than 32. Data is moved to the next slot if
|
||||
/// it does not fit.
|
||||
@@ -788,6 +791,7 @@ public:
|
||||
unsigned calldataEncodedTailSize() const override;
|
||||
bool isDynamicallySized() const override { return m_hasDynamicLength; }
|
||||
bool isDynamicallyEncoded() const override;
|
||||
bigint storageSizeUpperBound() const override;
|
||||
u256 storageSize() const override;
|
||||
bool canLiveOutsideStorage() const override { return m_baseType->canLiveOutsideStorage(); }
|
||||
bool nameable() const override { return true; }
|
||||
@@ -952,6 +956,7 @@ public:
|
||||
unsigned calldataEncodedTailSize() const override;
|
||||
bool isDynamicallyEncoded() const override;
|
||||
u256 memoryDataSize() const override;
|
||||
bigint storageSizeUpperBound() const override;
|
||||
u256 storageSize() const override;
|
||||
bool canLiveOutsideStorage() const override { return true; }
|
||||
bool nameable() const override { return true; }
|
||||
|
||||
Reference in New Issue
Block a user