Skip to content

Add ERC: Store, Table-Based Introspectable Storage#711

Merged
eip-review-bot merged 18 commits into
ethereum:masterfrom
latticexyz:store
Mar 20, 2025
Merged

Add ERC: Store, Table-Based Introspectable Storage#711
eip-review-bot merged 18 commits into
ethereum:masterfrom
latticexyz:store

Conversation

@alvrs

@alvrs alvrs commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

This standard introduces a flexible on-chain storage pattern that organizes data into structured tables with schemas, similar to a traditional database. This approach allows new tables to be added at runtime without impacting existing contracts, thereby simplifying upgrades and extensions. By providing a unified interface for data access, the standard enables any contract or off-chain service to read stored data without the need for custom getter functions. Additionally, by standardizing event emissions for state changes it enables automatic, schema-aware indexing.

@eip-review-bot

eip-review-bot commented Nov 8, 2024

Copy link
Copy Markdown
Collaborator

✅ All reviewers have approved.

@github-actions github-actions Bot added the w-ci label Nov 8, 2024
@alvrs alvrs marked this pull request as ready for review November 8, 2024 16:53
@alvrs alvrs requested a review from eip-review-bot as a code owner November 8, 2024 16:53
Comment thread ERCS/erc-xxxx.md Outdated
Comment thread ERCS/erc-xxxx.md Outdated
Comment thread ERCS/erc-xxxx.md Outdated
Comment thread ERCS/erc-xxxx.md
@@ -0,0 +1,499 @@
---
eip: <to be assigned>
title: Store, Table-Based Introspectable Storage

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: Store, Table-Based Introspectable Storage
title: Table-Based Introspectable Storage

Maybe simplify the title

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would like to keep the name for now. Thanks for the feedback!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context - we feel it's important to keep the term "Store" in the title since it's the name of the pattern, ie all events are prefixed with Store

@github-actions github-actions Bot removed the w-ci label Nov 18, 2024
@github-actions

Copy link
Copy Markdown

The commit d60529d (as a parent of 571b06e) contains errors.
Please inspect the Run Summary for details.

@github-actions github-actions Bot added the w-ci label Nov 18, 2024
@github-actions github-actions Bot removed the w-ci label Nov 27, 2024
alvrs and others added 8 commits November 27, 2024 11:34
Co-authored-by: Andrew B Coathup <28278242+abcoathup@users.noreply.github.com>
Co-authored-by: Andrew B Coathup <28278242+abcoathup@users.noreply.github.com>
Co-authored-by: Andrew B Coathup <28278242+abcoathup@users.noreply.github.com>
@alvrs

alvrs commented Dec 4, 2024

Copy link
Copy Markdown
Contributor Author

@abcoathup please let us know if there are any other requested changes before we can get this merged as draft!

Comment thread ERCS/erc-7813.md Outdated

## Abstract

This standard introduces a flexible on-chain storage pattern that organizes data into structured tables with schemas, similar to a traditional database. This approach allows new tables to be added at runtime without impacting existing contracts, thereby simplifying upgrades and extensions. By providing a unified interface for data access, the standard enables any contract or off-chain service to read stored data without the need for custom getter functions. Additionally, by standardizing event emissions for state changes it enables automatic, schema-aware indexing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your abstract is missing some technical meat. After reading this section, your audience should have a high level (but still technical) overview of how your proposal accomplishes its goals.

Comment thread ERCS/erc-7813.md Outdated

A piece of data stored in a **Table**, addressed by one or more keys.

#### ResourceId

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these headings are literals from your code (and it looks like they might be), you should enclose them in backticks (`). That goes for any code snippets in the text as well.

Comment thread ERCS/erc-7813.md Outdated
Comment thread ERCS/erc-7813.md Outdated
Comment thread ERCS/erc-7813.md Outdated
Comment thread ERCS/erc-7813.md Outdated
Comment thread ERCS/erc-7813.md Outdated
Comment thread ERCS/erc-7813.md Outdated
| tableId | ResourceId | The ID of the table where the record is deleted |
| keyTuple | bytes32[] | An array representing the composite key for the record |

#### Example

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be moved to your Reference Implementation section. You can link to it from here though.

Co-authored-by: Sam Wilson <57262657+SamWilsn@users.noreply.github.com>
vdrg and others added 5 commits January 3, 2025 08:33
Co-authored-by: Sam Wilson <57262657+SamWilsn@users.noreply.github.com>
Co-authored-by: Sam Wilson <57262657+SamWilsn@users.noreply.github.com>
Co-authored-by: Sam Wilson <57262657+SamWilsn@users.noreply.github.com>
Co-authored-by: Sam Wilson <57262657+SamWilsn@users.noreply.github.com>
@vdrg vdrg mentioned this pull request Jan 3, 2025
@alvrs

alvrs commented Jan 10, 2025

Copy link
Copy Markdown
Contributor Author

@SamWilsn we updated the PR with your feedback, could we get another look?

@alvrs

alvrs commented Jan 27, 2025

Copy link
Copy Markdown
Contributor Author

@abcoathup @SamWilsn please let us know if there is anything else you'd like us to change before we can get this merged as draft!

@SamWilsn SamWilsn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just some tiny formatting changes.

Comment thread ERCS/erc-7813.md
| encodedLengths | EncodedLengths | The encoded lengths of the dynamic data of the record |
| dynamicData | bytes | The dynamic data of the record, using [custom packed encoding](#packed-data-encoding) |

#### Store_SpliceStaticData

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#### Store_SpliceStaticData
#### `Store_SpliceStaticData`

Comment thread ERCS/erc-7813.md
| start | uint48 | The start position in bytes for the splice operation |
| data | bytes | Packed ABI encoding of a tuple with the value's static fields |

#### Store_SpliceDynamicData

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#### Store_SpliceDynamicData
#### `Store_SpliceDynamicData`

Comment thread ERCS/erc-7813.md
| encodedLengths | EncodedLengths | The resulting encoded lengths of the dynamic data of the record |
| data | bytes | The data to insert into the dynamic data of the record at the start byte |

#### Store_DeleteRecord

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#### Store_DeleteRecord
#### `Store_DeleteRecord`

@eip-review-bot eip-review-bot enabled auto-merge (squash) March 20, 2025 16:07

@eip-review-bot eip-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All Reviewers Have Approved; Performing Automatic Merge...

@eip-review-bot eip-review-bot merged commit 051392f into ethereum:master Mar 20, 2025

@eip-review-bot eip-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All Reviewers Have Approved; Performing Automatic Merge...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants