Skip to content

Commit 89be2ae

Browse files
bors[bot]zhangchiqingpattyshack
authored
Merge #4168 #4179
4168: refactor logProgress r=zhangchiqing a=zhangchiqing This PR: 1. Remove duplicated implementation of logProgress 2. although builds a lookup, the implementation is simplier 3. Also log 0% and 100%(before it only log from 10% to 90%). logging 0% is useful so that we know the processing is started. 100% is useful to know it's completed. 4179: mv fvm/derived fvm/storage/derived r=pattyshack a=pattyshack Co-authored-by: Leo Zhang (zhangchiqing) <[email protected]> Co-authored-by: Patrick Lee <[email protected]>
3 parents 308f506 + cbb9016 + 5ad98b8 commit 89be2ae

40 files changed

+85
-70
lines changed

cmd/execution_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818

1919
"github.com/onflow/flow-go/engine/execution/computation"
2020
"github.com/onflow/flow-go/engine/execution/rpc"
21-
"github.com/onflow/flow-go/fvm/derived"
21+
"github.com/onflow/flow-go/fvm/storage/derived"
2222
storage "github.com/onflow/flow-go/storage/badger"
2323
)
2424

engine/execution/computation/computer/computer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import (
1515
"github.com/onflow/flow-go/engine/execution/utils"
1616
"github.com/onflow/flow-go/fvm"
1717
"github.com/onflow/flow-go/fvm/blueprints"
18-
"github.com/onflow/flow-go/fvm/derived"
1918
"github.com/onflow/flow-go/fvm/state"
2019
"github.com/onflow/flow-go/fvm/storage"
20+
"github.com/onflow/flow-go/fvm/storage/derived"
2121
"github.com/onflow/flow-go/model/flow"
2222
"github.com/onflow/flow-go/module"
2323
"github.com/onflow/flow-go/module/executiondatasync/provider"

engine/execution/computation/computer/computer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ import (
2929
"github.com/onflow/flow-go/engine/execution/state/delta"
3030
"github.com/onflow/flow-go/engine/execution/testutil"
3131
"github.com/onflow/flow-go/fvm"
32-
"github.com/onflow/flow-go/fvm/derived"
3332
"github.com/onflow/flow-go/fvm/environment"
3433
fvmErrors "github.com/onflow/flow-go/fvm/errors"
3534
fvmmock "github.com/onflow/flow-go/fvm/mock"
3635
reusableRuntime "github.com/onflow/flow-go/fvm/runtime"
3736
"github.com/onflow/flow-go/fvm/state"
3837
"github.com/onflow/flow-go/fvm/storage"
38+
"github.com/onflow/flow-go/fvm/storage/derived"
3939
"github.com/onflow/flow-go/fvm/systemcontracts"
4040
"github.com/onflow/flow-go/ledger"
4141
"github.com/onflow/flow-go/model/flow"

engine/execution/computation/computer/mock/block_computer.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

engine/execution/computation/execution_verification_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ import (
2828
"github.com/onflow/flow-go/engine/verification/fetcher"
2929
"github.com/onflow/flow-go/fvm"
3030
"github.com/onflow/flow-go/fvm/blueprints"
31-
"github.com/onflow/flow-go/fvm/derived"
3231
"github.com/onflow/flow-go/fvm/environment"
3332
"github.com/onflow/flow-go/fvm/errors"
33+
"github.com/onflow/flow-go/fvm/storage/derived"
3434
completeLedger "github.com/onflow/flow-go/ledger/complete"
3535
"github.com/onflow/flow-go/ledger/complete/wal/fixtures"
3636
"github.com/onflow/flow-go/model/flow"

engine/execution/computation/manager.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111
"github.com/onflow/flow-go/engine/execution/computation/computer"
1212
"github.com/onflow/flow-go/engine/execution/computation/query"
1313
"github.com/onflow/flow-go/fvm"
14-
"github.com/onflow/flow-go/fvm/derived"
1514
reusableRuntime "github.com/onflow/flow-go/fvm/runtime"
1615
"github.com/onflow/flow-go/fvm/state"
16+
"github.com/onflow/flow-go/fvm/storage/derived"
1717
"github.com/onflow/flow-go/model/flow"
1818
"github.com/onflow/flow-go/module"
1919
"github.com/onflow/flow-go/module/executiondatasync/provider"
@@ -217,7 +217,6 @@ func (e *Manager) ExecuteScript(
217217
code,
218218
arguments,
219219
blockHeader,
220-
e.derivedChainData.NewDerivedBlockDataForScript(blockHeader.ID()),
221220
snapshot)
222221
}
223222

engine/execution/computation/manager_benchmark_test.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import (
1919
"github.com/onflow/flow-go/engine/execution/computation/computer"
2020
"github.com/onflow/flow-go/engine/execution/testutil"
2121
"github.com/onflow/flow-go/fvm"
22-
"github.com/onflow/flow-go/fvm/derived"
2322
reusableRuntime "github.com/onflow/flow-go/fvm/runtime"
2423
"github.com/onflow/flow-go/fvm/storage"
24+
"github.com/onflow/flow-go/fvm/storage/derived"
2525
"github.com/onflow/flow-go/model/flow"
2626
"github.com/onflow/flow-go/module/executiondatasync/execution_data"
2727
exedataprovider "github.com/onflow/flow-go/module/executiondatasync/provider"
@@ -82,22 +82,17 @@ func mustFundAccounts(
8282
execCtx fvm.Context,
8383
accs *testAccounts,
8484
) storage.SnapshotTree {
85-
derivedBlockData := derived.NewEmptyDerivedBlockData()
86-
execCtx = fvm.NewContextFromParent(
87-
execCtx,
88-
fvm.WithDerivedBlockData(derivedBlockData))
89-
9085
var err error
9186
for _, acc := range accs.accounts {
9287
transferTx := testutil.CreateTokenTransferTransaction(chain, 1_000_000, acc.address, chain.ServiceAddress())
9388
err = testutil.SignTransactionAsServiceAccount(transferTx, accs.seq, chain)
9489
require.NoError(b, err)
9590
accs.seq++
9691

97-
tx := fvm.Transaction(
98-
transferTx,
99-
derivedBlockData.NextTxIndexForTestingOnly())
100-
executionSnapshot, output, err := vm.Run(execCtx, tx, snapshotTree)
92+
executionSnapshot, output, err := vm.Run(
93+
execCtx,
94+
fvm.Transaction(transferTx, 0),
95+
snapshotTree)
10196
require.NoError(b, err)
10297
require.NoError(b, output.Err)
10398
snapshotTree = snapshotTree.Append(executionSnapshot)

engine/execution/computation/manager_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ import (
2828
unittest2 "github.com/onflow/flow-go/engine/execution/state/unittest"
2929
"github.com/onflow/flow-go/engine/execution/testutil"
3030
"github.com/onflow/flow-go/fvm"
31-
"github.com/onflow/flow-go/fvm/derived"
3231
"github.com/onflow/flow-go/fvm/environment"
3332
fvmErrors "github.com/onflow/flow-go/fvm/errors"
3433
"github.com/onflow/flow-go/fvm/state"
34+
"github.com/onflow/flow-go/fvm/storage/derived"
3535
"github.com/onflow/flow-go/ledger/complete"
3636
"github.com/onflow/flow-go/ledger/complete/wal/fixtures"
3737
"github.com/onflow/flow-go/model/flow"

engine/execution/computation/programs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import (
2121
"github.com/onflow/flow-go/engine/execution/computation/computer"
2222
"github.com/onflow/flow-go/engine/execution/testutil"
2323
"github.com/onflow/flow-go/fvm"
24-
"github.com/onflow/flow-go/fvm/derived"
2524
"github.com/onflow/flow-go/fvm/storage"
25+
"github.com/onflow/flow-go/fvm/storage/derived"
2626
"github.com/onflow/flow-go/model/flow"
2727
"github.com/onflow/flow-go/module/executiondatasync/execution_data"
2828
"github.com/onflow/flow-go/module/executiondatasync/provider"

engine/execution/computation/query/executor.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
"github.com/rs/zerolog"
1414

1515
"github.com/onflow/flow-go/fvm"
16-
"github.com/onflow/flow-go/fvm/derived"
1716
"github.com/onflow/flow-go/fvm/state"
17+
"github.com/onflow/flow-go/fvm/storage/derived"
1818
"github.com/onflow/flow-go/model/flow"
1919
"github.com/onflow/flow-go/module"
2020
"github.com/onflow/flow-go/utils/debug"
@@ -32,7 +32,6 @@ type Executor interface {
3232
script []byte,
3333
arguments [][]byte,
3434
blockHeader *flow.Header,
35-
derivedBlockData *derived.DerivedBlockData,
3635
snapshot state.StorageSnapshot,
3736
) (
3837
[]byte,
@@ -102,7 +101,6 @@ func (e *QueryExecutor) ExecuteScript(
102101
script []byte,
103102
arguments [][]byte,
104103
blockHeader *flow.Header,
105-
derivedBlockData *derived.DerivedBlockData,
106104
snapshot state.StorageSnapshot,
107105
) (
108106
encodedValue []byte,
@@ -163,7 +161,8 @@ func (e *QueryExecutor) ExecuteScript(
163161
fvm.NewContextFromParent(
164162
e.vmCtx,
165163
fvm.WithBlockHeader(blockHeader),
166-
fvm.WithDerivedBlockData(derivedBlockData)),
164+
fvm.WithDerivedBlockData(
165+
e.derivedChainData.NewDerivedBlockDataForScript(blockHeader.ID()))),
167166
fvm.NewScriptWithContextAndArgs(script, requestCtx, arguments...),
168167
snapshot)
169168
if err != nil {

0 commit comments

Comments
 (0)