public async Task Disposal_SideChain_NotAuthorized()
        {
            long lockedTokenAmount = 10;

            await InitializeCrossChainContractAsync();
            await ApproveBalanceAsync(lockedTokenAmount);

            var chainId = await InitAndCreateSideChainAsync();

            var disposalInput = new SInt32Value
            {
                Value = chainId
            };

            var ecKeyPair           = CryptoHelper.GenerateKeyPair();
            var other               = Tester.CreateNewContractTester(ecKeyPair);
            var organizationAddress = Address.Parser.ParseFrom((await Tester.ExecuteContractWithMiningAsync(
                                                                    ParliamentAddress,
                                                                    nameof(ParliamentAuthContractContainer.ParliamentAuthContractStub.GetGenesisOwnerAddress),
                                                                    new Empty()))
                                                               .ReturnValue);
            var proposal = await other.ExecuteContractWithMiningAsync(ParliamentAddress,
                                                                      nameof(ParliamentAuthContractContainer.ParliamentAuthContractStub.CreateProposal),
                                                                      new CreateProposalInput
            {
                ContractMethodName  = "DisposeSideChain",
                ExpiredTime         = TimestampHelper.GetUtcNow().AddDays(1),
                Params              = disposalInput.ToByteString(),
                ToAddress           = CrossChainContractAddress,
                OrganizationAddress = organizationAddress
            });

            var proposalId = Hash.Parser.ParseFrom(proposal.ReturnValue);

            await ApproveWithMinersAsync(proposalId);

            var transactionResult = await other.ExecuteContractWithMiningAsync(ParliamentAddress,
                                                                               nameof(ParliamentAuthContractContainer.ParliamentAuthContractStub.Release), proposalId);

            var status = transactionResult.Status;

            Assert.True(status == TransactionResultStatus.Failed);
            Assert.Contains("Not authorized to dispose.", transactionResult.Error);
        }
        protected async Task <Hash> CreateProposal(int chainId, string methodName)
        {
            var createProposalInput = new SInt32Value
            {
                Value = chainId
            };
            var organizationAddress = Address.Parser.ParseFrom((await Tester.ExecuteContractWithMiningAsync(ParliamentAddress,
                                                                                                            nameof(ParliamentAuthContract.GetDefaultOrganizationAddress), new Empty())).ReturnValue);
            var proposal = await Tester.ExecuteContractWithMiningAsync(ParliamentAddress,
                                                                       nameof(ParliamentAuthContract.CreateProposal), new CreateProposalInput
            {
                ContractMethodName  = methodName,
                ExpiredTime         = DateTime.UtcNow.AddDays(1).ToTimestamp(),
                Params              = createProposalInput.ToByteString(),
                ToAddress           = CrossChainContractAddress,
                OrganizationAddress = organizationAddress
            });

            var proposalId = Hash.Parser.ParseFrom(proposal.ReturnValue);

            return(proposalId);
        }
        public async Task Disposal_SideChain_NotAuthorized()
        {
            long lockedTokenAmount = 10;

            await ApproveBalanceAsync(lockedTokenAmount);

            var chainId = await InitAndCreateSideChainAsync();

            var disposalInput = new SInt32Value
            {
                Value = chainId
            };

            var ecKeyPair = SampleECKeyPairs.KeyPairs[1];
            var parliamentAuthContractStub2 = GetParliamentAuthContractTester(ecKeyPair);
            var organizationAddress         = await ParliamentAuthContractStub.GetDefaultOrganizationAddress.CallAsync(new Empty());

            var proposal = await parliamentAuthContractStub2.CreateProposal.SendAsync(new CreateProposalInput
            {
                ContractMethodName  = "DisposeSideChain",
                ExpiredTime         = TimestampHelper.GetUtcNow().AddDays(1),
                Params              = disposalInput.ToByteString(),
                ToAddress           = CrossChainContractAddress,
                OrganizationAddress = organizationAddress
            });

            var proposalId = Hash.Parser.ParseFrom(proposal.TransactionResult.ReturnValue);

            await ApproveWithMinersAsync(proposalId);

            var res = await parliamentAuthContractStub2.Release.SendWithExceptionAsync(proposalId);

            var status = res.TransactionResult.Status;

            Assert.True(status == TransactionResultStatus.Failed);
            Assert.Contains("No permission.", res.TransactionResult.Error);
        }