Skip to content

Commit 0a82217

Browse files
authored
update executor proto (0xPolygonHermez#2872)
* update executor proto * update doc
1 parent 63dc930 commit 0a82217

27 files changed

+1467
-832
lines changed

cmd/dumpstate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type dumpedState struct {
4747
type genesis state.Genesis
4848

4949
func (g genesis) MarshalJSON() ([]byte, error) {
50-
for _, action := range g.GenesisActions {
50+
for _, action := range g.Actions {
5151
if !strings.HasPrefix(action.Value, "0x") {
5252
action.Value = fmt.Sprintf("0x%s", action.Value)
5353
}
@@ -66,7 +66,7 @@ func (g genesis) MarshalJSON() ([]byte, error) {
6666
Actions []*state.GenesisAction
6767
}{
6868
Alias: (Alias)(g),
69-
Actions: g.GenesisActions,
69+
Actions: g.Actions,
7070
})
7171
}
7272

cmd/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func start(cliCtx *cli.Context) error {
117117
}
118118

119119
st := newState(cliCtx.Context, c, l2ChainID, []state.ForkIDInterval{}, stateSqlDB, eventLog, needsExecutor, needsStateTree)
120-
forkIDIntervals, err := forkIDIntervals(cliCtx.Context, st, etherman, c.NetworkConfig.Genesis.GenesisBlockNum)
120+
forkIDIntervals, err := forkIDIntervals(cliCtx.Context, st, etherman, c.NetworkConfig.Genesis.BlockNumber)
121121
if err != nil {
122122
log.Fatal("error getting forkIDs. Error: ", err)
123123
}

config/network.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ func LoadGenesisFromJSONString(jsonStr string) (NetworkConfig, error) {
121121

122122
cfg.L1Config = cfgJSON.L1Config
123123
cfg.Genesis = state.Genesis{
124-
GenesisBlockNum: cfgJSON.GenesisBlockNum,
125-
Root: common.HexToHash(cfgJSON.Root),
126-
GenesisActions: []*state.GenesisAction{},
127-
FirstBatchData: cfgJSON.FirstBatchData,
124+
BlockNumber: cfgJSON.GenesisBlockNum,
125+
Root: common.HexToHash(cfgJSON.Root),
126+
Actions: []*state.GenesisAction{},
127+
FirstBatchData: cfgJSON.FirstBatchData,
128128
}
129129

130130
for _, account := range cfgJSON.Genesis {
@@ -134,23 +134,23 @@ func LoadGenesisFromJSONString(jsonStr string) (NetworkConfig, error) {
134134
Type: int(merkletree.LeafTypeBalance),
135135
Value: account.Balance,
136136
}
137-
cfg.Genesis.GenesisActions = append(cfg.Genesis.GenesisActions, action)
137+
cfg.Genesis.Actions = append(cfg.Genesis.Actions, action)
138138
}
139139
if account.Nonce != "" && account.Nonce != "0" {
140140
action := &state.GenesisAction{
141141
Address: account.Address,
142142
Type: int(merkletree.LeafTypeNonce),
143143
Value: account.Nonce,
144144
}
145-
cfg.Genesis.GenesisActions = append(cfg.Genesis.GenesisActions, action)
145+
cfg.Genesis.Actions = append(cfg.Genesis.Actions, action)
146146
}
147147
if account.Bytecode != "" {
148148
action := &state.GenesisAction{
149149
Address: account.Address,
150150
Type: int(merkletree.LeafTypeCode),
151151
Bytecode: account.Bytecode,
152152
}
153-
cfg.Genesis.GenesisActions = append(cfg.Genesis.GenesisActions, action)
153+
cfg.Genesis.Actions = append(cfg.Genesis.Actions, action)
154154
}
155155
if len(account.Storage) > 0 {
156156
for storageKey, storageValue := range account.Storage {
@@ -160,7 +160,7 @@ func LoadGenesisFromJSONString(jsonStr string) (NetworkConfig, error) {
160160
StoragePosition: storageKey,
161161
Value: storageValue,
162162
}
163-
cfg.Genesis.GenesisActions = append(cfg.Genesis.GenesisActions, action)
163+
cfg.Genesis.Actions = append(cfg.Genesis.Actions, action)
164164
}
165165
}
166166
}

config/network_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ func TestLoadCustomNetworkConfig(t *testing.T) {
8888
Timestamp: 1697640780,
8989
Sequencer: common.HexToAddress("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"),
9090
},
91-
Root: common.HexToHash("0xBEEF"),
92-
GenesisBlockNum: 69,
93-
GenesisActions: []*state.GenesisAction{
91+
Root: common.HexToHash("0xBEEF"),
92+
BlockNumber: 69,
93+
Actions: []*state.GenesisAction{
9494
{
9595
Address: "0xc949254d682d8c9ad5682521675b8f43b102aec4",
9696
Type: int(merkletree.LeafTypeNonce),
@@ -173,7 +173,7 @@ func TestLoadCustomNetworkConfig(t *testing.T) {
173173
}`,
174174
expectedConfig: NetworkConfig{
175175
Genesis: state.Genesis{
176-
GenesisActions: []*state.GenesisAction{
176+
Actions: []*state.GenesisAction{
177177
{
178178
Address: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
179179
Type: int(merkletree.LeafTypeBalance),

docs/config-file/node-config-doc.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/config-file/node-config-doc.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,36 +2632,36 @@ chainId=0
26322632
**Type:** : `object`
26332633
**Description:** L1: Genesis of the rollup, first block number and root
26342634

2635-
| Property | Pattern | Type | Deprecated | Definition | Title/Description |
2636-
| ------------------------------------------------------------ | ------- | ---------------- | ---------- | ---------- | --------------------------------------------------------------------------------- |
2637-
| - [GenesisBlockNum](#NetworkConfig_Genesis_GenesisBlockNum ) | No | integer | No | - | GenesisBlockNum is the block number where the polygonZKEVM smc was deployed on L1 |
2638-
| - [Root](#NetworkConfig_Genesis_Root ) | No | array of integer | No | - | Root hash of the genesis block |
2639-
| - [GenesisActions](#NetworkConfig_Genesis_GenesisActions ) | No | array of object | No | - | Contracts to be deployed to L2 |
2640-
| - [FirstBatchData](#NetworkConfig_Genesis_FirstBatchData ) | No | object | No | - | Data of the first batch after the genesis(Batch 1) |
2635+
| Property | Pattern | Type | Deprecated | Definition | Title/Description |
2636+
| ---------------------------------------------------------- | ------- | ---------------- | ---------- | ---------- | ----------------------------------------------------------------------------- |
2637+
| - [BlockNumber](#NetworkConfig_Genesis_BlockNumber ) | No | integer | No | - | BlockNumber is the block number where the polygonZKEVM smc was deployed on L1 |
2638+
| - [Root](#NetworkConfig_Genesis_Root ) | No | array of integer | No | - | Root hash of the genesis block |
2639+
| - [Actions](#NetworkConfig_Genesis_Actions ) | No | array of object | No | - | Actions is the data to populate into the state trie |
2640+
| - [FirstBatchData](#NetworkConfig_Genesis_FirstBatchData ) | No | object | No | - | Data of the first batch after the genesis(Batch 1) |
26412641

2642-
#### <a name="NetworkConfig_Genesis_GenesisBlockNum"></a>13.2.1. `NetworkConfig.Genesis.GenesisBlockNum`
2642+
#### <a name="NetworkConfig_Genesis_BlockNumber"></a>13.2.1. `NetworkConfig.Genesis.BlockNumber`
26432643

26442644
**Type:** : `integer`
26452645

26462646
**Default:** `0`
26472647

2648-
**Description:** GenesisBlockNum is the block number where the polygonZKEVM smc was deployed on L1
2648+
**Description:** BlockNumber is the block number where the polygonZKEVM smc was deployed on L1
26492649

26502650
**Example setting the default value** (0):
26512651
```
26522652
[NetworkConfig.Genesis]
2653-
GenesisBlockNum=0
2653+
BlockNumber=0
26542654
```
26552655

26562656
#### <a name="NetworkConfig_Genesis_Root"></a>13.2.2. `NetworkConfig.Genesis.Root`
26572657

26582658
**Type:** : `array of integer`
26592659
**Description:** Root hash of the genesis block
26602660

2661-
#### <a name="NetworkConfig_Genesis_GenesisActions"></a>13.2.3. `NetworkConfig.Genesis.GenesisActions`
2661+
#### <a name="NetworkConfig_Genesis_Actions"></a>13.2.3. `NetworkConfig.Genesis.Actions`
26622662

26632663
**Type:** : `array of object`
2664-
**Description:** Contracts to be deployed to L2
2664+
**Description:** Actions is the data to populate into the state trie
26652665

26662666
| | Array restrictions |
26672667
| -------------------- | ------------------ |
@@ -2671,50 +2671,50 @@ GenesisBlockNum=0
26712671
| **Additional items** | False |
26722672
| **Tuple validation** | See below |
26732673

2674-
| Each item of this array must be | Description |
2675-
| ------------------------------------------------------------------- | ------------------------------------------------------------------------- |
2676-
| [GenesisActions items](#NetworkConfig_Genesis_GenesisActions_items) | GenesisAction represents one of the values set on the SMT during genesis. |
2674+
| Each item of this array must be | Description |
2675+
| ----------------------------------------------------- | ------------------------------------------------------------------------- |
2676+
| [Actions items](#NetworkConfig_Genesis_Actions_items) | GenesisAction represents one of the values set on the SMT during genesis. |
26772677

2678-
##### <a name="autogenerated_heading_3"></a>13.2.3.1. [NetworkConfig.Genesis.GenesisActions.GenesisActions items]
2678+
##### <a name="autogenerated_heading_3"></a>13.2.3.1. [NetworkConfig.Genesis.Actions.Actions items]
26792679

26802680
**Type:** : `object`
26812681
**Description:** GenesisAction represents one of the values set on the SMT during genesis.
26822682

2683-
| Property | Pattern | Type | Deprecated | Definition | Title/Description |
2684-
| --------------------------------------------------------------------------------- | ------- | ------- | ---------- | ---------- | ----------------- |
2685-
| - [address](#NetworkConfig_Genesis_GenesisActions_items_address ) | No | string | No | - | - |
2686-
| - [type](#NetworkConfig_Genesis_GenesisActions_items_type ) | No | integer | No | - | - |
2687-
| - [storagePosition](#NetworkConfig_Genesis_GenesisActions_items_storagePosition ) | No | string | No | - | - |
2688-
| - [bytecode](#NetworkConfig_Genesis_GenesisActions_items_bytecode ) | No | string | No | - | - |
2689-
| - [key](#NetworkConfig_Genesis_GenesisActions_items_key ) | No | string | No | - | - |
2690-
| - [value](#NetworkConfig_Genesis_GenesisActions_items_value ) | No | string | No | - | - |
2691-
| - [root](#NetworkConfig_Genesis_GenesisActions_items_root ) | No | string | No | - | - |
2683+
| Property | Pattern | Type | Deprecated | Definition | Title/Description |
2684+
| -------------------------------------------------------------------------- | ------- | ------- | ---------- | ---------- | ----------------- |
2685+
| - [address](#NetworkConfig_Genesis_Actions_items_address ) | No | string | No | - | - |
2686+
| - [type](#NetworkConfig_Genesis_Actions_items_type ) | No | integer | No | - | - |
2687+
| - [storagePosition](#NetworkConfig_Genesis_Actions_items_storagePosition ) | No | string | No | - | - |
2688+
| - [bytecode](#NetworkConfig_Genesis_Actions_items_bytecode ) | No | string | No | - | - |
2689+
| - [key](#NetworkConfig_Genesis_Actions_items_key ) | No | string | No | - | - |
2690+
| - [value](#NetworkConfig_Genesis_Actions_items_value ) | No | string | No | - | - |
2691+
| - [root](#NetworkConfig_Genesis_Actions_items_root ) | No | string | No | - | - |
26922692

2693-
##### <a name="NetworkConfig_Genesis_GenesisActions_items_address"></a>13.2.3.1.1. `NetworkConfig.Genesis.GenesisActions.GenesisActions items.address`
2693+
##### <a name="NetworkConfig_Genesis_Actions_items_address"></a>13.2.3.1.1. `NetworkConfig.Genesis.Actions.Actions items.address`
26942694

26952695
**Type:** : `string`
26962696

2697-
##### <a name="NetworkConfig_Genesis_GenesisActions_items_type"></a>13.2.3.1.2. `NetworkConfig.Genesis.GenesisActions.GenesisActions items.type`
2697+
##### <a name="NetworkConfig_Genesis_Actions_items_type"></a>13.2.3.1.2. `NetworkConfig.Genesis.Actions.Actions items.type`
26982698

26992699
**Type:** : `integer`
27002700

2701-
##### <a name="NetworkConfig_Genesis_GenesisActions_items_storagePosition"></a>13.2.3.1.3. `NetworkConfig.Genesis.GenesisActions.GenesisActions items.storagePosition`
2701+
##### <a name="NetworkConfig_Genesis_Actions_items_storagePosition"></a>13.2.3.1.3. `NetworkConfig.Genesis.Actions.Actions items.storagePosition`
27022702

27032703
**Type:** : `string`
27042704

2705-
##### <a name="NetworkConfig_Genesis_GenesisActions_items_bytecode"></a>13.2.3.1.4. `NetworkConfig.Genesis.GenesisActions.GenesisActions items.bytecode`
2705+
##### <a name="NetworkConfig_Genesis_Actions_items_bytecode"></a>13.2.3.1.4. `NetworkConfig.Genesis.Actions.Actions items.bytecode`
27062706

27072707
**Type:** : `string`
27082708

2709-
##### <a name="NetworkConfig_Genesis_GenesisActions_items_key"></a>13.2.3.1.5. `NetworkConfig.Genesis.GenesisActions.GenesisActions items.key`
2709+
##### <a name="NetworkConfig_Genesis_Actions_items_key"></a>13.2.3.1.5. `NetworkConfig.Genesis.Actions.Actions items.key`
27102710

27112711
**Type:** : `string`
27122712

2713-
##### <a name="NetworkConfig_Genesis_GenesisActions_items_value"></a>13.2.3.1.6. `NetworkConfig.Genesis.GenesisActions.GenesisActions items.value`
2713+
##### <a name="NetworkConfig_Genesis_Actions_items_value"></a>13.2.3.1.6. `NetworkConfig.Genesis.Actions.Actions items.value`
27142714

27152715
**Type:** : `string`
27162716

2717-
##### <a name="NetworkConfig_Genesis_GenesisActions_items_root"></a>13.2.3.1.7. `NetworkConfig.Genesis.GenesisActions.GenesisActions items.root`
2717+
##### <a name="NetworkConfig_Genesis_Actions_items_root"></a>13.2.3.1.7. `NetworkConfig.Genesis.Actions.Actions items.root`
27182718

27192719
**Type:** : `string`
27202720

docs/config-file/node-config-schema.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,9 +1049,9 @@
10491049
},
10501050
"Genesis": {
10511051
"properties": {
1052-
"GenesisBlockNum": {
1052+
"BlockNumber": {
10531053
"type": "integer",
1054-
"description": "GenesisBlockNum is the block number where the polygonZKEVM smc was deployed on L1",
1054+
"description": "BlockNumber is the block number where the polygonZKEVM smc was deployed on L1",
10551055
"default": 0
10561056
},
10571057
"Root": {
@@ -1063,7 +1063,7 @@
10631063
"minItems": 32,
10641064
"description": "Root hash of the genesis block"
10651065
},
1066-
"GenesisActions": {
1066+
"Actions": {
10671067
"items": {
10681068
"properties": {
10691069
"address": {
@@ -1093,7 +1093,7 @@
10931093
"description": "GenesisAction represents one of the values set on the SMT during genesis."
10941094
},
10951095
"type": "array",
1096-
"description": "Contracts to be deployed to L2"
1096+
"description": "Actions is the data to populate into the state trie"
10971097
},
10981098
"FirstBatchData": {
10991099
"properties": {

pool/pool_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var (
4949
stateDBCfg = dbutils.NewStateConfigFromEnv()
5050
poolDBCfg = dbutils.NewPoolConfigFromEnv()
5151
genesis = state.Genesis{
52-
GenesisActions: []*state.GenesisAction{
52+
Actions: []*state.GenesisAction{
5353
{
5454
Address: senderAddress,
5555
Type: int(merkletree.LeafTypeBalance),
@@ -290,7 +290,7 @@ func Test_AddTx_OversizedData(t *testing.T) {
290290
ReceivedAt: time.Now(),
291291
}
292292
genesis := state.Genesis{
293-
GenesisActions: []*state.GenesisAction{
293+
Actions: []*state.GenesisAction{
294294
{
295295
Address: senderAddress,
296296
Type: int(merkletree.LeafTypeBalance),
@@ -353,7 +353,7 @@ func Test_AddPreEIP155Tx(t *testing.T) {
353353
ReceivedAt: time.Now(),
354354
}
355355
genesis := state.Genesis{
356-
GenesisActions: []*state.GenesisAction{
356+
Actions: []*state.GenesisAction{
357357
{
358358
Address: senderAddress,
359359
Type: int(merkletree.LeafTypeBalance),
@@ -1012,7 +1012,7 @@ func Test_TryAddIncompatibleTxs(t *testing.T) {
10121012
initialBalance, _ := big.NewInt(0).SetString(encoding.MaxUint256StrNumber, encoding.Base10)
10131013
initialBalance = initialBalance.Add(initialBalance, initialBalance)
10141014
genesis := state.Genesis{
1015-
GenesisActions: []*state.GenesisAction{
1015+
Actions: []*state.GenesisAction{
10161016
{
10171017
Address: operations.DefaultSequencerAddress,
10181018
Type: int(merkletree.LeafTypeBalance),
@@ -1334,7 +1334,7 @@ func Test_AddTx_GasPriceErr(t *testing.T) {
13341334
ReceivedAt: time.Now(),
13351335
}
13361336
genesis := state.Genesis{
1337-
GenesisActions: []*state.GenesisAction{
1337+
Actions: []*state.GenesisAction{
13381338
{
13391339
Address: senderAddress,
13401340
Type: int(merkletree.LeafTypeBalance),
@@ -1475,7 +1475,7 @@ func Test_BlockedAddress(t *testing.T) {
14751475
}
14761476

14771477
genesis := state.Genesis{
1478-
GenesisActions: []*state.GenesisAction{
1478+
Actions: []*state.GenesisAction{
14791479
{
14801480
Address: auth.From.String(),
14811481
Type: int(merkletree.LeafTypeBalance),
@@ -1691,7 +1691,7 @@ func Test_AddTx_AccountQueueLimit(t *testing.T) {
16911691
ReceivedAt: time.Now(),
16921692
}
16931693
genesis := state.Genesis{
1694-
GenesisActions: []*state.GenesisAction{
1694+
Actions: []*state.GenesisAction{
16951695
{
16961696
Address: senderAddress,
16971697
Type: int(merkletree.LeafTypeBalance),
@@ -1800,7 +1800,7 @@ func Test_AddTx_GlobalQueueLimit(t *testing.T) {
18001800
ReceivedAt: time.Now(),
18011801
}
18021802
genesis := state.Genesis{
1803-
GenesisActions: genesisActions,
1803+
Actions: genesisActions,
18041804
FirstBatchData: genesis.FirstBatchData,
18051805
}
18061806
ctx := context.Background()
@@ -1882,7 +1882,7 @@ func Test_AddTx_NonceTooHigh(t *testing.T) {
18821882
ReceivedAt: time.Now(),
18831883
}
18841884
genesis := state.Genesis{
1885-
GenesisActions: []*state.GenesisAction{
1885+
Actions: []*state.GenesisAction{
18861886
{
18871887
Address: senderAddress,
18881888
Type: int(merkletree.LeafTypeBalance),

proto/src/proto/executor/v1/executor.proto

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -277,18 +277,20 @@ message ProcessBatchRequestV2 {
277277
uint32 skip_verify_l1_info_root = 14;
278278
// flag to skip the restriction to start a batch with a changeL2Block transaction
279279
uint32 skip_first_change_l2_block = 15;
280+
// flag to skip writing the block info root in the state
281+
uint32 skip_write_block_info_root = 16;
280282
// lInfoTree information
281-
map<uint32, L1DataV2> l1_info_tree_data = 16;
283+
map<uint32, L1DataV2> l1_info_tree_data = 17;
282284
// For testing purposes only
283-
map<string, string> db = 17;
284-
map<string, string> contracts_bytecode = 18; // For debug/testing purpposes only. Don't fill this on production
285-
TraceConfigV2 trace_config = 19;
286-
string context_id = 20;
287-
uint32 get_keys = 21; // if 1, the keys used to read or write storage values will be returned
285+
map<string, string> db = 18;
286+
map<string, string> contracts_bytecode = 19; // For debug/testing purpposes only. Don't fill this on production
287+
TraceConfigV2 trace_config = 20;
288+
string context_id = 21;
289+
uint32 get_keys = 22; // if 1, the keys used to read or write storage values will be returned
288290
// The state override set is an optional address-to-state mapping,
289291
// where each entry specifies some state to be ephemerally overridden
290292
// prior to executing the call.
291-
map<string, OverrideAccountV2> state_override = 22;
293+
map<string, OverrideAccountV2> state_override = 23;
292294
}
293295

294296
message L1DataV2 {
@@ -817,4 +819,6 @@ enum ExecutorError {
817819
EXECUTOR_ERROR_INVALID_L1_SMT_PROOF = 101;
818820
// EXECUTOR_ERROR_INVALID_BALANCE indicates that the input parameter balance value is invalid
819821
EXECUTOR_ERROR_INVALID_BALANCE = 102;
820-
}
822+
// EXECUTOR_ERROR_SM_MAIN_BINARY_LT4_MISMATCH indicates that the binary instruction less than four opcode failed
823+
EXECUTOR_ERROR_SM_MAIN_BINARY_LT4_MISMATCH = 103;
824+
}

state/batchV2.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ func (s *State) ProcessBatchV2(ctx context.Context, request ProcessRequest, upda
6262
processBatchRequest.SkipFirstChangeL2Block = cTrue
6363
}
6464

65+
if request.SkipWriteBlockInfoRoot {
66+
processBatchRequest.SkipWriteBlockInfoRoot = cTrue
67+
}
68+
6569
res, err := s.sendBatchRequestToExecutorV2(ctx, processBatchRequest, request.Caller)
6670
if err != nil {
6771
return nil, err

0 commit comments

Comments
 (0)