From d104df24bff0099feee5bc96e58fc0c4d46a550f Mon Sep 17 00:00:00 2001 From: amit-momin Date: Fri, 11 Oct 2024 16:24:56 -0500 Subject: [PATCH] Added compute unit limit estimation to Solana TXM --- .changeset/curly-baboons-enjoy.md | 5 +++++ core/config/docs/chains-solana.toml | 2 ++ core/services/chainlink/config_test.go | 2 ++ core/services/chainlink/testdata/config-full.toml | 1 + .../chainlink/testdata/config-multi-chain-effective.toml | 2 ++ core/web/resolver/testdata/config-full.toml | 1 + .../resolver/testdata/config-multi-chain-effective.toml | 2 ++ core/web/solana_chains_controller_test.go | 1 + docs/CONFIG.md | 7 +++++++ go.mod | 2 +- go.sum | 2 ++ 11 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .changeset/curly-baboons-enjoy.md diff --git a/.changeset/curly-baboons-enjoy.md b/.changeset/curly-baboons-enjoy.md new file mode 100644 index 00000000000..440f394d23b --- /dev/null +++ b/.changeset/curly-baboons-enjoy.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +Added the compute unit limit estimation feature for the Solana TXM #added diff --git a/core/config/docs/chains-solana.toml b/core/config/docs/chains-solana.toml index 7a5911c4d2e..626c2f0613f 100644 --- a/core/config/docs/chains-solana.toml +++ b/core/config/docs/chains-solana.toml @@ -38,6 +38,8 @@ FeeBumpPeriod = '3s' # Default BlockHistoryPollPeriod = '5s' # Default # ComputeUnitLimitDefault is the compute units limit applied to transactions unless overriden during the txm enqueue ComputeUnitLimitDefault = 200_000 # Default +# EstimateComputeUnitLimit enables or disables compute unit limit estimations per transaction. If estimations return 0 used compute, the ComputeUnitLimitDefault value is used, if set. +EstimateComputeUnitLimit = false # Default [Solana.MultiNode] # Enabled enables the multinode feature. diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index 9443fc1d060..b036566cc34 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -753,6 +753,7 @@ func TestConfig_Marshal(t *testing.T) { FeeBumpPeriod: commoncfg.MustNewDuration(time.Minute), BlockHistoryPollPeriod: commoncfg.MustNewDuration(time.Minute), ComputeUnitLimitDefault: ptr[uint32](100_000), + EstimateComputeUnitLimit: ptr(false), }, MultiNode: solcfg.MultiNodeConfig{ MultiNode: solcfg.MultiNode{ @@ -1278,6 +1279,7 @@ ComputeUnitPriceDefault = 100 FeeBumpPeriod = '1m0s' BlockHistoryPollPeriod = '1m0s' ComputeUnitLimitDefault = 100000 +EstimateComputeUnitLimit = false [Solana.MultiNode] Enabled = false diff --git a/core/services/chainlink/testdata/config-full.toml b/core/services/chainlink/testdata/config-full.toml index 35b8903878d..44362761bd1 100644 --- a/core/services/chainlink/testdata/config-full.toml +++ b/core/services/chainlink/testdata/config-full.toml @@ -500,6 +500,7 @@ ComputeUnitPriceDefault = 100 FeeBumpPeriod = '1m0s' BlockHistoryPollPeriod = '1m0s' ComputeUnitLimitDefault = 100000 +EstimateComputeUnitLimit = false [Solana.MultiNode] Enabled = false diff --git a/core/services/chainlink/testdata/config-multi-chain-effective.toml b/core/services/chainlink/testdata/config-multi-chain-effective.toml index 3d82a30e88c..f9d34ffbde6 100644 --- a/core/services/chainlink/testdata/config-multi-chain-effective.toml +++ b/core/services/chainlink/testdata/config-multi-chain-effective.toml @@ -661,6 +661,7 @@ ComputeUnitPriceDefault = 0 FeeBumpPeriod = '3s' BlockHistoryPollPeriod = '5s' ComputeUnitLimitDefault = 200000 +EstimateComputeUnitLimit = false [Solana.MultiNode] Enabled = false @@ -703,6 +704,7 @@ ComputeUnitPriceDefault = 0 FeeBumpPeriod = '3s' BlockHistoryPollPeriod = '5s' ComputeUnitLimitDefault = 200000 +EstimateComputeUnitLimit = false [Solana.MultiNode] Enabled = false diff --git a/core/web/resolver/testdata/config-full.toml b/core/web/resolver/testdata/config-full.toml index 6f8a6d5e777..c319a7bf8ec 100644 --- a/core/web/resolver/testdata/config-full.toml +++ b/core/web/resolver/testdata/config-full.toml @@ -499,6 +499,7 @@ ComputeUnitPriceDefault = 0 FeeBumpPeriod = '3s' BlockHistoryPollPeriod = '5s' ComputeUnitLimitDefault = 200000 +EstimateComputeUnitLimit = false [Solana.MultiNode] Enabled = false diff --git a/core/web/resolver/testdata/config-multi-chain-effective.toml b/core/web/resolver/testdata/config-multi-chain-effective.toml index 612f2eaf390..e29c763b74c 100644 --- a/core/web/resolver/testdata/config-multi-chain-effective.toml +++ b/core/web/resolver/testdata/config-multi-chain-effective.toml @@ -661,6 +661,7 @@ ComputeUnitPriceDefault = 0 FeeBumpPeriod = '3s' BlockHistoryPollPeriod = '5s' ComputeUnitLimitDefault = 200000 +EstimateComputeUnitLimit = false [Solana.MultiNode] Enabled = false @@ -703,6 +704,7 @@ ComputeUnitPriceDefault = 0 FeeBumpPeriod = '3s' BlockHistoryPollPeriod = '5s' ComputeUnitLimitDefault = 200000 +EstimateComputeUnitLimit = false [Solana.MultiNode] Enabled = false diff --git a/core/web/solana_chains_controller_test.go b/core/web/solana_chains_controller_test.go index 316f14ccf2d..148d6302592 100644 --- a/core/web/solana_chains_controller_test.go +++ b/core/web/solana_chains_controller_test.go @@ -59,6 +59,7 @@ ComputeUnitPriceDefault = 0 FeeBumpPeriod = '3s' BlockHistoryPollPeriod = '5s' ComputeUnitLimitDefault = 200000 +EstimateComputeUnitLimit = false Nodes = [] [MultiNode] diff --git a/docs/CONFIG.md b/docs/CONFIG.md index 59192906fc1..5694f1b9a74 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -9958,6 +9958,7 @@ ComputeUnitPriceDefault = 0 # Default FeeBumpPeriod = '3s' # Default BlockHistoryPollPeriod = '5s' # Default ComputeUnitLimitDefault = 200_000 # Default +EstimateComputeUnitLimit = false # Default ``` @@ -10076,6 +10077,12 @@ ComputeUnitLimitDefault = 200_000 # Default ``` ComputeUnitLimitDefault is the compute units limit applied to transactions unless overriden during the txm enqueue +### EstimateComputeUnitLimit +```toml +EstimateComputeUnitLimit = false # Default +``` +EstimateComputeUnitLimit enables or disables compute unit limit estimations per transaction. If estimations return 0 used compute, the ComputeUnitLimitDefault value is used, if set. + ## Solana.MultiNode ```toml [Solana.MultiNode] diff --git a/go.mod b/go.mod index 24c841fa59e..e550c41352e 100644 --- a/go.mod +++ b/go.mod @@ -80,7 +80,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.5.1 github.com/smartcontractkit/chainlink-data-streams v0.1.0 github.com/smartcontractkit/chainlink-feeds v0.1.1 - github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241010140936-4e1d0ae8315a + github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241011160257-b387468e20e6 github.com/smartcontractkit/chainlink-starknet/relayer v0.1.0 github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de diff --git a/go.sum b/go.sum index cc8ac4b8687..dac25eb4494 100644 --- a/go.sum +++ b/go.sum @@ -1067,6 +1067,8 @@ github.com/smartcontractkit/chainlink-feeds v0.1.1 h1:JzvUOM/OgGQA1sOqTXXl52R6An github.com/smartcontractkit/chainlink-feeds v0.1.1/go.mod h1:55EZ94HlKCfAsUiKUTNI7QlE/3d3IwTlsU3YNa/nBb4= github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241010140936-4e1d0ae8315a h1:WdteRQ8p+4m9VPA5ibwheQBeBd1ndy1YlE6y0K/qeVE= github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241010140936-4e1d0ae8315a/go.mod h1:XDrfLscHNHXIrB8MJVEYRcCVxxxO4BflcS+S6rlcgU4= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241011160257-b387468e20e6 h1:mA9p0VDJpuEQcZezk8uFDsslwF/vDcWcm7G73K03/8M= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241011160257-b387468e20e6/go.mod h1:XDrfLscHNHXIrB8MJVEYRcCVxxxO4BflcS+S6rlcgU4= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.0 h1:C00zDQ6AQdR9JFrHnOBEhC2TlYVzVSsC7k5AZ7hXwHI= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.0/go.mod h1:K6cKpFDW2hX4D4F5aq86l13AMJ3jyEz/AjZyGjYlS90= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs=