Closed foreso-GitHub closed 3 years ago
测试版本:v0.5.3-dev-20201229-549e506fdf4556bc9bfd675559fd201421bd3036
发币的最大值是2的63次方(即9223372036854775808),在这个版本上如果total_supply是9200000000000000000,或者9.012345678912345678/AAT29(decimals是18),它们都没有超过2的63次方,但是结果都返回“Amount out of range”。
{
"jsonrpc": "2.0",
"method": "jt_sendTransaction",
"params": [
{
"type": "IssueCoin",
"from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
"secret": "shhquPeZm7uQ6Rvjrqn6L2cR6H33u",
"name": "slkjgs",
"symbol": "AAT29",
"decimals": "18",
"total_supply": "9200000000000000000",
"local": true,
"flags": 65536
}
],
"id": 1
}
{
"error": {
"count": 1,
"description": "The compound error.",
"information": "1 errors"
},
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"error": {
"description": "The transaction is ill-formed.",
"information": "Amount out of range: false Negative: false Value: 9200000000000000000 Offset: 0",
"message": {
"decimals": "18",
"flags": 65536,
"from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
"local": true,
"name": "slkjgs",
"symbol": "AAT29",
"total_supply": "9200000000000000000",
"type": "IssueCoin"
}
},
"status": -278,
"type": "temINVALID"
}
],
"status": 1000,
"type": "tedCOMPOUND"
}
{
"jsonrpc": "2.0",
"method": "jt_sendTransaction",
"params": [
{
"type": "IssueCoin",
"from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
"secret": "shhquPeZm7uQ6Rvjrqn6L2cR6H33u",
"name": "slkjgs",
"symbol": "AAT29",
"decimals": "18",
"total_supply": "9.012345678912345678/AAT29",
"local": true,
"flags": 65536
}
],
"id": 1
}
{
"error": {
"count": 1,
"description": "The compound error.",
"information": "1 errors"
},
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"error": {
"description": "The transaction is ill-formed.",
"information": "Amount out of range: false Negative: false Value: 9012345678912345678 Offset: 0",
"message": {
"decimals": "18",
"flags": 65536,
"from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
"local": true,
"name": "slkjgs",
"symbol": "AAT29",
"total_supply": "9.012345678912345678/AAT29",
"type": "IssueCoin"
}
},
"status": -278,
"type": "temINVALID"
}
],
"status": 1000,
"type": "tedCOMPOUND"
}
测试版本:v0.5.3-dev-20201229-549e506fdf4556bc9bfd675559fd201421bd3036
发币的最大值是2的63次方(即9223372036854775808),在这个版本上如果total_supply是9200000000000000000,或者9.012345678912345678/AAT29(decimals是18),它们都没有超过2的63次方,但是结果都返回“Amount out of range”。
{ "jsonrpc": "2.0", "method": "jt_sendTransaction", "params": [ { "type": "IssueCoin", "from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J", "secret": "shhquPeZm7uQ6Rvjrqn6L2cR6H33u", "name": "slkjgs", "symbol": "AAT29", "decimals": "18", "total_supply": "9200000000000000000", "local": true, "flags": 65536 } ], "id": 1 }
{ "error": { "count": 1, "description": "The compound error.", "information": "1 errors" }, "id": 1, "jsonrpc": "2.0", "result": [ { "error": { "description": "The transaction is ill-formed.", "information": "Amount out of range: false Negative: false Value: 9200000000000000000 Offset: 0", "message": { "decimals": "18", "flags": 65536, "from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J", "local": true, "name": "slkjgs", "symbol": "AAT29", "total_supply": "9200000000000000000", "type": "IssueCoin" } }, "status": -278, "type": "temINVALID" } ], "status": 1000, "type": "tedCOMPOUND" }
{ "jsonrpc": "2.0", "method": "jt_sendTransaction", "params": [ { "type": "IssueCoin", "from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J", "secret": "shhquPeZm7uQ6Rvjrqn6L2cR6H33u", "name": "slkjgs", "symbol": "AAT29", "decimals": "18", "total_supply": "9.012345678912345678/AAT29", "local": true, "flags": 65536 } ], "id": 1 }
{ "error": { "count": 1, "description": "The compound error.", "information": "1 errors" }, "id": 1, "jsonrpc": "2.0", "result": [ { "error": { "description": "The transaction is ill-formed.", "information": "Amount out of range: false Negative: false Value: 9012345678912345678 Offset: 0", "message": { "decimals": "18", "flags": 65536, "from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J", "local": true, "name": "slkjgs", "symbol": "AAT29", "total_supply": "9.012345678912345678/AAT29", "type": "IssueCoin" } }, "status": -278, "type": "temINVALID" } ], "status": 1000, "type": "tedCOMPOUND" }
9223372036854775808,这个数不好记,就设置成9后边都是0的这种,现在是最大值,也就是(6位小数,对应是9万亿),应该是9后边有18个0
已经修复,下一个build验证
版本v0.5.3-dev-20201229-e6b44577a82873fc39752544df05f0d922af079f中,第一个问题已经修复。
@zyd82 东东,你看下你贴的问题,如果也修复了就关闭吧。
@caivega , 我comment的问题还没完全修复,表现为2种情况。
第一种情况,发行9000000000000000000个代币,9后面有18个0,这个是目前允许的最大值,理论上应该能够发行成功,但是返回“out of range”。
{
"jsonrpc": "2.0",
"method": "jt_sendTransaction",
"params": [
{
"type": "IssueCoin",
"from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
"secret": "shhquPeZm7uQ6Rvjrqn6L2cR6H33u",
"name": "slkjgs",
"symbol": "AAT44",
"decimals": "6",
"total_supply": "9000000000000000000",
"local": true,
"flags": 131072
}
],
"id": 1
}
{
"error": {
"count": 1,
"description": "The compound error.",
"information": "1 errors"
},
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"error": {
"description": "The transaction is ill-formed.",
"information": "error total_supply, out of range",
"message": {
"decimals": "6",
"flags": 131072,
"from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
"local": true,
"name": "slkjgs",
"symbol": "AAT44",
"total_supply": "9000000000000000000",
"type": "IssueCoin"
}
},
"status": -278,
"type": "temINVALID"
}
],
"status": 1000,
"type": "tedCOMPOUND"
}
第二种情况,发行8900000000000000000个代币(89后面有17个0),发行成功,但是余额查询结果是4288313981572612096。
{
"jsonrpc": "2.0",
"method": "jt_sendTransaction",
"params": [
{
"type": "IssueCoin",
"from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
"secret": "shhquPeZm7uQ6Rvjrqn6L2cR6H33u",
"name": "slkjgs",
"symbol": "AAT43",
"decimals": "6",
"total_supply": "8900000000000000000",
"local": true,
"flags": 131072
}
],
"id": 1
}
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"result": "5688965B09EF2D8873EF178ACB80D090335434F19FEAE2EBCD0BAA7286CB6E65"
}
]
}
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"TransactionType": "IssueCoin",
"Flags": 2147614720,
"Account": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
"Sequence": 103,
"Fee": "10",
"SigningPubKey": "034153EEBB406B3593AA7F31A4908E56ED820031DB87F4F2E868FB8E1686D5E1E3",
"TxnSignature": "304502210091A6A331466985D78B8E20EF7E684675F78221AF87B43C5E5FA47A4FEEDEC64D02201897C11980B5A2C16BEF6D0CF57FB51F88CFD68D1F4F5E9C58CEB7041FD63566",
"hash": "5688965B09EF2D8873EF178ACB80D090335434F19FEAE2EBCD0BAA7286CB6E65",
"Name": "slkjgs",
"Decimals": 6,
"TotalSupply": {
"value": "4288313981572612096",
"currency": "AAT43",
"issuer": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J"
},
"Owner": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
"date": 662627105,
"inLedger": 80922,
"ledger_index": 80922,
"meta": {
"AffectedNodes": [
{
"ModifiedNode": {
"FinalFields": {
"Hash": "0000000000000000000000000000000000000000000000000000000000000000",
"Account": "jhCVwTcg5aYWMMdfDmwqYxBr5NMA1PDfyg",
"Sequence": 0,
"Balance": {
"value": "8271190",
"currency": "SWT",
"issuer": "jjjjjjjjjjjjjjjjjjjjjhoLvTp"
}
},
"LedgerEntryType": "AccountRoot",
"PreviousFields": {
"Hash": "0000000000000000000000000000000000000000000000000000000000000000",
"Account": "jhCVwTcg5aYWMMdfDmwqYxBr5NMA1PDfyg",
"Sequence": 0,
"Balance": {
"value": "8271180",
"currency": "SWT",
"issuer": "jjjjjjjjjjjjjjjjjjjjjhoLvTp"
}
}
}
},
{
"ModifiedNode": {
"FinalFields": {
"Hash": "0000000000000000000000000000000000000000000000000000000000000000",
"Account": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
"Sequence": 103,
"Balance": {
"value": "99998969",
"currency": "SWT",
"issuer": "jjjjjjjjjjjjjjjjjjjjjhoLvTp"
}
},
"LedgerEntryType": "AccountRoot",
"PreviousFields": {
"Hash": "0000000000000000000000000000000000000000000000000000000000000000",
"Account": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
"Sequence": 102,
"Balance": {
"value": "99998979",
"currency": "SWT",
"issuer": "jjjjjjjjjjjjjjjjjjjjjhoLvTp"
}
}
}
},
{
"CreatedNode": {
"LedgerEntryType": "AccountRoot",
"NewFields": {
"Hash": "0000000000000000000000000000000000000000000000000000000000000000",
"Account": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
"Sequence": 103,
"Balance": {
"value": "4288313981572612096",
"currency": "AAT43",
"issuer": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J"
}
}
}
},
{
"CreatedNode": {
"LedgerEntryType": "CurrencyRoot",
"NewFields": {
"Hash": "0000000000000000000000000000000000000000000000000000000000000000",
"Flags": 131072,
"Account": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
"Sequence": 1,
"Name": "slkjgs",
"Decimals": 6,
"TotalSupply": {
"value": "4288313981572612096",
"currency": "AAT43",
"issuer": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J"
}
}
}
}
],
"TransactionIndex": 0,
"TransactionResult": "tesSUCCESS"
}
}
}
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"balance": {
"value": "4288313981572612096",
"currency": "AAT43",
"issuer": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J"
}
}
}
9000000000000000000(9后边18个0,是最大值,现在是-9000000000000000000 < total_supply < 9000000000000000000, 范围之内,负的是销毁), 等于是不允许的,不行改成?-9000000000000000000 <= total_supply <= 9000000000000000000
8900000000000000000, 这个确实有问题,我看看
我跟 @foreso-GitHub 讨论了一下,还是改成 -9000000000000000000 <= total_supply <= 9000000000000000000 吧。
OK
v0.5.3-dev-20201231-72973ab08899c404ac4998f2e79c8b5fac0e199e上验证通过。
发行代币,如果total_supply设得很大,则发行后total_supply的数值会发生变化。 推测原因是total_supply的类型发生变化,数值太大后溢出了。
版本:v0.5.3-dev-20201229-549e506fdf4556bc9bfd675559fd201421bd3036 昨天以前的版本没有这个问题。
TestCase:
请求:
结果: