Skip to content

Commit 98624b4

Browse files
authored
Merge pull request #81 from tronprotocol/develop
Develop
2 parents 1033c18 + 66883fe commit 98624b4

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

conf/private_net_config_witness1.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ seed.node = {
199199
]
200200
}
201201

202+
# if you use the fork database from mainnet keep this genesis.block the same as mainnet
202203
genesis.block = {
203204
# Reserve balance
204205
assets = [

conf/private_net_config_witness2.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ seed.node = {
200200
]
201201
}
202202

203+
# if you use the fork database from mainnet keep this genesis.block the same as mainnet
203204
genesis.block = {
204205
# Reserve balance
205206
assets = [

tools/stress_test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ broadcastTx = {
121121

122122
- `saveTxId`: configure whether to save the transaction id of the broadcast transactions.
123123

124-
*Note*: we can use the [dbfork](../toolkit/DbFork.md) tool to get enough `TRX/TRC10/TRC20` balances of address corresponding
124+
*Note*: we can use the [DBFork](../toolkit/DBFork.md) tool to get enough `TRX/TRC10/TRC20` balances of address corresponding
125125
to the `privateKey` for the stress test.
126126

127127
Then we can execute the following `generate` subcommand:
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ java -jar Toolkit.jar db copy output-directory output-directory-bak
4848
```
4949

5050
### Run the DBFork tool
51-
Run the DBFork tool in the Toolkit to modify the related data. The available parameters are:
51+
Run the DBFork tool in the Toolkit to modify the related data. First, check [Build The Toolkit](README.md#build-the-toolkit) to generate the `Toolkit.jar` file. After building successfully, you can use the following parameters to run the tool:
5252
- `-c | --config=<config>`: config the new witnesses, balances, etc for shadow
5353
fork. Default: fork.conf
5454
- `-d | --database-directory=<database>`: java-tron database directory path. Default: output-directory
5555
- `-h | --help`
5656
- `-r | --retain-witnesses`: retain the previous witnesses and active witnesses. Default: false
5757

58-
The example of `fork.conf` can be:
58+
The example of [fork.conf](./src/main/resources/fork.conf) can be:
5959

6060
```conf
6161
witnesses = [
@@ -126,23 +126,23 @@ For the `accounts`, we can configure the following properties:
126126
- `trc10Id`: the TRC10 token ID
127127
- `trc10Balance`: change the balance of `trc10Id`
128128

129-
*Note*: If you need to add new address, you can use the [tronlink](https://www.tronlink.org/) or [wallet-cli](https://github.com/tronprotocol/wallet-cli?tab=readme-ov-file#account-related-commands) to genrate the private key and address.
129+
*Note*: If you need to add new address, you can use the [tronlink](https://www.tronlink.org/) or [wallet-cli](https://github.com/tronprotocol/wallet-cli?tab=readme-ov-file#account-related-commands) to genrate the private key and address.
130130

131131
For the `trc20Contracts`, we can configure the following properties:
132132
- `contractAddress`: set the TRC20 contract address
133133
- `balancesSlotPosition`: set the `balances` slot position in the TRC20 contract storage layout
134134
- `address`: set the account address
135135
- `balance`: set the TRC20 balance
136136

137-
*Note*: the `balancesSlotPosition` sets slot position for
138-
`mapping(address account => uint256) private _balances` variable in the TRC20 contract.
139-
For most standard TRC20 contracts, the `balancesSlotPosition` is 0. For some special cases,
140-
you may need to change the `balancesSlotPosition` value. For more details about the variable slot position
141-
in the contract, please refer [layout_in_storage](https://docs.soliditylang.org/en/latest/internals/layout_in_storage.html).
137+
*Note*: the `balancesSlotPosition` sets slot position for
138+
`mapping(address account => uint256) private _balances` variable in the TRC20 contract.
139+
For most standard TRC20 contracts, the `balancesSlotPosition` is 0. For some special cases,
140+
you may need to change the `balancesSlotPosition` value. For more details about the variable slot position
141+
in the contract, please refer [layout_in_storage](https://docs.soliditylang.org/en/latest/internals/layout_in_storage.html).
142142

143-
set `latestBlockHeaderTimestamp` as current millisecond time to avoid the delay in producing blocks.
143+
Set `latestBlockHeaderTimestamp` as the current time in milliseconds. This timestamp is used before processing new blocks - setting it to the current time reduces debug log output and accelerates the production of the first new block. This setting does not impact the underlying block production logic.
144144

145-
set `maintenanceTimeInterval` and `nextMaintenanceTime` optionally to facilitate testing.
145+
Set `maintenanceTimeInterval` and `nextMaintenanceTime` optionally to facilitate testing.
146146

147147
Execute the fork command:
148148
```shell script
@@ -167,7 +167,9 @@ localwitness = [
167167
]
168168
```
169169

170-
If another node wants to join the shadow fork network, it needs to execute the above steps, or it copies the state data from the first shadow fork node directly. They need to configure the same `node.p2p.version` and add the `seed.node` in the config, then they can sync and produce blocks to form a local testnet.
170+
If another node wants to join the shadow fork network, it needs to execute the above steps, or it copies the database from the first shadow fork node directly. They need to configure the same `node.p2p.version` and add the `seed.node` in the config, then they can sync and produce blocks to form a local testnet.
171+
172+
For instructions on starting a private chain, please refer to [Setup Private Chain](../../private_net/README.md). Note that you must use the same `genesis.block` configuration as the forked database data to ensure compatibility. If the configurations do not match, the node may fail to start or encounter consensus issues.
171173

172174
At last, developers can connect and interact with the node by [wallet-cli](https://tronprotocol.github.io/documentation-en/clients/wallet-cli/),
173175
[TronBox](https://developers.tron.network/reference/what-is-tronbox), [Tron-IDE](https://developers.tron.network/docs/tron-ide) or other tools, and execute the shadow fork testing.

tools/toolkit/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ output-directory
183183
- `-r, --retain-witnesses`: retain the previous witnesses and active witnesses.
184184
- `-h, --help`: provide the help info
185185

186-
Please refer [DbFork](DbFork.md) guidance for more details.
186+
Please refer [DBFork](DBFork.md) guidance for more details.
187187

188188
## DB Query
189189
The [ListWitnesses](https://developers.tron.network/reference/listwitnesses) and [getReward](https://developers.tron.network/reference/wallet-getreward)

tools/toolkit/src/main/resources/fork.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ trc20Contracts = [
5353
}
5454
]
5555

56-
latestBlockHeaderTimestamp = 1739269661000
56+
latestBlockHeaderTimestamp = 1747986162000 # MilliSecond. Used in init setup, setting to current timestamp reduces debug log output and speeds up initialization. This setting does not impact the underlying block production logic.
5757
maintenanceTimeInterval = 21600000
58-
nextMaintenanceTime = 1735628894000
58+
nextMaintenanceTime = 1747996162000 # MilliSecond. Set next maintenance time. It could be anytime. If you set an expired time, it will trigger maintenance logic immediately after node startup.

0 commit comments

Comments
 (0)