Exemple #1
0
        public async Task RequestCrossChainData_Test()
        {
            var chainId       = ChainHelper.GetChainId(ChainHelper.ConvertBase58ToChainId("AELF") + 1);
            var remoteChainId = ChainOptions.ChainId;
            var height        = 2;
            var port          = 5000;
            await Server.StartAsync(port);

            var grpcClientInitializationContext = new GrpcClientInitializationContext
            {
                RemoteChainId = chainId,
                LocalChainId  = ChainHelper.ConvertBase58ToChainId("AELF"),
                DialTimeout   = 1000,
                UriStr        = string.Concat(Host, ":", port)
            };
            var client = new ClientForSideChain(grpcClientInitializationContext);

            _grpcCrossChainCommunicationTestHelper.GrpcCrossChainClients.TryAdd(remoteChainId, client);
            _grpcCrossChainCommunicationTestHelper.FakeSideChainBlockDataEntityCacheOnServerSide(height);
            await client.RequestCrossChainDataAsync(height, b => _blockCacheEntityProducer.TryAddBlockCacheEntity(b));

            var clientBlockDataEntityCache = GrpcCrossChainCommunicationTestHelper.ClientBlockDataEntityCache;
            var sideChainBlockData         = new SideChainBlockData {
                Height = height
            };

            Assert.Contains(sideChainBlockData, clientBlockDataEntityCache);
            Dispose();
        }
        public async Task RechargeForSideChain_ChainNoExist()
        {
            var  parentChainId     = 123;
            long lockedTokenAmount = 10;

            await InitializeCrossChainContractAsync(parentChainId);

            await ApproveBalanceAsync(lockedTokenAmount);

            var otherChainId  = ChainHelper.GetChainId(5);
            var rechargeInput = new RechargeInput()
            {
                ChainId = otherChainId,
                Amount  = 100_000L
            };

            await ApproveBalanceAsync(100_000L);

            var res = await CrossChainContractStub.Recharge.SendWithExceptionAsync(rechargeInput);

            var status = res.TransactionResult.Status;

            Assert.True(status == TransactionResultStatus.Failed);
            Assert.Contains("Side chain not found or not able to be recharged.", res.TransactionResult.Error);
        }
        public async Task RechargeForSideChain_ChainNoExist()
        {
            var  parentChainId     = 123;
            long lockedTokenAmount = 10;

            await InitializeCrossChainContractAsync(parentChainId);

            await ApproveBalanceAsync(lockedTokenAmount);

            var otherChainId  = ChainHelper.GetChainId(5);
            var rechargeInput = new RechargeInput()
            {
                ChainId = otherChainId,
                Amount  = 100_000L
            };

            await ApproveBalanceAsync(100_000L);

            var transactionResult = await ExecuteContractWithMiningAsync(CrossChainContractAddress,
                                                                         nameof(CrossChainContractContainer.CrossChainContractStub.Recharge),
                                                                         rechargeInput);

            transactionResult.Status.ShouldBe(TransactionResultStatus.Failed);
            transactionResult.Error.Contains("Side chain not found or not able to be recharged.").ShouldBeTrue();
        }
        public async Task CreateClient_Test()
        {
            var remoteChainId = ChainOptions.ChainId;
            var localChainId  = ChainHelper.GetChainId(1);

            var host = "127.0.0.1";
            var port = 5100;
            await Server.StartAsync(port);

            var fakeCrossChainClient = new CrossChainClientCreationContext
            {
                LocalChainId          = localChainId,
                RemoteChainId         = remoteChainId,
                IsClientToParentChain = false,
                RemoteServerHost      = host,
                RemoteServerPort      = port
            };

            await _crossChainClientService.CreateClientAsync(fakeCrossChainClient);

            var res = _grpcCrossChainClientProvider.TryGetClient(remoteChainId, out var client);

            Assert.True(res);

            await client.ConnectAsync();

            Assert.True(client.IsConnected);

            await client.CloseAsync();

            Assert.False(client.IsConnected);
        }
Exemple #5
0
        public void CreateCrossChainClient_Test()
        {
            var remoteChainId = ChainOptions.ChainId;
            var localChainId  = ChainHelper.GetChainId(1);

            var host = "127.0.0.1";
            var port = 5000;
            var crossChainClientDto = new CrossChainClientDto
            {
                LocalChainId          = localChainId,
                RemoteChainId         = remoteChainId,
                IsClientToParentChain = false,
                RemoteServerHost      = host,
                RemoteServerPort      = port
            };

            var client         = _grpcCrossChainClientProvider.CreateCrossChainClient(crossChainClientDto);
            var isClientCached = _grpcCrossChainClientProvider.TryGetClient(remoteChainId, out _);

            Assert.False(isClientCached);

            Assert.True(client.RemoteChainId == remoteChainId);
            Assert.False(client.IsConnected);
            Assert.Equal(remoteChainId, client.RemoteChainId);

            var expectedUriStr = string.Concat(host, ":", "5000");

            Assert.Equal(expectedUriStr, client.TargetUriString);
        }
Exemple #6
0
        public async Task GetAllChainIdHeightPairsAtLibAsync_Test()
        {
            {
                var allChainIdAndHeightResult =
                    await _crossChainIndexingDataService.GetAllChainIdHeightPairsAtLibAsync();

                allChainIdAndHeightResult.ShouldBe(new ChainIdAndHeightDict());
            }

            _crossChainTestHelper.SetFakeLibHeight(2);

            {
                var allChainIdAndHeightResult =
                    await _crossChainIndexingDataService.GetAllChainIdHeightPairsAtLibAsync();

                allChainIdAndHeightResult.ShouldBe(new ChainIdAndHeightDict());
            }

            var parentChainId = ChainHelper.GetChainId(10);

            _crossChainTestHelper.AddFakeParentChainIdHeight(parentChainId, 1);

            var sideChainId = ChainHelper.GetChainId(100);

            _crossChainTestHelper.AddFakeSideChainIdHeight(sideChainId, 0);

            {
                var allChainIdAndHeightResult =
                    await _crossChainIndexingDataService.GetAllChainIdHeightPairsAtLibAsync();

                allChainIdAndHeightResult.IdHeightDict[parentChainId].ShouldBe(1);
                allChainIdAndHeightResult.IdHeightDict[sideChainId].ShouldBe(0);
            }
        }
 public async Task <ChainInitializationData> GetChainInitializationDataAsync()
 {
     // Default Initialization Data
     return(new ChainInitializationData
     {
         Creator = SampleAccount.Accounts.First().Address,
         ChainId = ChainHelper.GetChainId(1),
         ChainCreatorPrivilegePreserved = false,
         ChainInitializationConsensusInfo = new ChainInitializationConsensusInfo
         {
             InitialConsensusData = new MinerListWithRoundNumber
             {
                 MinerList = new MinerList()
                 {
                     Pubkeys =
                     {
                         SampleAccount.Accounts.Take(3)
                         .Select(a => ByteString.CopyFrom(a.KeyPair.PublicKey))
                     }
                 }
             }.ToByteString()
         },
         CreationHeightOnParentChain = 100,
         CreationTimestamp = TimestampHelper.GetUtcNow(),
         NativeTokenInfoData = new TokenInfo
         {
             Symbol = "ELF",
             TokenName = "ELF",
             Decimals = 8,
             TotalSupply = 100_000_000_000_000_000,
             Issuer = SampleAccount.Accounts.First().Address,
             IssueChainId = ParentChainId,
         }.ToByteString(),
        public async Task ResponseParentChainBlockData_Test()
        {
            var chainId = ChainHelper.GetChainId(1);
            var height  = 3;
            var res     = await _chainResponseService.ResponseParentChainBlockDataAsync(height, chainId);

            Assert.True(res.Height == 3);
        }
        public async Task ResponseParentChainBlockData_WithoutBlock_Test()
        {
            var chainId = ChainHelper.GetChainId(1);
            var height  = 5;
            var res     = await _chainResponseService.ResponseParentChainBlockDataAsync(height, chainId);

            Assert.Null(res);
        }
        public async Task GetChainStatus_NotExist()
        {
            var chainId = ChainHelper.GetChainId(1);
            var res     = await CrossChainContractStub.GetChainStatus.SendWithExceptionAsync(new SInt32Value { Value = chainId });

            var status = res.TransactionResult.Status;

            Assert.True(status == TransactionResultStatus.Failed);
            Assert.Contains("Side chain not found.", res.TransactionResult.Error);
        }
        public async Task CrossChainServerStart_Test()
        {
            var localChainId = ChainHelper.GetChainId(1);
            await _grpcCrossChainServerNodePlugin.StartAsync(localChainId);

            Assert.True(_grpcCrossChainServer.IsStarted);
            await _grpcCrossChainServerNodePlugin.ShutdownAsync();

            Assert.False(_grpcCrossChainServer.IsStarted);
        }
Exemple #12
0
        public async Task GetChainInitializationData_Test()
        {
            var localChainId  = ChainHelper.GetChainId(1);
            var remoteChainId = _chainOptions.ChainId;
            await _server.StartAsync("localhost", 5000);

            CreateAndGetClient(localChainId, false, remoteChainId);
            var res = await _crossChainPlugin.GetChainInitializationDataAsync(localChainId);

            Assert.True(res.CreationHeightOnParentChain.Equals(1));
        }
        public async Task RecordSideChainData_WithChainNotExist()
        {
            int parentChainId = 123;
            long lockedToken = 10;
            long parentChainHeightOfCreation = 10;
            var sideChainId1 =
                await InitAndCreateSideChainAsync(parentChainHeightOfCreation, parentChainId, lockedToken);

            // create second side chain
            long lockedTokenAmount = 10;
            await ApproveBalanceAsync(lockedTokenAmount);
            var sideChainCreationRequest = CreateSideChainCreationRequest(1, lockedTokenAmount, ByteString.Empty);

            var sideChainId2 = ChainHelper.GetChainId(2);

            await BlockMiningService.MineBlockAsync(new List<Transaction>
            {
                CrossChainContractStub.CreateSideChain.GetTransaction(sideChainCreationRequest)
            }, true);

            var fakeSideChainBlockHash = Hash.FromString("sideChainBlockHash");
            var fakeTxMerkleTreeRoot = Hash.FromString("txMerkleTreeRoot");
            var sideChainBlockData1 =
                CreateSideChainBlockData(fakeSideChainBlockHash, 1, sideChainId1, fakeTxMerkleTreeRoot);

            var sideChainBlockData2 =
                CreateSideChainBlockData(fakeSideChainBlockHash, 2, sideChainId2, fakeTxMerkleTreeRoot);
            int fakeChainId = 124;

            var sideChainBlockData3 =
                CreateSideChainBlockData(fakeSideChainBlockHash, 1, fakeChainId, fakeTxMerkleTreeRoot);
            var crossChainBlockData = new CrossChainBlockData
            {
                SideChainBlockData = {sideChainBlockData1, sideChainBlockData2, sideChainBlockData3}
            };

            await BlockMiningService.MineBlockAsync(new List<Transaction>
            {
                CrossChainContractStub.RecordCrossChainData.GetTransaction(crossChainBlockData)
            });

            var balance = await CrossChainContractStub.GetSideChainBalance.CallAsync(new SInt32Value {Value = sideChainId1});
            Assert.Equal(lockedToken - 1, balance.Value);

            var blockHeader = await BlockchainService.GetBestChainLastBlockHeaderAsync();
            var indexedCrossChainBlockData =
                await CrossChainContractStub.GetIndexedCrossChainBlockDataByHeight.CallAsync(new SInt64Value
                    {Value = blockHeader.Height});

            var expectedCrossChainBlocData = new CrossChainBlockData();
            expectedCrossChainBlocData.SideChainBlockData.Add(sideChainBlockData1);
            Assert.Equal(expectedCrossChainBlocData, indexedCrossChainBlockData);
        }
Exemple #14
0
        public async Task RequestChainInitializationDataFromParentChain_Test()
        {
            var requestData = new SideChainInitializationRequest
            {
                ChainId = ChainHelper.GetChainId(1),
            };
            var context = BuildServerCallContext();
            var sideChainInitializationResponse =
                await ParentChainGrpcServerBase.RequestChainInitializationDataFromParentChain(requestData, context);

            Assert.Equal(1, sideChainInitializationResponse.CreationHeightOnParentChain);
        }
        public async Task ClientWithoutParentChainStart_Test()
        {
            var chainId = ChainHelper.GetChainId(1);
            await Server.StartAsync(5000);

            await _grpcCrossChainClientNodePlugin.StartAsync(chainId);

            var clients = _crossChainClientProvider.GetAllClients();

            clients.ShouldBeEmpty();
            Server.Dispose();
        }
        public async Task CheckLockedBalance_NotExist()
        {
            var chainId  = ChainHelper.GetChainId(1);
            var txResult = (await CrossChainContractStub.GetSideChainBalance.SendWithExceptionAsync(new SInt32Value {
                Value = chainId
            }))
                           .TransactionResult;
            var status = txResult.Status;

            Assert.True(status == TransactionResultStatus.Failed);
            Assert.Contains("Side chain not found.", txResult.Error);
        }
 public ParliamentContractPrivilegeTestBase()
 {
     var mainChainId = ChainHelper.ConvertBase58ToChainId("AELF");
     var chainId = ChainHelper.GetChainId(1);
     Tester = new ContractTester<ParliamentContractPrivilegeTestAElfModule>(chainId,SampleECKeyPairs.KeyPairs[1]);
     AsyncHelper.RunSync(() =>
         Tester.InitialChainAsyncWithAuthAsync(Tester.GetSideChainSystemContract(
             Tester.GetCallOwnerAddress(),
             mainChainId,"STA",out TotalSupply,Tester.GetCallOwnerAddress())));
     ParliamentAddress = Tester.GetContractAddress(ParliamentSmartContractAddressNameProvider.Name);
     TokenContractAddress = Tester.GetContractAddress(TokenSmartContractAddressNameProvider.Name);
 }
        public async Task ClientStart_Test()
        {
            var chainId       = ChainHelper.GetChainId(1);
            var remoteChainId = ChainOptions.ChainId;
            await Server.StartAsync(5000);

            await _grpcCrossChainClientNodePlugin.StartAsync(chainId);

            var clients = _crossChainClientProvider.GetAllClients();

            clients[0].RemoteChainId.ShouldBe(remoteChainId);
            Server.Dispose();
        }
Exemple #19
0
        public async Task CrossChainIndexingShake_Test()
        {
            var request = new HandShake
            {
                ListeningPort = 2100,
                ChainId       = ChainHelper.GetChainId(1)
            };
            var context = BuildServerCallContext();
            var indexingHandShakeReply = await BasicCrossChainRpcBase.CrossChainHandShake(request, context);

            Assert.NotNull(indexingHandShakeReply);
            Assert.True(indexingHandShakeReply.Status == HandShakeReply.Types.HandShakeStatus.Success);
        }
Exemple #20
0
        public async Task ClientStart_Test()
        {
            var chainId       = ChainHelper.GetChainId(1);
            var remoteChainId = ChainOptions.ChainId;
            await _server.StartAsync(5000);

            await _grpcCrossChainClientNodePlugin.StartAsync(chainId);

            var client = _crossChainClientProvider.GetAllClients();

            Assert.True(client[0].RemoteChainId == remoteChainId);
            Dispose();
        }
        public async Task GetLockedAddress_NotExist()
        {
            var sideChainId = ChainHelper.GetChainId(1);
            var result      = await Tester.ExecuteContractWithMiningAsync(CrossChainContractAddress,
                                                                          nameof(CrossChainContractContainer.CrossChainContractStub.LockedAddress), new SInt32Value
            {
                Value = sideChainId
            });

            var status = result.Status;

            Assert.True(status == TransactionResultStatus.Failed);
            Assert.Contains("Side chain not found.", result.Error);
        }
Exemple #22
0
        /// <summary>
        /// Create side chain. It is a proposal result from system address.
        /// </summary>
        /// <param name="sideChainCreationRequest"></param>
        /// <returns></returns>
        public override SInt32Value CreateSideChain(SideChainCreationRequest sideChainCreationRequest)
        {
            // side chain creation should be triggered by organization address from parliament.
            CheckOwnerAuthority();

            Assert(sideChainCreationRequest.LockedTokenAmount > 0 &&
                   sideChainCreationRequest.LockedTokenAmount > sideChainCreationRequest.IndexingPrice &&
                   sideChainCreationRequest.SideChainTokenInfo != null,
                   "Invalid chain creation request.");

            State.SideChainSerialNumber.Value = State.SideChainSerialNumber.Value.Add(1);
            var serialNumber = State.SideChainSerialNumber.Value;
            int chainId      = ChainHelper.GetChainId(serialNumber);

            // lock token and resource
            CreateSideChainToken(sideChainCreationRequest, chainId);
            var sideChainInfo = new SideChainInfo
            {
                Proposer                    = Context.Origin,
                SideChainId                 = chainId,
                SideChainStatus             = SideChainStatus.Active,
                SideChainCreationRequest    = sideChainCreationRequest,
                CreationTimestamp           = Context.CurrentBlockTime,
                CreationHeightOnParentChain = Context.CurrentHeight
            };

            State.SideChainInfo[chainId]          = sideChainInfo;
            State.CurrentSideChainHeight[chainId] = 0;

            var initialConsensusInfo = GetCurrentMiners();

            State.SideChainInitialConsensusInfo[chainId] = new BytesValue {
                Value = initialConsensusInfo.ToByteString()
            };
            Context.LogDebug(() => $"Initial miner list for side chain {chainId} :" +
                             string.Join(",",
                                         initialConsensusInfo.MinerList.Pubkeys));
            Context.LogDebug(() => $"RoundNumber {initialConsensusInfo.RoundNumber}");

            Context.Fire(new CreationRequested()
            {
                ChainId = chainId,
                Creator = Context.Origin
            });
            return(new SInt32Value()
            {
                Value = chainId
            });
        }
Exemple #23
0
        public async Task RequestIndexingParentChain_EmptyResponse_Test()
        {
            var requestData = new CrossChainRequest
            {
                ChainId    = ChainHelper.GetChainId(1),
                NextHeight = 101
            };

            var responseResults = new List <ParentChainBlockData>();
            IServerStreamWriter <ParentChainBlockData> responseStream = MockServerStreamWriter(responseResults);
            var context = BuildServerCallContext();
            await ParentChainGrpcServerBase.RequestIndexingFromParentChain(requestData, responseStream, context);

            Assert.Empty(responseResults);
        }
Exemple #24
0
        public async Task RequestIndexingSideChain_MaximalResponse_Test()
        {
            var requestData = new CrossChainRequest
            {
                ChainId    = ChainHelper.GetChainId(1),
                NextHeight = 10
            };

            var responseResults = new List <SideChainBlockData>();
            IServerStreamWriter <SideChainBlockData> responseStream = MockServerStreamWriter(responseResults);
            var context = BuildServerCallContext();
            await SideChainGrpcServerBase.RequestIndexingFromSideChain(requestData, responseStream, context);

            Assert.Equal(CrossChainCommunicationConstants.MaximalIndexingCount, responseResults.Count);
            Assert.Equal(10, responseResults[0].Height);
        }
        public async Task GetClientTest()
        {
            int remoteChainId1 = ChainHelper.GetChainId(1);
            int remoteChainId2 = ChainHelper.GetChainId(2);
            int remoteChainId3 = ChainHelper.GetChainId(3);
            var localChainId   = ChainHelper.ConvertBase58ToChainId("AELF");
            {
                var crossChainClientCreationContext1 = new CrossChainClientCreationContext
                {
                    LocalChainId          = localChainId,
                    RemoteChainId         = remoteChainId1,
                    IsClientToParentChain = false,
                    RemoteServerHost      = "localhost",
                    RemoteServerPort      = 5000
                };
                _crossChainCommunicationTestHelper.SetClientConnected(remoteChainId1, true);
                await _crossChainClientService.CreateClientAsync(crossChainClientCreationContext1);

                var client1 = await _crossChainClientService.GetConnectedCrossChainClientAsync(remoteChainId1);

                client1.IsConnected.ShouldBeTrue();
                client1.RemoteChainId.ShouldBe(remoteChainId1);
            }

            {
                var crossChainClientCreationContext2 = new CrossChainClientCreationContext
                {
                    LocalChainId          = localChainId,
                    RemoteChainId         = remoteChainId2,
                    IsClientToParentChain = false,
                    RemoteServerHost      = "localhost",
                    RemoteServerPort      = 5000
                };
                _crossChainCommunicationTestHelper.SetClientConnected(remoteChainId2, false);
                await _crossChainClientService.CreateClientAsync(crossChainClientCreationContext2);

                var client2 = await _crossChainClientService.GetConnectedCrossChainClientAsync(remoteChainId2);

                client2.ShouldBeNull();
            }

            {
                var client3 = await _crossChainClientService.GetConnectedCrossChainClientAsync(remoteChainId3);

                client3.ShouldBeNull();
            }
        }
Exemple #26
0
        public async Task RequestIndexingParentChain_SpecificResponse_Test()
        {
            var requestData = new CrossChainRequest
            {
                ChainId    = ChainHelper.GetChainId(1),
                NextHeight = 81
            };

            var responseResults = new List <ParentChainBlockData>();
            IServerStreamWriter <ParentChainBlockData> responseStream = MockServerStreamWriter(responseResults);
            var context = BuildServerCallContext();
            await ParentChainGrpcServerBase.RequestIndexingFromParentChain(requestData, responseStream, context);

            Assert.Equal(20, responseResults.Count);
            Assert.Equal(81, responseResults.First().Height);
            Assert.Equal(100, responseResults.Last().Height);
        }
Exemple #27
0
        public async Task RequestChainInitializationData_ParentClient_Test()
        {
            var chainId = ChainHelper.GetChainId(ChainHelper.ConvertBase58ToChainId("AELF") + 1);
            await Server.StartAsync(5000);

            var grpcClientInitializationContext = new GrpcClientInitializationContext
            {
                LocalChainId  = chainId,
                RemoteChainId = ChainHelper.ConvertBase58ToChainId("AELF"),
                DialTimeout   = 1000,
                UriStr        = string.Concat(Host, ":", "5000")
            };
            var client = new ClientForParentChain(grpcClientInitializationContext);
            var res    = await client.RequestChainInitializationDataAsync(chainId);

            Assert.Equal(1, res.CreationHeightOnParentChain);
            Dispose();
        }
        public async Task Disposal_SideChain__NotFound()
        {
            await InitializeCrossChainContractAsync();

            var chainId    = ChainHelper.GetChainId(1);
            var proposalId = await DisposalSideChainProposalAsync(new SInt32Value
            {
                Value = chainId
            });

            await ApproveWithMinersAsync(proposalId);

            var transactionResult = await ReleaseProposalWithExceptionAsync(proposalId);

            var status = transactionResult.Status;

            Assert.True(status == TransactionResultStatus.Failed);
            Assert.Contains("Side chain not found.", transactionResult.Error);
        }
Exemple #29
0
        public override SideChainIdAndHeightDict GetSideChainIdAndHeight(Empty input)
        {
            var dict         = new SideChainIdAndHeightDict();
            var serialNumber = State.SideChainSerialNumber.Value;

            for (long i = 1; i <= serialNumber; i++)
            {
                int chainId       = ChainHelper.GetChainId(i);
                var sideChainInfo = State.SideChainInfo[chainId];
                if (sideChainInfo.SideChainStatus != SideChainStatus.Active)
                {
                    continue;
                }
                var height = State.CurrentSideChainHeight[chainId];
                dict.IdHeightDict.Add(chainId, height);
            }

            return(dict);
        }
Exemple #30
0
        public void TestChainIdGeneration()
        {
            {
                var chainId        = ChainHelper.GetChainId(0);
                var chainIdBased58 = ChainHelper.ConvertChainIdToBase58(chainId);
                chainIdBased58.ShouldBe("2111");

                var convertedChainId = ChainHelper.ConvertBase58ToChainId(chainIdBased58);
                convertedChainId.ShouldBe(chainId);
            }

            {
                var chainId        = ChainHelper.GetChainId(1);
                var chainIdBased58 = ChainHelper.ConvertChainIdToBase58(chainId);
                chainIdBased58.ShouldBe("2112");

                var convertedChainId = ChainHelper.ConvertBase58ToChainId(chainIdBased58);
                convertedChainId.ShouldBe(chainId);
            }

            {
                var chainIdMaxValue        = ChainHelper.GetChainId(long.MaxValue);
                var chainIdBased58MaxValue = ChainHelper.ConvertChainIdToBase58(chainIdMaxValue);
                chainIdBased58MaxValue.ShouldBe("mR59");

                var convertedChainIdMaxValue = ChainHelper.ConvertBase58ToChainId(chainIdBased58MaxValue);
                convertedChainIdMaxValue.ShouldBe(chainIdMaxValue);

                var chainIdMinValue = ChainHelper.GetChainId(long.MinValue);
                chainIdMinValue.ShouldBe(chainIdMaxValue);
                var chainIdBased58MinValue = ChainHelper.ConvertChainIdToBase58(chainIdMaxValue);
                chainIdBased58MinValue.ShouldBe(chainIdBased58MaxValue);
                var convertedChainIdMinValue = ChainHelper.ConvertBase58ToChainId(chainIdBased58MinValue);
                convertedChainIdMinValue.ShouldBe(convertedChainIdMaxValue);
            }

            {
                var chainIdAElf    = ChainHelper.ConvertBase58ToChainId("AELF");
                var chainId        = ChainHelper.GetChainId(chainIdAElf + 1);
                var chainIdBased58 = ChainHelper.ConvertChainIdToBase58(chainId);
                chainIdBased58.ShouldBe("tDVV");
            }
        }