Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge feature/array-map-inlining (atree inlining feature branch) to main #429

Merged
merged 151 commits into from
Jul 29, 2024

Commits on Sep 14, 2023

  1. Inline child array/map data slab into parent slab

    Currently, every array or map are stored in its own slab and
    parent slab refers to child array or map by SlabID.
    
    The current approach can lead to many small slabs, especially for
    Cadence data structures with multiple nested levels.
    
    This commit inlines child array/map in parent slab when:
    - child array/map fits in one slab (root slab is data slab)
    - encoded size of inlined child array/map is less than the
      max inline size limit enforced by parent
    
    This commit optimizes encoding size by:
    - reusing inlined array types
    - reusing seed, digests, and field names of inlined composite types
    
    Also update debugging code to handle inlined array/map element.
    fxamacker committed Sep 14, 2023
    Configuration menu
    Copy the full SHA
    d6f3daa View commit details
    Browse the repository at this point in the history

Commits on Sep 17, 2023

  1. Check overwritten value in parentUpdater callback

    Currently, in parentUpdater callback, parent array/map resets same
    child value.
    
    Child value ID should match overwritten SlabIDStorable
    or Slab.SlabID().
    
    This commit adds check to make sure same child value is being reset.
    fxamacker committed Sep 17, 2023
    Configuration menu
    Copy the full SHA
    6f25137 View commit details
    Browse the repository at this point in the history

Commits on Sep 18, 2023

  1. Configuration menu
    Copy the full SHA
    399684a View commit details
    Browse the repository at this point in the history

Commits on Sep 19, 2023

  1. Configuration menu
    Copy the full SHA
    c178a72 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    efc46e6 View commit details
    Browse the repository at this point in the history

Commits on Sep 20, 2023

  1. Add notification in Set and Insert in Array

    This commit adds callback notification in the set or inserted child
    element in array.  So if child element is modified after Array.Set()
    or Array.Insert(), changes to child element is properly reflected
    in the parent array.
    
    This commit doesn't appear to be needed by current version of Cadence
    but it helps reduce Atree's dependence on an implementation detail
    of Cadence.
    fxamacker committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    1664e36 View commit details
    Browse the repository at this point in the history
  2. Add notification in Set in OrderedMap

    This commit adds callback notification in the set child element in map.
    So if child element is modified after OrderedMap.Set() , changes to
    child element is properly reflected in the parent map.
    
    This commit doesn't appear to be needed by current version of Cadence
    but it helps reduce Atree's dependence on an implementation detail
    of Cadence.
    fxamacker committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    feb6adf View commit details
    Browse the repository at this point in the history

Commits on Sep 21, 2023

  1. Deduplicate composite by type ID and field names

    Currently, deduplication feature in PR 342 (not merged yet)
    does not support Cadence attachments.
    
    Add support for Cadence attachments and other future
    use cases by using type ID and sorted field names
    instead of field count.
    
    While at it, also refactor encoding composite type to
    reduce traversal and type assertion.
    fxamacker committed Sep 21, 2023
    2 Configuration menu
    Copy the full SHA
    0d57f80 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1643589 View commit details
    Browse the repository at this point in the history
  3. Use new ExtraData for inlined slab during decoding

    Decoded ExtraData (including TypeInfo) can be shared by all
    inlined slabs.  This commit creates a new ExtraData with copied
    TypeInfo for inlined slabs to prevent accidental mutation.
    fxamacker committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    72d3614 View commit details
    Browse the repository at this point in the history
  4. Copy key for inlined composite during decoding

    Decoded ExtraData (including keys) can be shared by all
    inlined composite referring to the same type.
    
    This commit copies key for inlined composite to prevent
    accidental mutation.
    fxamacker committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    f66a85b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f8e0992 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    3584952 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    dc8a567 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5194eee View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    7375b82 View commit details
    Browse the repository at this point in the history
  10. Add more comments for Array and OrderedMap

    Some of the comments were taken from Atree's README
    which was originally authored by Ramtin.
    
    Co-authored-by: Ramtin M. Seraj <[email protected]>
    fxamacker and ramtinms committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    d49d6b4 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    f56232f View commit details
    Browse the repository at this point in the history

Commits on Sep 22, 2023

  1. Validate map key/value size <= max limit in tests

    While at it, also refactored validMapSlab().
    fxamacker committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    24aa117 View commit details
    Browse the repository at this point in the history
  2. Validate ValueID and SlabID for arrays in tests

    While at it, also refactored validArraySlab().
    fxamacker committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    15bde12 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    27aa4cb View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5d8ff98 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    6cd8c0c View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2023

  1. Refactor array validation

    fxamacker committed Sep 24, 2023
    Configuration menu
    Copy the full SHA
    43edeca View commit details
    Browse the repository at this point in the history
  2. Test inlined array slabs are not in storage

    Currently, ValidArray() doesn't verify that inlined array slabs
    are in not storage.
    
    It is called by tests in Atree and Cadence, so update it
    to check if inlined array slabs are in storage.
    fxamacker committed Sep 24, 2023
    Configuration menu
    Copy the full SHA
    119f6c5 View commit details
    Browse the repository at this point in the history
  3. Refactor map validation

    fxamacker committed Sep 24, 2023
    Configuration menu
    Copy the full SHA
    efcb2a2 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5af0bc4 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a71e7f8 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    2d8a4e8 View commit details
    Browse the repository at this point in the history

Commits on Sep 25, 2023

  1. Configuration menu
    Copy the full SHA
    ed36d65 View commit details
    Browse the repository at this point in the history

Commits on Sep 26, 2023

  1. Configuration menu
    Copy the full SHA
    04f93a2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    00a6df8 View commit details
    Browse the repository at this point in the history

Commits on Sep 27, 2023

  1. Add ReadOnly iterators and refactor other iterators

    This change:
    - Adds ReadOnly iterators that match current iterator API
      (except for the "ReadOnly" suffix added to some function names).
    - Refactors API of non-Readonly iterators because register
      inlining will require more parameters for MapIterator.
    
    For ReadOnly iterators, the caller is responsible for preventing
    changes to child containers during iteration because mutations
    of child containers are not guaranteed to persist.
    
    For non-ReadOnly iterators, two additional parameters are needed to
    update child container in parent map when child container is modified.
    fxamacker committed Sep 27, 2023
    Configuration menu
    Copy the full SHA
    d3de291 View commit details
    Browse the repository at this point in the history

Commits on Sep 29, 2023

  1. Configuration menu
    Copy the full SHA
    e88a73e View commit details
    Browse the repository at this point in the history

Commits on Oct 1, 2023

  1. Configuration menu
    Copy the full SHA
    a75e388 View commit details
    Browse the repository at this point in the history
  2. Uninline slab when it is overwritten or removed

    Currently, Set() and Remove() return overwritten or removed storable.
    If storable is inlined slab, it is not stored in storage (because it
    is removed from its parent slab which is in storage), so any future
    changes to it would be lost.
    
    On the other hand, if overwritten or removed storable is SlabIDStorable,
    any future changes to it can still be persisted because it is in
    its own slab in storage.
    
    This inconsistency (not merged or deployed yet) can cause potential
    data loss or unexpected behavior if deployed.
    
    This commit uninlines inlined slabs that is overwritten or removed,
    stores them in storage, and returns their SlabID as storable to caller.
    fxamacker committed Oct 1, 2023
    Configuration menu
    Copy the full SHA
    042eb68 View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2023

  1. Configuration menu
    Copy the full SHA
    f17354c View commit details
    Browse the repository at this point in the history
  2. Prune Array.mutableElementIndex in Set and Remove

    This commit prunes Array.mutableElementIndex by:
    - deleting overwritten element from mutableElementIndex
    - deleting removed element from mutableElementIndex
    
    While at it, add more checks for index in mutableElementIndex:
    - can't exceed number of array elements
    - can't be less than 0
    
    For context, Array.mutableElementIndex contains mutable
    element's updated index in parent array.  When parent
    array is modified, index in mutableElementIndex is updated.
    fxamacker committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    1a2e69f View commit details
    Browse the repository at this point in the history
  3. No-op on parentUpdater() if child isn't in parent

    This commit checks if child is in parent container at adjusted index or
    under the same key in parentUpdater() before modifying parent container.
    
    If child is no longer part of parent, parentUpdater() returns with no-op,
    and this callback is set to nil.
    
    This is to handle outdated child reference modifying parent after it
    is removed.
    fxamacker committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    63ea7a7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    53a716f View commit details
    Browse the repository at this point in the history
  5. Use unsafe.Sizeof instead of magic number

    Previously, the constant expression used hardcoded numbers.
    fxamacker committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    7a2aeb1 View commit details
    Browse the repository at this point in the history
  6. Add comment for potential overlapping tag nums in Cadence

    Currently, Atree uses CBOR tag numbers [247, 255] and grows downwards.
    Cadence uses CBOR tag numbers [128, 224] and grows upwards.  There
    MUST not be any overlap.
    
    This commit adds comment to warning about overlapping.  We can be more
    proactive about this by dividing up the remaining available tag numbers
    between Cadence and Atree.
    
    NOTE: A similar comment will be added to Cadence repo at
    github.com/onflow/cadence when the next atree-cadence integration
    PR is opened.
    fxamacker committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    e6fa347 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    03acd49 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    90be7ac View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    f3fdb2d View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    2775ff5 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    836eb70 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    4b3c26c View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2023

  1. Check duplicate SlabID in inlined slabs in tests

    This commit adds an extra check in exported validation functions
    that are only used for tests in Atree but can also be used by Cadence.
    fxamacker committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    3f87ec5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    903fc13 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8d02bbc View commit details
    Browse the repository at this point in the history
  4. Merge branch 'fxamacker/inline-array-and-map' into fxamacker/add-keyc…

    …omparator-and-hashinputprovider-to-mapiterator
    fxamacker committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    5df8b16 View commit details
    Browse the repository at this point in the history
  5. Add more comments

    fxamacker committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    2a6091a View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c07907d View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    f671189 View commit details
    Browse the repository at this point in the history

Commits on Oct 4, 2023

  1. Merge pull request #345 from onflow/fxamacker/add-keycomparator-and-h…

    …ashinputprovider-to-mapiterator
    
    Add readonly iterators and support value mutations only from non-readonly iterators
    fxamacker authored Oct 4, 2023
    Configuration menu
    Copy the full SHA
    5f1de0a View commit details
    Browse the repository at this point in the history
  2. Merge pull request #342 from onflow/fxamacker/inline-array-and-map

    Inline child array and map data slab into parent slab
    fxamacker authored Oct 4, 2023
    Configuration menu
    Copy the full SHA
    0fc8f74 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5eb2db8 View commit details
    Browse the repository at this point in the history
  4. Refactor smoke test

    fxamacker committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    e61ba40 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0c6f631 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c59afb8 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2023

  1. Add "slabcheck" flag to smoke test

    This commit adds flag "slabcheck" to enable checking in-memory
    and serialized slabs.  This flag is off by default because it can
    take a long time to run.
    fxamacker committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    acf4b70 View commit details
    Browse the repository at this point in the history
  2. Refactor smoke test

    fxamacker committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    b739b50 View commit details
    Browse the repository at this point in the history
  3. Refactor smoke test

    fxamacker committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    ff9d5a9 View commit details
    Browse the repository at this point in the history
  4. Refactor smoke test

    fxamacker committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    a10af61 View commit details
    Browse the repository at this point in the history
  5. Refactor smoke test

    fxamacker committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    e38ad5a View commit details
    Browse the repository at this point in the history

Commits on Oct 6, 2023

  1. Make smoke test support child array/map mutation

    This commit smoke tests mutation of child container:
    - existing child retrieved from parent array/map
    - new child appened/inserted to parent array
    - existing child set in parent array/map
    - new child set in parent map
    fxamacker committed Oct 6, 2023
    Configuration menu
    Copy the full SHA
    25dbc3e View commit details
    Browse the repository at this point in the history

Commits on Oct 9, 2023

  1. Refactor smoke test

    fxamacker committed Oct 9, 2023
    Configuration menu
    Copy the full SHA
    11f0faa View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3145ef4 View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2023

  1. Merge pull request #348 from onflow/fxamacker/update-smoke-test-for-a…

    …rray-map-inlining
    
    Update smoke test for atree inlining
    fxamacker authored Oct 10, 2023
    Configuration menu
    Copy the full SHA
    9b14a71 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    108dc31 View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2023

  1. Configuration menu
    Copy the full SHA
    aaa47cc View commit details
    Browse the repository at this point in the history
  2. Change array encoding error type

    Some errors that should be returned as external error
    are being returned as fatal error.  This caused a
    problem that was detected during Cadence integration.
    
    This commit resolves the problem by returning these
    fatal errors as external errors.
    fxamacker committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    f56c2e7 View commit details
    Browse the repository at this point in the history
  3. Change map encoding error type

    Some errors that should be returned as external error
    are being returned as fatal error.  This caused a
    problem that was detected during Cadence integration.
    
    This commit resolves the problem by returning these
    fatal errors as external errors.
    fxamacker committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    c7ae147 View commit details
    Browse the repository at this point in the history
  4. Add InlinedExtraData interface

    Cadence integration requires InlinedExtraData interface.
    fxamacker committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    945826b View commit details
    Browse the repository at this point in the history
  5. Add ContainerStorable interface

    ContainerStorable interface supports encoding container storable
    (storable containing other storables) as element.  This is needed
    for integration with Cadence.
    fxamacker committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    2e86400 View commit details
    Browse the repository at this point in the history
  6. Rename Encode to EncodeSlab

    fxamacker committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    2d5e4a4 View commit details
    Browse the repository at this point in the history
  7. Encode inlined map as map key

    This is needed for integration with Cadence because map key can be
    Cadence enums.
    fxamacker committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    485b800 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5eb10f1 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    5be1f94 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    800a44a View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    eecb91a View commit details
    Browse the repository at this point in the history

Commits on Oct 19, 2023

  1. Fix lint warning

    fxamacker committed Oct 19, 2023
    Configuration menu
    Copy the full SHA
    eb9a503 View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2023

  1. Configuration menu
    Copy the full SHA
    c8f01db View commit details
    Browse the repository at this point in the history
  2. Add more comments

    fxamacker committed Oct 20, 2023
    Configuration menu
    Copy the full SHA
    25c4d5e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3688e89 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    87e6b6b View commit details
    Browse the repository at this point in the history
  5. Merge pull request #352 from onflow/fxamacker/array-map-inlining-tweaks

    Update for Cadence integration for atree inlining and deduplication
    fxamacker authored Oct 20, 2023
    Configuration menu
    Copy the full SHA
    81a8e2d View commit details
    Browse the repository at this point in the history
  6. Merge pull request #350 from onflow/fxamacker/add-composite-type-to-s…

    …moke-test
    
    Make smoke tests check recently added data deduplication feature
    fxamacker authored Oct 20, 2023
    Configuration menu
    Copy the full SHA
    7ab6f5e View commit details
    Browse the repository at this point in the history

Commits on Oct 22, 2023

  1. Remove ContainerStorable.EncodeAsElement

    Currently, EncodeAsElement is used to encode inlined array and map,
    while Encode is used to encode standalone array and map.
    
    This commit simplifies encoding API by using Encode() to encode
    both inlined/standalone array/map.
    fxamacker committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    d718306 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2023

  1. Configuration menu
    Copy the full SHA
    d88bd12 View commit details
    Browse the repository at this point in the history
  2. Fail StorableSlab.Encode() with inlined array/map

    This commit makes StorableSlab.Encode() return
    error if it contains inlined array or inlined map.
    fxamacker committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    acdb685 View commit details
    Browse the repository at this point in the history
  3. Merge pull request #354 from onflow/fxamacker/refactor-encoding-API

    Remove ContainerStorable.EncodeAsElement
    fxamacker authored Oct 24, 2023
    Configuration menu
    Copy the full SHA
    cb82995 View commit details
    Browse the repository at this point in the history

Commits on Nov 30, 2023

  1. Support mutable iterator for array and map

    Mutable iterator for array and map supports:
    - indirect element mutation, such as modifying nested container
    - direct element mutation, such as overwriting existing element
      with new element
    
    Mutable iterator for array and map doesn't support:
    - inserting new elements into the array/map
    - removing existing elements from the array/map
    
    NOTE: use readonly iterator if mutation is not needed for
    better performance.
    
    This commit:
    - adds new interfaces ArrayIterator and MapIterator
    - decouples implementation of mutable and readonly iterators
    - refactors related functions
    fxamacker committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    9171a72 View commit details
    Browse the repository at this point in the history

Commits on Dec 1, 2023

  1. Configuration menu
    Copy the full SHA
    1624f6d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    20d7796 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    bcae77e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a0e7907 View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2023

  1. Configuration menu
    Copy the full SHA
    bbee1cc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4b0ec40 View commit details
    Browse the repository at this point in the history
  3. Update CI to increase timeout

    While at it, also reduce matrix of OS and Go versions
    given the duration of tests.
    fxamacker committed Dec 2, 2023
    Configuration menu
    Copy the full SHA
    b3e41ec View commit details
    Browse the repository at this point in the history

Commits on Dec 4, 2023

  1. Update some comments

    fxamacker committed Dec 4, 2023
    Configuration menu
    Copy the full SHA
    5e67357 View commit details
    Browse the repository at this point in the history

Commits on Jan 24, 2024

  1. Merge pull request #359 from onflow/fxamacker/handle-slab-operation-f…

    …or-mutable-iterators
    
    Add feature to support mutation for array and map iterators
    fxamacker authored Jan 24, 2024
    Configuration menu
    Copy the full SHA
    2fbf860 View commit details
    Browse the repository at this point in the history

Commits on Feb 28, 2024

  1. Deduplicate inlined dict type info to reduce RAM

    This change deduplicates Cadence dictionary type and composite
    type info, resulting in reduced memory and also persistent storage.
    
    More specifically, this encodes inlined atree slab extra data
    section as two-element array:
    - array of deduplicated type info
    - array of deduplicated extra data with type info index
    fxamacker committed Feb 28, 2024
    Configuration menu
    Copy the full SHA
    83d8870 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6825950 View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2024

  1. Configuration menu
    Copy the full SHA
    e029e43 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9be1712 View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2024

  1. Configuration menu
    Copy the full SHA
    a05f97e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8c7c31e View commit details
    Browse the repository at this point in the history
  3. Merge pull request #376 from onflow/fxamacker/add-inlining-array-settype

    Add support for changing type info of atree arrays (atree inlining branch)
    fxamacker authored Mar 8, 2024
    Configuration menu
    Copy the full SHA
    36e70a5 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    57de859 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    95dad1c View commit details
    Browse the repository at this point in the history
  6. Merge pull request #377 from onflow/fxamacker/add-inlining-map-settype

    Add support for changing type info of atree maps (atree inlining branch)
    fxamacker authored Mar 8, 2024
    Configuration menu
    Copy the full SHA
    43b2a0d View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    35fdb7e View commit details
    Browse the repository at this point in the history

Commits on Mar 14, 2024

  1. Merge pull request #369 from onflow/fxamacker/deduplicate-dict-type-info

    Reduce RAM and persistent storage by deduplicating inlined dict type info
    fxamacker authored Mar 14, 2024
    Configuration menu
    Copy the full SHA
    92714ca View commit details
    Browse the repository at this point in the history

Commits on Apr 2, 2024

  1. Use encoded type info to deduplicate extra data

    Currently, we use TypeInfo.Identifier() to deduplicate extra data
    and type info.  However, TypeInfo.Identifier() is implemented in
    another package and we can't enforce its uniqueness for different
    types.  If TypeInfo.Identifier() returns same ID for different
    types, different types is wrongly deduplicated.
    
    This commit uses encoded type info via TypeInfo.Encode() to
    deduplicate extra data.  This prevents differently encoded type
    info from being deduplicated by mistake.
    
    This commit also uses sync.Pool to reuse buffer for type info
    encoding.
    fxamacker committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    83c99b3 View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2024

  1. Merge pull request #381 from onflow/fxamacker/replace-typeinfo-identi…

    …fier
    
    Use encoded type info to deduplicate extra data
    fxamacker authored Apr 4, 2024
    Configuration menu
    Copy the full SHA
    92fcde4 View commit details
    Browse the repository at this point in the history

Commits on Apr 5, 2024

  1. Fix error type for external errors during serialization

    The wrong error type was returned when an external error
    was encountered.
    
    This commit returns the correct error type.
    fxamacker committed Apr 5, 2024
    Configuration menu
    Copy the full SHA
    661c07f View commit details
    Browse the repository at this point in the history
  2. Merge pull request #382 from onflow/fxamacker/fix-encoding-error-type

    Fix error type for external errors during serialization
    fxamacker authored Apr 5, 2024
    Configuration menu
    Copy the full SHA
    c6c951d View commit details
    Browse the repository at this point in the history

Commits on Apr 11, 2024

  1. Add feature to fix refs to non-existent registers

    In testnet, broken references seem to have resulted from a bug that was
    fixed 2 years ago by onflow/cadence#1565.
    
    A broken reference is a `StorageID` referencing a non-existent register.
    So far, only 10 registers in testnet (none on mainnet) were found to
    contain broken references.
    
    This commit adds a feature to enable migration programs in onflow/flow-go
    to fix broken references in maps.
    
    `FixLoadedBrokenReferences()` traverses loaded slabs and replaces
    broken map (if any) with empty map having the same StorageID and
    also removes all slabs in the old map.
    
    Limitations:
    - only fix broken references in map (this is intentional)
    - only traverse loaded slabs in deltas and cache
    
    IMPORTANT: This should not be used to silently fix unknown problems.
    It should only be used by migration programs to fix known problems
    which were determined to be appropriate to fix in this manner.
    fxamacker committed Apr 11, 2024
    Configuration menu
    Copy the full SHA
    30dad00 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2a71edc View commit details
    Browse the repository at this point in the history

Commits on Apr 17, 2024

  1. Update storage.go

    Co-authored-by: Bastian Müller <[email protected]>
    fxamacker and turbolent committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    6647715 View commit details
    Browse the repository at this point in the history
  2. Allow callers to skip fixing a broken reference

    Currently, calls to this function can be limited by migration
    programs by specifying the 9 testnet accounts affected by 10
    registers with broken references on testnet.
    
    This commit allows callers to implement additional restrictions,
    so calling FixLoadedBrokenReferences for the affected 9 testnet
    accounts can be even more limited at the callers discretion.
    
    In practice, this change is not expected to produce different
    migration results because full migration tests before this change
    correctly fixed the 10 known registers in the 9 testnet accounts.
    
    This commit added predicate func(old Value) bool to
    PersistentSlabStorage.FixLoadedBrokenReferences() to control
    whether to fix a atree.Value containing broken references.
    
    Also modified PersistentSlabStorage.FixLoadedBrokenReferences()
    to return fixed storage IDs and skipped storage IDs.  Both returned
    values are of type map[StorageID][]StorageID, with key as
    root slab ID and value as all slab IDs containing broken references
    connected to the root.
    
    Also added more tests and improved existing tests.
    fxamacker committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    3efd6be View commit details
    Browse the repository at this point in the history
  3. Add PersistentSlabStorage.GetAllChildReferences()

    This commit adds GetAllChildReferences() which essentially wraps
    an existing internal function.
    fxamacker committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    b362f82 View commit details
    Browse the repository at this point in the history
  4. Fix tests

    fxamacker committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    8febf26 View commit details
    Browse the repository at this point in the history
  5. Merge pull request #392 from onflow/fxamacker/export-getAllChildRefer…

    …ences-for-atree-inlining
    
    Add PersistentSlabStorage.GetAllChildReferences() for atree inlining
    fxamacker authored Apr 17, 2024
    Configuration menu
    Copy the full SHA
    300e7e8 View commit details
    Browse the repository at this point in the history
  6. Merge pull request #388 from onflow/fxamacker/add-fix-broken-referenc…

    …e-function-for-atree-inlining
    
    Add feature to enable atree inlining migration to fix references to non-existent registers
    fxamacker authored Apr 17, 2024
    Configuration menu
    Copy the full SHA
    e11f55f View commit details
    Browse the repository at this point in the history

Commits on Apr 26, 2024

  1. Fix GetAllChildReferences used by migration filter

    Migration programs in onflow/flow-go added a flag to filter
    old unreferenced slabs and onflow/atree added some functions
    to support that. However, some of the old unreferenced slabs
    are not filtered during migration.
    
    This commit fixes the migration filter by handling nested
    storage ID inside element such as Cadence SomeValue.
    fxamacker committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    a6b615b View commit details
    Browse the repository at this point in the history

Commits on Apr 29, 2024

  1. Merge pull request #396 from onflow/fxamacker/fix-get-child-reference…

    …s-to-handle-storage-id-in-element
    
    Fix migration filter for old unreferenced slabs (atree inlining feature branch)
    fxamacker authored Apr 29, 2024
    Configuration menu
    Copy the full SHA
    e4400b2 View commit details
    Browse the repository at this point in the history

Commits on May 9, 2024

  1. Add NonderterministicFastCommit

    NonderterministicFastCommit commits changes in nondeterministic order.
    It can be used by migration program when ordering isn't required.
    
                                 │  before.txt  │              after.txt               │
                                 │    sec/op    │    sec/op     vs base                │
    StorageFastCommit/10-12         89.72µ ± 4%   57.50µ ±  3%  -35.92% (p=0.000 n=10)
    StorageFastCommit/100-12        118.9µ ± 1%   116.0µ ±  4%        ~ (p=0.436 n=10)
    StorageFastCommit/1000-12       4.086m ± 5%   2.397m ± 25%  -41.35% (p=0.000 n=10)
    StorageFastCommit/10000-12     12.629m ± 4%   9.857m ±  3%  -21.95% (p=0.000 n=10)
    StorageFastCommit/100000-12    102.73m ± 0%   72.26m ±  1%  -29.66% (p=0.000 n=10)
    StorageFastCommit/1000000-12     1.544 ± 2%    1.141 ±  2%  -26.09% (p=0.000 n=10)
    geomean                         6.661m        4.848m        -27.21%
    
                                 │  before.txt  │              after.txt              │
                                 │     B/op     │     B/op      vs base               │
    StorageFastCommit/10-12        28.92Ki ± 0%   28.05Ki ± 0%  -3.00% (p=0.000 n=10)
    StorageFastCommit/100-12       286.4Ki ± 0%   278.6Ki ± 0%  -2.71% (p=0.000 n=10)
    StorageFastCommit/1000-12      3.009Mi ± 0%   2.901Mi ± 0%  -3.58% (p=0.000 n=10)
    StorageFastCommit/10000-12     28.65Mi ± 0%   27.79Mi ± 0%  -2.98% (p=0.000 n=10)
    StorageFastCommit/100000-12    278.8Mi ± 0%   271.1Mi ± 0%  -2.75% (p=0.000 n=10)
    StorageFastCommit/1000000-12   2.923Gi ± 0%   2.821Gi ± 0%  -3.49% (p=0.000 n=10)
    geomean                        9.101Mi        8.820Mi       -3.09%
    
                                 │ before.txt  │             after.txt              │
                                 │  allocs/op  │  allocs/op   vs base               │
    StorageFastCommit/10-12         219.0 ± 0%    205.0 ± 0%  -6.39% (p=0.000 n=10)
    StorageFastCommit/100-12       1.980k ± 0%   1.875k ± 0%  -5.30% (p=0.000 n=10)
    StorageFastCommit/1000-12      19.23k ± 0%   18.23k ± 0%  -5.22% (p=0.000 n=10)
    StorageFastCommit/10000-12     191.1k ± 0%   181.1k ± 0%  -5.24% (p=0.000 n=10)
    StorageFastCommit/100000-12    1.918M ± 0%   1.816M ± 0%  -5.30% (p=0.000 n=10)
    StorageFastCommit/1000000-12   19.15M ± 0%   18.15M ± 0%  -5.22% (p=0.000 n=10)
    geomean                        62.31k        58.91k       -5.45%
    fxamacker committed May 9, 2024
    Configuration menu
    Copy the full SHA
    7162eab View commit details
    Browse the repository at this point in the history
  2. Add more tests

    fxamacker committed May 9, 2024
    Configuration menu
    Copy the full SHA
    e739c6e View commit details
    Browse the repository at this point in the history
  3. Add BatchPreload to decode slabs in parallel

    The intended use for BatchPreload is to speedup migrations.
    
    BatchPreload decodes slabs in parallel and stores decoded
    slabs in cache for later retrieval.  This is useful for
    migration program when most or all slabs are expected to
    be migrated.
    
                               │  before.txt  │              after.txt               │
                               │    sec/op    │    sec/op     vs base                │
    StorageRetrieve/10-12         36.23µ ± 3%   35.33µ ±  4%        ~ (p=0.075 n=10)
    StorageRetrieve/100-12        469.6µ ± 8%   124.3µ ±  0%  -73.52% (p=0.000 n=10)
    StorageRetrieve/1000-12       6.678m ± 7%   2.303m ± 20%  -65.51% (p=0.000 n=10)
    StorageRetrieve/10000-12      29.81m ± 2%   12.26m ±  5%  -58.86% (p=0.000 n=10)
    StorageRetrieve/100000-12    303.33m ± 1%   88.40m ±  1%  -70.86% (p=0.000 n=10)
    StorageRetrieve/1000000-12     3.442 ± 1%    1.137 ±  3%  -66.96% (p=0.000 n=10)
    geomean                       12.34m        4.816m        -60.98%
    
                               │  before.txt  │              after.txt              │
                               │     B/op     │     B/op      vs base               │
    StorageRetrieve/10-12        21.59Ki ± 0%   21.59Ki ± 0%       ~ (p=1.000 n=10)
    StorageRetrieve/100-12       219.8Ki ± 0%   224.7Ki ± 0%  +2.24% (p=0.000 n=10)
    StorageRetrieve/1000-12      2.266Mi ± 0%   2.272Mi ± 0%  +0.27% (p=0.000 n=10)
    StorageRetrieve/10000-12     21.94Mi ± 0%   22.14Mi ± 0%  +0.91% (p=0.000 n=10)
    StorageRetrieve/100000-12    215.3Mi ± 0%   218.5Mi ± 0%  +1.50% (p=0.000 n=10)
    StorageRetrieve/1000000-12   2.211Gi ± 0%   2.212Gi ± 0%  +0.05% (p=0.000 n=10)
    geomean                      6.919Mi        6.976Mi       +0.82%
    
                               │ before.txt  │              after.txt               │
                               │  allocs/op  │  allocs/op   vs base                 │
    StorageRetrieve/10-12         76.00 ± 0%    76.00 ± 0%       ~ (p=1.000 n=10) ¹
    StorageRetrieve/100-12        745.0 ± 0%    759.0 ± 0%  +1.88% (p=0.000 n=10)
    StorageRetrieve/1000-12      7.161k ± 0%   7.153k ± 0%  -0.11% (p=0.000 n=10)
    StorageRetrieve/10000-12     70.77k ± 0%   70.58k ± 0%  -0.27% (p=0.000 n=10)
    StorageRetrieve/100000-12    711.9k ± 0%   709.7k ± 0%  -0.31% (p=0.000 n=10)
    StorageRetrieve/1000000-12   7.115M ± 0%   7.077M ± 0%  -0.54% (p=0.000 n=10)
    geomean                      22.93k        22.95k       +0.11%
    fxamacker committed May 9, 2024
    Configuration menu
    Copy the full SHA
    a459d96 View commit details
    Browse the repository at this point in the history

Commits on May 13, 2024

  1. Refactor to iterate deltas once in NonderterministicFastCommit

    This change reduces number of lines in the function but is
    not expected to yield significant speed improvements.
    fxamacker committed May 13, 2024
    Configuration menu
    Copy the full SHA
    a2a4f5c View commit details
    Browse the repository at this point in the history
  2. Lint

    fxamacker committed May 13, 2024
    Configuration menu
    Copy the full SHA
    aa1c121 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e83159f View commit details
    Browse the repository at this point in the history
  4. Lint

    fxamacker committed May 13, 2024
    Configuration menu
    Copy the full SHA
    5808810 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    aa2ee90 View commit details
    Browse the repository at this point in the history

Commits on May 14, 2024

  1. Revert "Bump golangci-lint from 1.52.2 to 1.53.3"

    This reverts commit e83159f.
    fxamacker committed May 14, 2024
    Configuration menu
    Copy the full SHA
    81b6dcd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    88fa22f View commit details
    Browse the repository at this point in the history
  3. Merge pull request #403 from onflow/fxamacker/add-nondeterministic-fa…

    …st-commit
    
    Add NonderterministicFastCommit to speed up migrations when ordering isn't required
    fxamacker authored May 14, 2024
    Configuration menu
    Copy the full SHA
    12929f5 View commit details
    Browse the repository at this point in the history
  4. Merge pull request #404 from onflow/fxamacker/add-batch-preload

    Add BatchPreload to decode slabs in parallel and cache
    fxamacker authored May 14, 2024
    Configuration menu
    Copy the full SHA
    73e00ec View commit details
    Browse the repository at this point in the history

Commits on May 21, 2024

  1. Check mutation of elements from readonly map iterator

    This commit returns ReadOnlyIteratorElementMutationError when
    elements of readonly map iterator are mutated. Also, a
    callback can be provided by the caller to log or debug
    such mutations with more context.
    
    As always, mutation of elements from readonly iterators are
    not guaranteed to persist.
    
    Instead of relying on other projects not to mutate readonly elements,
    this commit returns ReadOnlyIteratorElementMutationError when
    elements from readonly iterators are mutated.
    
    This commit also adds readonly iterator functions that receive
    mutation callbacks.  Callbacks are useful for logging, etc. with
    more context when mutation occurs.  Mutation handling is the same
    with or without callbacks.  If needed, other projects using atree
    can choose to panic in the callback when mutation is detected.
    
    If elements from readonly iterators are mutated:
    - those changes are not guaranteed to persist.
    - mutation functions of child containers return
      ReadOnlyIteratorElementMutationError.
    - ReadOnlyMapIteratorMutationCallback are called if provided
    fxamacker committed May 21, 2024
    Configuration menu
    Copy the full SHA
    0d63aaf View commit details
    Browse the repository at this point in the history
  2. Check mutation of elements from readonly array iterator

    This commit returns ReadOnlyIteratorElementMutationError when
    elements of readonly array iterator are mutated. Also, a
    callback can be provided by the caller to log or debug
    such mutations with more context.
    
    As always, mutation of elements from readonly iterators are
    not guaranteed to persist.
    
    Instead of relying on other projects not to mutate readonly elements,
    this commit returns ReadOnlyIteratorElementMutationError when
    elements from readonly iterators are mutated.
    
    This commit also adds readonly iterator functions that receive
    mutation callbacks.  Callbacks are useful for logging, etc. with
    more context when mutation occurs.  Mutation handling is the same
    with or without callbacks.  If needed, other projects using atree
    can choose to panic in the callback when mutation is detected.
    
    If elements from readonly iterators are mutated:
    - those changes are not guaranteed to persist.
    - mutation functions of child containers return
      ReadOnlyIteratorElementMutationError.
    - ReadOnlyMapIteratorMutationCallback are called if provided
    fxamacker committed May 21, 2024
    Configuration menu
    Copy the full SHA
    019775e View commit details
    Browse the repository at this point in the history
  3. Merge pull request #410 from onflow/fxamacker/add-mutation-callback-t…

    …o-readonly-map-iterator
    
    Check mutation of elements from readonly map iterator
    fxamacker authored May 21, 2024
    Configuration menu
    Copy the full SHA
    bbd27a3 View commit details
    Browse the repository at this point in the history
  4. Merge pull request #411 from onflow/fxamacker/add-mutation-callback-t…

    …o-readonly-array-iterator
    
    Check mutation of elements from readonly array iterator
    fxamacker authored May 21, 2024
    Configuration menu
    Copy the full SHA
    688791c View commit details
    Browse the repository at this point in the history

Commits on May 24, 2024

  1. Update comment for NondeterministicFastCommit

    Make it clearer that encoded slabs are still deterministic, so
    array and map iterations will remain deterministic.
    
    Only the sequence of changed slabs getting committed is
    nondeterministic.
    
    This is useful for migration programs that don't require
    commit sequence of slabs to be deterministic while
    still preserving deterministic encoding of slabs
    (e.g. iteration of arrays and maps remain deterministic).
    fxamacker committed May 24, 2024
    Configuration menu
    Copy the full SHA
    393e179 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #412 from onflow/fxamacker/update-comment-for-nond…

    …eterministicfastcommit
    
    Update comment for NondeterministicFastCommit
    fxamacker authored May 24, 2024
    Configuration menu
    Copy the full SHA
    b79c29e View commit details
    Browse the repository at this point in the history

Commits on Jun 4, 2024

  1. Configuration menu
    Copy the full SHA
    7bcf32f View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2024

  1. Merge pull request #415 from onflow/fxamacker/update-copyright

    Update copyright notice to Flow Foundation
    fxamacker authored Jun 13, 2024
    Configuration menu
    Copy the full SHA
    0db5873 View commit details
    Browse the repository at this point in the history

Commits on Jul 25, 2024

  1. Configuration menu
    Copy the full SHA
    691b753 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #428 from onflow/fxamacker/update-array-map-inlining

    Update feature/array-map-inlining (atree inlining feature branch)
    fxamacker authored Jul 25, 2024
    Configuration menu
    Copy the full SHA
    caf04d2 View commit details
    Browse the repository at this point in the history