mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Merge pull request #70 from Xahau/governance_hook_l2
Governance hook l2
This commit is contained in:
@@ -74,7 +74,7 @@ namespace detail {
|
||||
// Feature.cpp. Because it's only used to reserve storage, and determine how
|
||||
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
|
||||
// the actual number of amendments. A LogicError on startup will verify this.
|
||||
static constexpr std::size_t numFeatures = 63;
|
||||
static constexpr std::size_t numFeatures = 64;
|
||||
|
||||
/** Amendments that this server supports and the default voting behavior.
|
||||
Whether they are enabled depends on the Rules defined in the validated
|
||||
@@ -351,6 +351,7 @@ extern uint256 const fixUniversalNumber;
|
||||
extern uint256 const fixNonFungibleTokensV1_2;
|
||||
extern uint256 const fixNFTokenRemint;
|
||||
extern uint256 const featureImport;
|
||||
extern uint256 const featureXahauGenesis;
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
|
||||
@@ -111,6 +111,9 @@ fees() noexcept;
|
||||
Keylet const&
|
||||
negativeUNL() noexcept;
|
||||
|
||||
Keylet const&
|
||||
UNLReport() noexcept;
|
||||
|
||||
/** The beginning of an order book */
|
||||
struct book_t
|
||||
{
|
||||
|
||||
@@ -172,6 +172,13 @@ enum LedgerEntryType : std::uint16_t
|
||||
*/
|
||||
ltURI_TOKEN = 0x0055,
|
||||
|
||||
/** A ledger object that reports on the active dUNL validators
|
||||
* that were validating for more than 240 of the last 256 ledgers
|
||||
*
|
||||
* \sa keylet::UNLReport
|
||||
*/
|
||||
ltUNL_REPORT = 0x0052,
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** A special type, matching any ledger entry type.
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace ripple {
|
||||
@ingroup protocol
|
||||
*/
|
||||
/** Smallest legal byte size of a transaction. */
|
||||
std::size_t constexpr txMinSizeBytes = 32;
|
||||
std::size_t constexpr txMinSizeBytes = 10;
|
||||
|
||||
/** Largest legal byte size of a transaction. */
|
||||
std::size_t constexpr txMaxSizeBytes = megabytes(1);
|
||||
|
||||
@@ -477,6 +477,8 @@ extern SF_UINT256 const sfHookSetTxnID;
|
||||
extern SF_UINT256 const sfOfferID;
|
||||
extern SF_UINT256 const sfEscrowID;
|
||||
extern SF_UINT256 const sfURITokenID;
|
||||
extern SF_UINT256 const sfGovernanceFlags;
|
||||
extern SF_UINT256 const sfGovernanceMarks;
|
||||
|
||||
// currency amount (common)
|
||||
extern SF_AMOUNT const sfAmount;
|
||||
@@ -581,6 +583,8 @@ extern SField const sfHookExecution;
|
||||
extern SField const sfHookDefinition;
|
||||
extern SField const sfHookParameter;
|
||||
extern SField const sfHookGrant;
|
||||
extern SField const sfActiveValidator;
|
||||
extern SField const sfImportVLKey;
|
||||
|
||||
// array of objects (common)
|
||||
// ARRAY/1 is reserved for end of array
|
||||
@@ -594,6 +598,7 @@ extern SField const sfAffectedNodes;
|
||||
extern SField const sfMemos;
|
||||
extern SField const sfNFTokens;
|
||||
extern SField const sfHooks;
|
||||
extern SField const sfGenesisMint;
|
||||
|
||||
// array of objects (uncommon)
|
||||
extern SField const sfMajorities;
|
||||
@@ -603,6 +608,9 @@ extern SField const sfHookExecution;
|
||||
extern SField const sfHookParameters;
|
||||
extern SField const sfHooks;
|
||||
extern SField const sfHookGrants;
|
||||
extern SField const sfGenesisMints;
|
||||
extern SField const sfActiveValidators;
|
||||
extern SField const sfImportVLKeys;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -85,7 +85,8 @@ constexpr std::ratio<204, 256> preFixAmendmentMajorityCalcThreshold;
|
||||
constexpr std::ratio<80, 100> postFixAmendmentMajorityCalcThreshold;
|
||||
|
||||
/** The minimum amount of time an amendment must hold a majority */
|
||||
constexpr std::chrono::seconds const defaultAmendmentMajorityTime = days{5};
|
||||
constexpr std::chrono::seconds const defaultAmendmentMajorityTime = std::chrono::seconds{16};
|
||||
//days{5};
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
|
||||
@@ -146,7 +146,12 @@ enum TxType : std::uint16_t
|
||||
ttURITOKEN_CREATE_SELL_OFFER = 48,
|
||||
ttURITOKEN_CANCEL_SELL_OFFER = 49,
|
||||
|
||||
/** This transaciton accepts a proof of burn from an external network as a basis
|
||||
/** This transaction can only be used by the genesis account, which is controlled exclusively by
|
||||
* rewards/governance hooks, to print new XRP to be delivered directly to an array of destinations,
|
||||
* according to reward schedule */
|
||||
ttGENESIS_MINT = 96,
|
||||
|
||||
/** This transaction accepts a proof of burn from an external network as a basis
|
||||
* for minting according to featureImport */
|
||||
ttIMPORT = 97,
|
||||
|
||||
@@ -175,6 +180,7 @@ enum TxType : std::uint16_t
|
||||
*/
|
||||
ttUNL_MODIFY = 102,
|
||||
ttEMIT_FAILURE = 103,
|
||||
ttUNL_REPORT = 104,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -454,9 +454,10 @@ REGISTER_FIX (fixNonFungibleTokensV1_2, Supported::yes, VoteBehavior::De
|
||||
REGISTER_FIX (fixNFTokenRemint, Supported::yes, VoteBehavior::DefaultNo);
|
||||
REGISTER_FEATURE(Hooks, Supported::yes, VoteBehavior::DefaultYes);
|
||||
REGISTER_FEATURE(BalanceRewards, Supported::yes, VoteBehavior::DefaultYes);
|
||||
REGISTER_FEATURE(PaychanAndEscrowForTokens, Supported::yes, VoteBehavior::DefaultNo);
|
||||
REGISTER_FEATURE(URIToken, Supported::yes, VoteBehavior::DefaultNo);
|
||||
REGISTER_FEATURE(Import, Supported::yes, VoteBehavior::DefaultNo);
|
||||
REGISTER_FEATURE(PaychanAndEscrowForTokens, Supported::yes, VoteBehavior::DefaultYes);
|
||||
REGISTER_FEATURE(URIToken, Supported::yes, VoteBehavior::DefaultYes);
|
||||
REGISTER_FEATURE(Import, Supported::yes, VoteBehavior::DefaultYes);
|
||||
REGISTER_FEATURE(XahauGenesis, Supported::yes, VoteBehavior::DefaultYes);
|
||||
|
||||
// The following amendments are obsolete, but must remain supported
|
||||
// because they could potentially get enabled.
|
||||
|
||||
@@ -71,6 +71,7 @@ enum class LedgerNameSpace : std::uint16_t {
|
||||
NFTOKEN_SELL_OFFERS = 'i',
|
||||
URI_TOKEN = 'U',
|
||||
IMPORT_VLSEQ = 'I',
|
||||
UNL_REPORT = 'R',
|
||||
|
||||
// No longer used or supported. Left here to reserve the space
|
||||
// to avoid accidental reuse.
|
||||
@@ -236,6 +237,14 @@ negativeUNL() noexcept
|
||||
return ret;
|
||||
}
|
||||
|
||||
Keylet const&
|
||||
UNLReport() noexcept
|
||||
{
|
||||
static Keylet const ret{
|
||||
ltUNL_REPORT, indexHash(LedgerNameSpace::UNL_REPORT)};
|
||||
return ret;
|
||||
}
|
||||
|
||||
Keylet
|
||||
book_t::operator()(Book const& b) const
|
||||
{
|
||||
|
||||
@@ -125,6 +125,29 @@ InnerObjectFormats::InnerObjectFormats()
|
||||
{sfNFTokenID, soeREQUIRED},
|
||||
{sfURI, soeOPTIONAL},
|
||||
});
|
||||
|
||||
add(sfGenesisMint.jsonName.c_str(),
|
||||
sfGenesisMint.getCode(),
|
||||
{
|
||||
{sfDestination, soeREQUIRED},
|
||||
{sfAmount, soeOPTIONAL},
|
||||
{sfGovernanceFlags, soeOPTIONAL},
|
||||
{sfGovernanceMarks, soeOPTIONAL},
|
||||
});
|
||||
|
||||
add(sfActiveValidator.jsonName.c_str(),
|
||||
sfActiveValidator.getCode(),
|
||||
{
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfAccount, soeOPTIONAL},
|
||||
});
|
||||
|
||||
add(sfImportVLKey.jsonName.c_str(),
|
||||
sfImportVLKey.getCode(),
|
||||
{
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfAccount, soeOPTIONAL},
|
||||
});
|
||||
}
|
||||
|
||||
InnerObjectFormats const&
|
||||
|
||||
@@ -63,6 +63,8 @@ LedgerFormats::LedgerFormats()
|
||||
{sfRewardAccumulator, soeOPTIONAL},
|
||||
{sfFirstNFTokenSequence, soeOPTIONAL},
|
||||
{sfImportSequence, soeOPTIONAL},
|
||||
{sfGovernanceFlags, soeOPTIONAL},
|
||||
{sfGovernanceMarks, soeOPTIONAL},
|
||||
},
|
||||
commonFields);
|
||||
|
||||
@@ -298,6 +300,16 @@ LedgerFormats::LedgerFormats()
|
||||
},
|
||||
commonFields);
|
||||
|
||||
add(jss::UNLReport,
|
||||
ltUNL_REPORT,
|
||||
{
|
||||
{sfImportVLKeys, soeOPTIONAL},
|
||||
{sfActiveValidators, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
},
|
||||
commonFields);
|
||||
|
||||
add(jss::EmittedTxn,
|
||||
ltEMITTED_TXN,
|
||||
{
|
||||
|
||||
@@ -230,6 +230,8 @@ CONSTRUCT_TYPED_SFIELD(sfHookSetTxnID, "HookSetTxnID", UINT256,
|
||||
CONSTRUCT_TYPED_SFIELD(sfOfferID, "OfferID", UINT256, 34);
|
||||
CONSTRUCT_TYPED_SFIELD(sfEscrowID, "EscrowID", UINT256, 35);
|
||||
CONSTRUCT_TYPED_SFIELD(sfURITokenID, "URITokenID", UINT256, 36);
|
||||
CONSTRUCT_TYPED_SFIELD(sfGovernanceFlags, "GovernanceFlags", UINT256, 99);
|
||||
CONSTRUCT_TYPED_SFIELD(sfGovernanceMarks, "GovernanceMarks", UINT256, 98);
|
||||
|
||||
// currency amount (common)
|
||||
CONSTRUCT_TYPED_SFIELD(sfAmount, "Amount", AMOUNT, 1);
|
||||
@@ -336,6 +338,9 @@ CONSTRUCT_UNTYPED_SFIELD(sfHookExecution, "HookExecution", OBJECT,
|
||||
CONSTRUCT_UNTYPED_SFIELD(sfHookDefinition, "HookDefinition", OBJECT, 22);
|
||||
CONSTRUCT_UNTYPED_SFIELD(sfHookParameter, "HookParameter", OBJECT, 23);
|
||||
CONSTRUCT_UNTYPED_SFIELD(sfHookGrant, "HookGrant", OBJECT, 24);
|
||||
CONSTRUCT_UNTYPED_SFIELD(sfGenesisMint, "GenesisMint", OBJECT, 96);
|
||||
CONSTRUCT_UNTYPED_SFIELD(sfActiveValidator, "ActiveValidator", OBJECT, 95);
|
||||
CONSTRUCT_UNTYPED_SFIELD(sfImportVLKey, "ImportVLKey", OBJECT, 94);
|
||||
|
||||
// array of objects
|
||||
// ARRAY/1 is reserved for end of array
|
||||
@@ -356,6 +361,9 @@ CONSTRUCT_UNTYPED_SFIELD(sfDisabledValidators, "DisabledValidators", ARRAY,
|
||||
CONSTRUCT_UNTYPED_SFIELD(sfHookExecutions, "HookExecutions", ARRAY, 18);
|
||||
CONSTRUCT_UNTYPED_SFIELD(sfHookParameters, "HookParameters", ARRAY, 19);
|
||||
CONSTRUCT_UNTYPED_SFIELD(sfHookGrants, "HookGrants", ARRAY, 20);
|
||||
CONSTRUCT_UNTYPED_SFIELD(sfGenesisMints, "GenesisMints", ARRAY, 96);
|
||||
CONSTRUCT_UNTYPED_SFIELD(sfActiveValidators, "ActiveValidators", ARRAY, 95);
|
||||
CONSTRUCT_UNTYPED_SFIELD(sfImportVLKeys, "ImportVLKeys", ARRAY, 94);
|
||||
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -564,7 +564,7 @@ isPseudoTx(STObject const& tx)
|
||||
return false;
|
||||
|
||||
auto tt = safe_cast<TxType>(*t);
|
||||
return tt == ttAMENDMENT || tt == ttFEE || tt == ttUNL_MODIFY || tt == ttEMIT_FAILURE;
|
||||
return tt == ttAMENDMENT || tt == ttFEE || tt == ttUNL_MODIFY || tt == ttEMIT_FAILURE || tt == ttUNL_REPORT;
|
||||
}
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
@@ -192,6 +192,16 @@ TxFormats::TxFormats()
|
||||
},
|
||||
commonFields);
|
||||
|
||||
add(jss::UNLReport,
|
||||
ttUNL_REPORT,
|
||||
{
|
||||
{sfLedgerSequence, soeREQUIRED},
|
||||
{sfActiveValidator, soeOPTIONAL},
|
||||
{sfImportVLKey, soeOPTIONAL},
|
||||
|
||||
},
|
||||
commonFields);
|
||||
|
||||
add(jss::TicketCreate,
|
||||
ttTICKET_CREATE,
|
||||
{
|
||||
@@ -358,6 +368,13 @@ TxFormats::TxFormats()
|
||||
},
|
||||
commonFields);
|
||||
|
||||
add(jss::GenesisMint,
|
||||
ttGENESIS_MINT,
|
||||
{
|
||||
{sfGenesisMints, soeREQUIRED},
|
||||
},
|
||||
commonFields);
|
||||
|
||||
add(jss::Import,
|
||||
ttIMPORT,
|
||||
{
|
||||
|
||||
@@ -72,6 +72,7 @@ JSS(FeeSettings); // ledger type.
|
||||
JSS(FIELDS); // out: RPC server_definitions
|
||||
JSS(Flags); // in/out: TransactionSign; field.
|
||||
JSS(incomplete_shards); // out: OverlayImpl, PeerImp
|
||||
JSS(GenesisMint); // tt
|
||||
JSS(HookApiVersion); // field
|
||||
JSS(HookHash); // field
|
||||
JSS(HookNamespace); // field
|
||||
@@ -116,6 +117,7 @@ JSS(RippleState); // ledger type.
|
||||
JSS(SLE_hit_rate); // out: GetCounts.
|
||||
JSS(SetFee); // transaction type.
|
||||
JSS(UNLModify); // transaction type.
|
||||
JSS(UNLReport); // transaction type.
|
||||
JSS(SettleDelay); // in: TransactionSign
|
||||
JSS(SendMax); // in: TransactionSign
|
||||
JSS(Sequence); // in/out: TransactionSign; field.
|
||||
|
||||
Reference in New Issue
Block a user