-
Notifications
You must be signed in to change notification settings - Fork 521
stateUpgrades Documentation #1257
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
568dad6
stateUpgrades Documentation
9ff243e
fix
e7cd24b
improve wording
0cfea58
nit
bb356a3
move text
0241ebd
lint
8aa153b
linter
43f3e91
linter
ff73c2f
fix json wspace
8da703b
change
ee98808
lint
156d8e7
Update docs/subnets/customize-a-subnet.md
ca5d3ce
address comments
8ff8090
Update docs/subnets/customize-a-subnet.md
e378252
Update docs/subnets/customize-a-subnet.md
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1061,3 +1061,75 @@ If `allowFeeRecipients` or `RewardManager` precompile is enabled on the Subnet, | |
| doesn't specify a "feeRecipient", the fees will be burned in blocks it produces. | ||
|
|
||
| ::: | ||
|
|
||
| ## Network Upgrades: State Modification | ||
|
|
||
| SubnetEVM allows the network operators to specify a modification to state that will take place | ||
darioush marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| at the beginning of the first block with a timestamp greater than or equal to the one specified | ||
| in the configuration. | ||
|
|
||
| This provides a last resort path to updating non-upgradeable contracts via a network upgrade | ||
| (for example, to fix issues when you are running your own blockchain). | ||
|
|
||
| :::warning | ||
|
|
||
| This should only be used as a last resort alternative to forking `subnet-evm` and specifying | ||
| the network upgrade in code. | ||
|
|
||
| Using a network upgrade to modify state is not part of normal operations of the | ||
| EVM. You should ensure the modifications do not invalidate any of the assumptions of | ||
| deployed contracts or cause incompatibilities with downstream infrastructure such as | ||
| block explorers. | ||
|
|
||
| ::: | ||
|
|
||
|
|
||
| The timestamps for upgrades in `stateUpgrades` must be in increasing order. | ||
| `stateUpgrades` can be specified along with `precompileUpgrades` or by itself. | ||
|
|
||
| The following three state modifications are supported: | ||
|
|
||
| - `balanceChange`: adds a specified amount to the balance of a given account. This amount can be | ||
| specified as hex or decimal and must be positive. | ||
| - `storage`: modifies the specified storage slots to the specified values. Keys and values must | ||
| be 32 bytes specified in hex, with a `0x` prefix. | ||
| - `code`: modifies the code of a contract at the provided address to the specified code. The | ||
| code must _only_ be the runtime portion of a code. | ||
darioush marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| :::warning | ||
|
|
||
| If modifying the code, _only_ the runtime portion of the bytecode should be provided in | ||
| `upgrades.json`. Do not use the bytecode that would be used for deploying a new contract, as this | ||
| includes the constructor code as well. Refer to your compiler's documentation for information | ||
| on how to find the runtime portion of the contract you wish to modify. | ||
|
|
||
| ::: | ||
|
|
||
| The `upgrades.json` file shown below describes a network upgrade that will make the following | ||
| state modifications at the first block after (or at) `March 8, 2023 1:30:00 AM GMT`: | ||
|
|
||
| - Sets the code for the account at `0x71562b71999873DB5b286dF957af199Ec94617F7`, | ||
| - And adds `100` wei to the balance of the account at `0xFF00000000000000000000000000000000000000`, | ||
| - Sets the storage slot `0x1234` to the value `0x6666` for the account at `0xFF00000000000000000000000000000000000000`. | ||
|
|
||
| ```json | ||
| { | ||
| "stateUpgrades": [ | ||
| { | ||
| "blockTimestamp": 1678239000, | ||
| "accounts": { | ||
| "0x71562b71999873DB5b286dF957af199Ec94617F7": { | ||
| "code": "0xdeadbeef" | ||
|
||
| }, | ||
| "0xFF00000000000000000000000000000000000000": { | ||
| "balanceChange": "0x64", | ||
| "storage": { | ||
| "0x0000000000000000000000000000000000000000000000000000000000001234": "0x0000000000000000000000000000000000000000000000000000000000006666" | ||
|
||
| } | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.