-
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
A trust line with only lsf*Auth flags set is removed from the ledger [rippled version 1.12.0-rc4] #4698
Comments
Hello @scottschurr , Is this not the intended behavior? I'm of the understanding that Trust Lines in their default settings are candidates for removal, irrespective of their If we modify this behavior, we will have to rethink the conditions for deleting a Trust Line. |
It looks like the behavior I'm seeing is documented and expected. So it makes sense to close this issue. Thanks for researching this and sorry for the noise. |
Having the "Authorized" flag means that the trustline isn't in default settings. I've tried deleting trustlines with |
Here's the script I wrote to test out this authorized trustline functionality, if anyone wants to replicate: const xrpl = require("xrpl");
async function test() {
const client = new xrpl.Client("wss://s.altnet.rippletest.net:51233");
await client.connect();
console.log("connected");
const { wallet: issuer } = await client.fundWallet();
const { wallet: customer } = await client.fundWallet();
const accountSet = {
TransactionType: 'AccountSet',
Account: issuer.address,
SetFlag: xrpl.AccountSetAsfFlags.asfRequireAuth,
}
console.log(await client.submitAndWait(accountSet, {autofill: true, wallet: issuer}))
const customerTrust = {
TransactionType: 'TrustSet',
Account: customer.address,
LimitAmount: {currency: "USD", issuer: issuer.address, value: "2"}
}
console.log(await client.submitAndWait(customerTrust, {autofill: true, wallet: customer}))
const issuerTrust = {
TransactionType: 'TrustSet',
Account: issuer.address,
LimitAmount: {currency: "USD", issuer: customer.address, value: "0"},
Flags: xrpl.TrustSetFlags.tfSetfAuth,
}
console.log(await client.submitAndWait(issuerTrust, {autofill: true, wallet: issuer}))
console.log((await client.request({
command: 'account_objects',
account: issuer.address,
})).result.account_objects)
console.log((await client.request({
command: 'account_objects',
account: customer.address,
})).result.account_objects)
const issuerDelete = {
TransactionType: 'TrustSet',
Account: issuer.address,
LimitAmount: {currency: "USD", issuer: customer.address, value: "0"},
Flags: 0,
}
console.log(await client.submitAndWait(issuerDelete, {autofill: true, wallet: issuer}))
console.log((await client.request({
command: 'account_objects',
account: issuer.address,
})).result.account_objects)
console.log((await client.request({
command: 'account_objects',
account: customer.address,
})).result.account_objects)
await client.disconnect()
}
test() |
I'm not able to run this script, perhaps I'm missing a dependency
The expected behavior of your code is: The Since the |
It's Javascript, not Python. The expected behavior is that the trustline is created + authorized, but trying to delete the trustline by resetting everything else to default settings (since you can't unset |
@mvadari Haha thanks for the clarification, my bad. Do you execute this with node.js runtime? The |
Yes.
See the paragraph under the highlighted part. |
Here's a unit-test in C++ that seems to contradict your findings. It's a slight modification of @scottschurr 's code above. I've tried to mimic your javascript code in that unit test. In your code, you haven't reset the Nonetheless, I observed something strange with the javascript code. The persistence of the trust lines occurs even without the use of
JS Code: const xrpl = require("xrpl");
async function test() {
const client = new xrpl.Client("wss://s.altnet.rippletest.net:51233");
await client.connect();
console.log("connected");
const { wallet: issuer } = await client.fundWallet();
const { wallet: customer } = await client.fundWallet();
console.log("Creating trust line from customer's end\n")
const customerTrust = {
TransactionType: 'TrustSet',
Account: customer.address,
LimitAmount: {currency: "USD", issuer: issuer.address, value: "2"}
}
console.log(await client.submitAndWait(customerTrust, {autofill: true, wallet: customer}))
console.log("Creating trust line from issuer's end\n")
const issuerTrust = {
TransactionType: 'TrustSet',
Account: issuer.address,
LimitAmount: {currency: "USD", issuer: customer.address, value: "0"},
}
console.log(await client.submitAndWait(issuerTrust, {autofill: true, wallet: issuer}))
const custDelete = {
TransactionType: 'TrustSet',
Account: customer.address,
LimitAmount: {currency: "USD", issuer: issuer.address, value: "0"},
}
console.log(await client.submitAndWait(custDelete, {autofill: true, wallet: customer}))
console.log("Completed the reset of trustline from customer's" +
" perspective. Account objects for issuer and customer resp\n")
console.log((await client.request({
command: 'account_objects',
account: issuer.address,
})).result.account_objects)
console.log((await client.request({
command: 'account_objects',
account: customer.address,
})).result.account_objects)
await client.disconnect()
}
test() Results from the JS code: (the trustline has not been deleted from either party)
I have modified your code slightly to demonstrate this issue. I'm not sure why the js and C++ code differ in their behavior. Am I missing something? |
It looks like you're never actually authorizing the trustline. The issuer needs to authorize it, not the customer. In this case, Some things that make that testcase confusing to understand:
|
Okay, I've fixed the mistakes in the previous iteration. Here's the unit test : develop...ckeshava:rippled:AuthFlag If you reset the limits of the trust lines to the default, they are deleted from the accounts. This holds true for Authorised Trust lines too. This is incoherent with a section of the documentation |
@mvadari I have an update on this issue. There is an explanation for the difference in the behavior of C++ Unit tests and the Typescript libraries. many thanks to @ckniffen for brain-storming with me and helping me debug this issue. When new accounts are created in C++ unit tests, The behavior of C++ unit tests is documented here: Line 574 in 901152b
Typescript's Due to the above reasons, trust lines created in the two languages have different properties.
Since the trust lines generated from Typescript is not in the default state, they are not deleted even if developers update I haven't debugged the python library yet, I'm facing a tangential issue on that front. If this is a well-known intended behavior, then I'd recommend highlighting it in the docs. Otherwise, I'll look for specific places in the Typescript code that's causing this discrepency. |
Issue Description
A trust line is removed from the ledger unexpectedly.
Steps to Reproduce
The following unit test member function reproduces the problem.
The workaround is easy. Setting a non-zero trust limit changes the behaviors. Setting non-zero trust limits on both sides of the trust line results in expected behavior.
Given that there's an easy work around, use non-zero trust limits, this is not a high priority bug.
Environment
macOS Monterey 12.5.1
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
The text was updated successfully, but these errors were encountered: