Skip to content

Commit

Permalink
Remove old quick fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
janezpodhostnik committed Sep 13, 2022
1 parent 248a79d commit 0212dd5
Show file tree
Hide file tree
Showing 5 changed files with 204 additions and 29 deletions.
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

0 comments on commit 0212dd5

Please sign in to comment.