-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat: support Concise Transaction Identifier (CTID) (XLS-37) #4418
Conversation
Co-authored-by: Rome Reginelli <[email protected]>
@RichardAH says this is ready to be reviewed. At this time, he does not plan to do more for this. However, he will check with Denis to see if he has done some work on it. |
@intelliot There is another commit that I have here. Basically if you add the network config, all the env functions wont work. Like This PR will likely fail because this is not included. I can cherry pick this commit in if you'd like or I can rewrite the tests to manually inject the networkID |
That's up to you, but I would recommend proposing a PR that, as far as you know, would be ready to merge into |
@intelliot This is now ready for review. |
This should be merged prior to any parallel / side chains being launched |
fix bad seperator clang-format
Thanks john |
@RichardAH from your perspective, is this PR now ready to merge, or would you prefer to have @nbougalis take a look first? Also, it is suggested that this PR be squashed into 1 commit when it is merged, with the following commit message. If this message isn't ideal, please feel free to propose an alternative.
Note: I updated |
I will do a final review shortly. It’s been a long time since I wrote this code and I need to squash and review to see what ended up in it after other people’s changes |
LGTM |
I take this to mean that this PR is ready to merge. @manojsdoshi - please consider this PR for the next release, and squash with the commit message in #4418 (comment) |
The XLS-37 CTID (Concise Transaction ID) is a network-aware tx identifier which provides a way to efficiently locate a specific transaction without relying on transaction hashes. A CTID encodes the sequence number of the ledger that includes the tx, the transaction's index in that ledger, and the network ID. With the CTID, users can identify transactions and confirm their results. This applies even for transactions on sidechains, which may be difficult to find with only a transaction hash. Additionally, CTIDs require less storage space than transaction hashes, which can be beneficial for databases storing millions of transactions. The XLS-37 specification can be found at: XRPLF/XRPL-Standards#111 Add support for running a node on a different network. There is a new error code, `rpcWRONG_NETWORK`, returned when the requested CTID's network ID does not match the node's network ID. The error message looks like: Wrong network. You should submit this request to a node running on NetworkID: <net_id> * Add RPC support for the CTID format * tx - you can specify "ctid", which is the CTID (16 hex digits, in a string, always starting with "C") * When retrieving a tx, the "ctid" may be returned * Add support for encoding, decoding, and validating CTIDs * Add tests --------- Co-authored-by: Rome Reginelli <[email protected]> Co-authored-by: Denis Angell <[email protected]>
) The XLS-37 CTID (Concise Transaction ID) is a network-aware tx identifier which provides a way to efficiently locate a specific transaction without relying on transaction hashes. A CTID encodes the sequence number of the ledger that includes the tx, the transaction's index in that ledger, and the network ID. With the CTID, users can identify transactions and confirm their results. This applies even for transactions on sidechains, which may be difficult to find with only a transaction hash. Additionally, CTIDs require less storage space than transaction hashes, which can be beneficial for databases storing millions of transactions. The XLS-37 specification can be found at: XRPLF/XRPL-Standards#111 Add support for running a node on a different network. There is a new error code, `rpcWRONG_NETWORK`, returned when the requested CTID's network ID does not match the node's network ID. The error message looks like: Wrong network. You should submit this request to a node running on NetworkID: <net_id> * Add RPC support for the CTID format * tx - you can specify "ctid", which is the CTID (16 hex digits, in a string, always starting with "C") * When retrieving a tx, the "ctid" may be returned * Add support for encoding, decoding, and validating CTIDs * Add tests --------- Co-authored-by: Rome Reginelli <[email protected]> Co-authored-by: Denis Angell <[email protected]> --------- Co-authored-by: Rome Reginelli <[email protected]> Co-authored-by: Elliot Lee <[email protected]> Co-authored-by: Denis Angell <[email protected]>
(XLS-37) (XRPLF#4418) The XLS-37 CTID (Concise Transaction ID) is a network-aware tx identifier which provides a way to efficiently locate a specific transaction without relying on transaction hashes. A CTID encodes the sequence number of the ledger that includes the tx, the transaction's index in that ledger, and the network ID. With the CTID, users can identify transactions and confirm their results. This applies even for transactions on sidechains, which may be difficult to find with only a transaction hash. Additionally, CTIDs require less storage space than transaction hashes, which can be beneficial for databases storing millions of transactions. The XLS-37 specification can be found at: XRPLF/XRPL-Standards#111 Add support for running a node on a different network. There is a new error code, `rpcWRONG_NETWORK`, returned when the requested CTID's network ID does not match the node's network ID. The error message looks like: Wrong network. You should submit this request to a node running on NetworkID: <net_id> * Add RPC support for the CTID format * tx - you can specify "ctid", which is the CTID (16 hex digits, in a string, always starting with "C") * When retrieving a tx, the "ctid" may be returned * Add support for encoding, decoding, and validating CTIDs * Add tests --------- Co-authored-by: Rome Reginelli <[email protected]> Co-authored-by: Denis Angell <[email protected]> --------- Co-authored-by: Rome Reginelli <[email protected]> Co-authored-by: Elliot Lee <[email protected]> Co-authored-by: Denis Angell <[email protected]>
(XLS-37) (XRPLF#4418) The XLS-37 CTID (Concise Transaction ID) is a network-aware tx identifier which provides a way to efficiently locate a specific transaction without relying on transaction hashes. A CTID encodes the sequence number of the ledger that includes the tx, the transaction's index in that ledger, and the network ID. With the CTID, users can identify transactions and confirm their results. This applies even for transactions on sidechains, which may be difficult to find with only a transaction hash. Additionally, CTIDs require less storage space than transaction hashes, which can be beneficial for databases storing millions of transactions. The XLS-37 specification can be found at: XRPLF/XRPL-Standards#111 Add support for running a node on a different network. There is a new error code, `rpcWRONG_NETWORK`, returned when the requested CTID's network ID does not match the node's network ID. The error message looks like: Wrong network. You should submit this request to a node running on NetworkID: <net_id> * Add RPC support for the CTID format * tx - you can specify "ctid", which is the CTID (16 hex digits, in a string, always starting with "C") * When retrieving a tx, the "ctid" may be returned * Add support for encoding, decoding, and validating CTIDs * Add tests --------- Co-authored-by: Rome Reginelli <[email protected]> Co-authored-by: Denis Angell <[email protected]> --------- Co-authored-by: Rome Reginelli <[email protected]> Co-authored-by: Elliot Lee <[email protected]> Co-authored-by: Denis Angell <[email protected]> Signed-off-by: Manoj Doshi <[email protected]>
(XLS-37) (XRPLF#4418) The XLS-37 CTID (Concise Transaction ID) is a network-aware tx identifier which provides a way to efficiently locate a specific transaction without relying on transaction hashes. A CTID encodes the sequence number of the ledger that includes the tx, the transaction's index in that ledger, and the network ID. With the CTID, users can identify transactions and confirm their results. This applies even for transactions on sidechains, which may be difficult to find with only a transaction hash. Additionally, CTIDs require less storage space than transaction hashes, which can be beneficial for databases storing millions of transactions. The XLS-37 specification can be found at: XRPLF/XRPL-Standards#111 Add support for running a node on a different network. There is a new error code, `rpcWRONG_NETWORK`, returned when the requested CTID's network ID does not match the node's network ID. The error message looks like: Wrong network. You should submit this request to a node running on NetworkID: <net_id> * Add RPC support for the CTID format * tx - you can specify "ctid", which is the CTID (16 hex digits, in a string, always starting with "C") * When retrieving a tx, the "ctid" may be returned * Add support for encoding, decoding, and validating CTIDs * Add tests --------- Co-authored-by: Rome Reginelli <[email protected]> Co-authored-by: Denis Angell <[email protected]> Signed-off-by: Manoj Doshi <[email protected]>
(XLS-37) (XRPLF#4418) The XLS-37 CTID (Concise Transaction ID) is a network-aware tx identifier which provides a way to efficiently locate a specific transaction without relying on transaction hashes. A CTID encodes the sequence number of the ledger that includes the tx, the transaction's index in that ledger, and the network ID. With the CTID, users can identify transactions and confirm their results. This applies even for transactions on sidechains, which may be difficult to find with only a transaction hash. Additionally, CTIDs require less storage space than transaction hashes, which can be beneficial for databases storing millions of transactions. The XLS-37 specification can be found at: XRPLF/XRPL-Standards#111 Add support for running a node on a different network. There is a new error code, `rpcWRONG_NETWORK`, returned when the requested CTID's network ID does not match the node's network ID. The error message looks like: Wrong network. You should submit this request to a node running on NetworkID: <net_id> * Add RPC support for the CTID format * tx - you can specify "ctid", which is the CTID (16 hex digits, in a string, always starting with "C") * When retrieving a tx, the "ctid" may be returned * Add support for encoding, decoding, and validating CTIDs * Add tests --------- Co-authored-by: Rome Reginelli <[email protected]> Co-authored-by: Denis Angell <[email protected]>
(XLS-37) (XRPLF#4418) The XLS-37 CTID (Concise Transaction ID) is a network-aware tx identifier which provides a way to efficiently locate a specific transaction without relying on transaction hashes. A CTID encodes the sequence number of the ledger that includes the tx, the transaction's index in that ledger, and the network ID. With the CTID, users can identify transactions and confirm their results. This applies even for transactions on sidechains, which may be difficult to find with only a transaction hash. Additionally, CTIDs require less storage space than transaction hashes, which can be beneficial for databases storing millions of transactions. The XLS-37 specification can be found at: XRPLF/XRPL-Standards#111 Add support for running a node on a different network. There is a new error code, `rpcWRONG_NETWORK`, returned when the requested CTID's network ID does not match the node's network ID. The error message looks like: Wrong network. You should submit this request to a node running on NetworkID: <net_id> * Add RPC support for the CTID format * tx - you can specify "ctid", which is the CTID (16 hex digits, in a string, always starting with "C") * When retrieving a tx, the "ctid" may be returned * Add support for encoding, decoding, and validating CTIDs * Add tests --------- Co-authored-by: Rome Reginelli <[email protected]> Co-authored-by: Denis Angell <[email protected]> Signed-off-by: Manoj Doshi <[email protected]>
) * add CTIM to tx rpc --------- Co-authored-by: Rome Reginelli <[email protected]> Co-authored-by: Elliot Lee <[email protected]> Co-authored-by: Denis Angell <[email protected]>
) * add CTIM to tx rpc --------- Co-authored-by: Rome Reginelli <[email protected]> Co-authored-by: Elliot Lee <[email protected]> Co-authored-by: Denis Angell <[email protected]>
@@ -47,8 +47,8 @@ enum error_code_i { | |||
rpcJSON_RPC = 2, | |||
rpcFORBIDDEN = 3, | |||
|
|||
rpcWRONG_NETWORK = 4, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add "rpcWRONG_NETWORK" in unorderedErrorInfos ( ErrorCodes.cpp )
|
||
uint64_t ctidValue = | ||
((0xC000'0000ULL + static_cast<uint64_t>(ledger_seq)) << 32) + | ||
(static_cast<uint64_t>(txn_index) << 16) + network_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit late :)
But yeah {network_id, ledger_seq, txn_index}
https:/XRPLF/XRPL-Standards/discussions/91\#discussioncomment-5230494 https:/XRPLF/XRPL-Standards/discussions/91\#discussioncomment-5079139
High Level Overview of Change
RPC support for CTID
CTID is a network-aware short alternative to using transaction hashes that is based on the ledger sequence, transaction index and network ID of a validated transaction in a closed ledger.
tx
responseThis implements XLS-37
Type of Change