question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Regression, 0.11, important] Inconsistent handling of homeDomain in Transaction object

See original GitHub issue

Summary

0.11 seems to have introduced a regression were tx.operations[x].homeDomain is set to null instead of undefined when not defined. When this parameter is set to an empty string (to clear it), tx.operations[x].homeDomain is set to null as well. This introduce a confusion that could lead to a wrong interpretation of the transaction purpose, hence the important tag.

Expected behavior

The property at tx.operations[x].homeDomain should be set to undefined if it was not set among the setOptions operation options as for any other parameter. If the parameter were ‘’, it should properly reflect as well.

Reproduce

const StellarSdk = require('stellar-sdk')
const keypair = StellarSdk.Keypair.random()
const account = new StellarSdk.Account(keypair.publicKey(), '0')

// First operation do nothing.
const tx1 = new StellarSdk.TransactionBuilder(account)
	.addOperation(StellarSdk.Operation.setOptions({}))
	.build()

// Second operation unset homeDomain
const tx2 = new StellarSdk.TransactionBuilder(account)
	.addOperation(StellarSdk.Operation.setOptions({ homeDomain: ''}))
	.build()

// Both operations set tx.operations[0].homeDomain to `null`.
console.log(tx1.operations[0].homeDomain)
console.log(tx2.operations[0].homeDomain)

// However the `tx` tree remains consistent (first: undefined, second: '')
console.log(tx1.tx._attributes.operations[0]._attributes.body._value._attributes.homeDomain)
console.log(tx2.tx._attributes.operations[0]._attributes.body._value._attributes.homeDomain)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
bartekncommented, Oct 19, 2018

Sorry, you are right. Fix ready in https://github.com/stellar/js-stellar-base/pull/144.

0reactions
bartekncommented, Oct 19, 2018

Good point, changed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feuille1 - PLOS
RNA was extracted after 48 hours of treatment using Tri-reagent. ... Regression analysis of calculated GFR’s from 1 to 36 months yielded a...
Read more >
Languages | Free Full-Text | Gender in Unilingual and Mixed ... - MDPI
This study explores how bilingual speakers juggle languages with conflicting features, with a specific focus on gender in nominal constructions. We study ...
Read more >
Chapter 9: Risk Factors for Non-Insulin-Dependent Diabetes
This review of the risk factors for NIDDM summarizes findings related to the epidemiology and natural his- tory of the disease. Risk factors...
Read more >
Searching Genome-wide Disease Association Through SNP ...
The logistic regression model with both main effect. (marginal effect) terms and interaction terms, i.e., the full model has the following ...
Read more >
physically consistent manner: Topics by Science.gov
Testing this questionnaire in non-symptomatic employees and comparing its performance with objective assessments of physical workload are important next ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found