Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sisuresh committed Aug 11, 2023
1 parent 347e895 commit 2f92171
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 48 deletions.
9 changes: 0 additions & 9 deletions src/ledger/test/LedgerCloseMetaStreamTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,15 +468,6 @@ TEST_CASE_VERSIONS("meta stream contains reasonable meta", "[ledgerclosemeta]")

VirtualClock clock;
cfg.METADATA_OUTPUT_STREAM = metaPath;
// TODO: later when network configs per ledger are settled, regenerate
// meta and remove the 7 lines below
cfg.TESTING_LEDGER_MAX_SOROBAN_TX_COUNT = 1;
cfg.TESTING_LEDGER_MAX_TRANSACTIONS_SIZE_BYTES = 1;
cfg.TESTING_LEDGER_MAX_INSTRUCTIONS = 1;
cfg.TESTING_LEDGER_MAX_READ_LEDGER_ENTRIES = 1;
cfg.TESTING_LEDGER_MAX_READ_BYTES = 1;
cfg.TESTING_LEDGER_MAX_WRITE_LEDGER_ENTRIES = 1;
cfg.TESTING_LEDGER_MAX_WRITE_BYTES = 1;
cfg.USE_CONFIG_FOR_GENESIS = true;
{
// Do some stuff
Expand Down
78 changes: 45 additions & 33 deletions src/overlay/test/OverlayTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,43 @@ using namespace stellar::overlaytestutils;
namespace
{

ClaimPredicate
recursivePredicate(uint32_t counter)
{
if (counter == 10)
{
ClaimPredicate u;
u.type(CLAIM_PREDICATE_UNCONDITIONAL);
return u;
}

ClaimPredicate andPred;
andPred.type(CLAIM_PREDICATE_AND);
andPred.andPredicates().emplace_back(recursivePredicate(counter + 1));
andPred.andPredicates().emplace_back(recursivePredicate(counter + 1));

return andPred;
}

Operation
getOperationGreateThanMinMaxSizeBytes()
{
Claimant c;
c.v0().destination = txtest::getAccount("acc").getPublicKey();
c.v0().predicate = recursivePredicate(0);
CreateClaimableBalanceOp cbOp;
cbOp.claimants.emplace_back(c);

Operation op;
op.body.type(CREATE_CLAIMABLE_BALANCE);
op.body.createClaimableBalanceOp() = cbOp;

uint32 opSize = static_cast<uint32>(xdr::xdr_argpack_size(op));
REQUIRE(opSize > MinimumSorobanNetworkConfig::TX_MAX_SIZE_BYTES);

return op;
}

TEST_CASE("loopback peer hello", "[overlay][connections]")
{
VirtualClock clock;
Expand Down Expand Up @@ -98,43 +135,14 @@ TEST_CASE("loopback peer send auth before hello", "[overlay][connections]")
testutil::shutdownWorkScheduler(*app1);
}

ClaimPredicate
recursivePredicate(uint32_t counter)
{
if (counter == 10)
{
ClaimPredicate u;
u.type(CLAIM_PREDICATE_UNCONDITIONAL);
return u;
}

ClaimPredicate andPred;
andPred.type(CLAIM_PREDICATE_AND);
andPred.andPredicates().emplace_back(recursivePredicate(counter + 1));
andPred.andPredicates().emplace_back(recursivePredicate(counter + 1));

return andPred;
}

TEST_CASE("flow control byte capacity", "[overlay][flowcontrol]")
{
StellarMessage tx1;
tx1.type(TRANSACTION);

// Make tx1 larger than the minimum we can set TX_MAX_SIZE_BYTES to.
{
Claimant c;
c.v0().destination = txtest::getAccount("acc").getPublicKey();
c.v0().predicate = recursivePredicate(0);
CreateClaimableBalanceOp cbOp;
cbOp.claimants.emplace_back(c);

Operation op;
op.body.type(CREATE_CLAIMABLE_BALANCE);
op.body.createClaimableBalanceOp() = cbOp;

tx1.transaction().v0().tx.operations.emplace_back(op);
}
tx1.transaction().v0().tx.operations.emplace_back(
getOperationGreateThanMinMaxSizeBytes());
uint32 txSize = static_cast<uint32>(xdr::xdr_argpack_size(tx1));
REQUIRE(txSize > MinimumSorobanNetworkConfig::TX_MAX_SIZE_BYTES);

Expand Down Expand Up @@ -574,6 +582,8 @@ TEST_CASE("drop peers that dont respect capacity", "[overlay][flowcontrol]")
// tx is invalid, but it doesn't matter
StellarMessage msg;
msg.type(TRANSACTION);
msg.transaction().v0().tx.operations.emplace_back(
getOperationGreateThanMinMaxSizeBytes());
uint32 txSize = static_cast<uint32>(xdr::xdr_argpack_size(msg));

auto test = [&](bool fcBytes) {
Expand Down Expand Up @@ -2120,10 +2130,12 @@ TEST_CASE("overlay flow control", "[overlay][flowcontrol]")
cfg.PEER_FLOOD_READING_CAPACITY = 1;
cfg.PEER_READING_CAPACITY = 1;
cfg.FLOW_CONTROL_SEND_MORE_BATCH_SIZE = 1;
cfg.PEER_FLOOD_READING_CAPACITY_BYTES = 6000;
cfg.PEER_FLOOD_READING_CAPACITY_BYTES =
MinimumSorobanNetworkConfig::TX_MAX_SIZE_BYTES + 100;
cfg.FLOW_CONTROL_SEND_MORE_BATCH_SIZE_BYTES = 100;
cfg.TESTING_UPGRADE_MAX_TX_SET_SIZE = 1000;
cfg.TESTING_TX_MAX_SIZE_BYTES = 5900;
cfg.TESTING_TX_MAX_SIZE_BYTES =
MinimumSorobanNetworkConfig::TX_MAX_SIZE_BYTES;
configs.push_back(cfg);
}

Expand Down
12 changes: 6 additions & 6 deletions src/testdata/ledger-close-meta-v2-protocol-20.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
"v": 0
},
"ledgerHeader": {
"hash": "bde32c54fc1da92a0f3e30f817e21643be5d5eda458d219922ad419fac1fd1f6",
"hash": "659fa6b436dc39256354cecf7ec65884aa567de52cdeff1bcd7868ba899034f3",
"header": {
"ledgerVersion": 20,
"previousLedgerHash": "d94f59d57299e5bb5b2c04e4e1b92ea01b71aca1ef20f39953606177470668f1",
"previousLedgerHash": "4fd8bb2d20479737140fbb6d13d6403f15325ca218cbb1c2100c2504cf850ade",
"scpValue": {
"txSetHash": "c47b76d9b3dac8fa759cdbeeeddba7e79816257979b48fb8f4ae4f71dc4063f2",
"txSetHash": "ba5a1172ff7a59e53e6fcce5f5501d8e6e7ce5c63690ee801575af7b4186f3d2",
"closeTime": 0,
"upgrades": [],
"ext": {
"v": "STELLAR_VALUE_SIGNED",
"lcValueSignature": {
"nodeID": "GDDOUW25MRFLNXQMN3OODP6JQEXSGLMHAFZV4XPQ2D3GA4QFIDMEJG2O",
"signature": "2e94ed223116cfad63f269ef97d3dc4bc884dabef5e7d9e44303845a9b80b42794705fd28aa5925784a953773c795a4d2569d087b69fa0a8acc2ff662a070707"
"signature": "d66941ce90125e3bccbcfeb10cc8ff84ef871b458f16d8184d9c7ca5610c850c9662578e63dcde336785ad1c6da9e27c9a8e13c5fa78619831c475316f3ced0d"
}
}
},
"txSetResultHash": "cd1398cda325d4eada631301e6501421cda30fd0b43da3e5d0ffb26caf073b0a",
"bucketListHash": "2a311ace42b78fa98c86e6d60a3a3759879f75cad99fb0e0de0ef25901be7f96",
"bucketListHash": "b79edf213f4385c3bd739d96b99ca2ab68b9dd4084b4a6fb168f2243300016e9",
"ledgerSeq": 6,
"totalCoins": 1000000000000000000,
"feePool": 800,
Expand All @@ -49,7 +49,7 @@
"txSet": {
"v": 1,
"v1TxSet": {
"previousLedgerHash": "d94f59d57299e5bb5b2c04e4e1b92ea01b71aca1ef20f39953606177470668f1",
"previousLedgerHash": "4fd8bb2d20479737140fbb6d13d6403f15325ca218cbb1c2100c2504cf850ade",
"phases": [
{
"v": 0,
Expand Down

5 comments on commit 2f92171

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from dmkozh
at sisuresh@2f92171

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging sisuresh/stellar-core/upgrade-invariant = 2f92171 into auto

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sisuresh/stellar-core/upgrade-invariant = 2f92171 merged ok, testing candidate = 0df2e0c

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 0df2e0c

Please sign in to comment.