Skip to content

Commit 92250c5

Browse files
committed
Update emulator
1 parent a20dc99 commit 92250c5

File tree

7 files changed

+27
-27
lines changed

7 files changed

+27
-27
lines changed

integration/internal/emulator/blockchain.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ import (
4545

4646
"github.com/onflow/flow-core-contracts/lib/go/templates"
4747

48-
"github.com/onflow/flow-go/access"
4948
"github.com/onflow/flow-go/access/validator"
5049
"github.com/onflow/flow-go/engine"
5150
"github.com/onflow/flow-go/fvm"
5251
"github.com/onflow/flow-go/fvm/environment"
5352
fvmerrors "github.com/onflow/flow-go/fvm/errors"
5453
reusableRuntime "github.com/onflow/flow-go/fvm/runtime"
54+
accessmodel "github.com/onflow/flow-go/model/access"
5555
flowgo "github.com/onflow/flow-go/model/flow"
5656
"github.com/onflow/flow-go/module/metrics"
5757
)
@@ -174,8 +174,8 @@ func (b *Blockchain) GetChain() flowgo.Chain {
174174
return b.vmCtx.Chain
175175
}
176176

177-
func (b *Blockchain) GetNetworkParameters() access.NetworkParameters {
178-
return access.NetworkParameters{
177+
func (b *Blockchain) GetNetworkParameters() accessmodel.NetworkParameters {
178+
return accessmodel.NetworkParameters{
179179
ChainID: b.GetChain().ChainID(),
180180
}
181181
}
@@ -381,24 +381,24 @@ func (b *Blockchain) getTransaction(txID flowgo.Identifier) (*flowgo.Transaction
381381
return &tx, nil
382382
}
383383

384-
func (b *Blockchain) GetTransactionResult(txID flowgo.Identifier) (*access.TransactionResult, error) {
384+
func (b *Blockchain) GetTransactionResult(txID flowgo.Identifier) (*accessmodel.TransactionResult, error) {
385385
b.mu.RLock()
386386
defer b.mu.RUnlock()
387387

388388
return b.getTransactionResult(txID)
389389
}
390390

391-
func (b *Blockchain) getTransactionResult(txID flowgo.Identifier) (*access.TransactionResult, error) {
391+
func (b *Blockchain) getTransactionResult(txID flowgo.Identifier) (*accessmodel.TransactionResult, error) {
392392
if b.pendingBlock.ContainsTransaction(txID) {
393-
return &access.TransactionResult{
393+
return &accessmodel.TransactionResult{
394394
Status: flowgo.TransactionStatusPending,
395395
}, nil
396396
}
397397

398398
storedResult, err := b.storage.TransactionResultByID(context.Background(), txID)
399399
if err != nil {
400400
if errors.Is(err, ErrNotFound) {
401-
return &access.TransactionResult{
401+
return &accessmodel.TransactionResult{
402402
Status: flowgo.TransactionStatusUnknown,
403403
}, nil
404404
}
@@ -409,7 +409,7 @@ func (b *Blockchain) getTransactionResult(txID flowgo.Identifier) (*access.Trans
409409
if storedResult.ErrorCode > 0 {
410410
statusCode = 1
411411
}
412-
result := access.TransactionResult{
412+
result := accessmodel.TransactionResult{
413413
Status: flowgo.TransactionStatusSealed,
414414
StatusCode: uint(statusCode),
415415
ErrorMessage: storedResult.ErrorMessage,
@@ -943,7 +943,7 @@ func (b *Blockchain) GetTransactionsByBlockID(blockID flowgo.Identifier) ([]*flo
943943
return transactions, nil
944944
}
945945

946-
func (b *Blockchain) GetTransactionResultsByBlockID(blockID flowgo.Identifier) ([]*access.TransactionResult, error) {
946+
func (b *Blockchain) GetTransactionResultsByBlockID(blockID flowgo.Identifier) ([]*accessmodel.TransactionResult, error) {
947947
b.mu.RLock()
948948
defer b.mu.RUnlock()
949949

@@ -952,7 +952,7 @@ func (b *Blockchain) GetTransactionResultsByBlockID(blockID flowgo.Identifier) (
952952
return nil, fmt.Errorf("failed to get block %s: %w", blockID, err)
953953
}
954954

955-
var results []*access.TransactionResult
955+
var results []*accessmodel.TransactionResult
956956
for i, guarantee := range block.Payload.Guarantees {
957957
c, err := b.getCollectionByID(guarantee.CollectionID)
958958
if err != nil {

integration/internal/emulator/convert.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import (
2626

2727
sdk "github.com/onflow/flow-go-sdk"
2828

29-
"github.com/onflow/flow-go/access"
3029
"github.com/onflow/flow-go/fvm"
3130
fvmerrors "github.com/onflow/flow-go/fvm/errors"
31+
accessmodel "github.com/onflow/flow-go/model/access"
3232
flowgo "github.com/onflow/flow-go/model/flow"
3333
)
3434

@@ -159,7 +159,7 @@ func FlowTransactionToSDK(flowTx flowgo.TransactionBody) sdk.Transaction {
159159
return transaction
160160
}
161161

162-
func FlowTransactionResultToSDK(result *access.TransactionResult) (*sdk.TransactionResult, error) {
162+
func FlowTransactionResultToSDK(result *accessmodel.TransactionResult) (*sdk.TransactionResult, error) {
163163

164164
events, err := FlowEventsToSDK(result.Events)
165165
if err != nil {

integration/internal/emulator/emulator.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/onflow/crypto"
2727
"github.com/onflow/crypto/hash"
2828

29-
"github.com/onflow/flow-go/access"
29+
accessmodel "github.com/onflow/flow-go/model/access"
3030
flowgo "github.com/onflow/flow-go/model/flow"
3131
)
3232

@@ -117,7 +117,7 @@ func (s ServiceKey) AccountKey() (crypto.PublicKey, crypto.PrivateKey) {
117117

118118
type AccessProvider interface {
119119
Ping() error
120-
GetNetworkParameters() access.NetworkParameters
120+
GetNetworkParameters() accessmodel.NetworkParameters
121121

122122
GetLatestBlock() (*flowgo.Block, error)
123123
GetBlockByID(id flowgo.Identifier) (*flowgo.Block, error)
@@ -127,9 +127,9 @@ type AccessProvider interface {
127127
GetFullCollectionByID(colID flowgo.Identifier) (*flowgo.Collection, error)
128128

129129
GetTransaction(txID flowgo.Identifier) (*flowgo.TransactionBody, error)
130-
GetTransactionResult(txID flowgo.Identifier) (*access.TransactionResult, error)
130+
GetTransactionResult(txID flowgo.Identifier) (*accessmodel.TransactionResult, error)
131131
GetTransactionsByBlockID(blockID flowgo.Identifier) ([]*flowgo.TransactionBody, error)
132-
GetTransactionResultsByBlockID(blockID flowgo.Identifier) ([]*access.TransactionResult, error)
132+
GetTransactionResultsByBlockID(blockID flowgo.Identifier) ([]*accessmodel.TransactionResult, error)
133133

134134
GetAccount(address flowgo.Address) (*flowgo.Account, error)
135135
GetAccountAtBlockHeight(address flowgo.Address, blockHeight uint64) (*flowgo.Account, error)

integration/internal/emulator/errors.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
"github.com/onflow/flow-go-sdk/crypto"
2626

27-
"github.com/onflow/flow-go/access"
27+
"github.com/onflow/flow-go/access/validator"
2828
fvmerrors "github.com/onflow/flow-go/fvm/errors"
2929
flowgo "github.com/onflow/flow-go/model/flow"
3030
)
@@ -260,13 +260,13 @@ func (f *FVMError) Unwrap() error {
260260

261261
func ConvertAccessError(err error) error {
262262
switch typedErr := err.(type) {
263-
case access.IncompleteTransactionError:
263+
case validator.IncompleteTransactionError:
264264
return &IncompleteTransactionError{MissingFields: typedErr.MissingFields}
265-
case access.ExpiredTransactionError:
265+
case validator.ExpiredTransactionError:
266266
return &ExpiredTransactionError{RefHeight: typedErr.RefHeight, FinalHeight: typedErr.FinalHeight}
267-
case access.InvalidGasLimitError:
267+
case validator.InvalidGasLimitError:
268268
return &InvalidTransactionGasLimitError{Maximum: typedErr.Maximum, Actual: typedErr.Actual}
269-
case access.InvalidScriptError:
269+
case validator.InvalidScriptError:
270270
return &InvalidTransactionScriptError{ParserErr: typedErr.ParserErr}
271271
}
272272

integration/internal/emulator/memstore.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"fmt"
2525
"sync"
2626

27-
"github.com/onflow/flow-go/access"
27+
"github.com/onflow/flow-go/access/validator"
2828
"github.com/onflow/flow-go/fvm/environment"
2929
"github.com/onflow/flow-go/fvm/storage/snapshot"
3030
flowgo "github.com/onflow/flow-go/model/flow"
@@ -52,7 +52,7 @@ type Store struct {
5252
}
5353

5454
var _ environment.Blocks = &Store{}
55-
var _ access.Blocks = &Store{}
55+
var _ validator.Blocks = &Store{}
5656
var _ EmulatorStorage = &Store{}
5757

5858
func (b *Store) HeaderByID(id flowgo.Identifier) (*flowgo.Header, error) {

integration/internal/emulator/sdk.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
sdk "github.com/onflow/flow-go-sdk"
1717
"github.com/onflow/flow-go-sdk/templates"
1818

19-
"github.com/onflow/flow-go/access"
19+
accessmodel "github.com/onflow/flow-go/model/access"
2020
flowgo "github.com/onflow/flow-go/model/flow"
2121
)
2222

@@ -385,7 +385,7 @@ func (b *SDKAdapter) GetSystemTransaction(_ context.Context, _ flowgo.Identifier
385385
return nil, nil
386386
}
387387

388-
func (b *SDKAdapter) GetSystemTransactionResult(_ context.Context, _ flowgo.Identifier, _ entities.EventEncodingVersion) (*access.TransactionResult, error) {
388+
func (b *SDKAdapter) GetSystemTransactionResult(_ context.Context, _ flowgo.Identifier, _ entities.EventEncodingVersion) (*accessmodel.TransactionResult, error) {
389389
return nil, nil
390390
}
391391

integration/internal/emulator/store.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525

2626
"github.com/psiemens/graceland"
2727

28-
"github.com/onflow/flow-go/access"
28+
"github.com/onflow/flow-go/access/validator"
2929
"github.com/onflow/flow-go/fvm/environment"
3030
"github.com/onflow/flow-go/fvm/storage/snapshot"
3131
flowgo "github.com/onflow/flow-go/model/flow"
@@ -46,7 +46,7 @@ import (
4646
type EmulatorStorage interface {
4747
graceland.Routine
4848
environment.Blocks
49-
access.Blocks
49+
validator.Blocks
5050
LatestBlockHeight(ctx context.Context) (uint64, error)
5151

5252
// LatestBlock returns the block with the highest block height.

0 commit comments

Comments
 (0)