Skip to content

Commit

Permalink
[FOLD] Add telENV_RPC_FAILED error code
Browse files Browse the repository at this point in the history
  • Loading branch information
scottschurr committed Feb 13, 2024
1 parent d15cb0a commit 4a2ac11
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/ripple/protocol/TER.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ enum TELcodes : TERUnderlyingType {
telCAN_NOT_QUEUE_FULL,
telWRONG_NETWORK,
telREQUIRES_NETWORK_ID,
telNETWORK_ID_MAKES_TX_NON_CANONICAL
telNETWORK_ID_MAKES_TX_NON_CANONICAL,
telENV_RPC_FAILED
};

//------------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion src/ripple/protocol/impl/TER.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ transResults()
MAKE_ERROR(tefNO_TICKET, "Ticket is not in ledger."),
MAKE_ERROR(tefNFTOKEN_IS_NOT_TRANSFERABLE, "The specified NFToken is not transferable."),

MAKE_ERROR(telLOCAL_ERROR, "Local failure / unit test RPC failure."),
MAKE_ERROR(telLOCAL_ERROR, "Local failure."),
MAKE_ERROR(telBAD_DOMAIN, "Domain too long."),
MAKE_ERROR(telBAD_PATH_COUNT, "Malformed: Too many paths."),
MAKE_ERROR(telBAD_PUBLIC_KEY, "Public key is not valid."),
Expand All @@ -150,6 +150,7 @@ transResults()
MAKE_ERROR(telWRONG_NETWORK, "Transaction specifies a Network ID that differs from that of the local node."),
MAKE_ERROR(telREQUIRES_NETWORK_ID, "Transactions submitted to this node/network must include a correct NetworkID field."),
MAKE_ERROR(telNETWORK_ID_MAKES_TX_NON_CANONICAL, "Transactions submitted to this node/network must NOT include a NetworkID field."),
MAKE_ERROR(telENV_RPC_FAILED, "Unit test RPC failure."),

MAKE_ERROR(temMALFORMED, "Malformed transaction."),
MAKE_ERROR(temBAD_AMM_TOKENS, "Malformed: Invalid LPTokens."),
Expand Down
6 changes: 3 additions & 3 deletions src/test/app/MultiSign_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class MultiSign_test : public beast::unit_test::suite
env(noop(alice),
msig(demon, demon),
fee(3 * baseFee),
ter(telLOCAL_ERROR));
ter(telENV_RPC_FAILED));
env.close();
BEAST_EXPECT(env.seq(alice) == aliceSeq);

Expand Down Expand Up @@ -361,7 +361,7 @@ class MultiSign_test : public beast::unit_test::suite
msig phantoms{bogie, demon};
std::reverse(phantoms.signers.begin(), phantoms.signers.end());
std::uint32_t const aliceSeq = env.seq(alice);
env(noop(alice), phantoms, ter(telLOCAL_ERROR));
env(noop(alice), phantoms, ter(telENV_RPC_FAILED));
env.close();
BEAST_EXPECT(env.seq(alice) == aliceSeq);
}
Expand Down Expand Up @@ -1640,7 +1640,7 @@ class MultiSign_test : public beast::unit_test::suite
env(noop(alice),
msig(demon, demon),
fee(3 * baseFee),
ter(telLOCAL_ERROR));
ter(telENV_RPC_FAILED));
env.close();
BEAST_EXPECT(env.seq(alice) == aliceSeq);

Expand Down
2 changes: 1 addition & 1 deletion src/test/app/Regression_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ struct Regression_test : public beast::unit_test::suite
secp256r1Sig->setFieldVL(sfSigningPubKey, *pubKeyBlob);
jt.stx.reset(secp256r1Sig.release());

env(jt, ter(telLOCAL_ERROR));
env(jt, ter(telENV_RPC_FAILED));
};

Account const alice{"alice", KeyType::secp256k1};
Expand Down
6 changes: 3 additions & 3 deletions src/test/jtx/Env_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,9 @@ class Env_test : public beast::unit_test::suite
// Force the factor low enough to fail
params[jss::fee_mult_max] = 1;
params[jss::fee_div_max] = 2;
// RPC errors result in telLOCAL_ERROR
envs(
noop(alice), fee(none), seq(none), ter(telLOCAL_ERROR))(params);
// RPC errors result in telENV_RPC_FAILED
envs(noop(alice), fee(none), seq(none), ter(telENV_RPC_FAILED))(
params);

auto tx = env.tx();
BEAST_EXPECT(!tx);
Expand Down
2 changes: 1 addition & 1 deletion src/test/jtx/impl/Env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ Env::parseResult(Json::Value const& jr)
else
// Use an error code that is not used anywhere in the transaction engine
// to distinguish this case.
ter = telLOCAL_ERROR;
ter = telENV_RPC_FAILED;
return std::make_pair(ter, isTesSuccess(ter) || isTecClaim(ter));
}

Expand Down
10 changes: 5 additions & 5 deletions src/test/protocol/Memo_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Memo_test : public beast::unit_test::suite
JTx memoSize = makeJtxWithMemo();
memoSize.jv[sfMemos.jsonName][0u][sfMemo.jsonName]
[sfMemoData.jsonName] = std::string(2020, '0');
env(memoSize, ter(telLOCAL_ERROR));
env(memoSize, ter(telENV_RPC_FAILED));

// This memo is just barely small enough.
memoSize.jv[sfMemos.jsonName][0u][sfMemo.jsonName]
Expand All @@ -72,23 +72,23 @@ class Memo_test : public beast::unit_test::suite
auto& m = mi[sfCreatedNode.jsonName]; // CreatedNode in Memos
m[sfMemoData.jsonName] = "3030303030";

env(memoNonMemo, ter(telLOCAL_ERROR));
env(memoNonMemo, ter(telENV_RPC_FAILED));
}
{
// Put an invalid field in a Memo object.
JTx memoExtra = makeJtxWithMemo();
memoExtra
.jv[sfMemos.jsonName][0u][sfMemo.jsonName][sfFlags.jsonName] =
13;
env(memoExtra, ter(telLOCAL_ERROR));
env(memoExtra, ter(telENV_RPC_FAILED));
}
{
// Put a character that is not allowed in a URL in a MemoType field.
JTx memoBadChar = makeJtxWithMemo();
memoBadChar.jv[sfMemos.jsonName][0u][sfMemo.jsonName]
[sfMemoType.jsonName] =
strHex(std::string_view("ONE<INFINITY"));
env(memoBadChar, ter(telLOCAL_ERROR));
env(memoBadChar, ter(telENV_RPC_FAILED));
}
{
// Put a character that is not allowed in a URL in a MemoData field.
Expand All @@ -105,7 +105,7 @@ class Memo_test : public beast::unit_test::suite
memoBadChar.jv[sfMemos.jsonName][0u][sfMemo.jsonName]
[sfMemoFormat.jsonName] =
strHex(std::string_view("NoBraces{}InURL"));
env(memoBadChar, ter(telLOCAL_ERROR));
env(memoBadChar, ter(telENV_RPC_FAILED));
}
}

Expand Down

0 comments on commit 4a2ac11

Please sign in to comment.