diff --git a/adapters/access.go b/adapters/access.go index 5a9a197b..aa95b85c 100644 --- a/adapters/access.go +++ b/adapters/access.go @@ -25,6 +25,7 @@ import ( "github.com/onflow/flow-go/access" "github.com/onflow/flow-go/engine/access/subscription" "github.com/onflow/flow-go/engine/common/rpc/convert" + accessmodel "github.com/onflow/flow-go/model/access" flowgo "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow/protobuf/go/flow/entities" "github.com/rs/zerolog" @@ -38,7 +39,7 @@ import ( var _ access.API = &AccessAdapter{} -// AccessAdapter wraps the emulator adapters to be compatible with access.API. +// AccessAdapter wraps the emulator adapters to be compatible with accessmodel.API. type AccessAdapter struct { logger *zerolog.Logger emulator emulator.Emulator @@ -70,7 +71,7 @@ func (a *AccessAdapter) Ping(_ context.Context) error { return convertError(a.emulator.Ping(), codes.Internal) } -func (a *AccessAdapter) GetNetworkParameters(_ context.Context) access.NetworkParameters { +func (a *AccessAdapter) GetNetworkParameters(_ context.Context) accessmodel.NetworkParameters { return a.emulator.GetNetworkParameters() } @@ -205,7 +206,7 @@ func (a *AccessAdapter) GetTransactionResult( _ flowgo.Identifier, requiredEventEncodingVersion entities.EventEncodingVersion, ) ( - *access.TransactionResult, + *accessmodel.TransactionResult, error, ) { result, err := a.emulator.GetTransactionResult(id) @@ -434,7 +435,7 @@ func (a *AccessAdapter) GetSystemTransaction(_ context.Context, _ flowgo.Identif return nil, nil } -func (a *AccessAdapter) GetSystemTransactionResult(_ context.Context, _ flowgo.Identifier, _ entities.EventEncodingVersion) (*access.TransactionResult, error) { +func (a *AccessAdapter) GetSystemTransactionResult(_ context.Context, _ flowgo.Identifier, _ entities.EventEncodingVersion) (*accessmodel.TransactionResult, error) { return nil, nil } @@ -539,7 +540,7 @@ func (a *AccessAdapter) GetTransactionResultByIndex( blockID flowgo.Identifier, index uint32, requiredEventEncodingVersion entities.EventEncodingVersion, -) (*access.TransactionResult, error) { +) (*accessmodel.TransactionResult, error) { results, err := a.emulator.GetTransactionResultsByBlockID(blockID) if err != nil { return nil, convertError(err, codes.Internal) @@ -573,7 +574,7 @@ func (a *AccessAdapter) GetTransactionResultsByBlockID( _ context.Context, blockID flowgo.Identifier, requiredEventEncodingVersion entities.EventEncodingVersion, -) ([]*access.TransactionResult, error) { +) ([]*accessmodel.TransactionResult, error) { result, err := a.emulator.GetTransactionResultsByBlockID(blockID) if err != nil { return nil, convertError(err, codes.Internal) @@ -603,10 +604,10 @@ func (a *AccessAdapter) SendTransaction(_ context.Context, tx *flowgo.Transactio func (a *AccessAdapter) GetNodeVersionInfo( _ context.Context, ) ( - *access.NodeVersionInfo, + *accessmodel.NodeVersionInfo, error, ) { - return &access.NodeVersionInfo{}, nil + return &accessmodel.NodeVersionInfo{}, nil } func (a *AccessAdapter) SubscribeBlocksFromStartBlockID(ctx context.Context, startBlockID flowgo.Identifier, blockStatus flowgo.BlockStatus) subscription.Subscription { @@ -645,7 +646,7 @@ func (a *AccessAdapter) SubscribeBlockDigestsFromLatest(ctx context.Context, blo return nil } -func (a *AccessAdapter) SubscribeTransactionStatuses(ctx context.Context, tx *flowgo.TransactionBody, _ entities.EventEncodingVersion) subscription.Subscription { +func (a *AccessAdapter) SubscribeTransactionStatuses(ctx context.Context, _ flowgo.Identifier, _ entities.EventEncodingVersion) subscription.Subscription { return nil } diff --git a/adapters/access_test.go b/adapters/access_test.go index 79761b03..d51c447d 100644 --- a/adapters/access_test.go +++ b/adapters/access_test.go @@ -25,8 +25,8 @@ import ( "github.com/onflow/cadence" "github.com/onflow/cadence/encoding/ccf" - "github.com/onflow/flow-go/access" "github.com/onflow/flow-go/engine/common/rpc/convert" + accessmodel "github.com/onflow/flow-go/model/access" flowgo "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow/protobuf/go/flow/entities" "github.com/rs/zerolog" @@ -63,7 +63,7 @@ func TestAccess(t *testing.T) { })) t.Run("GetNetworkParameters", accessTest(func(t *testing.T, adapter *AccessAdapter, emu *mocks.MockEmulator) { - expected := access.NetworkParameters{ + expected := accessmodel.NetworkParameters{ ChainID: flowgo.MonotonicEmulator, } @@ -325,12 +325,12 @@ func TestAccess(t *testing.T) { blockID := flowgo.Identifier{} collectionID := flowgo.Identifier{} - emuResult := access.TransactionResult{ + emuResult := accessmodel.TransactionResult{ Events: []flowgo.Event{ ccfEventFixture(t), }, } - expected := access.TransactionResult{ + expected := accessmodel.TransactionResult{ Events: []flowgo.Event{ jsonCDCEventFixture(t), }, @@ -632,13 +632,13 @@ func TestAccess(t *testing.T) { blockID := flowgo.Identifier{} index := uint32(0) - txResult := &access.TransactionResult{ + txResult := &accessmodel.TransactionResult{ Events: []flowgo.Event{ ccfEventFixture(t), }, } - results := []*access.TransactionResult{txResult} - convertedTXResult := &access.TransactionResult{ + results := []*accessmodel.TransactionResult{txResult} + convertedTXResult := &accessmodel.TransactionResult{ Events: []flowgo.Event{ jsonCDCEventFixture(t), }, @@ -698,14 +698,14 @@ func TestAccess(t *testing.T) { blockID := flowgo.Identifier{} - results := []*access.TransactionResult{ + results := []*accessmodel.TransactionResult{ { Events: []flowgo.Event{ ccfEventFixture(t), }, }, } - expected := []*access.TransactionResult{ + expected := []*accessmodel.TransactionResult{ { Events: []flowgo.Event{ jsonCDCEventFixture(t), diff --git a/adapters/sdk.go b/adapters/sdk.go index 8e16f3fb..c15c9cdc 100644 --- a/adapters/sdk.go +++ b/adapters/sdk.go @@ -27,7 +27,7 @@ import ( "github.com/onflow/cadence/stdlib" sdk "github.com/onflow/flow-go-sdk" "github.com/onflow/flow-go-sdk/templates" - "github.com/onflow/flow-go/access" + accessmodel "github.com/onflow/flow-go/model/access" flowgo "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow/protobuf/go/flow/entities" "github.com/rs/zerolog" @@ -403,7 +403,7 @@ func (b *SDKAdapter) GetSystemTransaction(_ context.Context, _ flowgo.Identifier return nil, nil } -func (b *SDKAdapter) GetSystemTransactionResult(_ context.Context, _ flowgo.Identifier, _ entities.EventEncodingVersion) (*access.TransactionResult, error) { +func (b *SDKAdapter) GetSystemTransactionResult(_ context.Context, _ flowgo.Identifier, _ entities.EventEncodingVersion) (*accessmodel.TransactionResult, error) { return nil, nil } diff --git a/adapters/sdk_test.go b/adapters/sdk_test.go index b54ecb49..5e9e8b2d 100644 --- a/adapters/sdk_test.go +++ b/adapters/sdk_test.go @@ -29,7 +29,7 @@ import ( "github.com/onflow/cadence" flowgosdk "github.com/onflow/flow-go-sdk" - "github.com/onflow/flow-go/access" + accessmodel "github.com/onflow/flow-go/model/access" flowgo "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-emulator/convert" @@ -438,7 +438,7 @@ func TestSDK(t *testing.T) { expected := flowgosdk.TransactionResult{ Events: []flowgosdk.Event{}, } - flowResult := access.TransactionResult{} + flowResult := accessmodel.TransactionResult{} //success emu.EXPECT(). @@ -776,7 +776,7 @@ func TestSDK(t *testing.T) { blockID := flowgosdk.Identifier{} - flowTransactionResults := []*access.TransactionResult{} + flowTransactionResults := []*accessmodel.TransactionResult{} expected := []*flowgosdk.TransactionResult{} //success diff --git a/convert/flow.go b/convert/flow.go index d0258fb1..976cb488 100644 --- a/convert/flow.go +++ b/convert/flow.go @@ -27,7 +27,7 @@ import ( "github.com/onflow/cadence/encoding/ccf" sdk "github.com/onflow/flow-go-sdk" - "github.com/onflow/flow-go/access" + accessmodel "github.com/onflow/flow-go/model/access" flowgo "github.com/onflow/flow-go/model/flow" ) @@ -158,7 +158,7 @@ func FlowTransactionToSDK(flowTx flowgo.TransactionBody) sdk.Transaction { return transaction } -func FlowTransactionResultToSDK(result *access.TransactionResult) (*sdk.TransactionResult, error) { +func FlowTransactionResultToSDK(result *accessmodel.TransactionResult) (*sdk.TransactionResult, error) { events, err := FlowEventsToSDK(result.Events) if err != nil { diff --git a/emulator/blockchain.go b/emulator/blockchain.go index 04c70e95..b68ef7df 100644 --- a/emulator/blockchain.go +++ b/emulator/blockchain.go @@ -49,7 +49,7 @@ import ( "github.com/onflow/flow-core-contracts/lib/go/templates" flowsdk "github.com/onflow/flow-go-sdk" sdkcrypto "github.com/onflow/flow-go-sdk/crypto" - "github.com/onflow/flow-go/access" + "github.com/onflow/flow-go/access/validator" "github.com/onflow/flow-go/engine" "github.com/onflow/flow-go/fvm" fvmcrypto "github.com/onflow/flow-go/fvm/crypto" @@ -58,6 +58,7 @@ import ( "github.com/onflow/flow-go/fvm/meter" reusableRuntime "github.com/onflow/flow-go/fvm/runtime" "github.com/onflow/flow-go/fvm/storage/snapshot" + accessmodel "github.com/onflow/flow-go/model/access" flowgo "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/module/metrics" "github.com/rs/zerolog" @@ -347,7 +348,7 @@ type Blockchain struct { vm *fvm.VirtualMachine vmCtx fvm.Context - transactionValidator *access.TransactionValidator + transactionValidator *validator.TransactionValidator serviceKey ServiceKey @@ -505,8 +506,8 @@ func (b *Blockchain) GetChain() flowgo.Chain { return b.vmCtx.Chain } -func (b *Blockchain) GetNetworkParameters() access.NetworkParameters { - return access.NetworkParameters{ +func (b *Blockchain) GetNetworkParameters() accessmodel.NetworkParameters { + return accessmodel.NetworkParameters{ ChainID: b.GetChain().ChainID(), } } @@ -820,12 +821,12 @@ func configureBootstrapProcedure(conf config, flowAccountKey flowgo.AccountPubli ) } -func configureTransactionValidator(conf config, blocks *blocks) (*access.TransactionValidator, error) { - return access.NewTransactionValidator( +func configureTransactionValidator(conf config, blocks *blocks) (*validator.TransactionValidator, error) { + return validator.NewTransactionValidator( blocks, conf.GetChainID().Chain(), metrics.NewNoopCollector(), - access.TransactionValidationOptions{ + validator.TransactionValidationOptions{ Expiry: conf.TransactionExpiry, ExpiryBuffer: 0, AllowEmptyReferenceBlockID: conf.TransactionExpiry == 0, @@ -834,7 +835,7 @@ func configureTransactionValidator(conf config, blocks *blocks) (*access.Transac CheckScriptsParse: true, MaxTransactionByteSize: flowgo.DefaultMaxTransactionByteSize, MaxCollectionByteSize: flowgo.DefaultMaxCollectionByteSize, - CheckPayerBalanceMode: access.Disabled, + CheckPayerBalanceMode: validator.Disabled, }, nil, ) @@ -1007,16 +1008,16 @@ func (b *Blockchain) getTransaction(txID flowgo.Identifier) (*flowgo.Transaction return &tx, nil } -func (b *Blockchain) GetTransactionResult(txID flowgo.Identifier) (*access.TransactionResult, error) { +func (b *Blockchain) GetTransactionResult(txID flowgo.Identifier) (*accessmodel.TransactionResult, error) { b.mu.RLock() defer b.mu.RUnlock() return b.getTransactionResult(txID) } -func (b *Blockchain) getTransactionResult(txID flowgo.Identifier) (*access.TransactionResult, error) { +func (b *Blockchain) getTransactionResult(txID flowgo.Identifier) (*accessmodel.TransactionResult, error) { if b.pendingBlock.ContainsTransaction(txID) { - return &access.TransactionResult{ + return &accessmodel.TransactionResult{ Status: flowgo.TransactionStatusPending, }, nil } @@ -1024,7 +1025,7 @@ func (b *Blockchain) getTransactionResult(txID flowgo.Identifier) (*access.Trans storedResult, err := b.storage.TransactionResultByID(context.Background(), txID) if err != nil { if errors.Is(err, storage.ErrNotFound) { - return &access.TransactionResult{ + return &accessmodel.TransactionResult{ Status: flowgo.TransactionStatusUnknown, }, nil } @@ -1035,7 +1036,7 @@ func (b *Blockchain) getTransactionResult(txID flowgo.Identifier) (*access.Trans if storedResult.ErrorCode > 0 { statusCode = 1 } - result := access.TransactionResult{ + result := accessmodel.TransactionResult{ Status: flowgo.TransactionStatusSealed, StatusCode: uint(statusCode), ErrorMessage: storedResult.ErrorMessage, @@ -1714,7 +1715,7 @@ func (b *Blockchain) GetTransactionsByBlockID(blockID flowgo.Identifier) ([]*flo return transactions, nil } -func (b *Blockchain) GetTransactionResultsByBlockID(blockID flowgo.Identifier) ([]*access.TransactionResult, error) { +func (b *Blockchain) GetTransactionResultsByBlockID(blockID flowgo.Identifier) ([]*accessmodel.TransactionResult, error) { b.mu.RLock() defer b.mu.RUnlock() @@ -1723,7 +1724,7 @@ func (b *Blockchain) GetTransactionResultsByBlockID(blockID flowgo.Identifier) ( return nil, fmt.Errorf("failed to get block %s: %w", blockID, err) } - var results []*access.TransactionResult + var results []*accessmodel.TransactionResult for i, guarantee := range block.Payload.Guarantees { c, err := b.getCollectionByID(guarantee.CollectionID) if err != nil { diff --git a/emulator/blocks.go b/emulator/blocks.go index 58783f79..d0e61016 100644 --- a/emulator/blocks.go +++ b/emulator/blocks.go @@ -22,8 +22,7 @@ import ( "context" "errors" - "github.com/onflow/flow-go/access" - + "github.com/onflow/flow-go/access/validator" "github.com/onflow/flow-go/fvm/environment" flowgo "github.com/onflow/flow-go/model/flow" @@ -31,7 +30,7 @@ import ( ) var _ environment.Blocks = &blocks{} -var _ access.Blocks = &blocks{} +var _ validator.Blocks = &blocks{} type blocks struct { blockchain *Blockchain diff --git a/emulator/emulator.go b/emulator/emulator.go index 0b3db73d..2fe280e6 100644 --- a/emulator/emulator.go +++ b/emulator/emulator.go @@ -26,7 +26,7 @@ import ( "github.com/onflow/cadence/runtime" flowgosdk "github.com/onflow/flow-go-sdk" sdkcrypto "github.com/onflow/flow-go-sdk/crypto" - "github.com/onflow/flow-go/access" + accessmodel "github.com/onflow/flow-go/model/access" flowgo "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-emulator/types" @@ -124,7 +124,7 @@ type RollbackCapable interface { type AccessProvider interface { Ping() error - GetNetworkParameters() access.NetworkParameters + GetNetworkParameters() accessmodel.NetworkParameters GetLatestBlock() (*flowgo.Block, error) GetBlockByID(id flowgo.Identifier) (*flowgo.Block, error) @@ -134,9 +134,9 @@ type AccessProvider interface { GetFullCollectionByID(colID flowgo.Identifier) (*flowgo.Collection, error) GetTransaction(txID flowgo.Identifier) (*flowgo.TransactionBody, error) - GetTransactionResult(txID flowgo.Identifier) (*access.TransactionResult, error) + GetTransactionResult(txID flowgo.Identifier) (*accessmodel.TransactionResult, error) GetTransactionsByBlockID(blockID flowgo.Identifier) ([]*flowgo.TransactionBody, error) - GetTransactionResultsByBlockID(blockID flowgo.Identifier) ([]*access.TransactionResult, error) + GetTransactionResultsByBlockID(blockID flowgo.Identifier) ([]*accessmodel.TransactionResult, error) GetAccount(address flowgo.Address) (*flowgo.Account, error) GetAccountAtBlockHeight(address flowgo.Address, blockHeight uint64) (*flowgo.Account, error) diff --git a/emulator/mocks/emulator.go b/emulator/mocks/emulator.go index da986bf9..f809631e 100644 --- a/emulator/mocks/emulator.go +++ b/emulator/mocks/emulator.go @@ -17,7 +17,7 @@ import ( runtime "github.com/onflow/cadence/runtime" emulator "github.com/onflow/flow-emulator/emulator" types "github.com/onflow/flow-emulator/types" - access "github.com/onflow/flow-go/access" + access "github.com/onflow/flow-go/model/access" flow "github.com/onflow/flow-go/model/flow" gomock "go.uber.org/mock/gomock" ) diff --git a/go.mod b/go.mod index 5afed951..807c9d6b 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.23.4 require ( github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 - github.com/fxamacker/cbor/v2 v2.4.1-0.20230228173756-c0c9f774e40c + github.com/fxamacker/cbor/v2 v2.8.1-0.20250402194037-6f932b086829 github.com/glebarez/go-sqlite v1.22.0 github.com/go-redis/redis/v8 v8.11.5 github.com/google/go-dap v0.11.0 @@ -14,13 +14,13 @@ require ( github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/improbable-eng/grpc-web v0.15.0 github.com/logrusorgru/aurora v2.0.3+incompatible - github.com/onflow/cadence v1.3.1 + github.com/onflow/cadence v1.3.4 github.com/onflow/crypto v0.25.2 - github.com/onflow/flow-core-contracts/lib/go/templates v1.5.1-preview - github.com/onflow/flow-go v0.38.1-0.20250218174738-2181389f9f7d - github.com/onflow/flow-go-sdk v1.3.1 + github.com/onflow/flow-core-contracts/lib/go/templates v1.6.0 + github.com/onflow/flow-go v0.40.1 + github.com/onflow/flow-go-sdk v1.3.3 github.com/onflow/flow-nft/lib/go/contracts v1.2.3 - github.com/onflow/flow/protobuf/go/flow v0.4.9 + github.com/onflow/flow/protobuf/go/flow v0.4.10 github.com/prometheus/client_golang v1.20.5 github.com/psiemens/graceland v1.0.0 github.com/psiemens/sconfig v0.1.0 @@ -58,6 +58,7 @@ require ( github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect @@ -111,6 +112,7 @@ require ( github.com/ipfs/go-log/v2 v2.5.1 // indirect github.com/ipfs/go-metrics-interface v0.0.1 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect + github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect github.com/jbenet/goprocess v0.1.4 // indirect github.com/k0kubun/pp v3.0.1+incompatible // indirect github.com/kevinburke/go-bindata v3.24.0+incompatible // indirect @@ -143,9 +145,9 @@ require ( github.com/multiformats/go-varint v0.0.7 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/onflow/atree v0.9.0 // indirect + github.com/onflow/atree v0.10.0 // indirect github.com/onflow/bridged-usdc/lib/go/contracts v1.0.0 // indirect - github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.1-preview // indirect + github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.0 // indirect github.com/onflow/flow-ft/lib/go/contracts v1.0.1 // indirect github.com/onflow/flow-ft/lib/go/templates v1.0.1 // indirect github.com/onflow/flow-nft/lib/go/templates v1.2.1 // indirect @@ -169,6 +171,7 @@ require ( github.com/sethvargo/go-retry v0.2.3 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/slok/go-http-metrics v0.12.0 // indirect + github.com/sony/gobreaker v0.5.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.10.0 // indirect github.com/spf13/cast v1.5.0 // indirect @@ -214,7 +217,7 @@ require ( google.golang.org/protobuf v1.36.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - lukechampine.com/blake3 v1.3.0 // indirect + lukechampine.com/blake3 v1.4.0 // indirect modernc.org/libc v1.37.6 // indirect modernc.org/mathutil v1.6.0 // indirect modernc.org/memory v1.7.2 // indirect diff --git a/go.sum b/go.sum index 06096ad7..07651309 100644 --- a/go.sum +++ b/go.sum @@ -253,8 +253,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/fxamacker/cbor/v2 v2.4.1-0.20230228173756-c0c9f774e40c h1:5tm/Wbs9d9r+qZaUFXk59CWDD0+77PBqDREffYkyi5c= -github.com/fxamacker/cbor/v2 v2.4.1-0.20230228173756-c0c9f774e40c/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= +github.com/fxamacker/cbor/v2 v2.8.1-0.20250402194037-6f932b086829 h1:qOglMkJ5YBwog/GU/NXhP9gFqxUGMuqnmCkbj65JMhk= +github.com/fxamacker/cbor/v2 v2.8.1-0.20250402194037-6f932b086829/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/fxamacker/circlehash v0.3.0 h1:XKdvTtIJV9t7DDUtsf0RIpC1OcxZtPbmgIH7ekx28WA= github.com/fxamacker/circlehash v0.3.0/go.mod h1:3aq3OfVvsWtkWMb6A1owjOQFA+TLsD5FgJflnaQwtMM= github.com/gabriel-vasile/mimetype v1.4.6 h1:3+PzJTKLkvgjeTbts6msPJt4DixhT4YtFNf1gtGe3zc= @@ -737,32 +737,32 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onflow/atree v0.9.0 h1:M+Z/UPwzv0/Yy7ChI5T1ZIHD3YN1cs/hxGEs/HWhzaY= -github.com/onflow/atree v0.9.0/go.mod h1:FT6udJF9Q7VQTu3wknDhFX+VV4D44ZGdqtTAE5iztck= +github.com/onflow/atree v0.10.0 h1:LFYlRgb0fjs8vezBW/N/tzi+ijLMssjHwIwoV4RwYaA= +github.com/onflow/atree v0.10.0/go.mod h1:aqnnE8Os77JiBIeC7UcbeM7N1V3Ys5XWH0CykeMpym0= github.com/onflow/bridged-usdc/lib/go/contracts v1.0.0 h1:ofdfKH8KgY6qVFnlngTontds/IBERANeWl0PBPCtPOA= github.com/onflow/bridged-usdc/lib/go/contracts v1.0.0/go.mod h1:K4/oaEhhnSuJ9q6fpq1w9WEWRGtkNskhmoyH8t+X9Mk= -github.com/onflow/cadence v1.3.1 h1:bs9TFHQy8HHbwTtCtg5cLdyndWhmwq55RSwID1cb220= -github.com/onflow/cadence v1.3.1/go.mod h1:6/47FljVAdl3/31tShI8JOJW0sXYZHK1PwXkE+yk0qA= +github.com/onflow/cadence v1.3.4 h1:IpmlNHiVFQaw/lM71/jlc7gbsLsP5t8vaaSXJfQFQKo= +github.com/onflow/cadence v1.3.4/go.mod h1:SaQVKX36sn4Z0PULTVxVXyb33B5no2+/kawrvxw+GLc= github.com/onflow/crypto v0.25.2 h1:GjHunqVt+vPcdqhxxhAXiMIF3YiLX7gTuTR5O+VG2ns= github.com/onflow/crypto v0.25.2/go.mod h1:fY7eLqUdMKV8EGOw301unP8h7PvLVy8/6gVR++/g0BY= -github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.1-preview h1:W+QkNQcIbhtR+zXVROKq0bdDEnvzUfUrQrCmegmwzvc= -github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.1-preview/go.mod h1:LyCICUK6sK1jtEyb+3GuRw5tYfHT1uxACLwLTLxw/0I= -github.com/onflow/flow-core-contracts/lib/go/templates v1.5.1-preview h1:C0PraQFfwpav4nJAf/RPE9BJyYD6lUMvt+cJyiMDeis= -github.com/onflow/flow-core-contracts/lib/go/templates v1.5.1-preview/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64= +github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.0 h1:zbJaqR3bHicNz68YFJ/6gieUkxnMYz8dKxQrUUCc+/M= +github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.0/go.mod h1:ufT77Epq1gfXAHQQk13WcAHWEv+Aarecn5PMnljWJ1A= +github.com/onflow/flow-core-contracts/lib/go/templates v1.6.0 h1:hVlyGbZ+gkeX0mTxTC4D65HulJCUbbVFgOvVWdMfRI8= +github.com/onflow/flow-core-contracts/lib/go/templates v1.6.0/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64= github.com/onflow/flow-ft/lib/go/contracts v1.0.1 h1:Ts5ob+CoCY2EjEd0W6vdLJ7hLL3SsEftzXG2JlmSe24= github.com/onflow/flow-ft/lib/go/contracts v1.0.1/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A= github.com/onflow/flow-ft/lib/go/templates v1.0.1 h1:FDYKAiGowABtoMNusLuRCILIZDtVqJ/5tYI4VkF5zfM= github.com/onflow/flow-ft/lib/go/templates v1.0.1/go.mod h1:uQ8XFqmMK2jxyBSVrmyuwdWjTEb+6zGjRYotfDJ5pAE= -github.com/onflow/flow-go v0.38.1-0.20250218174738-2181389f9f7d h1:XRefc4rcBjGDEqsj3OB6XjSjSeYwMtysl7jmaLYpg+s= -github.com/onflow/flow-go v0.38.1-0.20250218174738-2181389f9f7d/go.mod h1:VS7MlNHZeDrGm9/jkuMCSvAQTLFXpzQD0BIMB8/QYB8= -github.com/onflow/flow-go-sdk v1.3.1 h1:2YdTL/R1/DjMYYmyKgArTeQ93GKvLlfCeCpMVH7b8q4= -github.com/onflow/flow-go-sdk v1.3.1/go.mod h1:0rMuCLShdX9F4pLBCPhlMGCFu8gu9SfiXT/Lc9qAi24= +github.com/onflow/flow-go v0.40.1 h1:2+Rejyu6D93ufRgmNCAes5QkPGOapdPlcFFpdSWPyeM= +github.com/onflow/flow-go v0.40.1/go.mod h1:+QPdqmSYxvXN3oxtt1nS/oFlcDjOQGYhf0TvHQylbzg= +github.com/onflow/flow-go-sdk v1.3.3 h1:wj7llql3wesQYBePh3lEFI+jk3Df1sa13bRsL139JDo= +github.com/onflow/flow-go-sdk v1.3.3/go.mod h1:tSLvYIac9DlmUEqKHSHbVRyv4mSB0va4AuiV3XB9ENc= github.com/onflow/flow-nft/lib/go/contracts v1.2.3 h1:4ju20g1xgDKWBT63rOj5f/Sa4Lc+naCSWT4p31x9yQk= github.com/onflow/flow-nft/lib/go/contracts v1.2.3/go.mod h1:eZ9VMMNfCq0ho6kV25xJn1kXeCfxnkhj3MwF3ed08gY= github.com/onflow/flow-nft/lib/go/templates v1.2.1 h1:SAALMZPDw9Eb9p5kSLnmnFxjyig1MLiT4JUlLp0/bSE= github.com/onflow/flow-nft/lib/go/templates v1.2.1/go.mod h1:W6hOWU0xltPqNpv9gQX8Pj8Jtf0OmRxc1XX2V0kzJaI= -github.com/onflow/flow/protobuf/go/flow v0.4.9 h1:UfsWWqj6VQbEHvaw8kSGvIawCpEfz3gOGZfcdugNxVE= -github.com/onflow/flow/protobuf/go/flow v0.4.9/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/onflow/flow/protobuf/go/flow v0.4.10 h1:CGEO3n96XZQd/k5HtkZyb90ouem9G+8fNcKyt8s2fvs= +github.com/onflow/flow/protobuf/go/flow v0.4.10/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/go-ethereum v1.14.7 h1:gg3awYqI02e3AypRdpJKEvNTJ6kz/OhAqRti0h54Wlc= github.com/onflow/go-ethereum v1.14.7/go.mod h1:zV14QLrXyYu5ucvcwHUA0r6UaqveqbXaehAVQJlSW+I= github.com/onflow/nft-storefront/lib/go/contracts v1.0.0 h1:sxyWLqGm/p4EKT6DUlQESDG1ZNMN9GjPCm1gTq7NGfc= @@ -1118,6 +1118,7 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -1284,6 +1285,7 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1561,8 +1563,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -lukechampine.com/blake3 v1.3.0 h1:sJ3XhFINmHSrYCgl958hscfIa3bw8x4DqMP3u1YvoYE= -lukechampine.com/blake3 v1.3.0/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= +lukechampine.com/blake3 v1.4.0 h1:xDbKOZCVbnZsfzM6mHSYcGRHZ3YrLDzqz8XnV4uaD5w= +lukechampine.com/blake3 v1.4.0/go.mod h1:MQJNQCTnR+kwOP/JEZSxj3MaQjp80FOFSNMMHXcSeX0= modernc.org/libc v1.37.6 h1:orZH3c5wmhIQFTXF+Nt+eeauyd+ZIt2BX6ARe+kD+aw= modernc.org/libc v1.37.6/go.mod h1:YAXkAZ8ktnkCKaN9sw/UDeUVkGYJ/YquGO4FTi5nmHE= modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= diff --git a/server/access/grpc.go b/server/access/grpc.go index 158db587..87743e1b 100644 --- a/server/access/grpc.go +++ b/server/access/grpc.go @@ -23,8 +23,8 @@ import ( "net" grpcprometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - "github.com/onflow/flow-go/access" legacyaccess "github.com/onflow/flow-go/access/legacy" + "github.com/onflow/flow-go/engine/access/rpc" "github.com/onflow/flow-go/engine/access/state_stream" "github.com/onflow/flow-go/engine/access/state_stream/backend" "github.com/onflow/flow-go/engine/access/subscription" @@ -68,7 +68,7 @@ func NewGRPCServer(logger *zerolog.Logger, blockchain *emulator.Blockchain, adap me.On("NodeID").Return(flowgo.ZeroID) legacyaccessproto.RegisterAccessAPIServer(grpcServer, legacyaccess.NewHandler(adapter, chain)) - accessproto.RegisterAccessAPIServer(grpcServer, access.NewHandler(adapter, chain, mockHeaderCache{}, me, subscription.DefaultMaxGlobalStreams)) + accessproto.RegisterAccessAPIServer(grpcServer, rpc.NewHandler(adapter, chain, mockHeaderCache{}, me, subscription.DefaultMaxGlobalStreams)) grpcprometheus.Register(grpcServer) diff --git a/server/access/rest.go b/server/access/rest.go index 7ecc027c..b488fc9b 100644 --- a/server/access/rest.go +++ b/server/access/rest.go @@ -35,7 +35,9 @@ import ( "github.com/onflow/flow-go/engine/access/subscription" "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/module" + "github.com/onflow/flow-go/module/irrecoverable" "github.com/onflow/flow-go/module/metrics" + modutil "github.com/onflow/flow-go/module/util" "github.com/prometheus/client_golang/prometheus" "github.com/rs/zerolog" @@ -115,7 +117,16 @@ func NewRestServer(logger *zerolog.Logger, blockchain *emulator.Blockchain, adap HeartbeatInterval: subscription.DefaultHeartbeatInterval, } + irrCtx, errCh := irrecoverable.WithSignaler(context.Background()) + go func() { + err := modutil.WaitError(errCh, irrCtx.Done()) + if err != nil { + logger.Fatal().Err(err).Msg("Rest server error") + } + }() + srv, err := rest.NewServer( + irrCtx, adapter, rest.Config{ ListenAddress: fmt.Sprintf("%s:3333", host), diff --git a/types/errors.go b/types/errors.go index dd2a7e54..dc88af2a 100644 --- a/types/errors.go +++ b/types/errors.go @@ -21,10 +21,10 @@ package types import ( "fmt" + "github.com/onflow/flow-go/access/validator" fvmerrors "github.com/onflow/flow-go/fvm/errors" "github.com/onflow/flow-go-sdk/crypto" - "github.com/onflow/flow-go/access" flowgo "github.com/onflow/flow-go/model/flow" ) @@ -257,13 +257,13 @@ func (f *FVMError) Unwrap() error { func ConvertAccessError(err error) error { switch typedErr := err.(type) { - case access.IncompleteTransactionError: + case validator.IncompleteTransactionError: return &IncompleteTransactionError{MissingFields: typedErr.MissingFields} - case access.ExpiredTransactionError: + case validator.ExpiredTransactionError: return &ExpiredTransactionError{RefHeight: typedErr.RefHeight, FinalHeight: typedErr.FinalHeight} - case access.InvalidGasLimitError: + case validator.InvalidGasLimitError: return &InvalidTransactionGasLimitError{Maximum: typedErr.Maximum, Actual: typedErr.Actual} - case access.InvalidScriptError: + case validator.InvalidScriptError: return &InvalidTransactionScriptError{ParserErr: typedErr.ParserErr} }