@@ -354,7 +354,7 @@ func TestTraceCall(t *testing.T) {
354
354
},
355
355
config : nil ,
356
356
expectErr : nil ,
357
- expect : `{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}` ,
357
+ expect : `{"gas":21000,"failed":false,"returnValue":"0x ","structLogs":[]}` ,
358
358
},
359
359
// Standard JSON trace upon the head, plain transfer.
360
360
{
@@ -366,7 +366,7 @@ func TestTraceCall(t *testing.T) {
366
366
},
367
367
config : nil ,
368
368
expectErr : nil ,
369
- expect : `{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}` ,
369
+ expect : `{"gas":21000,"failed":false,"returnValue":"0x ","structLogs":[]}` ,
370
370
},
371
371
// Upon the last state, default to the post block's state
372
372
{
@@ -377,7 +377,7 @@ func TestTraceCall(t *testing.T) {
377
377
Value : (* hexutil .Big )(new (big.Int ).Add (big .NewInt (params .Ether ), big .NewInt (100 ))),
378
378
},
379
379
config : nil ,
380
- expect : `{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}` ,
380
+ expect : `{"gas":21000,"failed":false,"returnValue":"0x ","structLogs":[]}` ,
381
381
},
382
382
// Before the first transaction, should be failed
383
383
{
@@ -411,7 +411,7 @@ func TestTraceCall(t *testing.T) {
411
411
},
412
412
config : & TraceCallConfig {TxIndex : uintPtr (2 )},
413
413
expectErr : nil ,
414
- expect : `{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}` ,
414
+ expect : `{"gas":21000,"failed":false,"returnValue":"0x ","structLogs":[]}` ,
415
415
},
416
416
// Standard JSON trace upon the non-existent block, error expects
417
417
{
@@ -435,7 +435,7 @@ func TestTraceCall(t *testing.T) {
435
435
},
436
436
config : nil ,
437
437
expectErr : nil ,
438
- expect : `{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}` ,
438
+ expect : `{"gas":21000,"failed":false,"returnValue":"0x ","structLogs":[]}` ,
439
439
},
440
440
// Tracing on 'pending' should fail:
441
441
{
@@ -458,7 +458,7 @@ func TestTraceCall(t *testing.T) {
458
458
BlockOverrides : & override.BlockOverrides {Number : (* hexutil .Big )(big .NewInt (0x1337 ))},
459
459
},
460
460
expectErr : nil ,
461
- expect : ` {"gas":53018,"failed":false,"returnValue":"","structLogs":[
461
+ expect : ` {"gas":53018,"failed":false,"returnValue":"0x ","structLogs":[
462
462
{"pc":0,"op":"NUMBER","gas":24946984,"gasCost":2,"depth":1,"stack":[]},
463
463
{"pc":1,"op":"STOP","gas":24946982,"gasCost":0,"depth":1,"stack":["0x1337"]}]}` ,
464
464
},
@@ -535,7 +535,7 @@ func TestTraceTransaction(t *testing.T) {
535
535
if ! reflect .DeepEqual (have , & logger.ExecutionResult {
536
536
Gas : params .TxGas ,
537
537
Failed : false ,
538
- ReturnValue : "" ,
538
+ ReturnValue : [] byte {} ,
539
539
StructLogs : []json.RawMessage {},
540
540
}) {
541
541
t .Error ("Transaction tracing result is different" )
@@ -596,7 +596,7 @@ func TestTraceBlock(t *testing.T) {
596
596
// Trace head block
597
597
{
598
598
blockNumber : rpc .BlockNumber (genBlocks ),
599
- want : fmt .Sprintf (`[{"txHash":"%v","result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]` , txHash ),
599
+ want : fmt .Sprintf (`[{"txHash":"%v","result":{"gas":21000,"failed":false,"returnValue":"0x ","structLogs":[]}}]` , txHash ),
600
600
},
601
601
// Trace non-existent block
602
602
{
@@ -606,12 +606,12 @@ func TestTraceBlock(t *testing.T) {
606
606
// Trace latest block
607
607
{
608
608
blockNumber : rpc .LatestBlockNumber ,
609
- want : fmt .Sprintf (`[{"txHash":"%v","result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]` , txHash ),
609
+ want : fmt .Sprintf (`[{"txHash":"%v","result":{"gas":21000,"failed":false,"returnValue":"0x ","structLogs":[]}}]` , txHash ),
610
610
},
611
611
// Trace pending block
612
612
{
613
613
blockNumber : rpc .PendingBlockNumber ,
614
- want : fmt .Sprintf (`[{"txHash":"%v","result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]` , txHash ),
614
+ want : fmt .Sprintf (`[{"txHash":"%v","result":{"gas":21000,"failed":false,"returnValue":"0x ","structLogs":[]}}]` , txHash ),
615
615
},
616
616
}
617
617
for i , tc := range testSuite {
@@ -704,7 +704,7 @@ func TestTracingWithOverrides(t *testing.T) {
704
704
randomAccounts [0 ].addr : override.OverrideAccount {Balance : newRPCBalance (new (big.Int ).Mul (big .NewInt (1 ), big .NewInt (params .Ether )))},
705
705
},
706
706
},
707
- want : `{"gas":21000,"failed":false,"returnValue":""}` ,
707
+ want : `{"gas":21000,"failed":false,"returnValue":"0x "}` ,
708
708
},
709
709
// Invalid call without state overriding
710
710
{
@@ -749,7 +749,7 @@ func TestTracingWithOverrides(t *testing.T) {
749
749
},
750
750
},
751
751
},
752
- want : `{"gas":23347,"failed":false,"returnValue":"000000000000000000000000000000000000000000000000000000000000007b "}` ,
752
+ want : `{"gas":23347,"failed":false,"returnValue":"0x000000000000000000000000000000000000000000000000000000000000007b "}` ,
753
753
},
754
754
{ // Override blocknumber
755
755
blockNumber : rpc .LatestBlockNumber ,
@@ -761,7 +761,7 @@ func TestTracingWithOverrides(t *testing.T) {
761
761
config : & TraceCallConfig {
762
762
BlockOverrides : & override.BlockOverrides {Number : (* hexutil .Big )(big .NewInt (0x1337 ))},
763
763
},
764
- want : `{"gas":59537,"failed":false,"returnValue":"0000000000000000000000000000000000000000000000000000000000001337 "}` ,
764
+ want : `{"gas":59537,"failed":false,"returnValue":"0x0000000000000000000000000000000000000000000000000000000000001337 "}` ,
765
765
},
766
766
{ // Override blocknumber, and query a blockhash
767
767
blockNumber : rpc .LatestBlockNumber ,
@@ -781,7 +781,7 @@ func TestTracingWithOverrides(t *testing.T) {
781
781
config : & TraceCallConfig {
782
782
BlockOverrides : & override.BlockOverrides {Number : (* hexutil .Big )(big .NewInt (0x1337 ))},
783
783
},
784
- want : `{"gas":72666,"failed":false,"returnValue":"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 "}` ,
784
+ want : `{"gas":72666,"failed":false,"returnValue":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 "}` ,
785
785
},
786
786
/*
787
787
pragma solidity =0.8.12;
@@ -815,7 +815,7 @@ func TestTracingWithOverrides(t *testing.T) {
815
815
},
816
816
},
817
817
},
818
- want : `{"gas":44100,"failed":false,"returnValue":"0000000000000000000000000000000000000000000000000000000000000001 "}` ,
818
+ want : `{"gas":44100,"failed":false,"returnValue":"0x0000000000000000000000000000000000000000000000000000000000000001 "}` ,
819
819
},
820
820
{ // Same again, this time with storage override
821
821
blockNumber : rpc .LatestBlockNumber ,
@@ -833,7 +833,7 @@ func TestTracingWithOverrides(t *testing.T) {
833
833
},
834
834
},
835
835
//want: `{"gas":46900,"failed":false,"returnValue":"0000000000000000000000000000000000000000000000000000000000000539"}`,
836
- want : `{"gas":44100,"failed":false,"returnValue":"0000000000000000000000000000000000000000000000000000000000000001 "}` ,
836
+ want : `{"gas":44100,"failed":false,"returnValue":"0x0000000000000000000000000000000000000000000000000000000000000001 "}` ,
837
837
},
838
838
{ // No state override
839
839
blockNumber : rpc .LatestBlockNumber ,
@@ -863,7 +863,7 @@ func TestTracingWithOverrides(t *testing.T) {
863
863
},
864
864
},
865
865
},
866
- want : `{"gas":25288,"failed":false,"returnValue":"0000000000000000000000000000000000000000000000000000000000000077 "}` ,
866
+ want : `{"gas":25288,"failed":false,"returnValue":"0x0000000000000000000000000000000000000000000000000000000000000077 "}` ,
867
867
},
868
868
{ // Full state override
869
869
// The original storage is
@@ -901,7 +901,7 @@ func TestTracingWithOverrides(t *testing.T) {
901
901
},
902
902
},
903
903
},
904
- want : `{"gas":25288,"failed":false,"returnValue":"0000000000000000000000000000000000000000000000000000000000000011 "}` ,
904
+ want : `{"gas":25288,"failed":false,"returnValue":"0x0000000000000000000000000000000000000000000000000000000000000011 "}` ,
905
905
},
906
906
{ // Partial state override
907
907
// The original storage is
@@ -939,7 +939,7 @@ func TestTracingWithOverrides(t *testing.T) {
939
939
},
940
940
},
941
941
},
942
- want : `{"gas":25288,"failed":false,"returnValue":"0000000000000000000000000000000000000000000000000000000000000055 "}` ,
942
+ want : `{"gas":25288,"failed":false,"returnValue":"0x0000000000000000000000000000000000000000000000000000000000000055 "}` ,
943
943
},
944
944
{ // Call to precompile ECREC (0x01), but code was modified to add 1 to input
945
945
blockNumber : rpc .LatestBlockNumber ,
@@ -1084,7 +1084,7 @@ func TestTraceChain(t *testing.T) {
1084
1084
backend .relHook = func () { rel .Add (1 ) }
1085
1085
api := NewAPI (backend )
1086
1086
1087
- single := `{"txHash":"0x0000000000000000000000000000000000000000000000000000000000000000","result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}`
1087
+ single := `{"txHash":"0x0000000000000000000000000000000000000000000000000000000000000000","result":{"gas":21000,"failed":false,"returnValue":"0x ","structLogs":[]}}`
1088
1088
var cases = []struct {
1089
1089
start uint64
1090
1090
end uint64
@@ -1198,7 +1198,7 @@ func TestTraceBlockWithBasefee(t *testing.T) {
1198
1198
// Trace head block
1199
1199
{
1200
1200
blockNumber : rpc .BlockNumber (genBlocks ),
1201
- want : fmt .Sprintf (`[{"txHash":"%#x","result":{"gas":21002,"failed":false,"returnValue":"","structLogs":[{"pc":0,"op":"BASEFEE","gas":84000,"gasCost":2,"depth":1,"stack":[]},{"pc":1,"op":"STOP","gas":83998,"gasCost":0,"depth":1,"stack":["%#x"]}]}}]` , txHash , baseFee ),
1201
+ want : fmt .Sprintf (`[{"txHash":"%#x","result":{"gas":21002,"failed":false,"returnValue":"0x ","structLogs":[{"pc":0,"op":"BASEFEE","gas":84000,"gasCost":2,"depth":1,"stack":[]},{"pc":1,"op":"STOP","gas":83998,"gasCost":0,"depth":1,"stack":["%#x"]}]}}]` , txHash , baseFee ),
1202
1202
},
1203
1203
}
1204
1204
for i , tc := range testSuite {
0 commit comments