Zilliqa / zq2

Zilliqa 2.0 code base
Apache License 2.0
9 stars 0 forks source link

`GetTransaction` doesn't return non-Zilliqa transactions #1010

Closed JamesHinshelwood closed 5 months ago

rrw-zilliqa commented 5 months ago

OK. A bit of poking with forge on ZQ1 devnet reveals that:

rrw-zilliqa commented 5 months ago

Sample forge source in zilliqa-experimental/richard/hello_forge ...

rrw-zilliqa commented 5 months ago

OK. Looks like in zq1 JSONConversion.cpp::LconvertTxToJson() simply renders things like the txn receipt object from their JSON representations, which leads to you getting EVM txn receipts for EVM txns, and Zilliqa txn receipts for Zilliqa txns ..

JamesHinshelwood commented 5 months ago

OK. Looks like in zq1 JSONConversion.cpp::LconvertTxToJson() simply renders things like the txn receipt object from their JSON representations, which leads to you getting EVM txn receipts for EVM txns, and Zilliqa txn receipts for Zilliqa txns ..

I think it depends on what you mean by "EVM txn receipts". As far as I can see, we still end up with a similar serialised structure, because TransactionReceipt.cpp is always handling the serialisation.

JamesHinshelwood commented 5 months ago

I suspect there wouldn't be any objection to GetTransaction returning the txn for pending txns?

I would worry about that change. I wouldn't be surprised if quite a few clients relied on GetTransaction returning success to mark a transaction as mined.

rrw-zilliqa commented 5 months ago

I suspect there wouldn't be any objection to GetTransaction returning the txn for pending txns?

I would worry about that change. I wouldn't be surprised if quite a few clients relied on GetTransaction returning success to mark a transaction as mined.

You may well be right, sadly :-( .

JamesHinshelwood commented 5 months ago

Our own client for one example :) https://github.com/Zilliqa/zilliqa-developer/blob/fdfe5a3b97a85e92417112e95969d4dc626d81f3/zilliqa/js/account/src/transaction.ts#L383

rrw-zilliqa commented 5 months ago

Yuck! FWIW, from this morning:

curl -d '{
    "id": "1",
    "jsonrpc": "2.0",
    "method": "GetTransaction",
    "params": ["0xc080157c71d052117c23aebad2903ba271f269600b24a37c53ffbf335c562982"]
}' -H "Content-Type: application/json" -X POST "https://dev-api.zilliqa.com/"
{"id":"1","jsonrpc":"2.0","result":{"ID":"c080157c71d052117c23aebad2903ba271f269600b24a37c53ffbf335c562982","amount":"0","data":"19FF1D21","gasLimit":"118","gasPrice":"2000000100","nonce":"257","receipt":{"cumulative_gas":"81","epoch_num":"6973847","event_logs":[{"address":"0x2e80edb86e50233f7cccd502d781a1b876855d4b","data":"0x00000000000000000000000000000000000000000000000000000000000003E8","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000cb57ec3f064a16cadb36c7c712f4c9fa62b77415","0x0000000000000000000000000000000000000000000000000000000000000000"]}],"success":true},"senderPubKey":"0x03D8E6450E260F80983BCD4FADB6CBC132AE7FEB552DDA45F94B48C80B86C6C3BE","signature":"0x333BCFD374A415C068EE02292AB6E4D16DFC55EB3FDF240B35B238412031C63D4756C7F124CFFE1F77DAD0CB49058CA0827186E69CA32B5180E9B333023D7A6C","toAddr":"2e80edb86e50233f7cccd502d781a1b876855d4b","version":"21823490"}}

and

curl -d '{
    "id": "1",
    "jsonrpc": "2.0",
    "method": "GetTransaction",
    "params": ["0x99d64f4c4fe552990233cc7a19eda61c79af6b50957aede8b1062f294fa56e5e"]                                                            
}' -H "Content-Type: application/json" -X POST "https://dev-api.zilliqa.com/"
{"id":"1","jsonrpc":"2.0","result":{"ID":"99d64f4c4fe552990233cc7a19eda61c79af6b50957aede8b1062f294fa56e5e","amount":"0","code":"45564D60806040523480156200001157600080FD5B5060405162000C6838038062000C688339810160408190526200003491620002C1565B82826003620000448382620003C5565B506004620000538282620003C5565B5050506000620000686200008060201B60201C565B905062000076818362000084565B50505050620004B9565B3390565B6001600160A01B038216620000B45760405163EC442F0560E01B8152600060048201526024015B60405180910390FD5B620000C260008383620000C6565B5050565B6001600160A01B038316620000F5578060026000828254620000E9919062000491565B90915550620001699050565B6001600160A01B038316600090815260208190526040902054818110156200014A5760405163391434E360E21B81526001600160A01B03851660048201526024810182905260448101839052606401620000AB565B6001600160A01B03841660009081526020819052604090209082900390555B6001600160A01B0382166200018757600280548290039055620001A6565B6001600160A01B03821660009081526020819052604090208054820190555B816001600160A01B0316836001600160A01B03167FDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF83604051620001EC91815260200190565B60405180910390A3505050565B634E487B7160E01B600052604160045260246000FD5B600082601F8301126200022157600080FD5B81516001600160401B03808211156200023E576200023E620001F9565B604051601F8301601F19908116603F01168101908282118183101715620002695762000269620001F9565B81604052838152602092508660208588010111156200028757600080FD5B600091505B83821015620002AB57858201830151818301840152908201906200028C565B6000602085830101528094505050505092915050565B600080600060608486031215620002D757600080FD5B83516001600160401B0380821115620002EF57600080FD5B620002FD878388016200020F565B945060208601519150808211156200031457600080FD5B5062000323868287016200020F565B925050604084015190509250925092565B600181811C908216806200034957607F821691505B6020821081036200036A57634E487B7160E01B600052602260045260246000FD5B50919050565B601F821115620003C0576000816000526020600020601F850160051C810160208610156200039B5750805B601F850160051C820191505B81811015620003BC57828155600101620003A7565B5050505B505050565B81516001600160401B03811115620003E157620003E1620001F9565B620003F981620003F2845462000334565B8462000370565B602080601F831160018114620004315760008415620004185750858301515B600019600386901B1C1916600185901B178555620003BC565B600085815260208120601F198616915B82811015620004625788860151825594840194600190910190840162000441565B5085821015620004815787850151600019600388901B60F8161C191681555B5050505050600190811B01905550565B80820180821115620004B357634E487B7160E01B600052601160045260246000FD5B92915050565B61079F80620004C96000396000F3FE608060405234801561001057600080FD5B506004361061009E5760003560E01C8063313CE56711610066578063313CE5671461011157806370A082311461012057806395D89B4114610149578063A9059CBB14610151578063DD62ED3E1461016457600080FD5B806306FDDE03146100A3578063095EA7B3146100C157806318160DDD146100E457806319FF1D21146100F657806323B872DD146100FE575B600080FD5B6100AB61019D565B6040516100B891906105E8565B60405180910390F35B6100D46100CF366004610653565B61022F565B60405190151581526020016100B8565B6002545B6040519081526020016100B8565B6100AB610249565B6100D461010C36600461067D565B61027A565B604051601281526020016100B8565B6100E861012E3660046106B9565B6001600160A01B031660009081526020819052604090205490565B6100AB61029E565B6100D461015F366004610653565B6102AD565B6100E86101723660046106DB565B6001600160A01B03918216600090815260016020908152604080832093909416825291909152205490565B6060600380546101AC9061070E565B80601F01602080910402602001604051908101604052809291908181526020018280546101D89061070E565B80156102255780601F106101FA57610100808354040283529160200191610225565B820191906000526020600020905B81548152906001019060200180831161020857829003601F168201915B5050505050905090565B60003361023D8185856102BB565B60019150505B92915050565B606033610258816103E86102CD565B505060408051808201909152600681526548656C6C6F2160D01B602082015290565B60003361028885828561030C565B61029385858561038A565B506001949350505050565B6060600480546101AC9061070E565B60003361023D81858561038A565B6102C883838360016103E9565B505050565B6001600160A01B0382166102FC57604051634B637E8F60E11B8152600060048201526024015B60405180910390FD5B610308826000836104BE565B5050565B6001600160A01B038381166000908152600160209081526040808320938616835292905220546000198114610384578181101561037557604051637DC7A0D960E11B81526001600160A01B038416600482015260248101829052604481018390526064016102F3565B610384848484840360006103E9565B50505050565B6001600160A01B0383166103B457604051634B637E8F60E11B8152600060048201526024016102F3565B6001600160A01B0382166103DE5760405163EC442F0560E01B8152600060048201526024016102F3565B6102C88383836104BE565B6001600160A01B0384166104135760405163E602DF0560E01B8152600060048201526024016102F3565B6001600160A01B03831661043D57604051634A1406B160E11B8152600060048201526024016102F3565B6001600160A01B038085166000908152600160209081526040808320938716835292905220829055801561038457826001600160A01B0316846001600160A01B03167F8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925846040516104B091815260200190565B60405180910390A350505050565B6001600160A01B0383166104E95780600260008282546104DE9190610748565B9091555061055B9050565B6001600160A01B0383166000908152602081905260409020548181101561053C5760405163391434E360E21B81526001600160A01B038516600482015260248101829052604481018390526064016102F3565B6001600160A01B03841660009081526020819052604090209082900390555B6001600160A01B03821661057757600280548290039055610596565B6001600160A01B03821660009081526020819052604090208054820190555B816001600160A01B0316836001600160A01B03167FDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF836040516105DB91815260200190565B60405180910390A3505050565B60006020808352835180602085015260005B81811015610616578581018301518582016040015282016105FA565B506000604082860101526040601F19601F8301168501019250505092915050565B80356001600160A01B038116811461064E57600080FD5B919050565B6000806040838503121561066657600080FD5B61066F83610637565B946020939093013593505050565B60008060006060848603121561069257600080FD5B61069B84610637565B92506106A960208501610637565B9150604084013590509250925092565B6000602082840312156106CB57600080FD5B6106D482610637565B9392505050565B600080604083850312156106EE57600080FD5B6106F783610637565B915061070560208401610637565B90509250929050565B600181811C9082168061072257607F821691505B60208210810361074257634E487B7160E01B600052602260045260246000FD5B50919050565B8082018082111561024357634E487B7160E01B600052601160045260246000FDFEA26469706673582212208E362C36560D7F52293EFB97DA95B5E416A0B878C42F5E14222D77188BFA6F9064736F6C63430008170033000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000A000000000000000000000000000000000000000000000000000000000000F42400000000000000000000000000000000000000000000000000000000000000008525257546573744100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045254414100000000000000000000000000000000000000000000000000000000","gasLimit":"1814","gasPrice":"2000000100","nonce":"256","receipt":{"cumulative_gas":"467","epoch_num":"6973847","event_logs":[{"address":"0x2e80edb86e50233f7cccd502d781a1b876855d4b","data":"0x00000000000000000000000000000000000000000000000000000000000F4240","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000cb57ec3f064a16cadb36c7c712f4c9fa62b77415"]}],"success":true},"senderPubKey":"0x03D8E6450E260F80983BCD4FADB6CBC132AE7FEB552DDA45F94B48C80B86C6C3BE","signature":"0xA6CDFA147A59B11882E338AA0432B580A10EF6CDAAFA1DFAC845BF89F0BE43F000DCC486B58D47123FA3E169DB54EF21D87CA5CA3B6C43808829DF16D0B3E2EB","toAddr":"0000000000000000000000000000000000000000","version":"21823490"}}