Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JkLondon committed Sep 10, 2024
1 parent 3744873 commit 4594038
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
3 changes: 0 additions & 3 deletions turbo/jsonrpc/trace_adhoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,6 @@ func (api *TraceAPIImpl) doCallMany(ctx context.Context, dbtx kv.Tx, msgs []type
if err != nil {
return nil, nil, err
}
println("block num:", blockNumber, chainConfig.ChainName)
stateReader, err := rpchelper.CreateStateReader(ctx, dbtx, api._blockReader, *parentNrOrHash, 0, api.filters, api.stateCache, chainConfig.ChainName)
if err != nil {
return nil, nil, err
Expand Down Expand Up @@ -1219,7 +1218,6 @@ func (api *TraceAPIImpl) doCallMany(ctx context.Context, dbtx kv.Tx, msgs []type
var blockCtx evmtypes.BlockContext

for txIndex, msg := range msgs {
println("in msg", "gp", msg.GasPrice().String(), "gas", msg.Gas(), "value", msg.Value().String())
if isHistoricalStateReader {
historicalStateReader.SetTxNum(baseTxNum + uint64(txIndex))
}
Expand Down Expand Up @@ -1322,7 +1320,6 @@ func (api *TraceAPIImpl) doCallMany(ctx context.Context, dbtx kv.Tx, msgs []type
gp := new(core.GasPool).AddGas(msg.Gas()).AddBlobGas(msg.BlobGas())

execResult, err = core.ApplyMessage(evm, msg, gp, true /* refunds */, gasBailout /*gasBailout*/ /* gasBailout */)
println(fmt.Sprintf("%+v", execResult))
}
if err != nil {
return nil, nil, fmt.Errorf("first run for txIndex %d error: %w", txIndex, err)
Expand Down
12 changes: 3 additions & 9 deletions turbo/jsonrpc/trace_adhoc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ func TestCoinbaseBalance(t *testing.T) {
}

func TestSwapBalance(t *testing.T) {
t.Log("start swapping balance")
m, _, _ := rpcdaemontest.CreateTestSentry(t)
api := NewTraceAPI(newBaseApiForTest(m), m.DB, &httpcfg.HttpCfg{})
// Call GetTransactionReceipt for transaction which is not in the database
Expand All @@ -105,10 +104,10 @@ func TestSwapBalance(t *testing.T) {
/*
Let's assume A - 0x71562b71999873db5b286df957af199ec94617f7 B - 0x14627ea0e2B27b817DbfF94c3dA383bB73F8C30b
A has big balance.
1. Sending 21000 + 2 wei from rich existing to empty account. Gp: 1 wei. Spent: 21000*1+21000+2 wei
2. Return 1 wei to initial sender. Gp: 1 wei. Spent: 21000*1+1.
1. Sending 2 wei from rich existing account to empty account. Gp: 0 wei. Spent: 2 wei
2. Return 1 wei to initial sender. Gp: 0 wei. Spent: 1 wei.
Balance new: 1 wei
Balance old diff is 21000*2 + 1 wei.
Balance old diff is 1 wei.
*/
if err != nil {
t.Errorf("calling CallMany: %v", err)
Expand All @@ -130,7 +129,6 @@ func TestSwapBalance(t *testing.T) {
t.Errorf("bad interface %+v", res.Balance)
}
for i := range b {
println("1st 0x14627ea0e2B27b817DbfF94c3dA383bB73F8C30b balance", b[i].Uint64())
require.Equal(t, uint64(2), b[i].Uint64())
}
}
Expand All @@ -143,7 +141,6 @@ func TestSwapBalance(t *testing.T) {
t.Errorf("bad interface %+v", res.Balance)
}
for i := range b {
println("1st 0x71562b71999873db5b286df957af199ec94617f7 diff", b[i].From.Uint64(), b[i].To.Uint64())
require.Equal(t, uint64(2), b[i].From.Uint64()-b[i].To.Uint64())
}
}
Expand All @@ -156,7 +153,6 @@ func TestSwapBalance(t *testing.T) {
t.Errorf("bad interface %+v", res.Balance)
}
for i := range b {
println("2nd 0x71562b71999873db5b286df957af199ec94617f7 diff", b[i].From.Uint64(), b[i].To.Uint64())
require.Equal(t, uint64(1), b[i].To.Uint64()-b[i].From.Uint64())
}
}
Expand All @@ -168,12 +164,10 @@ func TestSwapBalance(t *testing.T) {
if !okConv {
b := res.Balance.(map[string]*StateDiffBalance)
for i := range b {
println("2nd 0x14627ea0e2B27b817DbfF94c3dA383bB73F8C30b diff", b[i].From.Uint64(), b[i].To.Uint64())
require.Equal(t, uint64(1), b[i].From.Uint64()-b[i].To.Uint64())
}
} else {
for i := range b {
println("2nd 0x14627ea0e2B27b817DbfF94c3dA383bB73F8C30b balance", b[i].Uint64())
require.Equal(t, uint64(1), b[i].Uint64())
}
}
Expand Down

0 comments on commit 4594038

Please sign in to comment.