Open jimdanz opened 6 years ago
Stellar::Memo.new seems to validate that the memo provided is the right data type:
Stellar::Memo.new
[36] pry(main)> Stellar::Memo.new(:memo_text, {foo: 'bar'}) XDR::InvalidValueError: XDR::InvalidValueError from .../gems/xdr-3.0.0/lib/xdr/union.rb:86:in `set'
But it does not look at the value itself to validate length:
[37] pry(main)> Stellar::Memo.new(:memo_text, 'x' * 10000) => #<Stellar::Memo:0x007fdc5f3a7198 @arm=:text, @switch=#<Stellar::MemoType:0x007fdc5d80e800 @name="memo_text", @value=1>, .....
From my perspective it'd be great if the contract were that if Stellar::Memo.new returns a value, that value will be able to be serialized into XDR successfully.
@jimdanz thanks for mentioning this. We'd love a PR!
Stellar::Memo.new
seems to validate that the memo provided is the right data type:But it does not look at the value itself to validate length:
From my perspective it'd be great if the contract were that if
Stellar::Memo.new
returns a value, that value will be able to be serialized into XDR successfully.