Skip to content

Commit

Permalink
correct style
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunny Jiao committed Jan 24, 2025
1 parent e4addbd commit 74f4474
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ tools/dbfork/logs/
libs/
metric_monitor/datadir
private_net/datadir
tron-docker.iml
tron-docker.iml
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ repos:
- id: script-must-have-extension
- id: git-dirty
- id: git-check
- id: forbid-binary
exclude: \.(jpg|jpeg|png)$
- repo: local # check java files format use a customized script
hooks:
- id: checkstyle
Expand Down
12 changes: 6 additions & 6 deletions tools/dbfork/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
## Database Fork Tool
Database fork tool can help launch a private java-tron FullNode or network based on the state of public chain database to support shadow fork testing.
Database fork tool can help launch a private java-tron FullNode or network based on the state of public chain database to support shadow fork testing.
The public chain database can come from the Mainnet, Nile Testnet, or Shasta Testnet.

Database fork tool provides the ability to modify the witnesses and other related data in the database to
implement shadow fork testing, which includes:
- Erase the historical witnesses and active witnesses
- Write new witnesses to the state and update new active witnesses
- Write new balance for new addresses
- Modify the owner permission of existing account to simulate the account operation
- Modify the owner permission of existing account to simulate the account operation
- Set the new `latesteBlockHeaderTimestamp` to avoid the delay in producing blocks
- Set the new `maintenanceTimeInterval` and `nextMaintenanceTime` optionally to facilitate testing

Expand Down Expand Up @@ -37,7 +37,7 @@ node.shutdown = {
}
```

Please refer [Startup a fullnode](https://tronprotocol.github.io/documentation-en/using_javatron/installing_javatron/#startup-a-fullnode) to launch the FullNode and sync to the specified block number. The FullNode will halt when it syncs to the target block height.
Please refer [Startup a fullnode](https://tronprotocol.github.io/documentation-en/using_javatron/installing_javatron/#startup-a-fullnode) to launch the FullNode and sync to the specified block number. The FullNode will halt when it syncs to the target block height.

**Note**: `node.shutdown.BlockHeight` is the solidified block height. You can use the `/wallet/getnowblock` api to check the latest block height, which should be `node.shutdown.BlockHeight + 20` when the FullNode halts.

Expand Down Expand Up @@ -103,10 +103,10 @@ For the `accounts`, we can configure the following properties:
- `address`: add or modify the account address
- `accountName`: set the name of the account
- `accountType`: set the account type, namely `Normal`, `AssetIssue` and `Contract`
- `balance`: set the balance of the account
- `balance`: set the balance of the account
- `owner`: set the owner permission of the account

*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
*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.

set `latestBlockHeaderTimestamp` as current millisecond time to avoid the delay in producing blocks.
Expand All @@ -121,7 +121,7 @@ git clone https://github.com/tronprotocol/tron-docker.git
# enter the directory
cd tron-docker/tools/gradlew
# compile the database fork tool
./gradlew :dbfork:build
./gradlew :dbfork:build
# execute full command
java -jar ../dbfork/build/libs/dbfork.jar -c /path/to/fork.conf -d /path/to/output-directory
```
Expand Down
2 changes: 0 additions & 2 deletions tools/dbfork/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,3 @@ task checkstyleDBForkTest(type: Checkstyle) {
}

check.dependsOn checkstyleDBForkMain, checkstyleDBForkTest


1 change: 0 additions & 1 deletion tools/dbfork/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@
<logger level="INFO" name="dbfork"/>

</configuration>

1 change: 0 additions & 1 deletion tools/dbfork/src/test/java/org/tron/DBForkTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,3 @@ private static String getConfig(String config) {
return path == null ? null : path.getPath();
}
}

2 changes: 0 additions & 2 deletions tools/dbfork/src/test/resources/fork.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,3 @@ accounts = [
latestBlockHeaderTimestamp = 1735628883000
maintenanceTimeInterval = 21600000
nextMaintenanceTime = 1735628894000


2 changes: 1 addition & 1 deletion tools/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.vcs-url="https://github.com/tronprotocol/java-tron.git" \
org.label-schema.vendor="TRON protocol" \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0"
org.label-schema.schema-version="1.0"
2 changes: 1 addition & 1 deletion tools/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -eo pipefail
shopt -s nullglob

echo "./bin/FullNode $@" > command.txt
exec "./bin/FullNode" "$@"
exec "./bin/FullNode" "$@"
6 changes: 2 additions & 4 deletions tools/docker/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ java-tron support containerized processes, we maintain a Docker image with lates

## Prerequisites

Requires a docker to be installed on the system. Docker version >=20.10.12.
Requires a docker to be installed on the system. Docker version >=20.10.12.


## Quick Start
Expand Down Expand Up @@ -35,7 +35,7 @@ $ sh docker.sh --run --net main
or you can use `-p` to customize the port mapping, more custom parameters, please refer to [Options](#Options)

```shell
$ sh docker.sh --run --net main -p 8080:8090 -p 40051:50051
$ sh docker.sh --run --net main -p 8080:8090 -p 40051:50051
```

#### Full node on the nile test network
Expand Down Expand Up @@ -106,5 +106,3 @@ Parameters for all functions:
* **`-v`** bind mount a volume for the container,format: `-v host-src:container-dest`, the `host-src` is an absolute path
* **`--net`** select the network, you can join the main-net, test-net
* **`--update-config`** update configuration file, default true


2 changes: 1 addition & 1 deletion tools/docker/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ bash $TEST_PATH/dgoss run --sysctl net.ipv6.conf.all.disable_ipv6=1 $DOCKER_IMAG
#-p 8090:8090 -p 8091:8091 -p 18888:18888 -p 18888:18888/udp -p 50051:50051 \
> ./reports/01.xml || i=`expr $i + 1`

exit $i
exit $i
1 change: 0 additions & 1 deletion tools/docker/tests/01/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
process:
java:
running: true

2 changes: 1 addition & 1 deletion tools/docker/tests/01/goss_wait.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ http:
command:
/goss/testSync.sh: # use absolute directory to run shell
exit-status: 0
timeout: 10000000
timeout: 10000000
2 changes: 1 addition & 1 deletion tools/docker/tests/01/testSync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ for((i=1;i<=$count;i++)); do
fi
done
echo "sync not increased"
exit 1
exit 1
4 changes: 2 additions & 2 deletions tools/gradlew/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down

0 comments on commit 74f4474

Please sign in to comment.