Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FVM] Remove old quick fixes #3219

Merged
merged 1 commit into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 52 additions & 0 deletions fvm/environment/mock/account_creator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 97 additions & 0 deletions fvm/environment/mock/address_generator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions fvm/environment/mock/bootstrap_account_creator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions fvm/transaction.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package fvm

import (
"fmt"
"runtime/debug"
"strings"

otelTrace "go.opentelemetry.io/otel/trace"

"github.com/onflow/flow-go/fvm/errors"
Expand Down Expand Up @@ -43,20 +39,6 @@ func (proc *TransactionProcedure) SetTraceSpan(traceSpan otelTrace.Span) {
}

func (proc *TransactionProcedure) Run(vm *VirtualMachine, ctx Context, st *state.StateHolder, programs *programs.Programs) error {

defer func() {
if r := recover(); r != nil {

if strings.Contains(fmt.Sprintf("%v", r), errors.ErrCodeLedgerInteractionLimitExceededError.String()) {
ctx.Logger.Error().Str("trace", string(debug.Stack())).Msg("VM LedgerIntractionLimitExceeded panic")
proc.Err = errors.NewLedgerInteractionLimitExceededError(state.DefaultMaxInteractionSize, state.DefaultMaxInteractionSize)
return
}

panic(r)
}
}()

for _, p := range ctx.TransactionProcessors {
err := p.Process(vm, &ctx, proc, st, programs)
txErr, failure := errors.SplitErrorTypes(err)
Expand Down
15 changes: 4 additions & 11 deletions fvm/transactionInvoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,10 @@ func (i TransactionInvoker) Process(
common.TransactionLocation(proc.ID))

if err != nil {
var interactionLimitExceededErr *errors.LedgerInteractionLimitExceededError
if errors.As(err, &interactionLimitExceededErr) {
// If it is this special interaction limit error, just set it directly as the tx error
txError = err
} else {
// Otherwise, do what we use to do
txError = fmt.Errorf(
"transaction invocation failed when executing transaction: %w",
err,
)
}
txError = fmt.Errorf(
"transaction invocation failed when executing transaction: %w",
err,
)
}

// read computationUsed from the environment. This will be used to charge fees.
Expand Down