mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-16 04:24:56 +02:00
Merge remote-tracking branch 'origin/21-add-actiontracereceipt'
This commit is contained in:
commit
fd5ecf4268
4 changed files with 246 additions and 75 deletions
|
|
@ -16,6 +16,20 @@ func TestJson_EncodeActionTrace(t *testing.T) {
|
|||
Name: "transfer",
|
||||
Contract: "eosio",
|
||||
Receiver: "account2",
|
||||
Receipt: &message.ActionReceipt{
|
||||
Receiver: "account2",
|
||||
ActDigest: "0a2c71dba327cf13a107d3a4f91c9c98f510a8fbbb483b233e222033f13a3e36",
|
||||
GlobalSequence: 2329381932,
|
||||
RecvSequence: 22,
|
||||
AuthSequence: []message.AccountAuthSequence{
|
||||
{
|
||||
Account: "account1",
|
||||
Sequence: 1382772,
|
||||
},
|
||||
},
|
||||
CodeSequence: 1122,
|
||||
ABISequence: 12352,
|
||||
},
|
||||
Data: map[string]interface{}{
|
||||
"from": "account1",
|
||||
"to": "account2",
|
||||
|
|
@ -29,7 +43,7 @@ func TestJson_EncodeActionTrace(t *testing.T) {
|
|||
Return: []byte{0xde, 0xad, 0xbe, 0xef},
|
||||
}
|
||||
|
||||
expected := `{"tx_id":"ed3b8e853647971cf8296f004c3a1aeac255f082b2cb3c12cc3222e2d7c174ab","blocknum":267372365,"blocktimestamp":"2003-03-21T17:23:09.500","name":"transfer","contract":"eosio","receiver":"account2","data":{"from":"account1","quantity":"1000.0000 WAX","to":"account2"},"authorization":[{"actor":"account1","permission":"active"}],"except":"errstr","error":2,"return":"3q2+7w=="}`
|
||||
expected := `{"tx_id":"ed3b8e853647971cf8296f004c3a1aeac255f082b2cb3c12cc3222e2d7c174ab","blocknum":267372365,"blocktimestamp":"2003-03-21T17:23:09.500","receipt":{"receiver":"account2","act_digest":"0a2c71dba327cf13a107d3a4f91c9c98f510a8fbbb483b233e222033f13a3e36","global_sequence":2329381932,"recv_sequence":22,"auth_sequence":[{"account":"account1","sequence":1382772}],"code_sequence":1122,"abi_sequence":12352},"name":"transfer","contract":"eosio","receiver":"account2","data":{"from":"account1","quantity":"1000.0000 WAX","to":"account2"},"authorization":[{"actor":"account1","permission":"active"}],"except":"errstr","error":2,"return":"3q2+7w=="}`
|
||||
|
||||
data, err := encoder(msg)
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -44,6 +58,20 @@ func TestJson_DecodeActionTrace(t *testing.T) {
|
|||
Name: "transfer",
|
||||
Contract: "eosio",
|
||||
Receiver: "account2",
|
||||
Receipt: &message.ActionReceipt{
|
||||
Receiver: "account2",
|
||||
ActDigest: "f2f682847fd5bf00fb315b075dc00b4ff0ce18776758077b86a233dea49dc047",
|
||||
GlobalSequence: 287328,
|
||||
RecvSequence: 42,
|
||||
AuthSequence: []message.AccountAuthSequence{
|
||||
{
|
||||
Account: "account1",
|
||||
Sequence: 271877283,
|
||||
},
|
||||
},
|
||||
CodeSequence: 237823,
|
||||
ABISequence: 68323,
|
||||
},
|
||||
Data: map[string]interface{}{
|
||||
"from": "account1",
|
||||
"to": "account2",
|
||||
|
|
@ -57,7 +85,7 @@ func TestJson_DecodeActionTrace(t *testing.T) {
|
|||
Return: []byte{0xde, 0xad, 0xbe, 0xef},
|
||||
}
|
||||
|
||||
input := `{"tx_id":"952989f7464237b6cf9926e533ecd331df6794ed07564bd052bc368cbd65b4bc","blocknum":8723971,"blocktimestamp":"2024-06-21T08:08:26.500","name":"transfer","contract":"eosio","receiver":"account2","data":{"from":"account1","quantity":"1000.0000 WAX","to":"account2"},"authorization":[{"actor":"account1","permission":"active"}],"except":"errstr","error":2,"return":"3q2+7w=="}`
|
||||
input := `{"tx_id":"952989f7464237b6cf9926e533ecd331df6794ed07564bd052bc368cbd65b4bc","blocknum":8723971,"blocktimestamp":"2024-06-21T08:08:26.500","receipt":{"receiver":"account2","act_digest":"f2f682847fd5bf00fb315b075dc00b4ff0ce18776758077b86a233dea49dc047","global_sequence":287328,"recv_sequence":42,"auth_sequence":[{"account":"account1","sequence":271877283}],"code_sequence":237823,"abi_sequence":68323},"name":"transfer","contract":"eosio","receiver":"account2","data":{"from":"account1","quantity":"1000.0000 WAX","to":"account2"},"authorization":[{"actor":"account1","permission":"active"}],"except":"errstr","error":2,"return":"3q2+7w=="}`
|
||||
|
||||
msg := message.ActionTrace{}
|
||||
err := decoder([]byte(input), &msg)
|
||||
|
|
@ -137,7 +165,7 @@ func TestJson_DecodeTransactionTrace(t *testing.T) {
|
|||
ts := time.Unix(1730755743, int64(time.Millisecond)*500).UTC()
|
||||
block_num := uint32(2378197231)
|
||||
|
||||
input := `{"id":"f58bf8a0137fcea644dbc2b0cc5b6a017a848cd33b2e924703e7e3c6d1ca0c2e","blocknum":2378197231,"blocktimestamp":"2024-11-04T21:29:03.500","status":"executed","cpu_usage_us":442,"net_usage_words":16,"elapsed":22,"net_usage":128,"scheduled":true,"action_traces":[{"tx_id":"f58bf8a0137fcea644dbc2b0cc5b6a017a848cd33b2e924703e7e3c6d1ca0c2e","blocknum":2378197231,"blocktimestamp":"2024-11-04T21:29:03.500","name":"mine","contract":"","receiver":"actor01","data":{"equipment_id":1234,"location_id":5445453},"authorization":[{"actor":"actor01","permission":"active"}],"except":"","error":2,"return":"AQI="},{"tx_id":"f58bf8a0137fcea644dbc2b0cc5b6a017a848cd33b2e924703e7e3c6d1ca0c2e","blocknum":2378197231,"blocktimestamp":"2024-11-04T21:29:03.500","name":"addpoints","contract":"","receiver":"coolgame","data":{"points":"1023.0423 SCAM"},"authorization":[{"actor":"coolgame","permission":"usrpoints"}],"except":"","error":2,"return":"CPE="}],"except":"errstr","error":2}`
|
||||
input := `{"id":"f58bf8a0137fcea644dbc2b0cc5b6a017a848cd33b2e924703e7e3c6d1ca0c2e","blocknum":2378197231,"blocktimestamp":"2024-11-04T21:29:03.500","status":"executed","cpu_usage_us":442,"net_usage_words":16,"elapsed":22,"net_usage":128,"scheduled":true,"action_traces":[{"tx_id":"f58bf8a0137fcea644dbc2b0cc5b6a017a848cd33b2e924703e7e3c6d1ca0c2e","blocknum":2378197231,"blocktimestamp":"2024-11-04T21:29:03.500","receipt":{"receiver":"actor01","act_digest":"bf68a227a617aa9138215d31a2847005175f01151c6feeaeb6513fe2d090ff3a","global_sequence":47322,"recv_sequence":23289,"auth_sequence":[{"account":"actor01","sequence":56637232}],"code_sequence":98272,"abi_sequence":6823762},"name":"mine","contract":"","receiver":"actor01","data":{"equipment_id":1234,"location_id":5445453},"authorization":[{"actor":"actor01","permission":"active"}],"except":"","error":2,"return":"AQI="},{"tx_id":"f58bf8a0137fcea644dbc2b0cc5b6a017a848cd33b2e924703e7e3c6d1ca0c2e","blocknum":2378197231,"blocktimestamp":"2024-11-04T21:29:03.500","name":"addpoints","contract":"","receiver":"coolgame","data":{"points":"1023.0423 SCAM"},"authorization":[{"actor":"coolgame","permission":"usrpoints"}],"except":"","error":2,"return":"CPE="}],"except":"errstr","error":2}`
|
||||
|
||||
expected := message.TransactionTrace{
|
||||
Timestamp: ts,
|
||||
|
|
@ -156,6 +184,20 @@ func TestJson_DecodeTransactionTrace(t *testing.T) {
|
|||
Timestamp: ts,
|
||||
Receiver: "actor01",
|
||||
Name: "mine",
|
||||
Receipt: &message.ActionReceipt{
|
||||
Receiver: "actor01",
|
||||
ActDigest: "bf68a227a617aa9138215d31a2847005175f01151c6feeaeb6513fe2d090ff3a",
|
||||
GlobalSequence: 47322,
|
||||
RecvSequence: 23289,
|
||||
AuthSequence: []message.AccountAuthSequence{
|
||||
{
|
||||
Account: "actor01",
|
||||
Sequence: 56637232,
|
||||
},
|
||||
},
|
||||
CodeSequence: 98272,
|
||||
ABISequence: 6823762,
|
||||
},
|
||||
Authorization: []message.PermissionLevel{
|
||||
{
|
||||
Actor: "actor01",
|
||||
|
|
|
|||
|
|
@ -16,6 +16,20 @@ func TestMsgpack_EncodeActionTrace(t *testing.T) {
|
|||
Name: "sellitem",
|
||||
Contract: "mygame",
|
||||
Receiver: "eosio",
|
||||
Receipt: &message.ActionReceipt{
|
||||
Receiver: "eosio",
|
||||
ActDigest: "be9618d12f0b8d125731c6faf1304357291ada716bb190c6c03c8dd41c36bb79",
|
||||
GlobalSequence: 273871,
|
||||
RecvSequence: 237863,
|
||||
AuthSequence: []message.AccountAuthSequence{
|
||||
{
|
||||
Account: "eosio",
|
||||
Sequence: 217328173,
|
||||
},
|
||||
},
|
||||
CodeSequence: 2381267931,
|
||||
ABISequence: 847623,
|
||||
},
|
||||
Data: map[string]any{
|
||||
"item": map[string]any{
|
||||
"id": 2131242,
|
||||
|
|
@ -41,7 +55,7 @@ func TestMsgpack_EncodeActionTrace(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
|
||||
expected := []byte{
|
||||
0x8b, 0xad, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72,
|
||||
0x8c, 0xad, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72,
|
||||
0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x91,
|
||||
0x82, 0xa5, 0x61, 0x63, 0x74, 0x6f, 0x72, 0xa6,
|
||||
0x6d, 0x79, 0x67, 0x61, 0x6d, 0x65, 0xaa, 0x70,
|
||||
|
|
@ -72,27 +86,54 @@ func TestMsgpack_EncodeActionTrace(t *testing.T) {
|
|||
0x72, 0x02, 0xa6, 0x65, 0x78, 0x63, 0x65, 0x70,
|
||||
0x74, 0xa6, 0x65, 0x72, 0x72, 0x73, 0x74, 0x72,
|
||||
0xa4, 0x6e, 0x61, 0x6d, 0x65, 0xa8, 0x73, 0x65,
|
||||
0x6c, 0x6c, 0x69, 0x74, 0x65, 0x6d, 0xa8, 0x72,
|
||||
0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0xa5,
|
||||
0x65, 0x6f, 0x73, 0x69, 0x6f, 0xa6, 0x72, 0x65,
|
||||
0x74, 0x75, 0x72, 0x6e, 0xc4, 0x04, 0xde, 0xad,
|
||||
0xbe, 0xef, 0xa5, 0x74, 0x78, 0x5f, 0x69, 0x64,
|
||||
0xd9, 0x40, 0x65, 0x64, 0x63, 0x30, 0x36, 0x64,
|
||||
0x63, 0x65, 0x36, 0x33, 0x32, 0x30, 0x34, 0x35,
|
||||
0x39, 0x66, 0x64, 0x36, 0x34, 0x34, 0x37, 0x35,
|
||||
0x36, 0x39, 0x37, 0x32, 0x30, 0x34, 0x38, 0x64,
|
||||
0x61, 0x34, 0x35, 0x33, 0x62, 0x32, 0x38, 0x31,
|
||||
0x36, 0x62, 0x30, 0x61, 0x34, 0x33, 0x34, 0x63,
|
||||
0x33, 0x37, 0x64, 0x64, 0x66, 0x66, 0x64, 0x65,
|
||||
0x33, 0x36, 0x37, 0x37, 0x38, 0x64, 0x63, 0x61,
|
||||
0x62, 0x33,
|
||||
0x6c, 0x6c, 0x69, 0x74, 0x65, 0x6d, 0xa7, 0x72,
|
||||
0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x87, 0xac,
|
||||
0x61, 0x62, 0x69, 0x5f, 0x73, 0x65, 0x71, 0x75,
|
||||
0x65, 0x6e, 0x63, 0x65, 0xce, 0x00, 0x0c, 0xef,
|
||||
0x07, 0xaa, 0x61, 0x63, 0x74, 0x5f, 0x64, 0x69,
|
||||
0x67, 0x65, 0x73, 0x74, 0xd9, 0x40, 0x62, 0x65,
|
||||
0x39, 0x36, 0x31, 0x38, 0x64, 0x31, 0x32, 0x66,
|
||||
0x30, 0x62, 0x38, 0x64, 0x31, 0x32, 0x35, 0x37,
|
||||
0x33, 0x31, 0x63, 0x36, 0x66, 0x61, 0x66, 0x31,
|
||||
0x33, 0x30, 0x34, 0x33, 0x35, 0x37, 0x32, 0x39,
|
||||
0x31, 0x61, 0x64, 0x61, 0x37, 0x31, 0x36, 0x62,
|
||||
0x62, 0x31, 0x39, 0x30, 0x63, 0x36, 0x63, 0x30,
|
||||
0x33, 0x63, 0x38, 0x64, 0x64, 0x34, 0x31, 0x63,
|
||||
0x33, 0x36, 0x62, 0x62, 0x37, 0x39, 0xad, 0x61,
|
||||
0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x71, 0x75,
|
||||
0x65, 0x6e, 0x63, 0x65, 0x91, 0x82, 0xa7, 0x61,
|
||||
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xa5, 0x65,
|
||||
0x6f, 0x73, 0x69, 0x6f, 0xa8, 0x73, 0x65, 0x71,
|
||||
0x75, 0x65, 0x6e, 0x63, 0x65, 0xce, 0x0c, 0xf4,
|
||||
0x2a, 0x2d, 0xad, 0x63, 0x6f, 0x64, 0x65, 0x5f,
|
||||
0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65,
|
||||
0xce, 0x8d, 0xef, 0x43, 0xdb, 0xaf, 0x67, 0x6c,
|
||||
0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x71,
|
||||
0x75, 0x65, 0x6e, 0x63, 0x65, 0xce, 0x00, 0x04,
|
||||
0x2d, 0xcf, 0xa8, 0x72, 0x65, 0x63, 0x65, 0x69,
|
||||
0x76, 0x65, 0x72, 0xa5, 0x65, 0x6f, 0x73, 0x69,
|
||||
0x6f, 0xad, 0x72, 0x65, 0x63, 0x76, 0x5f, 0x73,
|
||||
0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0xce,
|
||||
0x00, 0x03, 0xa1, 0x27, 0xa8, 0x72, 0x65, 0x63,
|
||||
0x65, 0x69, 0x76, 0x65, 0x72, 0xa5, 0x65, 0x6f,
|
||||
0x73, 0x69, 0x6f, 0xa6, 0x72, 0x65, 0x74, 0x75,
|
||||
0x72, 0x6e, 0xc4, 0x04, 0xde, 0xad, 0xbe, 0xef,
|
||||
0xa5, 0x74, 0x78, 0x5f, 0x69, 0x64, 0xd9, 0x40,
|
||||
0x65, 0x64, 0x63, 0x30, 0x36, 0x64, 0x63, 0x65,
|
||||
0x36, 0x33, 0x32, 0x30, 0x34, 0x35, 0x39, 0x66,
|
||||
0x64, 0x36, 0x34, 0x34, 0x37, 0x35, 0x36, 0x39,
|
||||
0x37, 0x32, 0x30, 0x34, 0x38, 0x64, 0x61, 0x34,
|
||||
0x35, 0x33, 0x62, 0x32, 0x38, 0x31, 0x36, 0x62,
|
||||
0x30, 0x61, 0x34, 0x33, 0x34, 0x63, 0x33, 0x37,
|
||||
0x64, 0x64, 0x66, 0x66, 0x64, 0x65, 0x33, 0x36,
|
||||
0x37, 0x37, 0x38, 0x64, 0x63, 0x61, 0x62, 0x33,
|
||||
}
|
||||
|
||||
assert.Equal(t, expected, data)
|
||||
}
|
||||
|
||||
func TestMsgpack_DecodeActionTrace(t *testing.T) {
|
||||
data := []byte("\x8b\xadauthorization\x91\x82\xa5actor\xa6mygame\xaapermission\xa6active\xa8blocknum\xce\x00\x85F7\xaeblocktimestamp\xd6\xffH\xf1U\x1f\xa8contract\xa6mygame\xa4data\x83\xafdropped_from_id\xd2\x00\nK\x02\xa4item\x86\xa3dur\xd1\x00\x91\xa2id\xd2\x00\x00\xc1פname\xacShadowmourne\xa4qual\xa9legendary\xa3sta\xd1\x00ƣstr\xd1\x00ߨreceiver\xa8account1\xa5error\x02\xa6except\xa6errstr\xa4name\xa4drop\xa8receiver\xa8account1\xa6return\xc4\x04ޭ\xbe\xef\xa5tx_id\xd9@edc06dce6320459fd644756972048da453b2816b0a434c37ddffde36778dcab3")
|
||||
data := []byte("\x8c\xadauthorization\x91\x82\xa5actor\xa6mygame\xaapermission\xa6active\xa8blocknum\xce\x00\x85F7\xaeblocktimestamp\xd6\xffH\xf1U\x1f\xa8contract\xa6mygame\xa4data\x83\xafdropped_from_id\xd2\x00\nK\x02\xa4item\x86\xa3dur\xd1\x00\x91\xa2id\xd2\x00\x00\xc1פname\xacShadowmourne\xa4qual\xa9legendary\xa3sta\xd1\x00ƣstr\xd1\x00ߨreceiver\xa8account1\xa5error\x02\xa6except\xa6errstr\xa4name\xa4drop\xa7receipt\x87\xacabi_sequence\xce\x00\bӽ\xaaact_digest\xd9@676c5336de9d528d456b01e975b1006e2bdc86c8d566330321e9b309b634f523\xadauth_sequence\x91\x82\xa7account\xa6mygame\xa8sequence\xce\x00\v\v\x10\xadcode_sequence\xce\x0e2\x82\xb3\xafglobal_sequence\xce\x03r`6\xa8receiver\xa8account1\xadrecv_sequence\xce\x00\x13\x81S\xa8receiver\xa8account1\xa6return\xc4\x04ޭ\xbe\xef\xa5tx_id\xd9@edc06dce6320459fd644756972048da453b2816b0a434c37ddffde36778dcab3")
|
||||
|
||||
expected := message.ActionTrace{
|
||||
TxID: "edc06dce6320459fd644756972048da453b2816b0a434c37ddffde36778dcab3",
|
||||
|
|
@ -101,6 +142,20 @@ func TestMsgpack_DecodeActionTrace(t *testing.T) {
|
|||
Name: "drop",
|
||||
Contract: "mygame",
|
||||
Receiver: "account1",
|
||||
Receipt: &message.ActionReceipt{
|
||||
Receiver: "account1",
|
||||
ActDigest: "676c5336de9d528d456b01e975b1006e2bdc86c8d566330321e9b309b634f523",
|
||||
GlobalSequence: 57827382,
|
||||
RecvSequence: 1278291,
|
||||
AuthSequence: []message.AccountAuthSequence{
|
||||
{
|
||||
Account: "mygame",
|
||||
Sequence: 723728,
|
||||
},
|
||||
},
|
||||
CodeSequence: 238191283,
|
||||
ABISequence: 578493,
|
||||
},
|
||||
Data: map[string]any{
|
||||
"item": map[string]any{
|
||||
"id": int64(49623),
|
||||
|
|
@ -176,6 +231,20 @@ func TestMsgpack_EncodeTransactionTrace(t *testing.T) {
|
|||
Name: "sellitem",
|
||||
Contract: "skjdh23",
|
||||
Receiver: "eosio",
|
||||
Receipt: &message.ActionReceipt{
|
||||
Receiver: "eosio",
|
||||
ActDigest: "676c5336de9d528d456b01e975b1006e2bdc86c8d566330321e9b309b634f523",
|
||||
GlobalSequence: 34789213,
|
||||
RecvSequence: 578912378,
|
||||
AuthSequence: []message.AccountAuthSequence{
|
||||
{
|
||||
Account: "actor12123",
|
||||
Sequence: 547897,
|
||||
},
|
||||
},
|
||||
CodeSequence: 23193721,
|
||||
ABISequence: 4782232,
|
||||
},
|
||||
Data: map[string]any{
|
||||
"key": "value",
|
||||
},
|
||||
|
|
@ -202,7 +271,7 @@ func TestMsgpack_EncodeTransactionTrace(t *testing.T) {
|
|||
expected := []byte{
|
||||
0x8c, 0xad, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x5f, 0x74, 0x72, 0x61, 0x63, 0x65, 0x73, 0x92,
|
||||
0x8b, 0xad, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72,
|
||||
0x8c, 0xad, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72,
|
||||
0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x91,
|
||||
0x82, 0xa5, 0x61, 0x63, 0x74, 0x6f, 0x72, 0xaa,
|
||||
0x61, 0x63, 0x74, 0x6f, 0x72, 0x31, 0x32, 0x31,
|
||||
|
|
@ -219,59 +288,86 @@ func TestMsgpack_EncodeTransactionTrace(t *testing.T) {
|
|||
0x65, 0x72, 0x72, 0x6f, 0x72, 0x00, 0xa6, 0x65,
|
||||
0x78, 0x63, 0x65, 0x70, 0x74, 0xa0, 0xa4, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0xa8, 0x73, 0x65, 0x6c, 0x6c,
|
||||
0x69, 0x74, 0x65, 0x6d, 0xa8, 0x72, 0x65, 0x63,
|
||||
0x65, 0x69, 0x76, 0x65, 0x72, 0xa5, 0x65, 0x6f,
|
||||
0x73, 0x69, 0x6f, 0xa6, 0x72, 0x65, 0x74, 0x75,
|
||||
0x72, 0x6e, 0xc0, 0xa5, 0x74, 0x78, 0x5f, 0x69,
|
||||
0x64, 0xa0, 0x8b, 0xad, 0x61, 0x75, 0x74, 0x68,
|
||||
0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x91, 0x82, 0xa5, 0x61, 0x63, 0x74, 0x6f,
|
||||
0x72, 0xa9, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x31,
|
||||
0x34, 0x38, 0x32, 0xaa, 0x70, 0x65, 0x72, 0x6d,
|
||||
0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xa6, 0x61,
|
||||
0x63, 0x74, 0x69, 0x76, 0x65, 0xa8, 0x62, 0x6c,
|
||||
0x6f, 0x63, 0x6b, 0x6e, 0x75, 0x6d, 0x00, 0xae,
|
||||
0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0xc0, 0xa8,
|
||||
0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74,
|
||||
0xa7, 0x73, 0x6b, 0x6a, 0x64, 0x68, 0x32, 0x34,
|
||||
0xa4, 0x64, 0x61, 0x74, 0x61, 0xc0, 0xa5, 0x65,
|
||||
0x72, 0x72, 0x6f, 0x72, 0x00, 0xa6, 0x65, 0x78,
|
||||
0x63, 0x65, 0x70, 0x74, 0xa0, 0xa4, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0xa8, 0x73, 0x65, 0x6c, 0x6c, 0x69,
|
||||
0x74, 0x65, 0x6d, 0xa8, 0x72, 0x65, 0x63, 0x65,
|
||||
0x69, 0x76, 0x65, 0x72, 0xa5, 0x65, 0x6f, 0x73,
|
||||
0x69, 0x6f, 0xa6, 0x72, 0x65, 0x74, 0x75, 0x72,
|
||||
0x6e, 0xc0, 0xa5, 0x74, 0x78, 0x5f, 0x69, 0x64,
|
||||
0xa0, 0xa8, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x6e,
|
||||
0x75, 0x6d, 0xce, 0xa3, 0x3d, 0x9b, 0xc5, 0xae,
|
||||
0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0xd7, 0xff,
|
||||
0x77, 0x35, 0x94, 0x00, 0x65, 0x4e, 0x19, 0xff,
|
||||
0xac, 0x63, 0x70, 0x75, 0x5f, 0x75, 0x73, 0x61,
|
||||
0x67, 0x65, 0x5f, 0x75, 0x73, 0x17, 0xa7, 0x65,
|
||||
0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x04, 0xa5,
|
||||
0x65, 0x72, 0x72, 0x6f, 0x72, 0x02, 0xa6, 0x65,
|
||||
0x78, 0x63, 0x65, 0x70, 0x74, 0xa9, 0x65, 0x78,
|
||||
0x63, 0x65, 0x70, 0x74, 0x73, 0x74, 0x72, 0xa2,
|
||||
0x69, 0x64, 0xd9, 0x40, 0x65, 0x64, 0x63, 0x30,
|
||||
0x36, 0x64, 0x63, 0x65, 0x36, 0x33, 0x32, 0x30,
|
||||
0x34, 0x35, 0x39, 0x66, 0x64, 0x36, 0x34, 0x34,
|
||||
0x37, 0x35, 0x36, 0x39, 0x37, 0x32, 0x30, 0x34,
|
||||
0x38, 0x64, 0x61, 0x34, 0x35, 0x33, 0x62, 0x32,
|
||||
0x38, 0x31, 0x36, 0x62, 0x30, 0x61, 0x34, 0x33,
|
||||
0x34, 0x63, 0x33, 0x37, 0x64, 0x64, 0x66, 0x66,
|
||||
0x64, 0x65, 0x33, 0x36, 0x37, 0x37, 0x38, 0x64,
|
||||
0x63, 0x61, 0x62, 0x33, 0xa9, 0x6e, 0x65, 0x74,
|
||||
0x5f, 0x75, 0x73, 0x61, 0x67, 0x65, 0xcc, 0x80,
|
||||
0xaf, 0x6e, 0x65, 0x74, 0x5f, 0x75, 0x73, 0x61,
|
||||
0x67, 0x65, 0x5f, 0x77, 0x6f, 0x72, 0x64, 0x73,
|
||||
0x10, 0xa9, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75,
|
||||
0x6c, 0x65, 0x64, 0xc3, 0xa6, 0x73, 0x74, 0x61,
|
||||
0x74, 0x75, 0x73, 0xa9, 0x73, 0x6f, 0x66, 0x74,
|
||||
0x5f, 0x66, 0x61, 0x69, 0x6c,
|
||||
0x69, 0x74, 0x65, 0x6d, 0xa7, 0x72, 0x65, 0x63,
|
||||
0x65, 0x69, 0x70, 0x74, 0x87, 0xac, 0x61, 0x62,
|
||||
0x69, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e,
|
||||
0x63, 0x65, 0xce, 0x00, 0x48, 0xf8, 0x98, 0xaa,
|
||||
0x61, 0x63, 0x74, 0x5f, 0x64, 0x69, 0x67, 0x65,
|
||||
0x73, 0x74, 0xd9, 0x40, 0x36, 0x37, 0x36, 0x63,
|
||||
0x35, 0x33, 0x33, 0x36, 0x64, 0x65, 0x39, 0x64,
|
||||
0x35, 0x32, 0x38, 0x64, 0x34, 0x35, 0x36, 0x62,
|
||||
0x30, 0x31, 0x65, 0x39, 0x37, 0x35, 0x62, 0x31,
|
||||
0x30, 0x30, 0x36, 0x65, 0x32, 0x62, 0x64, 0x63,
|
||||
0x38, 0x36, 0x63, 0x38, 0x64, 0x35, 0x36, 0x36,
|
||||
0x33, 0x33, 0x30, 0x33, 0x32, 0x31, 0x65, 0x39,
|
||||
0x62, 0x33, 0x30, 0x39, 0x62, 0x36, 0x33, 0x34,
|
||||
0x66, 0x35, 0x32, 0x33, 0xad, 0x61, 0x75, 0x74,
|
||||
0x68, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e,
|
||||
0x63, 0x65, 0x91, 0x82, 0xa7, 0x61, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0xaa, 0x61, 0x63, 0x74,
|
||||
0x6f, 0x72, 0x31, 0x32, 0x31, 0x32, 0x33, 0xa8,
|
||||
0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65,
|
||||
0xce, 0x00, 0x08, 0x5c, 0x39, 0xad, 0x63, 0x6f,
|
||||
0x64, 0x65, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65,
|
||||
0x6e, 0x63, 0x65, 0xce, 0x01, 0x61, 0xe8, 0x79,
|
||||
0xaf, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f,
|
||||
0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65,
|
||||
0xce, 0x02, 0x12, 0xd7, 0x5d, 0xa8, 0x72, 0x65,
|
||||
0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0xa5, 0x65,
|
||||
0x6f, 0x73, 0x69, 0x6f, 0xad, 0x72, 0x65, 0x63,
|
||||
0x76, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e,
|
||||
0x63, 0x65, 0xce, 0x22, 0x81, 0x80, 0x7a, 0xa8,
|
||||
0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72,
|
||||
0xa5, 0x65, 0x6f, 0x73, 0x69, 0x6f, 0xa6, 0x72,
|
||||
0x65, 0x74, 0x75, 0x72, 0x6e, 0xc0, 0xa5, 0x74,
|
||||
0x78, 0x5f, 0x69, 0x64, 0xa0, 0x8b, 0xad, 0x61,
|
||||
0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x91, 0x82, 0xa5, 0x61,
|
||||
0x63, 0x74, 0x6f, 0x72, 0xa9, 0x61, 0x63, 0x74,
|
||||
0x6f, 0x72, 0x31, 0x34, 0x38, 0x32, 0xaa, 0x70,
|
||||
0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0xa6, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65,
|
||||
0xa8, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x6e, 0x75,
|
||||
0x6d, 0x00, 0xae, 0x62, 0x6c, 0x6f, 0x63, 0x6b,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
|
||||
0x70, 0xc0, 0xa8, 0x63, 0x6f, 0x6e, 0x74, 0x72,
|
||||
0x61, 0x63, 0x74, 0xa7, 0x73, 0x6b, 0x6a, 0x64,
|
||||
0x68, 0x32, 0x34, 0xa4, 0x64, 0x61, 0x74, 0x61,
|
||||
0xc0, 0xa5, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x00,
|
||||
0xa6, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0xa0,
|
||||
0xa4, 0x6e, 0x61, 0x6d, 0x65, 0xa8, 0x73, 0x65,
|
||||
0x6c, 0x6c, 0x69, 0x74, 0x65, 0x6d, 0xa8, 0x72,
|
||||
0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0xa5,
|
||||
0x65, 0x6f, 0x73, 0x69, 0x6f, 0xa6, 0x72, 0x65,
|
||||
0x74, 0x75, 0x72, 0x6e, 0xc0, 0xa5, 0x74, 0x78,
|
||||
0x5f, 0x69, 0x64, 0xa0, 0xa8, 0x62, 0x6c, 0x6f,
|
||||
0x63, 0x6b, 0x6e, 0x75, 0x6d, 0xce, 0xa3, 0x3d,
|
||||
0x9b, 0xc5, 0xae, 0x62, 0x6c, 0x6f, 0x63, 0x6b,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
|
||||
0x70, 0xd7, 0xff, 0x77, 0x35, 0x94, 0x00, 0x65,
|
||||
0x4e, 0x19, 0xff, 0xac, 0x63, 0x70, 0x75, 0x5f,
|
||||
0x75, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x75, 0x73,
|
||||
0x17, 0xa7, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65,
|
||||
0x64, 0x04, 0xa5, 0x65, 0x72, 0x72, 0x6f, 0x72,
|
||||
0x02, 0xa6, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74,
|
||||
0xa9, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x73,
|
||||
0x74, 0x72, 0xa2, 0x69, 0x64, 0xd9, 0x40, 0x65,
|
||||
0x64, 0x63, 0x30, 0x36, 0x64, 0x63, 0x65, 0x36,
|
||||
0x33, 0x32, 0x30, 0x34, 0x35, 0x39, 0x66, 0x64,
|
||||
0x36, 0x34, 0x34, 0x37, 0x35, 0x36, 0x39, 0x37,
|
||||
0x32, 0x30, 0x34, 0x38, 0x64, 0x61, 0x34, 0x35,
|
||||
0x33, 0x62, 0x32, 0x38, 0x31, 0x36, 0x62, 0x30,
|
||||
0x61, 0x34, 0x33, 0x34, 0x63, 0x33, 0x37, 0x64,
|
||||
0x64, 0x66, 0x66, 0x64, 0x65, 0x33, 0x36, 0x37,
|
||||
0x37, 0x38, 0x64, 0x63, 0x61, 0x62, 0x33, 0xa9,
|
||||
0x6e, 0x65, 0x74, 0x5f, 0x75, 0x73, 0x61, 0x67,
|
||||
0x65, 0xcc, 0x80, 0xaf, 0x6e, 0x65, 0x74, 0x5f,
|
||||
0x75, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x77, 0x6f,
|
||||
0x72, 0x64, 0x73, 0x10, 0xa9, 0x73, 0x63, 0x68,
|
||||
0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, 0xc3, 0xa6,
|
||||
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xa9, 0x73,
|
||||
0x6f, 0x66, 0x74, 0x5f, 0x66, 0x61, 0x69, 0x6c,
|
||||
}
|
||||
|
||||
assert.Equal(t, expected, data)
|
||||
}
|
||||
|
||||
|
|
@ -309,9 +405,6 @@ func TestMsgpack_DecodeTransactionTrace(t *testing.T) {
|
|||
Error: 43,
|
||||
}
|
||||
|
||||
// x, _ := encode(expected)
|
||||
// assert.Equal(t, data, string(x))
|
||||
|
||||
res := message.TransactionTrace{}
|
||||
err := decode(data, &res)
|
||||
assert.NoError(t, err)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@ type PermissionLevel struct {
|
|||
Permission string `json:"permission" msgpack:"permission"`
|
||||
}
|
||||
|
||||
type AccountAuthSequence struct {
|
||||
Account string `json:"account" msgpack:"account"`
|
||||
Sequence uint64 `json:"sequence" msgpack:"sequence"`
|
||||
}
|
||||
|
||||
type TransactionTrace struct {
|
||||
ID string `json:"id" msgpack:"id"`
|
||||
BlockNum uint32 `json:"blocknum" msgpack:"blocknum"`
|
||||
|
|
@ -34,6 +39,16 @@ type TransactionTrace struct {
|
|||
// Partial *PartialTransaction `json:"partial" eos:"optional"`
|
||||
}
|
||||
|
||||
type ActionReceipt struct {
|
||||
Receiver string `json:"receiver" msgpack:"receiver"`
|
||||
ActDigest string `json:"act_digest" msgpack:"act_digest"`
|
||||
GlobalSequence uint64 `json:"global_sequence" msgpack:"global_sequence"`
|
||||
RecvSequence uint64 `json:"recv_sequence" msgpack:"recv_sequence"`
|
||||
AuthSequence []AccountAuthSequence `json:"auth_sequence" msgpack:"auth_sequence"`
|
||||
CodeSequence uint32 `json:"code_sequence" msgpack:"code_sequence"`
|
||||
ABISequence uint32 `json:"abi_sequence" msgpack:"abi_sequence"`
|
||||
}
|
||||
|
||||
type ActionTrace struct {
|
||||
TxID string `json:"tx_id" msgpack:"tx_id"`
|
||||
|
||||
|
|
@ -41,6 +56,8 @@ type ActionTrace struct {
|
|||
|
||||
Timestamp time.Time `json:"blocktimestamp" msgpack:"blocktimestamp"`
|
||||
|
||||
Receipt *ActionReceipt `json:"receipt,omitempty" msgpack:"receipt"`
|
||||
|
||||
// Action name
|
||||
Name string `json:"name" msgpack:"name"`
|
||||
|
||||
|
|
|
|||
|
|
@ -171,6 +171,25 @@ func (processor *ShipProcessor) processBlock(block *ship.GetBlocksResultV0) {
|
|||
Receiver: act_trace.Receiver.String(),
|
||||
}
|
||||
|
||||
if act_trace.Receipt != nil {
|
||||
receipt := actionTraceVar.Impl.(*ship.ActionReceiptV0)
|
||||
act.Receipt = &message.ActionReceipt{
|
||||
Receiver: receipt.Receiver.String(),
|
||||
ActDigest: receipt.ActDigest.String(),
|
||||
GlobalSequence: receipt.GlobalSequence,
|
||||
RecvSequence: receipt.GlobalSequence,
|
||||
CodeSequence: uint32(receipt.CodeSequence),
|
||||
ABISequence: uint32(receipt.ABISequence),
|
||||
}
|
||||
|
||||
for _, auth := range receipt.AuthSequence {
|
||||
act.Receipt.AuthSequence = append(act.Receipt.AuthSequence, message.AccountAuthSequence{
|
||||
Account: auth.Account.String(),
|
||||
Sequence: auth.Sequence,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
for _, auth := range act_trace.Act.Authorization {
|
||||
act.Authorization = append(act.Authorization, message.PermissionLevel{
|
||||
Actor: auth.Actor.String(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue