Skip to content

Commit

Permalink
local-network: common name of log files for different EC, waiting at …
Browse files Browse the repository at this point in the history
…least 1 peer for waves node to solve rollback issues
  • Loading branch information
vsuharnikov committed Sep 12, 2024
1 parent 30b47d2 commit 933cfbe
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion local-network/configs/besu/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout alwaysWriteExceptions="false" pattern='${root.log.pattern}'/>
</Console>
<RollingFile name="RollingFile" fileName="/opt/besu/logs/besu.log" filePattern="/opt/besu/logs/besu-%d{MM-dd-yyyy}-%i.log.gz" >
<RollingFile name="RollingFile" fileName="/opt/besu/logs/log" filePattern="/opt/besu/logs/%d{MM-dd-yyyy}-%i.log.gz" >
<PatternLayout alwaysWriteExceptions="false" pattern='${root.log.pattern}'/>
<Policies>
<TimeBasedTriggeringPolicy />
Expand Down
2 changes: 0 additions & 2 deletions local-network/configs/geth/geth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ services:
- ./run-geth.sh:/tmp/run.sh:ro
env_file:
- ../ec-common/peers.env
logging:
driver: none
healthcheck:
test: 'wget -qO /dev/null --header "content-type: application/json" --post-data {\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1} http://127.0.0.1:8545'
interval: 5s
Expand Down
4 changes: 2 additions & 2 deletions local-network/configs/geth/run-geth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ IP=$(echo "$IP_RAW" | cut -d/ -f1)
NETWORK=$(echo "$IP_RAW" | xargs ipcalc -n | awk -F= '{print $2}')
PREFIX=$(echo "$IP_RAW" | xargs ipcalc -p | awk -F= '{print $2}')

tee /root/logs/bootnode.log <<EOF
tee /root/logs/log <<EOF
IP: $IP
NETWORK: $NETWORK
PREFIX: ${PREFIX}
Expand All @@ -35,7 +35,7 @@ geth \
--netrestrict="${NETWORK}/${PREFIX}" \
--bootnodes="${BESU_BOOTNODES}" \
--syncmode full \
--log.file="/root/logs/geth.log" \
--log.file="/root/logs/log" \
--verbosity=5 \
--log.format=terminal \
--log.rotate \
Expand Down
2 changes: 1 addition & 1 deletion local-network/deploy/src/waves-txs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as s from './common-settings';
export const scSetBalances = wt.data(
{
chainId: s.chainId,
fee: 2400000,
fee: 2_400_000,
data: [
{
key: `%s__${s.wavesMiner1.address}`,
Expand Down
14 changes: 12 additions & 2 deletions local-network/deploy/src/waves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as wavesUtils from './waves-utils';
import { ExtendedWavesApi } from './waves-utils';
import { wavesApi1, wavesApi2, ec1Rpc } from './nodes';

const wavesApis = [wavesApi1, wavesApi2];
const chainContractAddress = s.chainContract.address;

export interface SetupResult {
Expand Down Expand Up @@ -69,8 +70,8 @@ export async function setup(force: boolean): Promise<SetupResult> {
if (isContractSetupResponse.result.value) {
logger.info('The contract is already set up.');
} else {
const setupTxResult = await wavesApi1.transactions.broadcast(tx);
await wavesUtils.waitForTxn(wavesApi1, setupTxResult.id);
await wavesApi1.transactions.broadcast(tx);
await wavesUtils.waitForTxn(wavesApi1, tx.id);
}
};

Expand All @@ -88,6 +89,15 @@ export async function setup(force: boolean): Promise<SetupResult> {
logger.info('Wait Waves 1 node');
await wavesUtils.waitForUp(wavesApi1);

logger.info('Wait Waves node has at least one peer'); // Otherwise we can have problems with rollbacks
let connectedPeers = 0;
do {
await common.sleep(2000);
connectedPeers = (await wavesApi1.peers.fetchConnected()).peers.length;
} while (connectedPeers < 1);

logger.info(`Waves nodes peers: ${connectedPeers}`);

logger.info('Set staking contract balances');
const isNew = await scSetBalances();
const waitTime = 3000;// To eliminate micro fork issue
Expand Down

0 comments on commit 933cfbe

Please sign in to comment.