Skip to content

list records v2 #47

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions astro.config.ts
Original file line number Diff line number Diff line change
@@ -116,6 +116,10 @@ export default defineConfig({
label: 'Deployments',
link: '/production/deployments'
},
{
label: 'ListRecordsV2',
link: '/production/list-records-v2'
},
{
label: 'EFP Infrastructure',
link: '/production/infra'
62 changes: 62 additions & 0 deletions src/content/docs/production/list-records-v2.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: List Records V2
---

## Intent
This update address two issues:
- Preventing the risk of being frontrun during the slot claiming process
- Ensuring correct list records storage location in the case of identical deployment addresses on different chains

## List Records V2 Contract Changes
An additional check was added to the `_claimListManager` function to ensure that
the slot cannot be claimed by any other address than that specified in the slot
data itself.

#### List Storage Location: Slot Construction
The existing list storage location structure is unaffected, however the 32 byte
slot is now constructed using an address for the first 20 bytes and a pseudo
random nonce for the last 12 bytes

For example, a list storage location using the current structure would look like
this:
```solidity
0x010100000000000000000000000000000000000000000000000000000000000000015289fe5dabc021d02fddf23d4a4df96f4e0f17ef5550010c08608cc567bf432829280f99b40f7717290d6313134992e4971fa50e
```
This list storage location can be interpreted as follows
```solidity
{
Version: 0x01,
Type: 0x01,
Chain: 0x0000000000000000000000000000000000000000000000000000000000000001,
ListRecordsContract: 0x5289fe5dabc021d02fddf23d4a4df96f4e0f17ef,
Slot: 0x5550010c08608cc567bf432829280f99b40f7717290d6313134992e4971fa50e // 38587947120907837207653958898632315929230182373855930657826753963097023554830
}
```

Using the new slot construction method, if user with address
`0xc9c3a4337a1bba75d0860a1a81f7b990dc607334` was claiming then the slot would be
constructed like so:
```solidity
0xc9c3a4337a1bba75d0860a1a81f7b990dc607334000000000000000000000001
```
or
```solidity
0xc9c3a4337a1bba75d0860a1a81f7b990dc607334c021d02fddf23d4a4df96f4e
```
Note that the first 40 characters (or 20 bytes) is the address of the account
claiming the slot

## List Minter V2 Contract Changes
In the 'easyMint' and 'easyMintTo' functions, an additional check was added to
prevent the assignment of an incorrect list records storage location in the case
of an identical deployment addresses for list records contracts on different
chains.

```solidity
uint256 currentChain = block.chainid;
if (recordsContract == address(listRecordsL1) && currentChain == chain) {
listRecordsL1.claimListManagerForAddress(slot, msg.sender);
}
```
Prior to this update a list could have the wrong contract set as the list's
storage location, if the contracts shared the same address.