Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit b5923f1

Browse files
authored
Add Fork9UpgradeBatch params (#176)
* update * fix doc * update * update * update * update * update
1 parent aaab4fa commit b5923f1

8 files changed

Lines changed: 89 additions & 1 deletion

File tree

cmd/run.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,15 @@ func runSynchronizer(cfg config.Config, etherman *etherman.Client, ethTxManagerS
335335

336336
// XLayer handler
337337
setEthermanDaXLayer(cfg, st, eth, false)
338+
eth.SetFork9UpgradeBatch(cfg.Fork9UpgradeBatch)
338339

339340
etherManForL1 = append(etherManForL1, eth)
340341
}
341342
}
342343

343344
// XLayer handler
344345
setEthermanDaXLayer(cfg, st, etherman, false)
346+
etherman.SetFork9UpgradeBatch(cfg.Fork9UpgradeBatch)
345347

346348
etm := ethtxmanager.New(cfg.EthTxManager, etherman, ethTxManagerStorage, st)
347349
sy, err := synchronizer.NewSynchronizer(

config/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ type Config struct {
120120
State state.Config
121121
// Apollo configuration
122122
Apollo types.ApolloConfig
123+
// ForceBatchAddress Address of the L1 ForceBatch contract
124+
Fork9UpgradeBatch uint64 `mapstructure:"Fork9UpgradeBatch"`
123125
}
124126

125127
// Default parses the default configuration values.

config/default.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const DefaultValues = `
55
IsTrustedSequencer = false
66
ForkUpgradeBatchNumber = 0
77
ForkUpgradeNewForkId = 0
8+
Fork9UpgradeBatch = 0
89
910
[Log]
1011
Environment = "development" # "production" or "development"

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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
| - [HashDB](#HashDB ) | No | object | No | - | Configuration of the hash database connection |
2929
| - [State](#State ) | No | object | No | - | State service configuration |
3030
| - [Apollo](#Apollo ) | No | object | No | - | Apollo configuration |
31+
| - [Fork9UpgradeBatch](#Fork9UpgradeBatch ) | No | integer | No | - | ForceBatchAddress Address of the L1 ForceBatch contract |
3132

3233
## <a name="IsTrustedSequencer"></a>1. `IsTrustedSequencer`
3334

@@ -5476,5 +5477,18 @@ AppID=""
54765477
NamespaceName=""
54775478
```
54785479

5480+
## <a name="Fork9UpgradeBatch"></a>22. `Fork9UpgradeBatch`
5481+
5482+
**Type:** : `integer`
5483+
5484+
**Default:** `0`
5485+
5486+
**Description:** ForceBatchAddress Address of the L1 ForceBatch contract
5487+
5488+
**Example setting the default value** (0):
5489+
```
5490+
Fork9UpgradeBatch=0
5491+
```
5492+
54795493
----------------------------------------------------------------------------------------------------------------------------
54805494
Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans)

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,6 +2164,11 @@
21642164
"additionalProperties": false,
21652165
"type": "object",
21662166
"description": "Apollo configuration"
2167+
},
2168+
"Fork9UpgradeBatch": {
2169+
"type": "integer",
2170+
"description": "ForceBatchAddress Address of the L1 ForceBatch contract",
2171+
"default": 0
21672172
}
21682173
},
21692174
"additionalProperties": false,

docs/upgrade_testnet_rpc_fork9.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# upgrade testnet rpc fork.9
2+
XLayer Testnet has been upgraded to Fork9. You can upgrade permission less rpc nodes in two ways.
3+
4+
For more detailed information, please refer to:https://www.okx.com/zh-hans/xlayer/docs/developer/setup-zknode/setup-production-zknode
5+
## 1.Re-download the script and snapshot. It will take about 3 hours. (Recommended)
6+
``` bash
7+
apt install axel # Parallel download tools
8+
apt install pigz # Parallel compression tools
9+
wget https://static.okex.org/cdn/chain/xlayer/snapshot/run_xlayer_testnet.sh && chmod +x run_xlayer_testnet.sh && ./run_xlayer_testnet.sh init && cp ./testnet/example.env ./testnet/.env
10+
vim ./testnet/.env # Modify XLAYER_NODE_ETHERMAN_URL = "http://your.L1node.url"
11+
./run_xlayer_testnet.sh restore
12+
./run_xlayer_testnet.sh start
13+
```
14+
15+
## 2.Manual upgrade
16+
### 2.1 Stop the xlayer-sync and xlayer-rpc services.
17+
### 2.2 Modify the configuration file.
18+
Modify the docker-compose.yml file and replace the image version as follows:
19+
```
20+
xlayer-rpc->image: okexchain/xlayer-node:origin_sync-v0.3.6_20240412160714_76857189
21+
xlayer-sync->image: okexchain/xlayer-node:origin_sync-v0.3.6_20240412160714_76857189
22+
xlayer-prover->image: okexchain/xlayer-prover:origin_release_v0.3.1_20240327040854_458b8d26
23+
```
24+
25+
Modify the config/genesis.config.json file and add the fields rollupCreationBlockNumber and rollupManagerCreationBlockNumber as follows:
26+
```
27+
{
28+
...
29+
"genesisBlockNumber": 4648290,
30+
31+
"rollupCreationBlockNumber": 4648290,
32+
"rollupManagerCreationBlockNumber": 4648290,
33+
34+
"root": "0xb2fbff62137228e52809081a425bfcd30c0fdc8c1213085278c739676a7669b8",
35+
...
36+
}
37+
```
38+
39+
Modify the vim config/node.config.toml file and add the Fork9UpgradeBatch field as follows:
40+
```
41+
...
42+
ForkUpgradeBatchNumber=0
43+
ForkUpgradeNewForkId=0
44+
45+
Fork9UpgradeBatch=476000
46+
...
47+
48+
```
49+
50+
### 2.3 Start the xlayer-sync and xlayer-rpc services.
51+

etherman/etherman_xlayer.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ type Client struct {
208208
auth map[common.Address]bind.TransactOpts // empty in case of read-only client
209209

210210
da dataavailability.BatchDataProvider
211+
212+
fork9UpgradeBatch uint64
211213
}
212214

213215
// NewClient creates a new etherman.
@@ -827,6 +829,11 @@ func (etherMan *Client) updateForkId(ctx context.Context, vLog types.Log, blocks
827829
log.Debug("ignoring this event because it is related to another rollup %d, we are rollupID %d", affectedRollupID, etherMan.RollupID)
828830
return nil
829831
}
832+
if forkID == state.FORKID_9 && etherMan.fork9UpgradeBatch != 0 {
833+
batchNum = etherMan.fork9UpgradeBatch
834+
}
835+
log.Infof("updateForkId: %d, %d, %s", batchNum, forkID, version)
836+
830837
fork := ForkID{
831838
BatchNumber: batchNum,
832839
ForkID: forkID,
@@ -2071,6 +2078,12 @@ func (etherMan *Client) SetDataProvider(da dataavailability.BatchDataProvider) {
20712078
etherMan.da = da
20722079
}
20732080

2081+
// SetFork9UpgradeBatch sets the fork9 upgrade batch
2082+
func (etherMan *Client) SetFork9UpgradeBatch(fork9UpgradeBatch uint64) {
2083+
log.Infof("SetFork9UpgradeBatch:%v", fork9UpgradeBatch)
2084+
etherMan.fork9UpgradeBatch = fork9UpgradeBatch
2085+
}
2086+
20742087
// SetDataAvailabilityProtocol sets the address for the new data availability protocol
20752088
func (etherMan *Client) SetDataAvailabilityProtocol(from, daAddress common.Address) (*types.Transaction, error) {
20762089
auth, err := etherMan.getAuthByAddress(from)

0 commit comments

Comments
 (0)