Skip to content

Commit

Permalink
Update nep-0507.md
Browse files Browse the repository at this point in the history
Add empty lines after headings to avoid lint warning
  • Loading branch information
walnut-the-cat authored Sep 19, 2023
1 parent f9a336d commit 8577061
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions neps/nep-0507.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ LastUpdated: 2023-09-19
The NEP is to propose a chunk to contain post state root instead of pre state root.

### Key terminology

* Pre state root:
* Chunk producers include transactions and receipts in a chunk without executing them.
* A block only contains information about the state of the blockchain before the block, as well as how to modify the state during this block.
Expand All @@ -29,17 +30,20 @@ The NEP is to propose a chunk to contain post state root instead of pre state ro


## Motivation

The ideation of the project started as a pre-requsite for Stateless validation, which will be discussed in another NEP.

With stateless validation, we can no longer propose a chunk without executing it. The proposal itself is the state witness, which requires execution. Post-State-Root is therefore a prerequisite.

Having said that, it is worth noting that post state root iself can yield several critical benefits even without stateless validation and they are listed in Benefits section below as well as in the reference doc.

## Specification

**TBD**
[Explain the proposal as if you were teaching it to another developer. This generally means describing the syntax and semantics, naming new concepts, and providing clear examples. The specification needs to include sufficient detail to allow interoperable implementations getting built by following only the provided specification. In cases where it is infeasible to specify all implementation details upfront, broadly describe what they are.]

## Reference Implementation

**TBD**

Check failure on line 47 in neps/nep-0507.md

View workflow job for this annotation

GitHub Actions / markdown-lint

Emphasis used instead of a heading [Context: "TBD"]

neps/nep-0507.md:47 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "TBD"]

[This technical section is required for Protocol proposals but optional for other categories. A draft implementation should demonstrate a minimal implementation that assists in understanding or implementing this proposal. Explain the design in sufficient detail that:
Expand All @@ -53,23 +57,28 @@ Having said that, it is worth noting that post state root iself can yield severa
The section should return to the examples given in the previous section, and explain more fully how the detailed proposal makes those examples work.]

## Security Implications

So far, we have identified potential concern around 'delayed VRF'.

With Post-State-Root, we can only use the VRF from the previous block and will be is known beforehand to all chunk producers and other entities observing the blockchain.

The situtation may not be that bad considering transactions cannot be immediately executed (unless it’s a local receipt); one gets no advantage to include a transaction when they see that the current VRF is favorable, as their transaction’s first receipt would only be executed with the next VRF.

## Alternatives

N/A
[Explain any alternative designs that were considered and the rationale for not choosing them. Why your design is superior?]

## Future possibilities

**TBD**

Check failure on line 74 in neps/nep-0507.md

View workflow job for this annotation

GitHub Actions / markdown-lint

Emphasis used instead of a heading [Context: "TBD"]

neps/nep-0507.md:74 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "TBD"]

## Consequences

[Note] Please refer to [Post-State-Root changes](https://docs.google.com/document/d/1EE1wBXpufJ6d59R5jr6p1M21szivaFPCNE8ovDydELw/edit#heading=h.1zjpu0g8edny) section in the reference doc for more details.

### Positive

* Retrieval of incoming receipts is much easier: simply go through outgoing receipts of the previous block and find the ones which has the target shard as a destination shard.
* A chunk is executed before included in a block.
* Missed Chunks are handled similarly but in the simplified manner.
Expand All @@ -78,22 +87,26 @@ N/A
* Resharding no longer needs to take care of resharding outgoing receipts.

### Neutral

* The block structure mostly doesn’t change, except that it includes the hash of the post-state-roots from the chunks, as opposed to the hash of their pre-state-roots.
* A chunk now includes outgoing receipts from the current chunk, rather than of the previous chunk.
* For incoming receipts, we now need to fetch the partial outgoing receipts from the chunks of the previous block.
* State sync still requires incoming receipts for preceding missed chunks.
* Resharding still needs to take into account previously missed chunks.

### Negative

* With Post-State-Root, we can only use the VRF from the previous block and will be is known beforehand to all chunk producers and other entities observing the blockchain.
* In Near, as transactions cannot be immediately executed (unless it’s a local receipt), one gets no advantage to include a transaction when they see that the current VRF is favorable, as their transaction’s first receipt would only be executed with the next VRF
* Due to the delayed VRF, this leaves us with a potential issue of chunk producers deciding to not produce a block when they see an unfavorable VRF
* We can force all receipts to always execute with the VRF of the block they were generated from, so that even if they were included in a later chunk, they would have the same execution outcome.

### Backwards Compatibility

As the proposal dramatically changes the way state is stored in each chunk and execution timing of a chunk, there is no easy way to support replayabililty unless we want to keep pre state root code forever. This naturally raises the question of limited replayability at nearcore level. Please refer to [How to deleted old code](https://docs.google.com/document/d/1ey2EKK6ccoivvI9iBFCUiL7wqqr8kkoMYCqFL3Rs67I/edit?usp=sharing) for more details.

## Unresolved Issues (Optional)

* Detailed planning for pre state root to post state root Protocol upgrade: please refer to [the relevant section](https://docs.google.com/document/d/1EE1wBXpufJ6d59R5jr6p1M21szivaFPCNE8ovDydELw/edit#heading=h.qt474ok5fh46)
* Stateless validation is out of scope for this NEP and will be discussed separately.
* Supporting nearcore level limited replayability to cope with Backward compatibility issue mentioned above.
Expand Down

0 comments on commit 8577061

Please sign in to comment.