From 27ed7431f91876c03c02554d283853d7ca379eee Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Thu, 18 Jul 2024 12:52:12 +0300 Subject: [PATCH 01/22] Added new metrics for tx validation --- module/metrics.go | 6 ++++++ module/metrics/noop.go | 2 ++ module/metrics/transaction.go | 10 ++++++++++ module/mock/access_metrics.go | 10 ++++++++++ module/mock/transaction_metrics.go | 10 ++++++++++ 5 files changed, 38 insertions(+) diff --git a/module/metrics.go b/module/metrics.go index fe7e3ee228e..9ded3871448 100644 --- a/module/metrics.go +++ b/module/metrics.go @@ -1055,6 +1055,12 @@ type TransactionMetrics interface { // TransactionExpired tracks number of expired transactions TransactionExpired(txID flow.Identifier) + // TransactionValidated tracks number of validated transactions + TransactionValidated(txID flow.Identifier) + + // TransactionValidationFailed tracks number of validation failed transactions with reason + TransactionValidationFailed(txID flow.Identifier, reason string) + // TransactionSubmissionFailed should be called whenever we try to submit a transaction and it fails TransactionSubmissionFailed() } diff --git a/module/metrics/noop.go b/module/metrics/noop.go index 729e1280588..416aaff5acf 100644 --- a/module/metrics/noop.go +++ b/module/metrics/noop.go @@ -212,6 +212,8 @@ func (nc *NoopCollector) TransactionReceived(txID flow.Identifier, when time.Tim func (nc *NoopCollector) TransactionFinalized(txID flow.Identifier, when time.Time) {} func (nc *NoopCollector) TransactionExecuted(txID flow.Identifier, when time.Time) {} func (nc *NoopCollector) TransactionExpired(txID flow.Identifier) {} +func (nc *NoopCollector) TransactionValidated(txID flow.Identifier) {} +func (nc *NoopCollector) TransactionValidationFailed(txID flow.Identifier, reason string) {} func (nc *NoopCollector) TransactionSubmissionFailed() {} func (nc *NoopCollector) UpdateExecutionReceiptMaxHeight(height uint64) {} func (nc *NoopCollector) UpdateLastFullBlockHeight(height uint64) {} diff --git a/module/metrics/transaction.go b/module/metrics/transaction.go index 8bea3e9adea..457532ec6c7 100644 --- a/module/metrics/transaction.go +++ b/module/metrics/transaction.go @@ -331,3 +331,13 @@ func (tc *TransactionCollector) TransactionExpired(txID flow.Identifier) { tc.transactionSubmission.WithLabelValues("expired").Inc() tc.transactionTimings.Remove(txID) } + +func (tc *TransactionCollector) TransactionValidated(txID flow.Identifier) { + //TODO implement me + panic("implement me") +} + +func (tc *TransactionCollector) TransactionValidationFailed(txID flow.Identifier, reason string) { + //TODO implement me + panic("implement me") +} diff --git a/module/mock/access_metrics.go b/module/mock/access_metrics.go index 9866ad90e02..1b3050f0324 100644 --- a/module/mock/access_metrics.go +++ b/module/mock/access_metrics.go @@ -143,6 +143,16 @@ func (_m *AccessMetrics) TransactionSubmissionFailed() { _m.Called() } +// TransactionValidated provides a mock function with given fields: txID +func (_m *AccessMetrics) TransactionValidated(txID flow.Identifier) { + _m.Called(txID) +} + +// TransactionValidationFailed provides a mock function with given fields: txID, reason +func (_m *AccessMetrics) TransactionValidationFailed(txID flow.Identifier, reason string) { + _m.Called(txID, reason) +} + // UpdateExecutionReceiptMaxHeight provides a mock function with given fields: height func (_m *AccessMetrics) UpdateExecutionReceiptMaxHeight(height uint64) { _m.Called(height) diff --git a/module/mock/transaction_metrics.go b/module/mock/transaction_metrics.go index 9345b934a9a..6eae359d2e6 100644 --- a/module/mock/transaction_metrics.go +++ b/module/mock/transaction_metrics.go @@ -44,6 +44,16 @@ func (_m *TransactionMetrics) TransactionSubmissionFailed() { _m.Called() } +// TransactionValidated provides a mock function with given fields: txID +func (_m *TransactionMetrics) TransactionValidated(txID flow.Identifier) { + _m.Called(txID) +} + +// TransactionValidationFailed provides a mock function with given fields: txID, reason +func (_m *TransactionMetrics) TransactionValidationFailed(txID flow.Identifier, reason string) { + _m.Called(txID, reason) +} + // NewTransactionMetrics creates a new instance of TransactionMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewTransactionMetrics(t interface { From 353e672dd69c5283140fd1ac31699545a17871b2 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Thu, 18 Jul 2024 16:19:40 +0300 Subject: [PATCH 02/22] Implemented methods --- module/metrics/namespaces.go | 1 + module/metrics/transaction.go | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/module/metrics/namespaces.go b/module/metrics/namespaces.go index 2f2c75d5255..936f2d0cd94 100644 --- a/module/metrics/namespaces.go +++ b/module/metrics/namespaces.go @@ -44,6 +44,7 @@ const ( const ( subsystemTransactionTiming = "transaction_timing" subsystemTransactionSubmission = "transaction_submission" + subsystemTransactionValidation = "transaction_validation" subsystemConnectionPool = "connection_pool" subsystemHTTP = "http" ) diff --git a/module/metrics/transaction.go b/module/metrics/transaction.go index 457532ec6c7..98bf1dc410e 100644 --- a/module/metrics/transaction.go +++ b/module/metrics/transaction.go @@ -28,6 +28,8 @@ type TransactionCollector struct { scriptExecutionComparison *prometheus.CounterVec scriptSize prometheus.Histogram transactionResultDuration *prometheus.HistogramVec + transactionValidated *prometheus.CounterVec + transactionValidationFailed *prometheus.CounterVec } // interface check @@ -135,6 +137,18 @@ func NewTransactionCollector( Subsystem: subsystemTransactionSubmission, Help: "histogram for the transaction size in kb of scripts used in GetTransactionResult", }), + transactionValidated: promauto.NewCounterVec(prometheus.CounterOpts{ + Name: "transaction_validated_total", + Namespace: namespaceAccess, + Subsystem: subsystemTransactionValidation, + Help: "counter for the validated transactions", + }, []string{"txID"}), + transactionValidationFailed: promauto.NewCounterVec(prometheus.CounterOpts{ + Name: "transaction_validation_failed", + Namespace: namespaceAccess, + Subsystem: subsystemTransactionValidation, + Help: "counter for the failed transactions validation", + }, []string{"txID", "reason"}), } return tc @@ -333,11 +347,9 @@ func (tc *TransactionCollector) TransactionExpired(txID flow.Identifier) { } func (tc *TransactionCollector) TransactionValidated(txID flow.Identifier) { - //TODO implement me - panic("implement me") + tc.transactionValidated.WithLabelValues(txID.String()).Inc() } func (tc *TransactionCollector) TransactionValidationFailed(txID flow.Identifier, reason string) { - //TODO implement me - panic("implement me") + tc.transactionValidationFailed.WithLabelValues(txID.String(), reason).Inc() } From 1d8fc892df1ea302475fd4a7e614f2e0faad1297 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Thu, 18 Jul 2024 17:12:07 +0300 Subject: [PATCH 03/22] Added validator metrics raw --- access/validator.go | 17 +++++++++++++++++ engine/access/rpc/backend/backend.go | 9 +++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/access/validator.go b/access/validator.go index f85881c3414..81990dd125b 100644 --- a/access/validator.go +++ b/access/validator.go @@ -3,6 +3,8 @@ package access import ( "errors" "fmt" + "github.com/onflow/flow-go/module" + "github.com/onflow/flow-go/module/metrics" "github.com/onflow/cadence/runtime/parser" "github.com/onflow/crypto" @@ -78,11 +80,13 @@ type TransactionValidator struct { options TransactionValidationOptions serviceAccountAddress flow.Address limiter RateLimiter + transactionMetrics module.TransactionMetrics } func NewTransactionValidator( blocks Blocks, chain flow.Chain, + transactionMetrics module.TransactionMetrics, options TransactionValidationOptions, ) *TransactionValidator { return &TransactionValidator{ @@ -91,6 +95,7 @@ func NewTransactionValidator( options: options, serviceAccountAddress: chain.ServiceAddress(), limiter: NewNoopLimiter(), + transactionMetrics: transactionMetrics, } } @@ -106,6 +111,7 @@ func NewTransactionValidatorWithLimiter( options: options, serviceAccountAddress: chain.ServiceAddress(), limiter: rateLimiter, + transactionMetrics: metrics.NewNoopCollector(), //TODO: Need to separate validation metrics } } @@ -116,51 +122,62 @@ func (v *TransactionValidator) Validate(tx *flow.TransactionBody) (err error) { // checks will be skipped err = v.checkRateLimitPayer(tx) if err != nil { + v.transactionMetrics.TransactionValidationFailed(tx.ID(), "InvalidTxRateLimited") return err } err = v.checkTxSizeLimit(tx) if err != nil { + v.transactionMetrics.TransactionValidationFailed(tx.ID(), "InvalidTxByteSizeError") return err } err = v.checkMissingFields(tx) if err != nil { + v.transactionMetrics.TransactionValidationFailed(tx.ID(), "IncompleteTransactionError") return err } err = v.checkGasLimit(tx) if err != nil { + v.transactionMetrics.TransactionValidationFailed(tx.ID(), "InvalidGasLimitError") return err } err = v.checkExpiry(tx) if err != nil { + v.transactionMetrics.TransactionValidationFailed(tx.ID(), "ExpiredTransactionError") return err } err = v.checkCanBeParsed(tx) if err != nil { + v.transactionMetrics.TransactionValidationFailed(tx.ID(), "InvalidScriptError") return err } err = v.checkAddresses(tx) if err != nil { + v.transactionMetrics.TransactionValidationFailed(tx.ID(), "InvalidAddressError") return err } err = v.checkSignatureFormat(tx) if err != nil { + v.transactionMetrics.TransactionValidationFailed(tx.ID(), "InvalidSignatureError") return err } err = v.checkSignatureDuplications(tx) if err != nil { + v.transactionMetrics.TransactionValidationFailed(tx.ID(), "DuplicatedSignatureError") return err } // TODO replace checkSignatureFormat by verifying the account/payer signatures + v.transactionMetrics.TransactionValidated(tx.ID()) + return nil } diff --git a/engine/access/rpc/backend/backend.go b/engine/access/rpc/backend/backend.go index 2ff8a37c0ed..c00813b16a5 100644 --- a/engine/access/rpc/backend/backend.go +++ b/engine/access/rpc/backend/backend.go @@ -252,7 +252,7 @@ func New(params Params) (*Backend, error) { chainID: params.ChainID, transactions: params.Transactions, executionReceipts: params.ExecutionReceipts, - transactionValidator: configureTransactionValidator(params.State, params.ChainID), + transactionValidator: configureTransactionValidator(params.State, params.ChainID, params.AccessMetrics), transactionMetrics: params.AccessMetrics, retry: retry, connFactory: params.ConnFactory, @@ -304,10 +304,15 @@ func identifierList(ids []string) (flow.IdentifierList, error) { return idList, nil } -func configureTransactionValidator(state protocol.State, chainID flow.ChainID) *access.TransactionValidator { +func configureTransactionValidator( + state protocol.State, + chainID flow.ChainID, + transactionMetrics module.TransactionMetrics, +) *access.TransactionValidator { return access.NewTransactionValidator( access.NewProtocolStateBlocks(state), chainID.Chain(), + transactionMetrics, access.TransactionValidationOptions{ Expiry: flow.DefaultTransactionExpiry, ExpiryBuffer: flow.DefaultTransactionExpiryBuffer, From b0718b1b3329b96bc1596ca012e1f0f371509f37 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Mon, 22 Jul 2024 13:55:20 +0300 Subject: [PATCH 04/22] Added metrics to collection node --- access/validator.go | 63 ++++++++++++------------ cmd/collection/main.go | 6 +++ engine/collection/ingest/engine.go | 2 + engine/collection/ingest/engine_test.go | 2 +- engine/testutil/nodes.go | 2 +- module/metrics.go | 9 ++-- module/metrics/noop.go | 1 + module/metrics/transaction.go | 24 +-------- module/metrics/transaction_validation.go | 45 +++++++++++++++++ 9 files changed, 94 insertions(+), 60 deletions(-) create mode 100644 module/metrics/transaction_validation.go diff --git a/access/validator.go b/access/validator.go index 81990dd125b..2994426bf1d 100644 --- a/access/validator.go +++ b/access/validator.go @@ -3,11 +3,9 @@ package access import ( "errors" "fmt" - "github.com/onflow/flow-go/module" - "github.com/onflow/flow-go/module/metrics" - "github.com/onflow/cadence/runtime/parser" "github.com/onflow/crypto" + "github.com/onflow/flow-go/module" "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/state" @@ -75,27 +73,27 @@ type TransactionValidationOptions struct { } type TransactionValidator struct { - blocks Blocks // for looking up blocks to check transaction expiry - chain flow.Chain // for checking validity of addresses - options TransactionValidationOptions - serviceAccountAddress flow.Address - limiter RateLimiter - transactionMetrics module.TransactionMetrics + blocks Blocks // for looking up blocks to check transaction expiry + chain flow.Chain // for checking validity of addresses + options TransactionValidationOptions + serviceAccountAddress flow.Address + limiter RateLimiter + transactionValidationMetrics module.TransactionValidationMetrics } func NewTransactionValidator( blocks Blocks, chain flow.Chain, - transactionMetrics module.TransactionMetrics, + transactionValidationMetrics module.TransactionValidationMetrics, options TransactionValidationOptions, ) *TransactionValidator { return &TransactionValidator{ - blocks: blocks, - chain: chain, - options: options, - serviceAccountAddress: chain.ServiceAddress(), - limiter: NewNoopLimiter(), - transactionMetrics: transactionMetrics, + blocks: blocks, + chain: chain, + options: options, + serviceAccountAddress: chain.ServiceAddress(), + limiter: NewNoopLimiter(), + transactionValidationMetrics: transactionValidationMetrics, } } @@ -103,15 +101,16 @@ func NewTransactionValidatorWithLimiter( blocks Blocks, chain flow.Chain, options TransactionValidationOptions, + transactionValidationMetrics module.TransactionValidationMetrics, rateLimiter RateLimiter, ) *TransactionValidator { return &TransactionValidator{ - blocks: blocks, - chain: chain, - options: options, - serviceAccountAddress: chain.ServiceAddress(), - limiter: rateLimiter, - transactionMetrics: metrics.NewNoopCollector(), //TODO: Need to separate validation metrics + blocks: blocks, + chain: chain, + options: options, + serviceAccountAddress: chain.ServiceAddress(), + limiter: rateLimiter, + transactionValidationMetrics: transactionValidationMetrics, } } @@ -122,61 +121,61 @@ func (v *TransactionValidator) Validate(tx *flow.TransactionBody) (err error) { // checks will be skipped err = v.checkRateLimitPayer(tx) if err != nil { - v.transactionMetrics.TransactionValidationFailed(tx.ID(), "InvalidTxRateLimited") + v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "InvalidTxRateLimited") return err } err = v.checkTxSizeLimit(tx) if err != nil { - v.transactionMetrics.TransactionValidationFailed(tx.ID(), "InvalidTxByteSizeError") + v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "InvalidTxByteSizeError") return err } err = v.checkMissingFields(tx) if err != nil { - v.transactionMetrics.TransactionValidationFailed(tx.ID(), "IncompleteTransactionError") + v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "IncompleteTransactionError") return err } err = v.checkGasLimit(tx) if err != nil { - v.transactionMetrics.TransactionValidationFailed(tx.ID(), "InvalidGasLimitError") + v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "InvalidGasLimitError") return err } err = v.checkExpiry(tx) if err != nil { - v.transactionMetrics.TransactionValidationFailed(tx.ID(), "ExpiredTransactionError") + v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "ExpiredTransactionError") return err } err = v.checkCanBeParsed(tx) if err != nil { - v.transactionMetrics.TransactionValidationFailed(tx.ID(), "InvalidScriptError") + v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "InvalidScriptError") return err } err = v.checkAddresses(tx) if err != nil { - v.transactionMetrics.TransactionValidationFailed(tx.ID(), "InvalidAddressError") + v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "InvalidAddressError") return err } err = v.checkSignatureFormat(tx) if err != nil { - v.transactionMetrics.TransactionValidationFailed(tx.ID(), "InvalidSignatureError") + v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "InvalidSignatureError") return err } err = v.checkSignatureDuplications(tx) if err != nil { - v.transactionMetrics.TransactionValidationFailed(tx.ID(), "DuplicatedSignatureError") + v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "DuplicatedSignatureError") return err } // TODO replace checkSignatureFormat by verifying the account/payer signatures - v.transactionMetrics.TransactionValidated(tx.ID()) + v.transactionValidationMetrics.TransactionValidated(tx.ID()) return nil } diff --git a/cmd/collection/main.go b/cmd/collection/main.go index c3d1496918a..1dde0e9e5df 100644 --- a/cmd/collection/main.go +++ b/cmd/collection/main.go @@ -94,6 +94,7 @@ func main() { followerCore *hotstuff.FollowerLoop // follower hotstuff logic followerEng *followereng.ComplianceEngine colMetrics module.CollectionMetrics + txValidationMtrics module.TransactionValidationMetrics machineAccountMetrics module.MachineAccountMetrics err error @@ -270,6 +271,10 @@ func main() { colMetrics = metrics.NewCollectionCollector(node.Tracer) return nil }). + Module("transaction validation metrics", func(node *cmd.NodeConfig) error { + txValidationMtrics = metrics.NewTransactionValidationCollector() + return nil + }). Module("machine account metrics", func(node *cmd.NodeConfig) error { machineAccountMetrics = metrics.NewMachineAccountCollector(node.MetricsRegisterer, machineAccountInfo.FlowAddress()) return nil @@ -426,6 +431,7 @@ func main() { node.Metrics.Engine, node.Metrics.Mempool, colMetrics, + txValidationMtrics, node.Me, node.RootChainID.Chain(), pools, diff --git a/engine/collection/ingest/engine.go b/engine/collection/ingest/engine.go index 81141b65977..197f9e18877 100644 --- a/engine/collection/ingest/engine.go +++ b/engine/collection/ingest/engine.go @@ -51,6 +51,7 @@ func New( engMetrics module.EngineMetrics, mempoolMetrics module.MempoolMetrics, colMetrics module.CollectionMetrics, + txValidationMetrics module.TransactionValidationMetrics, me module.Local, chain flow.Chain, pools *epochs.TransactionPools, @@ -71,6 +72,7 @@ func New( MaxTransactionByteSize: config.MaxTransactionByteSize, MaxCollectionByteSize: config.MaxCollectionByteSize, }, + txValidationMetrics, limiter, ) diff --git a/engine/collection/ingest/engine_test.go b/engine/collection/ingest/engine_test.go index 7bef24a290a..7f8b0edaeec 100644 --- a/engine/collection/ingest/engine_test.go +++ b/engine/collection/ingest/engine_test.go @@ -126,7 +126,7 @@ func (suite *Suite) SetupTest() { suite.conf = DefaultConfig() chain := flow.Testnet.Chain() - suite.engine, err = New(log, net, suite.state, metrics, metrics, metrics, suite.me, chain, suite.pools, suite.conf, NewAddressRateLimiter(rate.Limit(1), 1)) + suite.engine, err = New(log, net, suite.state, metrics, metrics, metrics, metrics, suite.me, chain, suite.pools, suite.conf, NewAddressRateLimiter(rate.Limit(1), 1)) suite.Require().NoError(err) } diff --git a/engine/testutil/nodes.go b/engine/testutil/nodes.go index b6d1037b500..e33360a83ee 100644 --- a/engine/testutil/nodes.go +++ b/engine/testutil/nodes.go @@ -292,7 +292,7 @@ func CollectionNode(t *testing.T, hub *stub.Hub, identity bootstrap.NodeInfo, ro collections := storage.NewCollections(node.PublicDB, transactions) clusterPayloads := storage.NewClusterPayloads(node.Metrics, node.PublicDB) - ingestionEngine, err := collectioningest.New(node.Log, node.Net, node.State, node.Metrics, node.Metrics, node.Metrics, node.Me, node.ChainID.Chain(), pools, collectioningest.DefaultConfig(), + ingestionEngine, err := collectioningest.New(node.Log, node.Net, node.State, node.Metrics, node.Metrics, node.Metrics, node.Metrics, node.Me, node.ChainID.Chain(), pools, collectioningest.DefaultConfig(), ingest.NewAddressRateLimiter(rate.Limit(1), 10)) // 10 tps require.NoError(t, err) diff --git a/module/metrics.go b/module/metrics.go index 9ded3871448..72ad09c1788 100644 --- a/module/metrics.go +++ b/module/metrics.go @@ -1055,14 +1055,15 @@ type TransactionMetrics interface { // TransactionExpired tracks number of expired transactions TransactionExpired(txID flow.Identifier) + // TransactionSubmissionFailed should be called whenever we try to submit a transaction and it fails + TransactionSubmissionFailed() +} + +type TransactionValidationMetrics interface { // TransactionValidated tracks number of validated transactions TransactionValidated(txID flow.Identifier) - // TransactionValidationFailed tracks number of validation failed transactions with reason TransactionValidationFailed(txID flow.Identifier, reason string) - - // TransactionSubmissionFailed should be called whenever we try to submit a transaction and it fails - TransactionSubmissionFailed() } type PingMetrics interface { diff --git a/module/metrics/noop.go b/module/metrics/noop.go index 416aaff5acf..d0ca96ab0a0 100644 --- a/module/metrics/noop.go +++ b/module/metrics/noop.go @@ -37,6 +37,7 @@ func (nc *NoopCollector) BlockProposalDuration(duration time.Duration) // interface check var _ module.BackendScriptsMetrics = (*NoopCollector)(nil) var _ module.TransactionMetrics = (*NoopCollector)(nil) +var _ module.TransactionValidationMetrics = (*NoopCollector)(nil) var _ module.HotstuffMetrics = (*NoopCollector)(nil) var _ module.EngineMetrics = (*NoopCollector)(nil) var _ module.HeroCacheMetrics = (*NoopCollector)(nil) diff --git a/module/metrics/transaction.go b/module/metrics/transaction.go index 98bf1dc410e..0c8a5416024 100644 --- a/module/metrics/transaction.go +++ b/module/metrics/transaction.go @@ -13,6 +13,7 @@ import ( ) type TransactionCollector struct { + *TransactionValidationCollector transactionTimings mempool.TransactionTimings log zerolog.Logger logTimeToFinalized bool @@ -28,8 +29,6 @@ type TransactionCollector struct { scriptExecutionComparison *prometheus.CounterVec scriptSize prometheus.Histogram transactionResultDuration *prometheus.HistogramVec - transactionValidated *prometheus.CounterVec - transactionValidationFailed *prometheus.CounterVec } // interface check @@ -137,18 +136,7 @@ func NewTransactionCollector( Subsystem: subsystemTransactionSubmission, Help: "histogram for the transaction size in kb of scripts used in GetTransactionResult", }), - transactionValidated: promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "transaction_validated_total", - Namespace: namespaceAccess, - Subsystem: subsystemTransactionValidation, - Help: "counter for the validated transactions", - }, []string{"txID"}), - transactionValidationFailed: promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "transaction_validation_failed", - Namespace: namespaceAccess, - Subsystem: subsystemTransactionValidation, - Help: "counter for the failed transactions validation", - }, []string{"txID", "reason"}), + TransactionValidationCollector: NewTransactionValidationCollector(), } return tc @@ -345,11 +333,3 @@ func (tc *TransactionCollector) TransactionExpired(txID flow.Identifier) { tc.transactionSubmission.WithLabelValues("expired").Inc() tc.transactionTimings.Remove(txID) } - -func (tc *TransactionCollector) TransactionValidated(txID flow.Identifier) { - tc.transactionValidated.WithLabelValues(txID.String()).Inc() -} - -func (tc *TransactionCollector) TransactionValidationFailed(txID flow.Identifier, reason string) { - tc.transactionValidationFailed.WithLabelValues(txID.String(), reason).Inc() -} diff --git a/module/metrics/transaction_validation.go b/module/metrics/transaction_validation.go new file mode 100644 index 00000000000..d39f62029b2 --- /dev/null +++ b/module/metrics/transaction_validation.go @@ -0,0 +1,45 @@ +package metrics + +import ( + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" + + "github.com/onflow/flow-go/model/flow" + "github.com/onflow/flow-go/module" +) + +// TransactionValidationCollector TODO +type TransactionValidationCollector struct { + transactionValidated *prometheus.CounterVec + transactionValidationFailed *prometheus.CounterVec +} + +// interface check +var _ module.TransactionValidationMetrics = (*TransactionValidationCollector)(nil) + +func NewTransactionValidationCollector() *TransactionValidationCollector { + return &TransactionValidationCollector{ + transactionValidated: promauto.NewCounterVec(prometheus.CounterOpts{ + Name: "transaction_validated_total", + Namespace: namespaceAccess, + Subsystem: subsystemTransactionValidation, + Help: "counter for the validated transactions", + }, []string{"txID"}), + transactionValidationFailed: promauto.NewCounterVec(prometheus.CounterOpts{ + Name: "transaction_validation_failed", + Namespace: namespaceAccess, + Subsystem: subsystemTransactionValidation, + Help: "counter for the failed transactions validation", + }, []string{"txID", "reason"}), + } +} + +// TransactionValidated TODO +func (tc *TransactionValidationCollector) TransactionValidated(txID flow.Identifier) { + tc.transactionValidated.WithLabelValues(txID.String()).Inc() +} + +// TransactionValidationFailed TODO +func (tc *TransactionValidationCollector) TransactionValidationFailed(txID flow.Identifier, reason string) { + tc.transactionValidationFailed.WithLabelValues(txID.String(), reason).Inc() +} From 02cb7b41901e6234e3dd2f93599f6657c8c5e9f9 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Mon, 22 Jul 2024 15:05:39 +0300 Subject: [PATCH 05/22] Fixed issue with moks and interfaces --- access/validator.go | 2 + .../node_builder/access_node_builder.go | 78 ++++++++++--------- engine/access/rpc/backend/backend.go | 2 +- module/metrics.go | 1 + module/metrics/access.go | 7 ++ module/metrics/transaction.go | 3 - module/mock/transaction_metrics.go | 10 --- module/mock/transaction_validation_metrics.go | 37 +++++++++ 8 files changed, 90 insertions(+), 50 deletions(-) create mode 100644 module/mock/transaction_validation_metrics.go diff --git a/access/validator.go b/access/validator.go index 2994426bf1d..993abde9a88 100644 --- a/access/validator.go +++ b/access/validator.go @@ -3,8 +3,10 @@ package access import ( "errors" "fmt" + "github.com/onflow/cadence/runtime/parser" "github.com/onflow/crypto" + "github.com/onflow/flow-go/module" "github.com/onflow/flow-go/model/flow" diff --git a/cmd/access/node_builder/access_node_builder.go b/cmd/access/node_builder/access_node_builder.go index 6ec79994829..e4ec2bd6c33 100644 --- a/cmd/access/node_builder/access_node_builder.go +++ b/cmd/access/node_builder/access_node_builder.go @@ -273,42 +273,43 @@ type FlowAccessNodeBuilder struct { *AccessNodeConfig // components - FollowerState protocol.FollowerState - SyncCore *chainsync.Core - RpcEng *rpc.Engine - FollowerDistributor *consensuspubsub.FollowerDistributor - CollectionRPC access.AccessAPIClient - TransactionTimings *stdmap.TransactionTimings - CollectionsToMarkFinalized *stdmap.Times - CollectionsToMarkExecuted *stdmap.Times - BlocksToMarkExecuted *stdmap.Times - TransactionMetrics *metrics.TransactionCollector - RestMetrics *metrics.RestCollector - AccessMetrics module.AccessMetrics - PingMetrics module.PingMetrics - Committee hotstuff.DynamicCommittee - Finalized *flow.Header // latest finalized block that the node knows of at startup time - Pending []*flow.Header - FollowerCore module.HotStuffFollower - Validator hotstuff.Validator - ExecutionDataDownloader execution_data.Downloader - PublicBlobService network.BlobService - ExecutionDataRequester state_synchronization.ExecutionDataRequester - ExecutionDataStore execution_data.ExecutionDataStore - ExecutionDataBlobstore blobs.Blobstore - ExecutionDataCache *execdatacache.ExecutionDataCache - ExecutionIndexer *indexer.Indexer - ExecutionIndexerCore *indexer.IndexerCore - ScriptExecutor *backend.ScriptExecutor - RegistersAsyncStore *execution.RegistersAsyncStore - Reporter *index.Reporter - EventsIndex *index.EventsIndex - TxResultsIndex *index.TransactionResultsIndex - IndexerDependencies *cmd.DependencyList - collectionExecutedMetric module.CollectionExecutedMetric - ExecutionDataPruner *pruner.Pruner - ExecutionDataDatastore *badger.Datastore - ExecutionDataTracker tracker.Storage + FollowerState protocol.FollowerState + SyncCore *chainsync.Core + RpcEng *rpc.Engine + FollowerDistributor *consensuspubsub.FollowerDistributor + CollectionRPC access.AccessAPIClient + TransactionTimings *stdmap.TransactionTimings + CollectionsToMarkFinalized *stdmap.Times + CollectionsToMarkExecuted *stdmap.Times + BlocksToMarkExecuted *stdmap.Times + TransactionMetrics *metrics.TransactionCollector + TransactionValidationMetrics *metrics.TransactionValidationCollector + RestMetrics *metrics.RestCollector + AccessMetrics module.AccessMetrics + PingMetrics module.PingMetrics + Committee hotstuff.DynamicCommittee + Finalized *flow.Header // latest finalized block that the node knows of at startup time + Pending []*flow.Header + FollowerCore module.HotStuffFollower + Validator hotstuff.Validator + ExecutionDataDownloader execution_data.Downloader + PublicBlobService network.BlobService + ExecutionDataRequester state_synchronization.ExecutionDataRequester + ExecutionDataStore execution_data.ExecutionDataStore + ExecutionDataBlobstore blobs.Blobstore + ExecutionDataCache *execdatacache.ExecutionDataCache + ExecutionIndexer *indexer.Indexer + ExecutionIndexerCore *indexer.IndexerCore + ScriptExecutor *backend.ScriptExecutor + RegistersAsyncStore *execution.RegistersAsyncStore + Reporter *index.Reporter + EventsIndex *index.EventsIndex + TxResultsIndex *index.TransactionResultsIndex + IndexerDependencies *cmd.DependencyList + collectionExecutedMetric module.CollectionExecutedMetric + ExecutionDataPruner *pruner.Pruner + ExecutionDataDatastore *badger.Datastore + ExecutionDataTracker tracker.Storage // The sync engine participants provider is the libp2p peer store for the access node // which is not available until after the network has started. @@ -1612,6 +1613,10 @@ func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) { ) return nil }). + Module("transaction validation metrics", func(node *cmd.NodeConfig) error { + builder.TransactionValidationMetrics = metrics.NewTransactionValidationCollector() + return nil + }). Module("rest metrics", func(node *cmd.NodeConfig) error { m, err := metrics.NewRestCollector(routes.URLToRoute, node.MetricsRegisterer) if err != nil { @@ -1623,6 +1628,7 @@ func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) { Module("access metrics", func(node *cmd.NodeConfig) error { builder.AccessMetrics = metrics.NewAccessCollector( metrics.WithTransactionMetrics(builder.TransactionMetrics), + metrics.WithTransactionValidationMetrics(builder.TransactionValidationMetrics), metrics.WithBackendScriptsMetrics(builder.TransactionMetrics), metrics.WithRestMetrics(builder.RestMetrics), ) diff --git a/engine/access/rpc/backend/backend.go b/engine/access/rpc/backend/backend.go index c00813b16a5..70de1435b56 100644 --- a/engine/access/rpc/backend/backend.go +++ b/engine/access/rpc/backend/backend.go @@ -307,7 +307,7 @@ func identifierList(ids []string) (flow.IdentifierList, error) { func configureTransactionValidator( state protocol.State, chainID flow.ChainID, - transactionMetrics module.TransactionMetrics, + transactionMetrics module.TransactionValidationMetrics, ) *access.TransactionValidator { return access.NewTransactionValidator( access.NewProtocolStateBlocks(state), diff --git a/module/metrics.go b/module/metrics.go index 72ad09c1788..590f6143739 100644 --- a/module/metrics.go +++ b/module/metrics.go @@ -882,6 +882,7 @@ type AccessMetrics interface { RestMetrics GRPCConnectionPoolMetrics TransactionMetrics + TransactionValidationMetrics BackendScriptsMetrics // UpdateExecutionReceiptMaxHeight is called whenever we store an execution receipt from a block from a newer height diff --git a/module/metrics/access.go b/module/metrics/access.go index 1116f87f433..aacfe316c76 100644 --- a/module/metrics/access.go +++ b/module/metrics/access.go @@ -10,6 +10,12 @@ import ( type AccessCollectorOpts func(*AccessCollector) +func WithTransactionValidationMetrics(m module.TransactionValidationMetrics) AccessCollectorOpts { + return func(ac *AccessCollector) { + ac.TransactionValidationMetrics = m + } +} + func WithTransactionMetrics(m module.TransactionMetrics) AccessCollectorOpts { return func(ac *AccessCollector) { ac.TransactionMetrics = m @@ -31,6 +37,7 @@ func WithRestMetrics(m module.RestMetrics) AccessCollectorOpts { type AccessCollector struct { module.RestMetrics module.TransactionMetrics + module.TransactionValidationMetrics module.BackendScriptsMetrics connectionReused prometheus.Counter diff --git a/module/metrics/transaction.go b/module/metrics/transaction.go index 0c8a5416024..e888d9a4433 100644 --- a/module/metrics/transaction.go +++ b/module/metrics/transaction.go @@ -13,7 +13,6 @@ import ( ) type TransactionCollector struct { - *TransactionValidationCollector transactionTimings mempool.TransactionTimings log zerolog.Logger logTimeToFinalized bool @@ -33,7 +32,6 @@ type TransactionCollector struct { // interface check var _ module.BackendScriptsMetrics = (*TransactionCollector)(nil) -var _ module.TransactionMetrics = (*TransactionCollector)(nil) func NewTransactionCollector( log zerolog.Logger, @@ -136,7 +134,6 @@ func NewTransactionCollector( Subsystem: subsystemTransactionSubmission, Help: "histogram for the transaction size in kb of scripts used in GetTransactionResult", }), - TransactionValidationCollector: NewTransactionValidationCollector(), } return tc diff --git a/module/mock/transaction_metrics.go b/module/mock/transaction_metrics.go index 6eae359d2e6..9345b934a9a 100644 --- a/module/mock/transaction_metrics.go +++ b/module/mock/transaction_metrics.go @@ -44,16 +44,6 @@ func (_m *TransactionMetrics) TransactionSubmissionFailed() { _m.Called() } -// TransactionValidated provides a mock function with given fields: txID -func (_m *TransactionMetrics) TransactionValidated(txID flow.Identifier) { - _m.Called(txID) -} - -// TransactionValidationFailed provides a mock function with given fields: txID, reason -func (_m *TransactionMetrics) TransactionValidationFailed(txID flow.Identifier, reason string) { - _m.Called(txID, reason) -} - // NewTransactionMetrics creates a new instance of TransactionMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewTransactionMetrics(t interface { diff --git a/module/mock/transaction_validation_metrics.go b/module/mock/transaction_validation_metrics.go new file mode 100644 index 00000000000..9eb8136a843 --- /dev/null +++ b/module/mock/transaction_validation_metrics.go @@ -0,0 +1,37 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mock + +import ( + flow "github.com/onflow/flow-go/model/flow" + mock "github.com/stretchr/testify/mock" +) + +// TransactionValidationMetrics is an autogenerated mock type for the TransactionValidationMetrics type +type TransactionValidationMetrics struct { + mock.Mock +} + +// TransactionValidated provides a mock function with given fields: txID +func (_m *TransactionValidationMetrics) TransactionValidated(txID flow.Identifier) { + _m.Called(txID) +} + +// TransactionValidationFailed provides a mock function with given fields: txID, reason +func (_m *TransactionValidationMetrics) TransactionValidationFailed(txID flow.Identifier, reason string) { + _m.Called(txID, reason) +} + +// NewTransactionValidationMetrics creates a new instance of TransactionValidationMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewTransactionValidationMetrics(t interface { + mock.TestingT + Cleanup(func()) +}) *TransactionValidationMetrics { + mock := &TransactionValidationMetrics{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} From 2865fa8a58343da0491dd72650d2b1f7733bb3e6 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Mon, 22 Jul 2024 15:25:20 +0300 Subject: [PATCH 06/22] Added tx validation metrics to collection node metrics --- cmd/collection/main.go | 6 ------ engine/collection/ingest/engine.go | 3 +-- engine/collection/ingest/engine_test.go | 2 +- engine/testutil/nodes.go | 2 +- module/metrics.go | 1 + module/metrics/collection.go | 7 +++++-- module/mock/collection_metrics.go | 10 ++++++++++ 7 files changed, 19 insertions(+), 12 deletions(-) diff --git a/cmd/collection/main.go b/cmd/collection/main.go index 1dde0e9e5df..c3d1496918a 100644 --- a/cmd/collection/main.go +++ b/cmd/collection/main.go @@ -94,7 +94,6 @@ func main() { followerCore *hotstuff.FollowerLoop // follower hotstuff logic followerEng *followereng.ComplianceEngine colMetrics module.CollectionMetrics - txValidationMtrics module.TransactionValidationMetrics machineAccountMetrics module.MachineAccountMetrics err error @@ -271,10 +270,6 @@ func main() { colMetrics = metrics.NewCollectionCollector(node.Tracer) return nil }). - Module("transaction validation metrics", func(node *cmd.NodeConfig) error { - txValidationMtrics = metrics.NewTransactionValidationCollector() - return nil - }). Module("machine account metrics", func(node *cmd.NodeConfig) error { machineAccountMetrics = metrics.NewMachineAccountCollector(node.MetricsRegisterer, machineAccountInfo.FlowAddress()) return nil @@ -431,7 +426,6 @@ func main() { node.Metrics.Engine, node.Metrics.Mempool, colMetrics, - txValidationMtrics, node.Me, node.RootChainID.Chain(), pools, diff --git a/engine/collection/ingest/engine.go b/engine/collection/ingest/engine.go index 197f9e18877..3286f36f791 100644 --- a/engine/collection/ingest/engine.go +++ b/engine/collection/ingest/engine.go @@ -51,7 +51,6 @@ func New( engMetrics module.EngineMetrics, mempoolMetrics module.MempoolMetrics, colMetrics module.CollectionMetrics, - txValidationMetrics module.TransactionValidationMetrics, me module.Local, chain flow.Chain, pools *epochs.TransactionPools, @@ -72,7 +71,7 @@ func New( MaxTransactionByteSize: config.MaxTransactionByteSize, MaxCollectionByteSize: config.MaxCollectionByteSize, }, - txValidationMetrics, + colMetrics, limiter, ) diff --git a/engine/collection/ingest/engine_test.go b/engine/collection/ingest/engine_test.go index 7f8b0edaeec..7bef24a290a 100644 --- a/engine/collection/ingest/engine_test.go +++ b/engine/collection/ingest/engine_test.go @@ -126,7 +126,7 @@ func (suite *Suite) SetupTest() { suite.conf = DefaultConfig() chain := flow.Testnet.Chain() - suite.engine, err = New(log, net, suite.state, metrics, metrics, metrics, metrics, suite.me, chain, suite.pools, suite.conf, NewAddressRateLimiter(rate.Limit(1), 1)) + suite.engine, err = New(log, net, suite.state, metrics, metrics, metrics, suite.me, chain, suite.pools, suite.conf, NewAddressRateLimiter(rate.Limit(1), 1)) suite.Require().NoError(err) } diff --git a/engine/testutil/nodes.go b/engine/testutil/nodes.go index e33360a83ee..b6d1037b500 100644 --- a/engine/testutil/nodes.go +++ b/engine/testutil/nodes.go @@ -292,7 +292,7 @@ func CollectionNode(t *testing.T, hub *stub.Hub, identity bootstrap.NodeInfo, ro collections := storage.NewCollections(node.PublicDB, transactions) clusterPayloads := storage.NewClusterPayloads(node.Metrics, node.PublicDB) - ingestionEngine, err := collectioningest.New(node.Log, node.Net, node.State, node.Metrics, node.Metrics, node.Metrics, node.Metrics, node.Me, node.ChainID.Chain(), pools, collectioningest.DefaultConfig(), + ingestionEngine, err := collectioningest.New(node.Log, node.Net, node.State, node.Metrics, node.Metrics, node.Metrics, node.Me, node.ChainID.Chain(), pools, collectioningest.DefaultConfig(), ingest.NewAddressRateLimiter(rate.Limit(1), 10)) // 10 tps require.NoError(t, err) diff --git a/module/metrics.go b/module/metrics.go index 590f6143739..ae38cfae6ca 100644 --- a/module/metrics.go +++ b/module/metrics.go @@ -591,6 +591,7 @@ type CruiseCtlMetrics interface { } type CollectionMetrics interface { + TransactionValidationMetrics // TransactionIngested is called when a new transaction is ingested by the // node. It increments the total count of ingested transactions and starts // a tx->col span for the transaction. diff --git a/module/metrics/collection.go b/module/metrics/collection.go index fa97a28b679..557eab48b77 100644 --- a/module/metrics/collection.go +++ b/module/metrics/collection.go @@ -10,6 +10,7 @@ import ( ) type CollectionCollector struct { + module.TransactionValidationMetrics tracer module.Tracer transactionsIngested prometheus.Counter // tracks the number of ingested transactions finalizedHeight *prometheus.GaugeVec // tracks the finalized height @@ -17,11 +18,13 @@ type CollectionCollector struct { guarantees *prometheus.HistogramVec // counts the number/size of FINALIZED collections } +var _ module.CollectionMetrics = (*CollectionCollector)(nil) + func NewCollectionCollector(tracer module.Tracer) *CollectionCollector { cc := &CollectionCollector{ - tracer: tracer, - + TransactionValidationMetrics: NewTransactionValidationCollector(), + tracer: tracer, transactionsIngested: promauto.NewCounter(prometheus.CounterOpts{ Namespace: namespaceCollection, Name: "ingested_transactions_total", diff --git a/module/mock/collection_metrics.go b/module/mock/collection_metrics.go index bde071e902e..00f915638a8 100644 --- a/module/mock/collection_metrics.go +++ b/module/mock/collection_metrics.go @@ -29,6 +29,16 @@ func (_m *CollectionMetrics) TransactionIngested(txID flow.Identifier) { _m.Called(txID) } +// TransactionValidated provides a mock function with given fields: txID +func (_m *CollectionMetrics) TransactionValidated(txID flow.Identifier) { + _m.Called(txID) +} + +// TransactionValidationFailed provides a mock function with given fields: txID, reason +func (_m *CollectionMetrics) TransactionValidationFailed(txID flow.Identifier, reason string) { + _m.Called(txID, reason) +} + // NewCollectionMetrics creates a new instance of CollectionMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewCollectionMetrics(t interface { From 3224109af090efbd83d1dd0cc299893ce564cec7 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Mon, 22 Jul 2024 22:54:14 +0300 Subject: [PATCH 07/22] refactor validation method --- access/validator.go | 93 ++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 55 deletions(-) diff --git a/access/validator.go b/access/validator.go index 993abde9a88..7b123cf688b 100644 --- a/access/validator.go +++ b/access/validator.go @@ -74,6 +74,11 @@ type TransactionValidationOptions struct { MaxCollectionByteSize uint64 } +type ValidationStep struct { + check func(*flow.TransactionBody) error + failReason string +} + type TransactionValidator struct { blocks Blocks // for looking up blocks to check transaction expiry chain flow.Chain // for checking validity of addresses @@ -81,6 +86,8 @@ type TransactionValidator struct { serviceAccountAddress flow.Address limiter RateLimiter transactionValidationMetrics module.TransactionValidationMetrics + + validationSteps []ValidationStep } func NewTransactionValidator( @@ -89,7 +96,7 @@ func NewTransactionValidator( transactionValidationMetrics module.TransactionValidationMetrics, options TransactionValidationOptions, ) *TransactionValidator { - return &TransactionValidator{ + txValidator := &TransactionValidator{ blocks: blocks, chain: chain, options: options, @@ -97,6 +104,10 @@ func NewTransactionValidator( limiter: NewNoopLimiter(), transactionValidationMetrics: transactionValidationMetrics, } + + initValidationSteps(txValidator) + + return txValidator } func NewTransactionValidatorWithLimiter( @@ -106,7 +117,7 @@ func NewTransactionValidatorWithLimiter( transactionValidationMetrics module.TransactionValidationMetrics, rateLimiter RateLimiter, ) *TransactionValidator { - return &TransactionValidator{ + txValidator := &TransactionValidator{ blocks: blocks, chain: chain, options: options, @@ -114,65 +125,37 @@ func NewTransactionValidatorWithLimiter( limiter: rateLimiter, transactionValidationMetrics: transactionValidationMetrics, } -} - -func (v *TransactionValidator) Validate(tx *flow.TransactionBody) (err error) { - // rate limit transactions for specific payers. - // a short term solution to prevent attacks that send too many failed transactions - // if a transaction is from a payer that should be rate limited, all the following - // checks will be skipped - err = v.checkRateLimitPayer(tx) - if err != nil { - v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "InvalidTxRateLimited") - return err - } - - err = v.checkTxSizeLimit(tx) - if err != nil { - v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "InvalidTxByteSizeError") - return err - } - err = v.checkMissingFields(tx) - if err != nil { - v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "IncompleteTransactionError") - return err - } + initValidationSteps(txValidator) - err = v.checkGasLimit(tx) - if err != nil { - v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "InvalidGasLimitError") - return err - } - - err = v.checkExpiry(tx) - if err != nil { - v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "ExpiredTransactionError") - return err - } + return txValidator +} - err = v.checkCanBeParsed(tx) - if err != nil { - v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "InvalidScriptError") - return err - } - - err = v.checkAddresses(tx) - if err != nil { - v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "InvalidAddressError") - return err +func initValidationSteps(txValidator *TransactionValidator) { + txValidator.validationSteps = []ValidationStep{ + // rate limit transactions for specific payers. + // a short term solution to prevent attacks that send too many failed transactions + // if a transaction is from a payer that should be rate limited, all the following + // checks will be skipped + {txValidator.checkRateLimitPayer, "invalid transaction rate limit"}, + {txValidator.checkTxSizeLimit, "invalid transaction byte size"}, + {txValidator.checkMissingFields, "incomplete transaction"}, + {txValidator.checkGasLimit, "invalid gas limit"}, + {txValidator.checkExpiry, "expired transaction"}, + {txValidator.checkCanBeParsed, "invalid script"}, + {txValidator.checkAddresses, "invalid address"}, + {txValidator.checkSignatureFormat, "invalid signature"}, + {txValidator.checkSignatureDuplications, "duplicated signature"}, } +} - err = v.checkSignatureFormat(tx) - if err != nil { - v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "InvalidSignatureError") - return err - } +func (v *TransactionValidator) Validate(tx *flow.TransactionBody) (err error) { - err = v.checkSignatureDuplications(tx) - if err != nil { - v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "DuplicatedSignatureError") - return err + for _, step := range v.validationSteps { + if err = step.check(tx); err != nil { + v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), step.failReason) + return err + } } // TODO replace checkSignatureFormat by verifying the account/payer signatures From 1430dc3f72bd56fdd05584d2efab23ca496c16b0 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Mon, 22 Jul 2024 23:55:14 +0300 Subject: [PATCH 08/22] Fixed imports --- access/validator.go | 11 ++++------- access/validator_test.go | 5 ++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/access/validator.go b/access/validator.go index 9c7216f4f91..9530aa825ce 100644 --- a/access/validator.go +++ b/access/validator.go @@ -5,22 +5,19 @@ import ( "errors" "fmt" - "github.com/onflow/flow-core-contracts/lib/go/templates" - - "github.com/onflow/flow-go/fvm/systemcontracts" + "github.com/rs/zerolog/log" "github.com/onflow/cadence" jsoncdc "github.com/onflow/cadence/encoding/json" "github.com/onflow/cadence/runtime/parser" "github.com/onflow/crypto" - - "github.com/rs/zerolog/log" - - "github.com/onflow/flow-go/module" + "github.com/onflow/flow-core-contracts/lib/go/templates" cadenceutils "github.com/onflow/flow-go/access/utils" "github.com/onflow/flow-go/fvm" + "github.com/onflow/flow-go/fvm/systemcontracts" "github.com/onflow/flow-go/model/flow" + "github.com/onflow/flow-go/module" "github.com/onflow/flow-go/module/execution" "github.com/onflow/flow-go/state" "github.com/onflow/flow-go/state/protocol" diff --git a/access/validator_test.go b/access/validator_test.go index 0871e7242b3..87b7ade62a9 100644 --- a/access/validator_test.go +++ b/access/validator_test.go @@ -5,9 +5,6 @@ import ( "errors" "testing" - "github.com/onflow/flow-go/module" - "github.com/onflow/flow-go/module/metrics" - "github.com/onflow/cadence" "github.com/onflow/cadence/runtime/common" "github.com/stretchr/testify/assert" @@ -20,7 +17,9 @@ import ( accessmock "github.com/onflow/flow-go/access/mock" "github.com/onflow/flow-go/fvm" "github.com/onflow/flow-go/model/flow" + "github.com/onflow/flow-go/module" execmock "github.com/onflow/flow-go/module/execution/mock" + "github.com/onflow/flow-go/module/metrics" "github.com/onflow/flow-go/utils/unittest" ) From 4e5d1e41bb0e0977c98e8001119510cff4a2ee55 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Thu, 25 Jul 2024 18:34:19 +0300 Subject: [PATCH 09/22] Fixed remarks --- access/validator.go | 47 ++++++++++++------- module/metrics.go | 4 +- module/metrics/noop.go | 4 +- module/metrics/transaction_validation.go | 19 ++++---- module/mock/access_metrics.go | 12 ++--- module/mock/collection_metrics.go | 12 ++--- module/mock/transaction_validation_metrics.go | 17 +++---- 7 files changed, 62 insertions(+), 53 deletions(-) diff --git a/access/validator.go b/access/validator.go index 9530aa825ce..1ab7cf6a0bb 100644 --- a/access/validator.go +++ b/access/validator.go @@ -23,6 +23,19 @@ import ( "github.com/onflow/flow-go/state/protocol" ) +const ( + InvalidTransactionRateLimit = "invalid transaction rate limit" + InvalidTransactionByteSize = "invalid transaction byte size" + IncompleteTransaction = "incomplete transaction" + InvalidGasLimit = "invalid gas limit" + ExpiredTransaction = "expired transaction" + InvalidScript = "invalid script" + InvalidAddresses = "invalid address" + InvalidSignature = "invalid signature" + DuplicatedSignature = "duplicated signature" + InsufficientBalance = "insufficient balance" +) + type Blocks interface { HeaderByID(id flow.Identifier) (*flow.Header, error) FinalizedHeader() (*flow.Header, error) @@ -131,7 +144,7 @@ func NewTransactionValidator( transactionValidationMetrics: transactionValidationMetrics, } - initValidationSteps(txValidator) + txValidator.initValidationSteps() return txValidator, nil } @@ -152,26 +165,26 @@ func NewTransactionValidatorWithLimiter( transactionValidationMetrics: transactionValidationMetrics, } - initValidationSteps(txValidator) + txValidator.initValidationSteps() return txValidator } -func initValidationSteps(txValidator *TransactionValidator) { - txValidator.validationSteps = []ValidationStep{ +func (v *TransactionValidator) initValidationSteps() { + v.validationSteps = []ValidationStep{ // rate limit transactions for specific payers. // a short term solution to prevent attacks that send too many failed transactions // if a transaction is from a payer that should be rate limited, all the following // checks will be skipped - {txValidator.checkRateLimitPayer, "invalid transaction rate limit"}, - {txValidator.checkTxSizeLimit, "invalid transaction byte size"}, - {txValidator.checkMissingFields, "incomplete transaction"}, - {txValidator.checkGasLimit, "invalid gas limit"}, - {txValidator.checkExpiry, "expired transaction"}, - {txValidator.checkCanBeParsed, "invalid script"}, - {txValidator.checkAddresses, "invalid address"}, - {txValidator.checkSignatureFormat, "invalid signature"}, - {txValidator.checkSignatureDuplications, "duplicated signature"}, + {v.checkRateLimitPayer, InvalidTransactionRateLimit}, + {v.checkTxSizeLimit, InvalidTransactionByteSize}, + {v.checkMissingFields, IncompleteTransaction}, + {v.checkGasLimit, InvalidGasLimit}, + {v.checkExpiry, ExpiredTransaction}, + {v.checkCanBeParsed, InvalidScript}, + {v.checkAddresses, InvalidAddresses}, + {v.checkSignatureFormat, InvalidSignature}, + {v.checkSignatureDuplications, DuplicatedSignature}, } } @@ -179,7 +192,7 @@ func (v *TransactionValidator) Validate(ctx context.Context, tx *flow.Transactio for _, step := range v.validationSteps { if err = step.check(tx); err != nil { - v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), step.failReason) + v.transactionValidationMetrics.TransactionValidationFailed(step.failReason) return err } } @@ -191,7 +204,7 @@ func (v *TransactionValidator) Validate(ctx context.Context, tx *flow.Transactio // are 'internal' and related to script execution process. they shouldn't // prevent the transaction from proceeding. if IsInsufficientBalanceError(err) { - v.transactionValidationMetrics.TransactionValidationFailed(tx.ID(), "insufficient balance") + v.transactionValidationMetrics.TransactionValidationFailed(InsufficientBalance) return err } @@ -201,7 +214,7 @@ func (v *TransactionValidator) Validate(ctx context.Context, tx *flow.Transactio // TODO replace checkSignatureFormat by verifying the account/payer signatures - v.transactionValidationMetrics.TransactionValidated(tx.ID()) + v.transactionValidationMetrics.TransactionValidated() return nil } @@ -421,7 +434,7 @@ func (v *TransactionValidator) checkSufficientBalanceToPayForTransaction(ctx con } // return no error if payer has sufficient balance - if canExecuteTransaction { + if bool(canExecuteTransaction) { return nil } diff --git a/module/metrics.go b/module/metrics.go index fd5dd9c70cd..2f3b6da7f8f 100644 --- a/module/metrics.go +++ b/module/metrics.go @@ -1073,9 +1073,9 @@ type TransactionMetrics interface { type TransactionValidationMetrics interface { // TransactionValidated tracks number of validated transactions - TransactionValidated(txID flow.Identifier) + TransactionValidated() // TransactionValidationFailed tracks number of validation failed transactions with reason - TransactionValidationFailed(txID flow.Identifier, reason string) + TransactionValidationFailed(reason string) } type PingMetrics interface { diff --git a/module/metrics/noop.go b/module/metrics/noop.go index 299704c4d5a..3d9c1c9254c 100644 --- a/module/metrics/noop.go +++ b/module/metrics/noop.go @@ -216,8 +216,8 @@ func (nc *NoopCollector) TransactionReceived(txID flow.Identifier, when time.Tim func (nc *NoopCollector) TransactionFinalized(txID flow.Identifier, when time.Time) {} func (nc *NoopCollector) TransactionExecuted(txID flow.Identifier, when time.Time) {} func (nc *NoopCollector) TransactionExpired(txID flow.Identifier) {} -func (nc *NoopCollector) TransactionValidated(txID flow.Identifier) {} -func (nc *NoopCollector) TransactionValidationFailed(txID flow.Identifier, reason string) {} +func (nc *NoopCollector) TransactionValidated() {} +func (nc *NoopCollector) TransactionValidationFailed(reason string) {} func (nc *NoopCollector) TransactionSubmissionFailed() {} func (nc *NoopCollector) UpdateExecutionReceiptMaxHeight(height uint64) {} func (nc *NoopCollector) UpdateLastFullBlockHeight(height uint64) {} diff --git a/module/metrics/transaction_validation.go b/module/metrics/transaction_validation.go index d39f62029b2..908c56b6c10 100644 --- a/module/metrics/transaction_validation.go +++ b/module/metrics/transaction_validation.go @@ -4,13 +4,12 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/module" ) // TransactionValidationCollector TODO type TransactionValidationCollector struct { - transactionValidated *prometheus.CounterVec + transactionValidated prometheus.Counter transactionValidationFailed *prometheus.CounterVec } @@ -19,27 +18,27 @@ var _ module.TransactionValidationMetrics = (*TransactionValidationCollector)(ni func NewTransactionValidationCollector() *TransactionValidationCollector { return &TransactionValidationCollector{ - transactionValidated: promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "transaction_validated_total", + transactionValidated: promauto.NewCounter(prometheus.CounterOpts{ + Name: "transaction_validation_succeeded", Namespace: namespaceAccess, Subsystem: subsystemTransactionValidation, Help: "counter for the validated transactions", - }, []string{"txID"}), + }), transactionValidationFailed: promauto.NewCounterVec(prometheus.CounterOpts{ Name: "transaction_validation_failed", Namespace: namespaceAccess, Subsystem: subsystemTransactionValidation, Help: "counter for the failed transactions validation", - }, []string{"txID", "reason"}), + }, []string{"reason"}), } } // TransactionValidated TODO -func (tc *TransactionValidationCollector) TransactionValidated(txID flow.Identifier) { - tc.transactionValidated.WithLabelValues(txID.String()).Inc() +func (tc *TransactionValidationCollector) TransactionValidated() { + tc.transactionValidated.Inc() } // TransactionValidationFailed TODO -func (tc *TransactionValidationCollector) TransactionValidationFailed(txID flow.Identifier, reason string) { - tc.transactionValidationFailed.WithLabelValues(txID.String(), reason).Inc() +func (tc *TransactionValidationCollector) TransactionValidationFailed(reason string) { + tc.transactionValidationFailed.WithLabelValues(reason).Inc() } diff --git a/module/mock/access_metrics.go b/module/mock/access_metrics.go index 1b3050f0324..d9389e84dec 100644 --- a/module/mock/access_metrics.go +++ b/module/mock/access_metrics.go @@ -143,14 +143,14 @@ func (_m *AccessMetrics) TransactionSubmissionFailed() { _m.Called() } -// TransactionValidated provides a mock function with given fields: txID -func (_m *AccessMetrics) TransactionValidated(txID flow.Identifier) { - _m.Called(txID) +// TransactionValidated provides a mock function with given fields: +func (_m *AccessMetrics) TransactionValidated() { + _m.Called() } -// TransactionValidationFailed provides a mock function with given fields: txID, reason -func (_m *AccessMetrics) TransactionValidationFailed(txID flow.Identifier, reason string) { - _m.Called(txID, reason) +// TransactionValidationFailed provides a mock function with given fields: reason +func (_m *AccessMetrics) TransactionValidationFailed(reason string) { + _m.Called(reason) } // UpdateExecutionReceiptMaxHeight provides a mock function with given fields: height diff --git a/module/mock/collection_metrics.go b/module/mock/collection_metrics.go index 00f915638a8..c0e823aaa67 100644 --- a/module/mock/collection_metrics.go +++ b/module/mock/collection_metrics.go @@ -29,14 +29,14 @@ func (_m *CollectionMetrics) TransactionIngested(txID flow.Identifier) { _m.Called(txID) } -// TransactionValidated provides a mock function with given fields: txID -func (_m *CollectionMetrics) TransactionValidated(txID flow.Identifier) { - _m.Called(txID) +// TransactionValidated provides a mock function with given fields: +func (_m *CollectionMetrics) TransactionValidated() { + _m.Called() } -// TransactionValidationFailed provides a mock function with given fields: txID, reason -func (_m *CollectionMetrics) TransactionValidationFailed(txID flow.Identifier, reason string) { - _m.Called(txID, reason) +// TransactionValidationFailed provides a mock function with given fields: reason +func (_m *CollectionMetrics) TransactionValidationFailed(reason string) { + _m.Called(reason) } // NewCollectionMetrics creates a new instance of CollectionMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. diff --git a/module/mock/transaction_validation_metrics.go b/module/mock/transaction_validation_metrics.go index 9eb8136a843..f67105ee845 100644 --- a/module/mock/transaction_validation_metrics.go +++ b/module/mock/transaction_validation_metrics.go @@ -2,24 +2,21 @@ package mock -import ( - flow "github.com/onflow/flow-go/model/flow" - mock "github.com/stretchr/testify/mock" -) +import mock "github.com/stretchr/testify/mock" // TransactionValidationMetrics is an autogenerated mock type for the TransactionValidationMetrics type type TransactionValidationMetrics struct { mock.Mock } -// TransactionValidated provides a mock function with given fields: txID -func (_m *TransactionValidationMetrics) TransactionValidated(txID flow.Identifier) { - _m.Called(txID) +// TransactionValidated provides a mock function with given fields: +func (_m *TransactionValidationMetrics) TransactionValidated() { + _m.Called() } -// TransactionValidationFailed provides a mock function with given fields: txID, reason -func (_m *TransactionValidationMetrics) TransactionValidationFailed(txID flow.Identifier, reason string) { - _m.Called(txID, reason) +// TransactionValidationFailed provides a mock function with given fields: reason +func (_m *TransactionValidationMetrics) TransactionValidationFailed(reason string) { + _m.Called(reason) } // NewTransactionValidationMetrics creates a new instance of TransactionValidationMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. From 059889d197735274353261c471d53912328aa1a4 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Thu, 25 Jul 2024 18:49:01 +0300 Subject: [PATCH 10/22] Added comments --- .../node_builder/access_node_builder.go | 2 +- module/metrics.go | 2 +- module/metrics/collection.go | 2 +- module/metrics/transaction_validation.go | 20 +++++++++++++------ 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/cmd/access/node_builder/access_node_builder.go b/cmd/access/node_builder/access_node_builder.go index a1c8f79b269..539cfb644a3 100644 --- a/cmd/access/node_builder/access_node_builder.go +++ b/cmd/access/node_builder/access_node_builder.go @@ -1624,7 +1624,7 @@ func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) { return nil }). Module("transaction validation metrics", func(node *cmd.NodeConfig) error { - builder.TransactionValidationMetrics = metrics.NewTransactionValidationCollector() + builder.TransactionValidationMetrics = metrics.NewTransactionValidationCollector(metrics.AccessNamespace) return nil }). Module("rest metrics", func(node *cmd.NodeConfig) error { diff --git a/module/metrics.go b/module/metrics.go index 2f3b6da7f8f..bb02652ff2e 100644 --- a/module/metrics.go +++ b/module/metrics.go @@ -1072,7 +1072,7 @@ type TransactionMetrics interface { } type TransactionValidationMetrics interface { - // TransactionValidated tracks number of validated transactions + // TransactionValidated tracks number of successfully validated transactions TransactionValidated() // TransactionValidationFailed tracks number of validation failed transactions with reason TransactionValidationFailed(reason string) diff --git a/module/metrics/collection.go b/module/metrics/collection.go index 557eab48b77..5961c3689c2 100644 --- a/module/metrics/collection.go +++ b/module/metrics/collection.go @@ -23,7 +23,7 @@ var _ module.CollectionMetrics = (*CollectionCollector)(nil) func NewCollectionCollector(tracer module.Tracer) *CollectionCollector { cc := &CollectionCollector{ - TransactionValidationMetrics: NewTransactionValidationCollector(), + TransactionValidationMetrics: NewTransactionValidationCollector(CollectionNamespace), tracer: tracer, transactionsIngested: promauto.NewCounter(prometheus.CounterOpts{ Namespace: namespaceCollection, diff --git a/module/metrics/transaction_validation.go b/module/metrics/transaction_validation.go index 908c56b6c10..6cc941af89c 100644 --- a/module/metrics/transaction_validation.go +++ b/module/metrics/transaction_validation.go @@ -7,7 +7,14 @@ import ( "github.com/onflow/flow-go/module" ) -// TransactionValidationCollector TODO +type NamespaceType string + +const ( + AccessNamespace NamespaceType = namespaceAccess + CollectionNamespace NamespaceType = namespaceCollection +) + +// TransactionValidationCollector the metrics for transaction validation functionality type TransactionValidationCollector struct { transactionValidated prometheus.Counter transactionValidationFailed *prometheus.CounterVec @@ -16,29 +23,30 @@ type TransactionValidationCollector struct { // interface check var _ module.TransactionValidationMetrics = (*TransactionValidationCollector)(nil) -func NewTransactionValidationCollector() *TransactionValidationCollector { +// NewTransactionValidationCollector creates new instance of TransactionValidationCollector +func NewTransactionValidationCollector(namespace NamespaceType) *TransactionValidationCollector { return &TransactionValidationCollector{ transactionValidated: promauto.NewCounter(prometheus.CounterOpts{ Name: "transaction_validation_succeeded", - Namespace: namespaceAccess, + Namespace: string(namespace), Subsystem: subsystemTransactionValidation, Help: "counter for the validated transactions", }), transactionValidationFailed: promauto.NewCounterVec(prometheus.CounterOpts{ Name: "transaction_validation_failed", - Namespace: namespaceAccess, + Namespace: string(namespace), Subsystem: subsystemTransactionValidation, Help: "counter for the failed transactions validation", }, []string{"reason"}), } } -// TransactionValidated TODO +// TransactionValidated tracks number of successfully validated transactions func (tc *TransactionValidationCollector) TransactionValidated() { tc.transactionValidated.Inc() } -// TransactionValidationFailed TODO +// TransactionValidationFailed tracks number of validation failed transactions with reason func (tc *TransactionValidationCollector) TransactionValidationFailed(reason string) { tc.transactionValidationFailed.WithLabelValues(reason).Inc() } From e01131d746fb68d0eef78c548f9ab084f3d29d4b Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Tue, 30 Jul 2024 13:39:29 +0300 Subject: [PATCH 11/22] Update access/validator.go Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com> --- access/validator.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/access/validator.go b/access/validator.go index 1ab7cf6a0bb..32ff580adbb 100644 --- a/access/validator.go +++ b/access/validator.go @@ -24,16 +24,16 @@ import ( ) const ( - InvalidTransactionRateLimit = "invalid transaction rate limit" - InvalidTransactionByteSize = "invalid transaction byte size" - IncompleteTransaction = "incomplete transaction" - InvalidGasLimit = "invalid gas limit" - ExpiredTransaction = "expired transaction" - InvalidScript = "invalid script" - InvalidAddresses = "invalid address" - InvalidSignature = "invalid signature" - DuplicatedSignature = "duplicated signature" - InsufficientBalance = "insufficient balance" + InvalidTransactionRateLimit = "payer_exceeded_ratelimit" + InvalidTransactionByteSize = "transaction_exceeded_size_limit" + IncompleteTransaction = "missing_fields" + InvalidGasLimit = "invalid_gas_limit" + ExpiredTransaction = "transaction_expired" + InvalidScript = "invalid_script" + InvalidAddresses = "invalid_address" + InvalidSignature = "invalid_signature" + DuplicatedSignature = "duplicate_signature" + InsufficientBalance = "payer_insufficient_balance" ) type Blocks interface { From 3986b90bb3f52eb8d2bd9cc85a91d9ae817a2526 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Tue, 30 Jul 2024 14:04:04 +0300 Subject: [PATCH 12/22] make constant private in module --- access/validator.go | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/access/validator.go b/access/validator.go index 32ff580adbb..b4efe602cd5 100644 --- a/access/validator.go +++ b/access/validator.go @@ -24,16 +24,16 @@ import ( ) const ( - InvalidTransactionRateLimit = "payer_exceeded_ratelimit" - InvalidTransactionByteSize = "transaction_exceeded_size_limit" - IncompleteTransaction = "missing_fields" - InvalidGasLimit = "invalid_gas_limit" - ExpiredTransaction = "transaction_expired" - InvalidScript = "invalid_script" - InvalidAddresses = "invalid_address" - InvalidSignature = "invalid_signature" - DuplicatedSignature = "duplicate_signature" - InsufficientBalance = "payer_insufficient_balance" + invalidTransactionRateLimit = "payer_exceeded_ratelimit" + invalidTransactionByteSize = "transaction_exceeded_size_limit" + incompleteTransaction = "missing_fields" + invalidGasLimit = "invalid_gas_limit" + expiredTransaction = "transaction_expired" + invalidScript = "invalid_script" + invalidAddresses = "invalid_address" + invalidSignature = "invalid_signature" + duplicatedSignature = "duplicate_signature" + insufficientBalance = "payer_insufficient_balance" ) type Blocks interface { @@ -176,15 +176,15 @@ func (v *TransactionValidator) initValidationSteps() { // a short term solution to prevent attacks that send too many failed transactions // if a transaction is from a payer that should be rate limited, all the following // checks will be skipped - {v.checkRateLimitPayer, InvalidTransactionRateLimit}, - {v.checkTxSizeLimit, InvalidTransactionByteSize}, - {v.checkMissingFields, IncompleteTransaction}, - {v.checkGasLimit, InvalidGasLimit}, - {v.checkExpiry, ExpiredTransaction}, - {v.checkCanBeParsed, InvalidScript}, - {v.checkAddresses, InvalidAddresses}, - {v.checkSignatureFormat, InvalidSignature}, - {v.checkSignatureDuplications, DuplicatedSignature}, + {v.checkRateLimitPayer, invalidTransactionRateLimit}, + {v.checkTxSizeLimit, invalidTransactionByteSize}, + {v.checkMissingFields, incompleteTransaction}, + {v.checkGasLimit, invalidGasLimit}, + {v.checkExpiry, expiredTransaction}, + {v.checkCanBeParsed, invalidScript}, + {v.checkAddresses, invalidAddresses}, + {v.checkSignatureFormat, invalidSignature}, + {v.checkSignatureDuplications, duplicatedSignature}, } } @@ -204,7 +204,7 @@ func (v *TransactionValidator) Validate(ctx context.Context, tx *flow.Transactio // are 'internal' and related to script execution process. they shouldn't // prevent the transaction from proceeding. if IsInsufficientBalanceError(err) { - v.transactionValidationMetrics.TransactionValidationFailed(InsufficientBalance) + v.transactionValidationMetrics.TransactionValidationFailed(insufficientBalance) return err } From 67088f13720bc18b77df71ff05b3e77997478da6 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Tue, 30 Jul 2024 14:04:32 +0300 Subject: [PATCH 13/22] fixed typo --- access/validator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/access/validator.go b/access/validator.go index b4efe602cd5..d5aed3cba9e 100644 --- a/access/validator.go +++ b/access/validator.go @@ -24,7 +24,7 @@ import ( ) const ( - invalidTransactionRateLimit = "payer_exceeded_ratelimit" + invalidTransactionRateLimit = "payer_exceeded_rate_limit" invalidTransactionByteSize = "transaction_exceeded_size_limit" incompleteTransaction = "missing_fields" invalidGasLimit = "invalid_gas_limit" From dea4035c0d6173e4945c8627a81dc33a68bb8f52 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Tue, 30 Jul 2024 15:42:18 +0300 Subject: [PATCH 14/22] Fixed emulator issue --- integration/go.mod | 5 ++++- integration/go.sum | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/integration/go.mod b/integration/go.mod index 454980613ac..f4bc6f3a10c 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -24,7 +24,7 @@ require ( github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f - github.com/onflow/flow-go v0.36.8-0.20240729193633-433a32eeb0cd + github.com/onflow/flow-go v0.36.8-0.20240729205403-18c8533fa521 github.com/onflow/flow-go-sdk v1.0.0-preview.44 github.com/onflow/flow-go/insecure v0.0.0-00010101000000-000000000000 github.com/onflow/flow/protobuf/go/flow v0.4.5 @@ -358,3 +358,6 @@ require ( replace github.com/onflow/flow-go => ../ replace github.com/onflow/flow-go/insecure => ../insecure + +//TODO: Should be rmoved, when emulator part will be merged +replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240730123659-82e94c205df3 diff --git a/integration/go.sum b/integration/go.sum index b37d46e2bc0..dbb716d82ac 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -999,6 +999,8 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= +github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240730123659-82e94c205df3 h1:oA3q3NGq3tvCnTMFr2eZc76IxnYVVUm5FyAPG9RzWa0= +github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240730123659-82e94c205df3/go.mod h1:1nrWbImsy29n5wSu/hCPWZ3ckrVYBjX+TwDJm3hm1h4= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= @@ -2150,8 +2152,6 @@ github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 h1:q9tXLIALwQ76bO4 github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1/go.mod h1:u/mkP/B+PbV33tEG3qfkhhBlydSvAKxfLZSfB4lsJHg= github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 h1:FfhMBAb78p6VAWkJ+iqdKLErGQVQgxk5w6DP5ZruWX8= github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1/go.mod h1:NgbMOYnMh0GN48VsNKZuiwK7uyk38Wyo8jN9+C9QE30= -github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f h1:2Ejpmm2Vrl/XLaE6lniE1vNfi6WYhzqHiCk6oomGoFE= -github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f/go.mod h1:0rqp896zEcjNqqDiQNBUlpS/7nzS4+E+yG/4s0P13bQ= github.com/onflow/flow-ft/lib/go/contracts v1.0.0 h1:mToacZ5NWqtlWwk/7RgIl/jeKB/Sy/tIXdw90yKHcV0= github.com/onflow/flow-ft/lib/go/contracts v1.0.0/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A= github.com/onflow/flow-ft/lib/go/templates v1.0.0 h1:6cMS/lUJJ17HjKBfMO/eh0GGvnpElPgBXx7h5aoWJhs= From 8152bcacfa3194a41870c6f50e0af97f1f1837d3 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Thu, 1 Aug 2024 17:26:07 +0300 Subject: [PATCH 15/22] Fixed remarks --- access/validator.go | 34 ++++++------------- .../node_builder/access_node_builder.go | 2 +- module/metrics/collection.go | 2 +- module/metrics/labels.go | 14 ++++++++ module/metrics/transaction_validation.go | 13 +++---- 5 files changed, 31 insertions(+), 34 deletions(-) diff --git a/access/validator.go b/access/validator.go index d5aed3cba9e..80f64ac97e9 100644 --- a/access/validator.go +++ b/access/validator.go @@ -19,23 +19,11 @@ import ( "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/module" "github.com/onflow/flow-go/module/execution" + "github.com/onflow/flow-go/module/metrics" "github.com/onflow/flow-go/state" "github.com/onflow/flow-go/state/protocol" ) -const ( - invalidTransactionRateLimit = "payer_exceeded_rate_limit" - invalidTransactionByteSize = "transaction_exceeded_size_limit" - incompleteTransaction = "missing_fields" - invalidGasLimit = "invalid_gas_limit" - expiredTransaction = "transaction_expired" - invalidScript = "invalid_script" - invalidAddresses = "invalid_address" - invalidSignature = "invalid_signature" - duplicatedSignature = "duplicate_signature" - insufficientBalance = "payer_insufficient_balance" -) - type Blocks interface { HeaderByID(id flow.Identifier) (*flow.Header, error) FinalizedHeader() (*flow.Header, error) @@ -176,15 +164,15 @@ func (v *TransactionValidator) initValidationSteps() { // a short term solution to prevent attacks that send too many failed transactions // if a transaction is from a payer that should be rate limited, all the following // checks will be skipped - {v.checkRateLimitPayer, invalidTransactionRateLimit}, - {v.checkTxSizeLimit, invalidTransactionByteSize}, - {v.checkMissingFields, incompleteTransaction}, - {v.checkGasLimit, invalidGasLimit}, - {v.checkExpiry, expiredTransaction}, - {v.checkCanBeParsed, invalidScript}, - {v.checkAddresses, invalidAddresses}, - {v.checkSignatureFormat, invalidSignature}, - {v.checkSignatureDuplications, duplicatedSignature}, + {v.checkRateLimitPayer, metrics.InvalidTransactionRateLimit}, + {v.checkTxSizeLimit, metrics.InvalidTransactionByteSize}, + {v.checkMissingFields, metrics.IncompleteTransaction}, + {v.checkGasLimit, metrics.InvalidGasLimit}, + {v.checkExpiry, metrics.ExpiredTransaction}, + {v.checkCanBeParsed, metrics.InvalidScript}, + {v.checkAddresses, metrics.InvalidAddresses}, + {v.checkSignatureFormat, metrics.InvalidSignature}, + {v.checkSignatureDuplications, metrics.DuplicatedSignature}, } } @@ -204,7 +192,7 @@ func (v *TransactionValidator) Validate(ctx context.Context, tx *flow.Transactio // are 'internal' and related to script execution process. they shouldn't // prevent the transaction from proceeding. if IsInsufficientBalanceError(err) { - v.transactionValidationMetrics.TransactionValidationFailed(insufficientBalance) + v.transactionValidationMetrics.TransactionValidationFailed(metrics.InsufficientBalance) return err } diff --git a/cmd/access/node_builder/access_node_builder.go b/cmd/access/node_builder/access_node_builder.go index ba846d8cdb5..883d8c99855 100644 --- a/cmd/access/node_builder/access_node_builder.go +++ b/cmd/access/node_builder/access_node_builder.go @@ -1631,7 +1631,7 @@ func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) { return nil }). Module("transaction validation metrics", func(node *cmd.NodeConfig) error { - builder.TransactionValidationMetrics = metrics.NewTransactionValidationCollector(metrics.AccessNamespace) + builder.TransactionValidationMetrics = metrics.NewTransactionValidationCollector() return nil }). Module("rest metrics", func(node *cmd.NodeConfig) error { diff --git a/module/metrics/collection.go b/module/metrics/collection.go index 5961c3689c2..557eab48b77 100644 --- a/module/metrics/collection.go +++ b/module/metrics/collection.go @@ -23,7 +23,7 @@ var _ module.CollectionMetrics = (*CollectionCollector)(nil) func NewCollectionCollector(tracer module.Tracer) *CollectionCollector { cc := &CollectionCollector{ - TransactionValidationMetrics: NewTransactionValidationCollector(CollectionNamespace), + TransactionValidationMetrics: NewTransactionValidationCollector(), tracer: tracer, transactionsIngested: promauto.NewCounter(prometheus.CounterOpts{ Namespace: namespaceCollection, diff --git a/module/metrics/labels.go b/module/metrics/labels.go index 916f3e2bc07..82260ca3c5d 100644 --- a/module/metrics/labels.go +++ b/module/metrics/labels.go @@ -155,6 +155,20 @@ const ( MessageEntityResponse = "entity_response" ) +// transaction validation labels +const ( + InvalidTransactionRateLimit = "payer_exceeded_rate_limit" + InvalidTransactionByteSize = "transaction_exceeded_size_limit" + IncompleteTransaction = "missing_fields" + InvalidGasLimit = "invalid_gas_limit" + ExpiredTransaction = "transaction_expired" + InvalidScript = "invalid_script" + InvalidAddresses = "invalid_address" + InvalidSignature = "invalid_signature" + DuplicatedSignature = "duplicate_signature" + InsufficientBalance = "payer_insufficient_balance" +) + const ExecutionDataRequestRetryable = "retryable" const LabelViolationReason = "reason" diff --git a/module/metrics/transaction_validation.go b/module/metrics/transaction_validation.go index 6cc941af89c..53a1ec10fe5 100644 --- a/module/metrics/transaction_validation.go +++ b/module/metrics/transaction_validation.go @@ -9,11 +9,6 @@ import ( type NamespaceType string -const ( - AccessNamespace NamespaceType = namespaceAccess - CollectionNamespace NamespaceType = namespaceCollection -) - // TransactionValidationCollector the metrics for transaction validation functionality type TransactionValidationCollector struct { transactionValidated prometheus.Counter @@ -24,17 +19,17 @@ type TransactionValidationCollector struct { var _ module.TransactionValidationMetrics = (*TransactionValidationCollector)(nil) // NewTransactionValidationCollector creates new instance of TransactionValidationCollector -func NewTransactionValidationCollector(namespace NamespaceType) *TransactionValidationCollector { +func NewTransactionValidationCollector() *TransactionValidationCollector { return &TransactionValidationCollector{ transactionValidated: promauto.NewCounter(prometheus.CounterOpts{ - Name: "transaction_validation_succeeded", - Namespace: string(namespace), + Name: "transaction_validation_successes_total", + Namespace: namespaceAccess, Subsystem: subsystemTransactionValidation, Help: "counter for the validated transactions", }), transactionValidationFailed: promauto.NewCounterVec(prometheus.CounterOpts{ Name: "transaction_validation_failed", - Namespace: string(namespace), + Namespace: namespaceAccess, Subsystem: subsystemTransactionValidation, Help: "counter for the failed transactions validation", }, []string{"reason"}), From 0cd78523aaf234c02ed0163503fcfd5b55872238 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Mon, 12 Aug 2024 10:49:58 +0300 Subject: [PATCH 16/22] Added metrics for skipped transaction validation --- module/metrics.go | 2 ++ module/metrics/noop.go | 1 + module/metrics/transaction_validation.go | 16 ++++++++++++++-- module/mock/access_metrics.go | 5 +++++ module/mock/collection_metrics.go | 5 +++++ module/mock/transaction_validation_metrics.go | 5 +++++ 6 files changed, 32 insertions(+), 2 deletions(-) diff --git a/module/metrics.go b/module/metrics.go index 5073e567f98..f43c8b9325e 100644 --- a/module/metrics.go +++ b/module/metrics.go @@ -1092,6 +1092,8 @@ type TransactionValidationMetrics interface { TransactionValidated() // TransactionValidationFailed tracks number of validation failed transactions with reason TransactionValidationFailed(reason string) + // TransactionValidationSkipped tracks number of skipped transaction validations + TransactionValidationSkipped() } type PingMetrics interface { diff --git a/module/metrics/noop.go b/module/metrics/noop.go index aa0ae7512d7..17460bf460a 100644 --- a/module/metrics/noop.go +++ b/module/metrics/noop.go @@ -218,6 +218,7 @@ func (nc *NoopCollector) TransactionExecuted(txID flow.Identifier, when time.Tim func (nc *NoopCollector) TransactionExpired(txID flow.Identifier) {} func (nc *NoopCollector) TransactionValidated() {} func (nc *NoopCollector) TransactionValidationFailed(reason string) {} +func (nc *NoopCollector) TransactionValidationSkipped() {} func (nc *NoopCollector) TransactionSubmissionFailed() {} func (nc *NoopCollector) UpdateExecutionReceiptMaxHeight(height uint64) {} func (nc *NoopCollector) UpdateLastFullBlockHeight(height uint64) {} diff --git a/module/metrics/transaction_validation.go b/module/metrics/transaction_validation.go index 53a1ec10fe5..720d0e97a03 100644 --- a/module/metrics/transaction_validation.go +++ b/module/metrics/transaction_validation.go @@ -11,8 +11,9 @@ type NamespaceType string // TransactionValidationCollector the metrics for transaction validation functionality type TransactionValidationCollector struct { - transactionValidated prometheus.Counter - transactionValidationFailed *prometheus.CounterVec + transactionValidated prometheus.Counter + transactionValidationSkipped prometheus.Counter + transactionValidationFailed *prometheus.CounterVec } // interface check @@ -27,6 +28,12 @@ func NewTransactionValidationCollector() *TransactionValidationCollector { Subsystem: subsystemTransactionValidation, Help: "counter for the validated transactions", }), + transactionValidationSkipped: promauto.NewCounter(prometheus.CounterOpts{ + Name: "transaction_validation_skipped", + Namespace: namespaceAccess, + Subsystem: subsystemTransactionValidation, + Help: "counter for the skipped transaction validations", + }), transactionValidationFailed: promauto.NewCounterVec(prometheus.CounterOpts{ Name: "transaction_validation_failed", Namespace: namespaceAccess, @@ -45,3 +52,8 @@ func (tc *TransactionValidationCollector) TransactionValidated() { func (tc *TransactionValidationCollector) TransactionValidationFailed(reason string) { tc.transactionValidationFailed.WithLabelValues(reason).Inc() } + +// TransactionValidationSkipped tracks number of skipped transaction validations +func (tc *TransactionValidationCollector) TransactionValidationSkipped() { + tc.transactionValidationSkipped.Inc() +} diff --git a/module/mock/access_metrics.go b/module/mock/access_metrics.go index d9389e84dec..21ecc03740f 100644 --- a/module/mock/access_metrics.go +++ b/module/mock/access_metrics.go @@ -153,6 +153,11 @@ func (_m *AccessMetrics) TransactionValidationFailed(reason string) { _m.Called(reason) } +// TransactionValidationSkipped provides a mock function with given fields: +func (_m *AccessMetrics) TransactionValidationSkipped() { + _m.Called() +} + // UpdateExecutionReceiptMaxHeight provides a mock function with given fields: height func (_m *AccessMetrics) UpdateExecutionReceiptMaxHeight(height uint64) { _m.Called(height) diff --git a/module/mock/collection_metrics.go b/module/mock/collection_metrics.go index c0e823aaa67..34c5e7efee5 100644 --- a/module/mock/collection_metrics.go +++ b/module/mock/collection_metrics.go @@ -39,6 +39,11 @@ func (_m *CollectionMetrics) TransactionValidationFailed(reason string) { _m.Called(reason) } +// TransactionValidationSkipped provides a mock function with given fields: +func (_m *CollectionMetrics) TransactionValidationSkipped() { + _m.Called() +} + // NewCollectionMetrics creates a new instance of CollectionMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewCollectionMetrics(t interface { diff --git a/module/mock/transaction_validation_metrics.go b/module/mock/transaction_validation_metrics.go index f67105ee845..0003f6762f7 100644 --- a/module/mock/transaction_validation_metrics.go +++ b/module/mock/transaction_validation_metrics.go @@ -19,6 +19,11 @@ func (_m *TransactionValidationMetrics) TransactionValidationFailed(reason strin _m.Called(reason) } +// TransactionValidationSkipped provides a mock function with given fields: +func (_m *TransactionValidationMetrics) TransactionValidationSkipped() { + _m.Called() +} + // NewTransactionValidationMetrics creates a new instance of TransactionValidationMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewTransactionValidationMetrics(t interface { From 05d30f25ea5b0580d124e9a82c366456b5498c6b Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Tue, 13 Aug 2024 16:04:18 +0300 Subject: [PATCH 17/22] Apply suggestions from code review Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com> --- module/metrics/transaction_validation.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/metrics/transaction_validation.go b/module/metrics/transaction_validation.go index 720d0e97a03..70cfe2d7a6a 100644 --- a/module/metrics/transaction_validation.go +++ b/module/metrics/transaction_validation.go @@ -29,13 +29,13 @@ func NewTransactionValidationCollector() *TransactionValidationCollector { Help: "counter for the validated transactions", }), transactionValidationSkipped: promauto.NewCounter(prometheus.CounterOpts{ - Name: "transaction_validation_skipped", + Name: "transaction_validation_skipped_total", Namespace: namespaceAccess, Subsystem: subsystemTransactionValidation, Help: "counter for the skipped transaction validations", }), transactionValidationFailed: promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "transaction_validation_failed", + Name: "transaction_validation_failed_total", Namespace: namespaceAccess, Subsystem: subsystemTransactionValidation, Help: "counter for the failed transactions validation", From fa181d710c717995ea517c2e4bb33ce012db00d5 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Tue, 13 Aug 2024 16:07:07 +0300 Subject: [PATCH 18/22] Call skiped metric --- access/validator.go | 1 + 1 file changed, 1 insertion(+) diff --git a/access/validator.go b/access/validator.go index 80f64ac97e9..f0dec8071d0 100644 --- a/access/validator.go +++ b/access/validator.go @@ -197,6 +197,7 @@ func (v *TransactionValidator) Validate(ctx context.Context, tx *flow.Transactio } // log and ignore all other errors + v.transactionValidationMetrics.TransactionValidationSkipped() log.Info().Err(err).Msg("check payer validation skipped due to error") } From 45bba99e3ce3f398f8e1caf2ab21f2dfa09267d1 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Tue, 13 Aug 2024 16:29:14 +0300 Subject: [PATCH 19/22] Fixed emulator dependencies --- integration/go.mod | 4 ++-- integration/go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration/go.mod b/integration/go.mod index 39a7c296b77..4d8515f3463 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -25,7 +25,7 @@ require ( github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f - github.com/onflow/flow-go v0.36.8-0.20240729205403-18c8533fa521 + github.com/onflow/flow-go v0.37.0-crescendo-RC3.0.20240808013212-1dd0921e5306 github.com/onflow/flow-go-sdk v1.0.0-preview.50 github.com/onflow/flow-go/insecure v0.0.0-00010101000000-000000000000 github.com/onflow/flow/protobuf/go/flow v0.4.5 @@ -364,4 +364,4 @@ replace github.com/onflow/flow-go/insecure => ../insecure replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c //TODO: Should be rmoved, when emulator part will be merged -replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240730123659-82e94c205df3 +replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240813132717-b6afea8b14d9 diff --git a/integration/go.sum b/integration/go.sum index 637aa4b3b8b..1375fe0c20a 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -999,8 +999,8 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240730123659-82e94c205df3 h1:oA3q3NGq3tvCnTMFr2eZc76IxnYVVUm5FyAPG9RzWa0= -github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240730123659-82e94c205df3/go.mod h1:1nrWbImsy29n5wSu/hCPWZ3ckrVYBjX+TwDJm3hm1h4= +github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240813132717-b6afea8b14d9 h1:moeQhWeig0bXy4R7p8dX5ef1SUueB0+pw36aANaNgAk= +github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240813132717-b6afea8b14d9/go.mod h1:7ImmF0Y4HdRlhaNYWcVTc0SDuo3laXtEJaNfgElz5R4= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= From 2b52b790d5b415e7966bf7cfc2492bab879f50b0 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Tue, 27 Aug 2024 13:23:36 +0300 Subject: [PATCH 20/22] updated emulator --- integration/go.mod | 4 ++-- integration/go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration/go.mod b/integration/go.mod index 93735951a5e..c1f26cf8f4d 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -25,7 +25,7 @@ require ( github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f - github.com/onflow/flow-go v0.37.0-crescendo-RC3.0.20240808013212-1dd0921e5306 + github.com/onflow/flow-go v0.37.7-0.20240826193109-e211841b59f5 github.com/onflow/flow-go-sdk v1.0.0-preview.53 github.com/onflow/flow-go/insecure v0.0.0-00010101000000-000000000000 github.com/onflow/flow/protobuf/go/flow v0.4.5 @@ -364,4 +364,4 @@ replace github.com/onflow/flow-go/insecure => ../insecure replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c //TODO: Should be rmoved, when emulator part will be merged -replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240813132717-b6afea8b14d9 +replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240827102115-de43e06d2699 diff --git a/integration/go.sum b/integration/go.sum index e650ff30cee..20cf9fd149d 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -999,8 +999,8 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240813132717-b6afea8b14d9 h1:moeQhWeig0bXy4R7p8dX5ef1SUueB0+pw36aANaNgAk= -github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240813132717-b6afea8b14d9/go.mod h1:7ImmF0Y4HdRlhaNYWcVTc0SDuo3laXtEJaNfgElz5R4= +github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240827102115-de43e06d2699 h1:7RbiGHVo/RyZ+Qd9r1+WPdgH2nOLVW3AZvPQdn4TVac= +github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240827102115-de43e06d2699/go.mod h1:olkloG8iCvyqW1Eyg9kyzkzJJx+xR7chczDdh52PLUE= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= From c54ab220a769d54205c528008f7004d8c3e3ecf2 Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Thu, 29 Aug 2024 18:49:47 +0300 Subject: [PATCH 21/22] removed replace --- go.mod | 4 ++-- go.sum | 10 +++++++--- insecure/go.mod | 4 ++-- insecure/go.sum | 7 ++----- integration/go.mod | 5 +---- integration/go.sum | 8 ++++---- 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/go.mod b/go.mod index 54c7f970c47..35311028dca 100644 --- a/go.mod +++ b/go.mod @@ -54,7 +54,7 @@ require ( github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 github.com/onflow/flow-go-sdk v1.0.0-preview.53 - github.com/onflow/flow/protobuf/go/flow v0.4.5 + github.com/onflow/flow/protobuf/go/flow v0.4.6 github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 github.com/pierrec/lz4 v2.6.1+incompatible github.com/pkg/errors v0.9.1 @@ -255,13 +255,13 @@ require ( github.com/multiformats/go-multicodec v0.9.0 // indirect github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect - github.com/nxadm/tail v1.4.8 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/onflow/flow-ft/lib/go/contracts v1.0.0 // indirect github.com/onflow/flow-ft/lib/go/templates v1.0.0 // indirect github.com/onflow/flow-nft/lib/go/contracts v1.2.1 // indirect github.com/onflow/flow-nft/lib/go/templates v1.2.0 // indirect github.com/onflow/sdks v0.6.0-preview.1 // indirect + github.com/onsi/ginkgo v1.16.5 // indirect github.com/onsi/ginkgo/v2 v2.13.2 // indirect github.com/opencontainers/runtime-spec v1.1.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect diff --git a/go.sum b/go.sum index 1463899bfe0..ba0e842329e 100644 --- a/go.sum +++ b/go.sum @@ -1480,6 +1480,7 @@ github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= @@ -2193,8 +2194,8 @@ github.com/onflow/flow-nft/lib/go/contracts v1.2.1/go.mod h1:2gpbza+uzs1k7x31hkp github.com/onflow/flow-nft/lib/go/templates v1.2.0 h1:JSQyh9rg0RC+D1930BiRXN8lrtMs+ubVMK6aQPon6Yc= github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJe5Gqgr2eeH49QB6+s6ze00w0= github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= -github.com/onflow/flow/protobuf/go/flow v0.4.5 h1:6o+pgYGqwXdEhqSJxu2BdnDXkOQVOkfGAb6IiXB+NPM= -github.com/onflow/flow/protobuf/go/flow v0.4.5/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/onflow/flow/protobuf/go/flow v0.4.6 h1:KE/CsRVfyG5lGBtm1aNcjojMciQyS5GfPF3ixOWRfi0= +github.com/onflow/flow/protobuf/go/flow v0.4.6/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= @@ -2209,8 +2210,9 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.13.2 h1:Bi2gGVkfn6gQcjNjZJVO8Gf0FHzMPf2phUei9tejVMs= github.com/onsi/ginkgo/v2 v2.13.2/go.mod h1:XStQ8QcGwLyF4HdfcZB8SFOS/MWCgDuXMSBe6zrvLgM= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= @@ -2991,6 +2993,7 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -3181,6 +3184,7 @@ golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= diff --git a/insecure/go.mod b/insecure/go.mod index cb75a3ad34e..4eb97a8aab2 100644 --- a/insecure/go.mod +++ b/insecure/go.mod @@ -200,6 +200,7 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect + github.com/nxadm/tail v1.4.8 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/onflow/atree v0.8.0-rc.6 // indirect github.com/onflow/cadence v1.0.0-preview.50 // indirect @@ -210,11 +211,10 @@ require ( github.com/onflow/flow-go-sdk v1.0.0-preview.53 // indirect github.com/onflow/flow-nft/lib/go/contracts v1.2.1 // indirect github.com/onflow/flow-nft/lib/go/templates v1.2.0 // indirect - github.com/onflow/flow/protobuf/go/flow v0.4.5 // indirect + github.com/onflow/flow/protobuf/go/flow v0.4.6 // indirect github.com/onflow/go-ethereum v1.14.7 // indirect github.com/onflow/sdks v0.6.0-preview.1 // indirect github.com/onflow/wal v1.0.2 // indirect - github.com/onsi/ginkgo v1.16.5 // indirect github.com/onsi/ginkgo/v2 v2.13.2 // indirect github.com/opencontainers/runtime-spec v1.1.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect diff --git a/insecure/go.sum b/insecure/go.sum index 067f5159e23..e9a54b19be8 100644 --- a/insecure/go.sum +++ b/insecure/go.sum @@ -1475,7 +1475,6 @@ github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= @@ -2181,8 +2180,8 @@ github.com/onflow/flow-nft/lib/go/contracts v1.2.1/go.mod h1:2gpbza+uzs1k7x31hkp github.com/onflow/flow-nft/lib/go/templates v1.2.0 h1:JSQyh9rg0RC+D1930BiRXN8lrtMs+ubVMK6aQPon6Yc= github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJe5Gqgr2eeH49QB6+s6ze00w0= github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= -github.com/onflow/flow/protobuf/go/flow v0.4.5 h1:6o+pgYGqwXdEhqSJxu2BdnDXkOQVOkfGAb6IiXB+NPM= -github.com/onflow/flow/protobuf/go/flow v0.4.5/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/onflow/flow/protobuf/go/flow v0.4.6 h1:KE/CsRVfyG5lGBtm1aNcjojMciQyS5GfPF3ixOWRfi0= +github.com/onflow/flow/protobuf/go/flow v0.4.6/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/sdks v0.5.1-0.20230912225508-b35402f12bba/go.mod h1:F0dj0EyHC55kknLkeD10js4mo14yTdMotnWMslPirrU= @@ -2977,7 +2976,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -3168,7 +3166,6 @@ golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= diff --git a/integration/go.mod b/integration/go.mod index cc24f21d6d9..dbc4a985f47 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -28,7 +28,7 @@ require ( github.com/onflow/flow-go v0.37.7-0.20240826193109-e211841b59f5 github.com/onflow/flow-go-sdk v1.0.0-preview.53 github.com/onflow/flow-go/insecure v0.0.0-00010101000000-000000000000 - github.com/onflow/flow/protobuf/go/flow v0.4.5 + github.com/onflow/flow/protobuf/go/flow v0.4.6 github.com/onflow/go-ethereum v1.14.7 github.com/prometheus/client_golang v1.18.0 github.com/prometheus/client_model v0.5.0 @@ -359,6 +359,3 @@ require ( replace github.com/onflow/flow-go => ../ replace github.com/onflow/flow-go/insecure => ../insecure - -//TODO: Should be rmoved, when emulator part will be merged -replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240827102115-de43e06d2699 diff --git a/integration/go.sum b/integration/go.sum index f3c8dec6370..5200631813b 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -999,8 +999,6 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240827102115-de43e06d2699 h1:7RbiGHVo/RyZ+Qd9r1+WPdgH2nOLVW3AZvPQdn4TVac= -github.com/The-K-R-O-K/flow-emulator v1.0.0-preview.12.0.20240827102115-de43e06d2699/go.mod h1:olkloG8iCvyqW1Eyg9kyzkzJJx+xR7chczDdh52PLUE= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= @@ -2155,6 +2153,8 @@ github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 h1:q9tXLIALwQ76bO4 github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1/go.mod h1:u/mkP/B+PbV33tEG3qfkhhBlydSvAKxfLZSfB4lsJHg= github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 h1:FfhMBAb78p6VAWkJ+iqdKLErGQVQgxk5w6DP5ZruWX8= github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1/go.mod h1:NgbMOYnMh0GN48VsNKZuiwK7uyk38Wyo8jN9+C9QE30= +github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f h1:2Ejpmm2Vrl/XLaE6lniE1vNfi6WYhzqHiCk6oomGoFE= +github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f/go.mod h1:0rqp896zEcjNqqDiQNBUlpS/7nzS4+E+yG/4s0P13bQ= github.com/onflow/flow-ft/lib/go/contracts v1.0.0 h1:mToacZ5NWqtlWwk/7RgIl/jeKB/Sy/tIXdw90yKHcV0= github.com/onflow/flow-ft/lib/go/contracts v1.0.0/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A= github.com/onflow/flow-ft/lib/go/templates v1.0.0 h1:6cMS/lUJJ17HjKBfMO/eh0GGvnpElPgBXx7h5aoWJhs= @@ -2167,8 +2167,8 @@ github.com/onflow/flow-nft/lib/go/contracts v1.2.1/go.mod h1:2gpbza+uzs1k7x31hkp github.com/onflow/flow-nft/lib/go/templates v1.2.0 h1:JSQyh9rg0RC+D1930BiRXN8lrtMs+ubVMK6aQPon6Yc= github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJe5Gqgr2eeH49QB6+s6ze00w0= github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= -github.com/onflow/flow/protobuf/go/flow v0.4.5 h1:6o+pgYGqwXdEhqSJxu2BdnDXkOQVOkfGAb6IiXB+NPM= -github.com/onflow/flow/protobuf/go/flow v0.4.5/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/onflow/flow/protobuf/go/flow v0.4.6 h1:KE/CsRVfyG5lGBtm1aNcjojMciQyS5GfPF3ixOWRfi0= +github.com/onflow/flow/protobuf/go/flow v0.4.6/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/sdks v0.5.1-0.20230912225508-b35402f12bba/go.mod h1:F0dj0EyHC55kknLkeD10js4mo14yTdMotnWMslPirrU= From 9012cd0102b024d2d8b3712cb05818b0c539eefb Mon Sep 17 00:00:00 2001 From: Andrii Slisarchuk Date: Thu, 29 Aug 2024 19:15:27 +0300 Subject: [PATCH 22/22] Fixed emulator version --- integration/go.mod | 2 +- integration/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integration/go.mod b/integration/go.mod index dbc4a985f47..92fb18f5522 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -24,7 +24,7 @@ require ( github.com/onflow/crypto v0.25.2 github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 - github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f + github.com/onflow/flow-emulator v1.0.0-preview.41.0.20240829134601-0be55d6970b5 github.com/onflow/flow-go v0.37.7-0.20240826193109-e211841b59f5 github.com/onflow/flow-go-sdk v1.0.0-preview.53 github.com/onflow/flow-go/insecure v0.0.0-00010101000000-000000000000 diff --git a/integration/go.sum b/integration/go.sum index 5200631813b..ddb9b4bb31e 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -2153,8 +2153,8 @@ github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 h1:q9tXLIALwQ76bO4 github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1/go.mod h1:u/mkP/B+PbV33tEG3qfkhhBlydSvAKxfLZSfB4lsJHg= github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 h1:FfhMBAb78p6VAWkJ+iqdKLErGQVQgxk5w6DP5ZruWX8= github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1/go.mod h1:NgbMOYnMh0GN48VsNKZuiwK7uyk38Wyo8jN9+C9QE30= -github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f h1:2Ejpmm2Vrl/XLaE6lniE1vNfi6WYhzqHiCk6oomGoFE= -github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f/go.mod h1:0rqp896zEcjNqqDiQNBUlpS/7nzS4+E+yG/4s0P13bQ= +github.com/onflow/flow-emulator v1.0.0-preview.41.0.20240829134601-0be55d6970b5 h1:Z5PC3Sqvl2UemY27uwUwzkLb8EXUf+m/aEimxFzOXuc= +github.com/onflow/flow-emulator v1.0.0-preview.41.0.20240829134601-0be55d6970b5/go.mod h1:gFafyGD4Qxs+XT2BRSIjQJ86ILSmgm1VYUoCr1nVxVI= github.com/onflow/flow-ft/lib/go/contracts v1.0.0 h1:mToacZ5NWqtlWwk/7RgIl/jeKB/Sy/tIXdw90yKHcV0= github.com/onflow/flow-ft/lib/go/contracts v1.0.0/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A= github.com/onflow/flow-ft/lib/go/templates v1.0.0 h1:6cMS/lUJJ17HjKBfMO/eh0GGvnpElPgBXx7h5aoWJhs=