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

Enforce line endings to be "LF" #3534

Merged
merged 3 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,5 @@ SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
UseCRLF: false
...
46 changes: 33 additions & 13 deletions Builds/VisualStudio/stellar-core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,39 @@ exit /b 0
<None Include="..\..\docs\transaction.md" />
<None Include="..\..\docs\tx-simulation.md" />
<None Include="..\..\docs\versioning.md" />
<CustomBuild Include="..\..\hash-xdrs.sh">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNextV|x64'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseCurrV|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugCurrV|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNoPostgres|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNextV|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='ReleaseCurrV|x64'">sh ../../hash-xdrs.sh ../../src/protocol-curr &gt; src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='ReleaseCurrV|x64'">running hash-xdrs.sh</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='ReleaseCurrV|x64'">src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='ReleaseCurrV|x64'">src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h</AdditionalInputs>
<OutputItemType Condition="'$(Configuration)|$(Platform)'=='ReleaseCurrV|x64'">None</OutputItemType>
<Command Condition="'$(Configuration)|$(Platform)'=='DebugNextV|x64'">sh ../../hash-xdrs.sh ../../src/protocol-next &gt; src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='DebugNextV|x64'">running hash-xdrs.sh</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DebugNextV|x64'">src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='DebugNextV|x64'">src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h</AdditionalInputs>
<OutputItemType Condition="'$(Configuration)|$(Platform)'=='DebugNextV|x64'">None</OutputItemType>
<Command Condition="'$(Configuration)|$(Platform)'=='DebugCurrV|x64'">sh ../../hash-xdrs.sh ../../src/protocol-curr &gt; src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='DebugCurrV|x64'">running hash-xdrs.sh</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DebugCurrV|x64'">src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='DebugCurrV|x64'">src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h</AdditionalInputs>
<OutputItemType Condition="'$(Configuration)|$(Platform)'=='DebugCurrV|x64'">None</OutputItemType>
<Command Condition="'$(Configuration)|$(Platform)'=='DebugNoPostgres|x64'">sh ../../hash-xdrs.sh ../../src/protocol-next &gt; src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='DebugNoPostgres|x64'">running hash-xdrs.sh</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DebugNoPostgres|x64'">src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='DebugNoPostgres|x64'">src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h</AdditionalInputs>
<OutputItemType Condition="'$(Configuration)|$(Platform)'=='DebugNoPostgres|x64'">None</OutputItemType>
<Command Condition="'$(Configuration)|$(Platform)'=='ReleaseNextV|x64'">sh ../../hash-xdrs.sh ../../src/protocol-next &gt; src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='ReleaseNextV|x64'">running hash-xdrs.sh</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='ReleaseNextV|x64'">src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='ReleaseNextV|x64'">src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h</AdditionalInputs>
<OutputItemType Condition="'$(Configuration)|$(Platform)'=='ReleaseNextV|x64'">None</OutputItemType>
</CustomBuild>
<None Include="..\..\INSTALL.md" />
<None Include="..\..\Makefile.am" />
<None Include="..\..\NEWS" />
Expand Down Expand Up @@ -1422,19 +1455,6 @@ exit /b 0
<AdditionalInputs>src/$(Configuration)/generated/xdr/Stellar-types.h</AdditionalInputs>
<OutputItemType>ClInclude</OutputItemType>
</CustomBuild>
<CustomBuild Include="..\..\hash-xdrs.sh">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='DebugNextV|x64'">sh ../../hash-xdrs.sh ../../src/protocol-next &gt; src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DebugNoPostgres|x64'">sh ../../hash-xdrs.sh ../../src/protocol-next &gt; src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='ReleaseNextV|x64'">sh ../../hash-xdrs.sh ../../src/protocol-next &gt; src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DebugCurrV|x64'">sh ../../hash-xdrs.sh ../../src/protocol-curr &gt; src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='ReleaseCurrV|x64'">sh ../../hash-xdrs.sh ../../src/protocol-curr &gt; src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Command>
<Message>running hash-xdrs.sh</Message>
<Outputs>src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp</Outputs>
<AdditionalInputs>src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h</AdditionalInputs>
<OutputItemType>ClCompile</OutputItemType>
</CustomBuild>

<CustomBuild Include="..\..\src\main\StellarCoreVersion.cpp.in">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='DebugNextV|x64'">sed.exe -e "s/%%%%VERSION%%%%/msvc custom/" &lt; %(FullPath) &gt; %(RelativeDir)\StellarCoreVersion.cpp</Command>
Expand Down
5 changes: 2 additions & 3 deletions Builds/VisualStudio/stellar-core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,7 @@
<ClCompile Include="..\..\src\overlay\test\TxAdvertQueueTests.cpp">
<Filter>overlay\tests</Filter>
</ClCompile>
<ClCompile Include="src\$(Configuration)\generated\xdr\XDRFilesSha256.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\lib\util\cpptoml.h">
Expand Down Expand Up @@ -2222,9 +2223,6 @@
<ClInclude Include="src\$(Configuration)\generated\xdr\Stellar-internal.h">
<Filter>xdr\generated</Filter>
</ClInclude>
<ClInclude Include="src\$(Configuration)\generated\xdr\XDRFilesSha256.cpp">
<Filter>xdr\generated</Filter>
</ClInclude>
<ClInclude Include="..\..\src\util\xdrquery\XDRQuery.h">
<Filter>util\xdrquery</Filter>
</ClInclude>
Expand Down Expand Up @@ -2449,6 +2447,7 @@
<CustomBuild Include="..\..\src\util\xdrquery\XDRQueryScanner.ll">
<Filter>util\xdrquery</Filter>
</CustomBuild>
<CustomBuild Include="..\..\hash-xdrs.sh" />
</ItemGroup>
<ItemGroup>
<Text Include="..\..\INSTALL-Windows.md" />
Expand Down
20 changes: 18 additions & 2 deletions INSTALL-Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@
* Windows 10 SDK
* C++/CLI Support

# Configure Git

Some functionality depends on Linux file endings, as such you need to configure git with:
```
[core]
eol = lf
autocrlf = input
```
NB: if you change this setting in an existing working folder, you need to reset it to have the proper line ending.
This can be done with the following sequence:
```
git checkout-index --force --all
git rm --cached -r .
git reset --hard
```

## Download and install rust

Easiest is to use rustup, found on [rust-lang.org](https://www.rust-lang.org/tools/install).
Expand Down Expand Up @@ -78,8 +94,8 @@ If you do not have cURL installed
## clang-format

For making changes to the code, you should install the clang-format tool and Visual Studio extension, you can find both at http://llvm.org/builds/
* note that the version of clang-format used currently is 8.0 (other versions may not format the same way).
* we recommend downloading 8.0 from http://releases.llvm.org/download.html
* note that the version of clang-format used currently is 10.0 (other versions may not format the same way).
* we recommend downloading 10.0 from http://releases.llvm.org/download.html

# Build on Windows using the Windows Subsystem for Linux
To setup the subsystem, go to https://msdn.microsoft.com/en-us/commandline/wsl/install_guide
Expand Down
8 changes: 8 additions & 0 deletions ci-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ then
exit 1
fi

crlf=$(find . ! \( -type d -o -path './.git/*' -o -path './Builds/*' -o -path './lib/*' \) -print0 | xargs -0 -n1 -P9 file "{}" | grep CRLF || true)
if [ -n "$crlf" ]
then
echo "Found some files with Windows line endings:"
echo "$crlf"
exit 1
fi

date
time make -j$(($NPROCS + 1))

Expand Down
2 changes: 1 addition & 1 deletion src/herder/TransactionQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ TransactionQueue::getMaxOpsToFloodThisPeriod() const
Rounding::ROUND_UP);
releaseAssertOrThrow(opsToFlood >= 0 &&
opsToFlood <= std::numeric_limits<uint32_t>::max());
return opsToFlood;
return static_cast<uint32_t>(opsToFlood);
}

TransactionQueue::BroadcastStatus
Expand Down
3 changes: 2 additions & 1 deletion src/herder/TxSetFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,8 @@ TxSetFrame::applySurgePricing(Application& app)
return;
}

size_t maxOps = app.getLedgerManager().getLastMaxTxSetSizeOps();
uint32_t maxOps =
static_cast<uint32_t>(app.getLedgerManager().getLastMaxTxSetSizeOps());
auto const& lclHeader =
app.getLedgerManager().getLastClosedLedgerHeader().header;

Expand Down
2 changes: 2 additions & 0 deletions src/herder/test/HerderTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2213,10 +2213,12 @@ TEST_CASE("SCP State", "[herder][acceptance]")
{
configure(Config::TestDbMode::TESTDB_ON_DISK_SQLITE);
}
#ifdef USE_POSTGRES
SECTION("postgres")
{
configure(Config::TestDbMode::TESTDB_POSTGRESQL);
}
#endif
// add node0 and node1, in lockstep
{
SCPQuorumSet qSet;
Expand Down
2 changes: 1 addition & 1 deletion src/herder/test/TransactionQueueTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ TEST_CASE("TransactionQueue limits", "[herder][transactionqueue]")
// the limiter, but with `minFee + 1` can be added. Use for checking
// that fee threshold is applied even when there is enough space in
// the limiter, but some transactions were evicted before.
auto checkMinFeeToFitWithNoEvict = [&](int64_t minFee) {
auto checkMinFeeToFitWithNoEvict = [&](uint32_t minFee) {
std::vector<TxStackPtr> txsToEvict;
// 0 fee is a special case as transaction shouldn't have 0 fee.
// Hence we only check that fee of 1 allows transaction to be added.
Expand Down
6 changes: 3 additions & 3 deletions src/test/TxTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ getAccountSigners(PublicKey const& k, Application& app)
TransactionFramePtr
transactionFromOperationsV0(Application& app, SecretKey const& from,
SequenceNumber seq,
const std::vector<Operation>& ops, int fee)
const std::vector<Operation>& ops, uint32_t fee)
{
TransactionEnvelope e(ENVELOPE_TYPE_TX_V0);
e.v0().tx.sourceAccountEd25519 = from.getPublicKey().ed25519();
Expand All @@ -624,7 +624,7 @@ transactionFromOperationsV0(Application& app, SecretKey const& from,
TransactionFramePtr
transactionFromOperationsV1(Application& app, SecretKey const& from,
SequenceNumber seq,
const std::vector<Operation>& ops, int fee,
const std::vector<Operation>& ops, uint32_t fee,
std::optional<PreconditionsV2> cond)
{
TransactionEnvelope e(ENVELOPE_TYPE_TX);
Expand Down Expand Up @@ -653,7 +653,7 @@ transactionFromOperationsV1(Application& app, SecretKey const& from,
TransactionFramePtr
transactionFromOperations(Application& app, SecretKey const& from,
SequenceNumber seq, const std::vector<Operation>& ops,
int fee)
uint32_t fee)
{
uint32_t ledgerVersion;
{
Expand Down
11 changes: 5 additions & 6 deletions src/test/TxTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,19 @@ bool doesAccountExist(Application& app, PublicKey const& k);
xdr::xvector<Signer, 20> getAccountSigners(PublicKey const& k,
Application& app);

TransactionFramePtr
transactionFromOperationsV0(Application& app, SecretKey const& from,
SequenceNumber seq,
std::vector<Operation> const& ops, int fee = 0);
TransactionFramePtr transactionFromOperationsV0(
Application& app, SecretKey const& from, SequenceNumber seq,
std::vector<Operation> const& ops, uint32_t fee = 0);
TransactionFramePtr
transactionFromOperationsV1(Application& app, SecretKey const& from,
SequenceNumber seq,
std::vector<Operation> const& ops, int fee,
std::vector<Operation> const& ops, uint32_t fee,
std::optional<PreconditionsV2> cond = std::nullopt);
TransactionFramePtr transactionFromOperations(Application& app,
SecretKey const& from,
SequenceNumber seq,
std::vector<Operation> const& ops,
int fee = 0);
uint32_t fee = 0);
TransactionFramePtr transactionWithV2Precondition(Application& app,
TestAccount& account,
int64_t sequenceDelta,
Expand Down
2 changes: 1 addition & 1 deletion src/transactions/InvokeHostFunctionOpFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ InvokeHostFunctionOpFrame::doApply(AbstractLedgerTxn& ltx)
toXDRBuf(mInvokeHostFunction.parameters),
toXDRBuf(mInvokeHostFunction.footprint), ledgerEntryXdrBufs);
}
catch (std::exception& e)
catch (std::exception&)
{
innerResult().code(INVOKE_HOST_FUNCTION_TRAPPED);
return false;
Expand Down
Loading