Skip to content

Commit 6a55a1d

Browse files
committed
Revert "add MPTAmount support in Payment tx and binary-codec"
This reverts commit 9fdee49.
1 parent bc6ea59 commit 6a55a1d

File tree

13 files changed

+37
-528
lines changed

13 files changed

+37
-528
lines changed

tests/integration/transactions/test_payment.py

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,9 @@
44
test_async_and_sync,
55
)
66
from tests.integration.reusable_values import DESTINATION, WALLET
7-
8-
# from xrpl.models.amounts.mpt_amount import MPTAmount
97
from xrpl.models.exceptions import XRPLModelException
10-
11-
# from xrpl.models.requests.account_objects import AccountObjects, AccountObjectType
128
from xrpl.models.transactions import Payment
139

14-
# from xrpl.models.transactions.mptoken_issuance_create import MPTokenIssuanceCreate
15-
# from xrpl.utils import int_to_hex
16-
1710

1811
class TestPayment(IntegrationTestCase):
1912
@test_async_and_sync(globals())
@@ -141,48 +134,3 @@ async def test_deliver_max_alias_field(self, client):
141134
client,
142135
)
143136
self.assertFalse(response.is_successful())
144-
145-
# TODO: uncomment test module when rippled Docker image supports MPT feature
146-
# @test_async_and_sync(globals())
147-
# async def test_mpt_payment(self, client):
148-
# tx = MPTokenIssuanceCreate(
149-
# account=WALLET.classic_address,
150-
# maximum_amount=int_to_hex(9223372036854775807), # "7fffffffffffffff"
151-
# asset_scale=2,
152-
# )
153-
154-
# response = await sign_and_reliable_submission_async(
155-
# tx,
156-
# WALLET,
157-
# client,
158-
# )
159-
160-
# self.assertTrue(response.is_successful())
161-
# self.assertEqual(response.result["engine_result"], "tesSUCCESS")
162-
163-
# # confirm MPTokenIssuance ledger object was created
164-
# account_objects_response = await client.request(
165-
# AccountObjects(
166-
# account=WALLET.address, type=AccountObjectType.MPT_ISSUANCE
167-
# )
168-
# )
169-
170-
# # subsequent integration tests (sync/async + json/websocket) add one
171-
# # MPTokenIssuance object to the account
172-
# account_objects = account_objects_response.result["account_objects"]
173-
# self.assertTrue(len(account_objects) > 0)
174-
175-
# mpt_issuance_id = account_objects[0]["mpt_issuance_id"]
176-
177-
# payment = Payment(
178-
# account=WALLET.address,
179-
# amount=MPTAmount(mpt_issuance_id=mpt_issuance_id, value="10"),
180-
# destination=DESTINATION.address,
181-
# )
182-
183-
# response = await sign_and_reliable_submission_async(
184-
# payment,
185-
# WALLET,
186-
# client,
187-
# )
188-
# self.assertTrue(response.is_successful())

tests/unit/core/binarycodec/fixtures/data/data-driven-tests.json

Lines changed: 0 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,14 +2762,6 @@
27622762
"expected_hex": "4000000000000001",
27632763
"is_negative": false
27642764
},
2765-
{
2766-
"test_json": "-1",
2767-
"type_id": 6,
2768-
"is_native": true,
2769-
"type": "Amount",
2770-
"error": "Value is negative",
2771-
"is_negative": true
2772-
},
27732765
{
27742766
"test_json": {
27752767
"currency": "USD",
@@ -3955,170 +3947,6 @@
39553947
"type_specialisation_field": "TransactionResult",
39563948
"type": "UInt8",
39573949
"expected_hex": "8D"
3958-
},
3959-
{
3960-
"test_json": {
3961-
"mpt_issuance_id": "00002403C84A0A28E0190E208E982C352BBD5006600555CF",
3962-
"value": "9223372036854775808"
3963-
},
3964-
"type": "Amount",
3965-
"error": "Value is too large"
3966-
},
3967-
{
3968-
"test_json": {
3969-
"mpt_issuance_id": "00002403C84A0A28E0190E208E982C352BBD5006600555CF",
3970-
"value": "18446744073709551615"
3971-
},
3972-
"type": "Amount",
3973-
"error": "Value is too large"
3974-
},
3975-
{
3976-
"test_json": {
3977-
"mpt_issuance_id": "00002403C84A0A28E0190E208E982C352BBD5006600555CF",
3978-
"value": "-1"
3979-
},
3980-
"type": "Amount",
3981-
"error": "Value is negative"
3982-
},
3983-
{
3984-
"test_json": {
3985-
"mpt_issuance_id": "00002403C84A0A28E0190E208E982C352BBD5006600555CF",
3986-
"value": "10.1"
3987-
},
3988-
"type": "Amount",
3989-
"error": "Value has decimal point"
3990-
},
3991-
{
3992-
"test_json": {
3993-
"mpt_issuance_id": "10",
3994-
"value": "10"
3995-
},
3996-
"type": "Amount",
3997-
"error": "mpt_issuance_id has invalid hash length"
3998-
},
3999-
{
4000-
"test_json": {
4001-
"mpt_issuance_id": "00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4002-
"value": "10",
4003-
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji"
4004-
},
4005-
"type": "Amount",
4006-
"error": "Issuer not valid for MPT"
4007-
},
4008-
{
4009-
"test_json": {
4010-
"mpt_issuance_id": "00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4011-
"value": "10",
4012-
"currency": "USD"
4013-
},
4014-
"type": "Amount",
4015-
"error": "Currency not valid for MPT"
4016-
},
4017-
{
4018-
"test_json": {
4019-
"mpt_issuance_id": "00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4020-
"value": "a"
4021-
},
4022-
"type": "Amount",
4023-
"error": "Value has incorrect hex format"
4024-
},
4025-
{
4026-
"test_json": {
4027-
"mpt_issuance_id": "00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4028-
"value": "0xy"
4029-
},
4030-
"type": "Amount",
4031-
"error": "Value has bad hex character"
4032-
},
4033-
{
4034-
"test_json": {
4035-
"mpt_issuance_id": "00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4036-
"value": "/"
4037-
},
4038-
"type": "Amount",
4039-
"error": "Value has bad character"
4040-
},
4041-
{
4042-
"test_json": {
4043-
"mpt_issuance_id": "00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4044-
"value": "0x8000000000000000"
4045-
},
4046-
"type": "Amount",
4047-
"error": "Hex value out of range"
4048-
},
4049-
{
4050-
"test_json": {
4051-
"mpt_issuance_id": "00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4052-
"value": "0xFFFFFFFFFFFFFFFF"
4053-
},
4054-
"type": "Amount",
4055-
"error": "Hex value out of range"
4056-
},
4057-
{
4058-
"test_json": {
4059-
"mpt_issuance_id":"00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4060-
"value": "9223372036854775807"
4061-
},
4062-
"type_id": 6,
4063-
"is_native": false,
4064-
"type": "Amount",
4065-
"expected_hex": "607FFFFFFFFFFFFFFF00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4066-
"is_negative": false
4067-
},
4068-
{
4069-
"test_json": {
4070-
"mpt_issuance_id":"00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4071-
"value": "0"
4072-
},
4073-
"type_id": 6,
4074-
"is_native": false,
4075-
"type": "Amount",
4076-
"expected_hex": "60000000000000000000002403C84A0A28E0190E208E982C352BBD5006600555CF",
4077-
"is_negative": false
4078-
},
4079-
{
4080-
"test_json": {
4081-
"mpt_issuance_id":"00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4082-
"value": "-0"
4083-
},
4084-
"type_id": 6,
4085-
"is_native": false,
4086-
"type": "Amount",
4087-
"expected_hex": "60000000000000000000002403C84A0A28E0190E208E982C352BBD5006600555CF",
4088-
"is_negative": false
4089-
},
4090-
{
4091-
"test_json": {
4092-
"mpt_issuance_id":"00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4093-
"value": "100"
4094-
},
4095-
"type_id": 6,
4096-
"is_native": false,
4097-
"type": "Amount",
4098-
"expected_hex": "60000000000000006400002403C84A0A28E0190E208E982C352BBD5006600555CF",
4099-
"is_negative": false
4100-
},
4101-
{
4102-
"test_json": {
4103-
"mpt_issuance_id":"00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4104-
"value": "0xa"
4105-
},
4106-
"type_id": 6,
4107-
"is_native": false,
4108-
"type": "Amount",
4109-
"expected_hex": "60000000000000000A00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4110-
"is_negative": false
4111-
},
4112-
{
4113-
"test_json": {
4114-
"mpt_issuance_id":"00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4115-
"value": "0x7FFFFFFFFFFFFFFF"
4116-
},
4117-
"type_id": 6,
4118-
"is_native": false,
4119-
"type": "Amount",
4120-
"expected_hex": "607FFFFFFFFFFFFFFF00002403C84A0A28E0190E208E982C352BBD5006600555CF",
4121-
"is_negative": false
41223950
}
41233951
]
41243952
}

tests/unit/core/binarycodec/types/test_amount.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,6 @@
8181
["100000000000000000", "416345785D8A0000"],
8282
]
8383

84-
# [MPT dict, expected serialized hex]
85-
MPT_CASES = [
86-
[
87-
{
88-
"mpt_issuance_id": "0000012FFD9EE5DA93AC614B4DB94D7E0FCE415CA51BED47",
89-
"value": "1",
90-
},
91-
"6000000000000000010000012FFD9EE5DA93AC614B4DB94D7E0FCE415CA51BED47",
92-
],
93-
[
94-
{
95-
"value": "9223372036854775807",
96-
"mpt_issuance_id": "0000012FFD9EE5DA93AC614B4DB94D7E0FCE415CA51BED47",
97-
},
98-
"607FFFFFFFFFFFFFFF0000012FFD9EE5DA93AC614B4DB94D7E0FCE415CA51BED47",
99-
],
100-
]
101-
10284

10385
class TestAmount(TestSerializedType):
10486
def test_assert_xrp_is_valid_passes(self):
@@ -166,11 +148,6 @@ def test_from_value_xrp(self):
166148
amount_object = amount.Amount.from_value(json)
167149
self.assertEqual(amount_object.to_hex(), serialized)
168150

169-
def test_from_value_mpt(self):
170-
for json, serialized in MPT_CASES:
171-
amount_object = amount.Amount.from_value(json)
172-
self.assertEqual(amount_object.to_hex(), serialized)
173-
174151
def test_to_json_issued_currency(self):
175152
for json, serialized in IOU_CASES:
176153
parser = BinaryParser(serialized)
@@ -183,12 +160,6 @@ def test_to_json_xrp(self):
183160
amount_object = amount.Amount.from_parser(parser)
184161
self.assertEqual(amount_object.to_json(), json)
185162

186-
def test_to_json_mpt(self):
187-
for json, serialized in MPT_CASES:
188-
parser = BinaryParser(serialized)
189-
amount_object = amount.Amount.from_parser(parser)
190-
self.assertEqual(amount_object.to_json(), json)
191-
192163
def test_fixtures(self):
193164
for fixture in data_driven_fixtures_for_type("Amount"):
194165
self.fixture_test(fixture)

tests/unit/core/binarycodec/types/test_hash_types.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from xrpl.core.binarycodec.exceptions import XRPLBinaryCodecException
55
from xrpl.core.binarycodec.types.hash128 import Hash128
66
from xrpl.core.binarycodec.types.hash160 import Hash160
7-
from xrpl.core.binarycodec.types.hash192 import Hash192
87
from xrpl.core.binarycodec.types.hash256 import Hash256
98

109

@@ -68,34 +67,6 @@ def test_raises_invalid_value_type(self):
6867
self.assertRaises(XRPLBinaryCodecException, Hash160.from_value, invalid_value)
6968

7069

71-
class TestHash192(TestCase):
72-
def setUp(self):
73-
# 24 bytes, 48 nibbles
74-
self.hex_192_bits = "100000000020000000003000000000400000000050000000"
75-
self.parser = BinaryParser(self.hex_192_bits)
76-
self.expected_width = 24
77-
78-
def test_constructors(self):
79-
from_constructor = Hash192(bytes.fromhex(self.hex_192_bits))
80-
from_value = Hash192.from_value(self.hex_192_bits)
81-
from_parser = Hash192.from_parser(self.parser)
82-
83-
self.assertEqual(from_constructor.to_hex(), self.hex_192_bits)
84-
self.assertEqual(from_value.to_hex(), self.hex_192_bits)
85-
self.assertEqual(from_parser.to_hex(), self.hex_192_bits)
86-
87-
def test_constructor_raises_invalid_length(self):
88-
# 25 bytes, 50 nibbles
89-
too_many_bytes_hex = "10000000002000000000300000000040000000005000000012"
90-
self.assertRaises(
91-
XRPLBinaryCodecException, Hash192.from_value, too_many_bytes_hex
92-
)
93-
94-
def test_raises_invalid_value_type(self):
95-
invalid_value = 1
96-
self.assertRaises(XRPLBinaryCodecException, Hash192.from_value, invalid_value)
97-
98-
9970
class TestHash256(TestCase):
10071
def setUp(self):
10172
# 32 bytes, 64 nibbles

tests/unit/models/transactions/test_payment.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,3 @@ def test_destination_wallet(self):
133133
}
134134
with self.assertRaises(XRPLModelException):
135135
Payment(**transaction_dict)
136-
137-
def test_mpt_payment(self):
138-
transaction_dict = {
139-
"account": _ACCOUNT,
140-
"fee": _FEE,
141-
"sequence": _SEQUENCE,
142-
"amount": {
143-
"mpt_issuance_id": "000004C463C52827307480341125DA0577DEFC38405B0E3E",
144-
"value": "10",
145-
},
146-
"destination": _DESTINATION,
147-
}
148-
tx = Payment(**transaction_dict)
149-
self.assertTrue(tx.is_valid())

xrpl/core/binarycodec/types/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from xrpl.core.binarycodec.types.hash import Hash
77
from xrpl.core.binarycodec.types.hash128 import Hash128
88
from xrpl.core.binarycodec.types.hash160 import Hash160
9-
from xrpl.core.binarycodec.types.hash192 import Hash192
109
from xrpl.core.binarycodec.types.hash256 import Hash256
1110
from xrpl.core.binarycodec.types.issue import Issue
1211
from xrpl.core.binarycodec.types.path_set import PathSet
@@ -28,7 +27,6 @@
2827
"Hash",
2928
"Hash128",
3029
"Hash160",
31-
"Hash192",
3230
"Hash256",
3331
"Issue",
3432
"PathSet",

0 commit comments

Comments
 (0)