Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v4.7.6 merge to master #6010

Merged
merged 63 commits into from
Oct 4, 2024
Merged
Changes from 6 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
ff69595
test(CI): add test-retry plugin for test
halibobo1205 Jul 1, 2024
ee7765f
Merge pull request #5916 from halibobo1205/release/4.7.6_add_retry
lvs007 Jul 18, 2024
496d64d
feat(version): update version to 4.7.6
halibobo1205 Jul 18, 2024
f092d0e
Merge pull request #5919 from halibobo1205/version/update_version
lvs007 Jul 18, 2024
0dc7a3f
feat(net) : optimize the isIdle method
zeusoo001 Jun 24, 2024
ddbe8f1
feat(net): add isSyncIdle method
zeusoo001 Jul 1, 2024
0779c00
feat(net): optimize fetch inventory message check logic
zeusoo001 Jun 25, 2024
fdbfa17
feat(net) : optimizing the sortPeers method
zeusoo001 Jun 21, 2024
ea14933
feat(net): use comparingLong method for sortPeers
zeusoo001 Jul 1, 2024
3b3b668
initial commit of test isolated
317787106 Jul 18, 2024
6466458
init commit of set_block_both_have2
317787106 Jul 18, 2024
6a08ac6
test(MerkleTree): ignore testConcurrent
halibobo1205 Jul 1, 2024
f5961f4
add testcase testProcessBlock for BlockMsgHandler
317787106 Jul 19, 2024
6706d83
add testcase testProcessBlock for BlockMsgHandler
317787106 Jul 19, 2024
4211348
Merge pull request #5927 from halibobo1205/test/remove_unstable_test
lvs007 Jul 19, 2024
90a6e8f
fix(http/metric): change endpoint variable from member to local
tomatoishealthy May 14, 2024
27cd42f
Merge pull request #5920 from halibobo1205/fix/endpoint-concurrent-ac…
lvs007 Jul 22, 2024
e670386
set lastactivetime in P2pEventHandlerImpl
317787106 Jul 22, 2024
4791cdf
Merge branch 'release_v4.7.6' into feature/test_isolated3
317787106 Jul 22, 2024
ecd43b7
Merge pull request #5923 from zeusoo001/f-sortpeers-method-opt
lvs007 Jul 22, 2024
afc3979
Merge pull request #5921 from zeusoo001/f-isidle-method-opt
lvs007 Jul 23, 2024
729a99b
Merge pull request #5922 from zeusoo001/f-sync-fetch-block-opt
lvs007 Jul 23, 2024
735bccb
add updateLastActiveTime
317787106 Jul 23, 2024
cae19ea
Merge branch 'release_v4.7.6' into feature/test_isolated3
317787106 Jul 23, 2024
343c5f6
optimize log method of PeerConnection
317787106 Jul 23, 2024
34eb577
Merge branch 'release_v4.7.6' into hotfix/set_block_both_have2
317787106 Jul 23, 2024
d6bbbe4
Merge pull request #5925 from 317787106/hotfix/set_block_both_have2
lvs007 Jul 25, 2024
a718006
catch exception of sort peers
317787106 Jul 25, 2024
4f234be
Merge branch 'release_v4.7.6' into feature/test_isolated3
317787106 Jul 25, 2024
14fda8f
catch exception min of peers
317787106 Jul 25, 2024
54b0395
Merge pull request #5924 from 317787106/feature/test_isolated3
lvs007 Jul 29, 2024
d6faee8
feat(monitor): add tcp out traffic and udp in traffic statistics
zeusoo001 Jul 31, 2024
21f0cb5
Merge pull request #5942 from zeusoo001/net_traffic_monitor3
lvs007 Aug 6, 2024
81bb50b
add some log for isolated2 disconnection
317787106 Aug 7, 2024
0d21388
add log of candidate disconnect size when node is isolated
317787106 Aug 7, 2024
0acc84b
set blockNotChangeThreshold from 90 to 60 seconds
317787106 Aug 9, 2024
0fc9acb
remove the condition of peer.isDisconnect
317787106 Aug 9, 2024
0f7c7f4
don't disconnect with syncing node when random disconnect
317787106 Aug 13, 2024
7bdae32
add DisConnectCause
317787106 Aug 13, 2024
ffbb69e
add DisConnectCause
317787106 Aug 13, 2024
abf8c42
change the condition of isLanNode
317787106 Aug 13, 2024
40cb055
don't disconnect with syncing peer if i am lan node
317787106 Aug 13, 2024
14a0750
modify testcase of ResilienceServiceTest
317787106 Aug 14, 2024
424a3dd
Merge pull request #5944 from 317787106/feature/test_isolated3
lvs007 Aug 14, 2024
471b522
use the condition: active size >= min active size in isolate2
317787106 Aug 15, 2024
553fbb4
change varible name from lastActiveTime to lastInteractiveTime
317787106 Aug 16, 2024
1a7abf3
fix the testcase of testUpdateLastInteractiveTime
317787106 Aug 16, 2024
ea7ef8e
Merge pull request #5956 from 317787106/feature/test_isolated3
lvs007 Aug 16, 2024
31b5d46
Add transaction expiration time check before execution (#1)
fyyhtx Aug 19, 2024
8d496f8
prefer to disconnect from broadcast nodes when isOpenFullTcpDisconnec…
317787106 Sep 2, 2024
f99d216
adjust ResilienceServiceTest
317787106 Sep 3, 2024
e242ae1
add testcase PeerStatusCheckTest
317787106 Sep 3, 2024
6c3a526
use WeightedRandom to choose broadcast peer
317787106 Sep 4, 2024
59e92c8
don't disconnect from high peer if its number <=1
317787106 Sep 4, 2024
1996f7b
Merge pull request #5984 from 317787106/feature/test_isolated3
lvs007 Sep 5, 2024
7bdf75e
Merge remote-tracking branch 'origin/release_v4.7.6' into release_v4.7.6
jwrct Sep 5, 2024
6c73ede
feat(net): delete useless test code
jwrct Sep 12, 2024
cdbbb0a
Merge pull request #5999 from fyyhtx/release_v4.7.6
lvs007 Sep 12, 2024
ddccce4
print trx size from pending and repush after generating block
317787106 Sep 27, 2024
450763b
add some test case
317787106 Sep 27, 2024
9b58a57
Merge pull request #6017 from 317787106/feature/print_sr_queue_size
lvs007 Sep 27, 2024
98a37b1
feat(dependencies): update dependencies for protobuf-java
halibobo1205 Sep 22, 2024
0f39d7a
Merge pull request #6025 from halibobo1205/feat/update_libp2p
lvs007 Oct 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -151,6 +151,13 @@ private void processBlock(PeerConnection peer, BlockCapsule block) throws P2pExc
try {
tronNetDelegate.processBlock(block, false);
witnessProductBlockService.validWitnessProductTwoBlock(block);

Item item = new Item(blockId, InventoryType.BLOCK);
tronNetDelegate.getActivePeer().forEach(p -> {
if (p.getAdvInvReceive().getIfPresent(item) != null) {
p.setBlockBothHave(blockId);
}
});
} catch (Exception e) {
logger.warn("Process adv block {} from peer {} failed. reason: {}",
blockId, peer.getInetAddress(), e.getMessage());
Original file line number Diff line number Diff line change
@@ -229,7 +229,8 @@ public String log() {
channel.getInetSocketAddress(),
(now - channel.getStartTime()) / Constant.ONE_THOUSAND,
channel.getAvgLatency(),
fastForwardBlock != null ? fastForwardBlock.getNum() : blockBothHave.getNum(),
fastForwardBlock != null ? fastForwardBlock.getNum() : String.format("%d [%ds]",
blockBothHave.getNum(), (now - blockBothHaveUpdateTime) / Constant.ONE_THOUSAND),
isNeedSyncFromPeer(),
isNeedSyncFromUs(),
syncBlockToFetch.size(),
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
package org.tron.core.net.messagehandler;

import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;

import com.google.common.collect.ImmutableList;
import com.google.protobuf.ByteString;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;

import lombok.extern.slf4j.Slf4j;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
import org.tron.common.BaseTest;
import org.tron.common.utils.ByteArray;
import org.tron.common.utils.Sha256Hash;
import org.tron.core.Constant;
import org.tron.core.capsule.BlockCapsule;
import org.tron.core.capsule.BlockCapsule.BlockId;
import org.tron.core.config.Parameter;
import org.tron.core.config.args.Args;
import org.tron.core.exception.P2pException;
import org.tron.core.net.TronNetDelegate;
import org.tron.core.net.message.adv.BlockMessage;
import org.tron.core.net.peer.Item;
import org.tron.core.net.peer.PeerConnection;
@@ -41,9 +48,8 @@ public class BlockMsgHandlerTest extends BaseTest {
*/
@BeforeClass
public static void init() {
Args.setParam(new String[]{"--output-directory", dbPath(), "--debug"},
Args.setParam(new String[] {"--output-directory", dbPath(), "--debug"},
Constant.TEST_CONF);

}

@Before
@@ -123,4 +129,42 @@ public void testProcessMessage() {
logger.error("error", e);
}
}

@Test
public void testProcessBlock() {
TronNetDelegate tronNetDelegate = Mockito.mock(TronNetDelegate.class);

try {
Field field = handler.getClass().getDeclaredField("tronNetDelegate");
field.setAccessible(true);
field.set(handler, tronNetDelegate);

BlockCapsule blockCapsule0 = new BlockCapsule(1,
Sha256Hash.wrap(ByteString
.copyFrom(ByteArray
.fromHexString(
"9938a342238077182498b464ac0292229938a342238077182498b464ac029222"))),
1234,
ByteString.copyFrom("1234567".getBytes()));

peer.getAdvInvReceive()
.put(new Item(blockCapsule0.getBlockId(), InventoryType.BLOCK),
System.currentTimeMillis());

Mockito.doReturn(true).when(tronNetDelegate).validBlock(any(BlockCapsule.class));
Mockito.doReturn(true).when(tronNetDelegate).containBlock(any(BlockId.class));
Mockito.doReturn(blockCapsule0.getBlockId()).when(tronNetDelegate).getHeadBlockId();
Mockito.doNothing().when(tronNetDelegate).processBlock(any(BlockCapsule.class), anyBoolean());
List<PeerConnection> peers = new ArrayList<>();
peers.add(peer);
Mockito.doReturn(peers).when(tronNetDelegate).getActivePeer();

Method method = handler.getClass()
.getDeclaredMethod("processBlock", PeerConnection.class, BlockCapsule.class);
method.setAccessible(true);
method.invoke(handler, peer, blockCapsule0);
} catch (Exception e) {
Assert.fail();
}
}
}