mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-25 13:05:49 +00:00
more xahaugenesis debugging
This commit is contained in:
@@ -493,11 +493,15 @@ RCLConsensus::Adaptor::doAccept(
|
|||||||
|
|
||||||
for (auto const& item : *result.txns.map_)
|
for (auto const& item : *result.txns.map_)
|
||||||
{
|
{
|
||||||
|
#ifndef DEBUG
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
retriableTxs.insert(
|
retriableTxs.insert(
|
||||||
std::make_shared<STTx const>(SerialIter{item.slice()}));
|
std::make_shared<STTx const>(SerialIter{item.slice()}));
|
||||||
JLOG(j_.debug()) << " Tx: " << item.key();
|
JLOG(j_.debug()) << " Tx: " << item.key();
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
}
|
}
|
||||||
catch (std::exception const& ex)
|
catch (std::exception const& ex)
|
||||||
{
|
{
|
||||||
@@ -505,6 +509,7 @@ RCLConsensus::Adaptor::doAccept(
|
|||||||
JLOG(j_.warn())
|
JLOG(j_.warn())
|
||||||
<< " Tx: " << item.key() << " throws: " << ex.what();
|
<< " Tx: " << item.key() << " throws: " << ex.what();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
auto built = buildLCL(
|
auto built = buildLCL(
|
||||||
|
|||||||
@@ -118,8 +118,10 @@ applyTransactions(
|
|||||||
{
|
{
|
||||||
auto const txid = it->first.getTXID();
|
auto const txid = it->first.getTXID();
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
if (pass == 0 && built->txExists(txid))
|
if (pass == 0 && built->txExists(txid))
|
||||||
{
|
{
|
||||||
it = txns.erase(it);
|
it = txns.erase(it);
|
||||||
@@ -142,6 +144,7 @@ applyTransactions(
|
|||||||
case ApplyResult::Retry:
|
case ApplyResult::Retry:
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
#ifndef DEBUG
|
||||||
}
|
}
|
||||||
catch (std::exception const& ex)
|
catch (std::exception const& ex)
|
||||||
{
|
{
|
||||||
@@ -150,6 +153,7 @@ applyTransactions(
|
|||||||
failed.insert(txid);
|
failed.insert(txid);
|
||||||
it = txns.erase(it);
|
it = txns.erase(it);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
JLOG(j.debug()) << (certainRetry ? "Pass: " : "Final pass: ") << pass
|
JLOG(j.debug()) << (certainRetry ? "Pass: " : "Final pass: ") << pass
|
||||||
|
|||||||
@@ -386,6 +386,22 @@ Change::activateXahauGenesis()
|
|||||||
|
|
||||||
Sandbox sb(&view());
|
Sandbox sb(&view());
|
||||||
|
|
||||||
|
static auto const accid = calcAccountID(
|
||||||
|
generateKeyPair(KeyType::secp256k1, generateSeed("masterpassphrase"))
|
||||||
|
.first);
|
||||||
|
auto const kl = keylet::account(accid);
|
||||||
|
auto sle = sb.peek(kl);
|
||||||
|
if (!sle)
|
||||||
|
{
|
||||||
|
JLOG(j_.warn())
|
||||||
|
<< "featureXahauGenesis genesis account doesn't exist!!";
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// running total of the amount of xrp we will burn from the genesis, less the initial distributions
|
||||||
|
auto destroyedXRP = sle->getFieldAmount(sfBalance).xrp() - GENESIS;
|
||||||
|
|
||||||
// Step 1: mint genesis distribution
|
// Step 1: mint genesis distribution
|
||||||
for (auto const& [account, amount] : initial_distribution)
|
for (auto const& [account, amount] : initial_distribution)
|
||||||
{
|
{
|
||||||
@@ -427,6 +443,8 @@ Change::activateXahauGenesis()
|
|||||||
|
|
||||||
sle->setFieldAmount(sfBalance, bal);
|
sle->setFieldAmount(sfBalance, bal);
|
||||||
|
|
||||||
|
destroyedXRP -= amount;
|
||||||
|
|
||||||
if (exists)
|
if (exists)
|
||||||
sb.update(sle);
|
sb.update(sle);
|
||||||
else
|
else
|
||||||
@@ -435,19 +453,6 @@ Change::activateXahauGenesis()
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Step 2: burn genesis funds to (almost) zero
|
// Step 2: burn genesis funds to (almost) zero
|
||||||
static auto const accid = calcAccountID(
|
|
||||||
generateKeyPair(KeyType::secp256k1, generateSeed("masterpassphrase"))
|
|
||||||
.first);
|
|
||||||
|
|
||||||
auto const kl = keylet::account(accid);
|
|
||||||
auto sle = sb.peek(kl);
|
|
||||||
if (!sle)
|
|
||||||
{
|
|
||||||
JLOG(j_.warn())
|
|
||||||
<< "featureXahauGenesis genesis account doesn't exist!!";
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sle->setFieldAmount(sfBalance, GENESIS);
|
sle->setFieldAmount(sfBalance, GENESIS);
|
||||||
|
|
||||||
@@ -550,7 +555,7 @@ Change::activateXahauGenesis()
|
|||||||
hookDef->setFieldArray(sfHookParameters, STArray(vec, sfHookParameters));
|
hookDef->setFieldArray(sfHookParameters, STArray(vec, sfHookParameters));
|
||||||
}
|
}
|
||||||
|
|
||||||
hookDef->setFieldU8(sfHookApiVersion, 0);
|
hookDef->setFieldU16(sfHookApiVersion, 0);
|
||||||
hookDef->setFieldVL(sfCreateCode, wasmBytes);
|
hookDef->setFieldVL(sfCreateCode, wasmBytes);
|
||||||
hookDef->setFieldH256(sfHookSetTxnID, ctx_.tx.getTransactionID());
|
hookDef->setFieldH256(sfHookSetTxnID, ctx_.tx.getTransactionID());
|
||||||
hookDef->setFieldU64(sfReferenceCount, 1);
|
hookDef->setFieldU64(sfReferenceCount, 1);
|
||||||
@@ -589,7 +594,15 @@ Change::activateXahauGenesis()
|
|||||||
|
|
||||||
JLOG(j_.warn()) << "featureXahauGenesis amendment executed successfully";
|
JLOG(j_.warn()) << "featureXahauGenesis amendment executed successfully";
|
||||||
|
|
||||||
|
if (destroyedXRP < beast::zero)
|
||||||
|
{
|
||||||
|
JLOG(j_.warn())
|
||||||
|
<< "featureXahauGenesis: destroyed XRP tally was negative, bailing.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sb.apply(ctx_.rawView());
|
sb.apply(ctx_.rawView());
|
||||||
|
ctx_.rawView().rawDestroyXRP(destroyedXRP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -151,6 +151,9 @@ XRPNotCreated::finalize(
|
|||||||
|
|
||||||
auto const tt = tx.getTxnType();
|
auto const tt = tx.getTxnType();
|
||||||
|
|
||||||
|
if (tt == ttAMENDMENT && tx.getFieldH256(sfAmendment) == featureXahauGenesis)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (view.rules().enabled(featureImport) && tt == ttIMPORT && res == tesSUCCESS)
|
if (view.rules().enabled(featureImport) && tt == ttIMPORT && res == tesSUCCESS)
|
||||||
{
|
{
|
||||||
// different rules for ttIMPORT
|
// different rules for ttIMPORT
|
||||||
@@ -195,6 +198,8 @@ XRPNotCreated::finalize(
|
|||||||
|
|
||||||
return (drops_ == dropsAdded.drops() - fee.drops());
|
return (drops_ == dropsAdded.drops() - fee.drops());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// The net change should never be positive, as this would mean that the
|
// The net change should never be positive, as this would mean that the
|
||||||
// transaction created XRP out of thin air. That's not possible.
|
// transaction created XRP out of thin air. That's not possible.
|
||||||
@@ -540,6 +545,9 @@ ValidNewAccountRoot::finalize(
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto tt = tx.getTxnType();
|
auto tt = tx.getTxnType();
|
||||||
|
|
||||||
|
if (tt == ttAMENDMENT && tx.getFieldH256(sfAmendment) == featureXahauGenesis)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (accountsCreated_ > 1 && tt != ttGENESIS_MINT)
|
if (accountsCreated_ > 1 && tt != ttGENESIS_MINT)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -166,8 +166,10 @@ applyTransaction(
|
|||||||
JLOG(j.debug()) << "TXN " << txn.getTransactionID()
|
JLOG(j.debug()) << "TXN " << txn.getTransactionID()
|
||||||
<< (retryAssured ? "/retry" : "/final");
|
<< (retryAssured ? "/retry" : "/final");
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
auto const result = apply(app, view, txn, flags, j);
|
auto const result = apply(app, view, txn, flags, j);
|
||||||
if (result.second)
|
if (result.second)
|
||||||
{
|
{
|
||||||
@@ -187,12 +189,14 @@ applyTransaction(
|
|||||||
|
|
||||||
JLOG(j.debug()) << "Transaction retry: " << transHuman(result.first);
|
JLOG(j.debug()) << "Transaction retry: " << transHuman(result.first);
|
||||||
return ApplyResult::Retry;
|
return ApplyResult::Retry;
|
||||||
|
#ifndef DEBUG
|
||||||
}
|
}
|
||||||
catch (std::exception const& ex)
|
catch (std::exception const& ex)
|
||||||
{
|
{
|
||||||
JLOG(j.warn()) << "Throws: " << ex.what();
|
JLOG(j.warn()) << "Throws: " << ex.what();
|
||||||
return ApplyResult::Fail;
|
return ApplyResult::Fail;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|||||||
@@ -571,15 +571,20 @@ preflight(
|
|||||||
beast::Journal j)
|
beast::Journal j)
|
||||||
{
|
{
|
||||||
PreflightContext const pfctx(app, tx, rules, flags, j);
|
PreflightContext const pfctx(app, tx, rules, flags, j);
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
return {pfctx, invoke_preflight(pfctx)};
|
return {pfctx, invoke_preflight(pfctx)};
|
||||||
|
#ifndef DEBUG
|
||||||
}
|
}
|
||||||
catch (std::exception const& e)
|
catch (std::exception const& e)
|
||||||
{
|
{
|
||||||
JLOG(j.fatal()) << "apply: " << e.what();
|
JLOG(j.fatal()) << "apply: " << e.what();
|
||||||
return {pfctx, {tefEXCEPTION, TxConsequences{tx}}};
|
return {pfctx, {tefEXCEPTION, TxConsequences{tx}}};
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PreclaimResult
|
PreclaimResult
|
||||||
@@ -615,17 +620,22 @@ preclaim(
|
|||||||
preflightResult.flags,
|
preflightResult.flags,
|
||||||
preflightResult.j);
|
preflightResult.j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
if (ctx->preflightResult != tesSUCCESS)
|
if (ctx->preflightResult != tesSUCCESS)
|
||||||
return {*ctx, ctx->preflightResult};
|
return {*ctx, ctx->preflightResult};
|
||||||
return {*ctx, invoke_preclaim(*ctx)};
|
return {*ctx, invoke_preclaim(*ctx)};
|
||||||
|
#ifndef DEBUG
|
||||||
}
|
}
|
||||||
catch (std::exception const& e)
|
catch (std::exception const& e)
|
||||||
{
|
{
|
||||||
JLOG(ctx->j.fatal()) << "apply: " << e.what();
|
JLOG(ctx->j.fatal()) << "apply: " << e.what();
|
||||||
return {*ctx, tefEXCEPTION};
|
return {*ctx, tefEXCEPTION};
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
XRPAmount
|
XRPAmount
|
||||||
@@ -649,8 +659,10 @@ doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view)
|
|||||||
// info to recover.
|
// info to recover.
|
||||||
return {tefEXCEPTION, false};
|
return {tefEXCEPTION, false};
|
||||||
}
|
}
|
||||||
|
#ifndef DEBUG
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
if (!preclaimResult.likelyToClaimFee)
|
if (!preclaimResult.likelyToClaimFee)
|
||||||
return {preclaimResult.ter, false};
|
return {preclaimResult.ter, false};
|
||||||
|
|
||||||
@@ -663,12 +675,14 @@ doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view)
|
|||||||
preclaimResult.flags,
|
preclaimResult.flags,
|
||||||
preclaimResult.j);
|
preclaimResult.j);
|
||||||
return invoke_apply(ctx);
|
return invoke_apply(ctx);
|
||||||
|
#ifndef DEBUG
|
||||||
}
|
}
|
||||||
catch (std::exception const& e)
|
catch (std::exception const& e)
|
||||||
{
|
{
|
||||||
JLOG(preclaimResult.j.fatal()) << "apply: " << e.what();
|
JLOG(preclaimResult.j.fatal()) << "apply: " << e.what();
|
||||||
return {tefEXCEPTION, false};
|
return {tefEXCEPTION, false};
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|||||||
@@ -457,7 +457,7 @@ REGISTER_FEATURE(BalanceRewards, Supported::yes, VoteBehavior::De
|
|||||||
REGISTER_FEATURE(PaychanAndEscrowForTokens, Supported::yes, VoteBehavior::DefaultYes);
|
REGISTER_FEATURE(PaychanAndEscrowForTokens, Supported::yes, VoteBehavior::DefaultYes);
|
||||||
REGISTER_FEATURE(URIToken, Supported::yes, VoteBehavior::DefaultYes);
|
REGISTER_FEATURE(URIToken, Supported::yes, VoteBehavior::DefaultYes);
|
||||||
REGISTER_FEATURE(Import, Supported::yes, VoteBehavior::DefaultYes);
|
REGISTER_FEATURE(Import, Supported::yes, VoteBehavior::DefaultYes);
|
||||||
REGISTER_FEATURE(XahauGenesis, Supported::yes, VoteBehavior::DefaultYes);
|
REGISTER_FEATURE(XahauGenesis, Supported::yes, VoteBehavior::DefaultNo);
|
||||||
|
|
||||||
// The following amendments are obsolete, but must remain supported
|
// The following amendments are obsolete, but must remain supported
|
||||||
// because they could potentially get enabled.
|
// because they could potentially get enabled.
|
||||||
|
|||||||
Reference in New Issue
Block a user