Commit Graph

28 Commits

Author SHA1 Message Date
Justin Starry 09241ae9c3
Use reserved account keys list to restrict tx write locks (#541)
* Plumb through reserved account keys set

* Plumb through tests
2024-04-13 09:37:58 +08:00
steviez 9076348ef4
Make CostTracker aware of inflight transactions (#437)
When a leader is packing a Bank, transactions costs are added to the
CostTracker and then later updated or removed, depending on if the
tx is committed. However, it is possible for a Bank to be frozen while
there are several tx's in flight.

CostUpdateService submits a metric with cost information almost
immediately after a Bank has been frozen. The result is that we have
observed cost details being submitted before some cost removals take
place, which causes a massive over-reporting of the block cost
compared to actual.

This PR adds a field to track the number of transactions that are
inflight, and adds a simple mechanism to try to allow that value to
settle to zero before submitting the datapoint. The number of inflight
tx's is submitted with the datapoint, so even if the value does not
settle to zero, we can still detect this case and know the metric is
tainted.

Co-authored-by: Andrew Fitzgerald <apfitzge@gmail.com>
2024-03-29 07:34:12 -05:00
Tao Zhu 9770cd9083
add precompile signature metrics to cost tracker (#133) 2024-03-08 00:48:35 +00:00
Tao Zhu 8f3f06cc7f
Combine builtin and BPF compute cost in cost model (#29)
* Combine builtin and BPF execution cost into programs_execution_cost since VM has started to consume CUs uniformly

* update tests

* apply suggestions from code review
2024-03-07 09:23:49 -06:00
Tao Zhu c1613517bf
assert simple vote tx const cost (#100)
* assert simple vote tx const cost
2024-03-06 11:08:49 -06:00
Andrew Fitzgerald 5e4332ee35
Feature Impl: cost model uses number of requested write locks (#34820) 2024-01-22 09:22:49 -08:00
Tao Zhu d0b793a6fd
remove old comment (#34775) 2024-01-15 16:39:10 -06:00
Tao Zhu 613f0ff226
removed obsolete field from cost_tracker (#34762) 2024-01-12 17:54:02 -06:00
Tao Zhu 86c88d7ff6
Remove feature set from compute budget processor (#34472)
remove feature_set from compute_budget_processor
2023-12-15 15:01:02 -06:00
Tao Zhu 7360f48eb5
remove unnecessary wrapper function (#34428)
* remove unnecessary wrapper function

* add test to FeeStructure
2023-12-15 14:56:19 -06:00
Tao Zhu f214a8220f
cleanup feature code after mainnet-beta activation (#34208)
* cleanup feature code after mainnet-beta activation
* rebase then cleanup references to activated feature
2023-12-15 13:14:51 -06:00
Jon Cinque cfb16ab76a
sdk: Upgrade to borsh 1.2.1 (#34355)
* sdk: Update to borsh 1, revert borsh 0.9 / 0.10

* Restore borsh 0.10 and 0.9 support

* Update sbf lockfile

* Add borsh 0.10 implementations for stake types

* Fix weirdness on whitespace

* Update to borsh 1.2.1

* Update changelog

* compute-budget: Move `pack` under dev-context-only-utils

* Revert test to use HashMap

* transaction-status: Add comment about borsh version
2023-12-08 13:18:10 +01:00
Andrew Fitzgerald 6d703edd2e
check vote costs against block limits in would_fit (#34207) 2023-11-22 13:19:13 -08:00
Tao Zhu 510b6b949f
Split compute budget instructions process from struct (#33852)
* Split compute budget instruction processing from ComputeBudget struct itself, so CB instructions can be processed elsewhere without involving ComputeBudget

* updated tests

* avoid built ComputeBudget from dated ComputeBudgetLimits in this refactoring PR

* Clean-up program-runtime/src/compute_budget_processor.rs

* Add test for a corner case that deprecated instruction is used to request units greater than max limit;
* Update code to handle the corner case.
2023-10-26 22:12:56 -05:00
Kevin Heavey af7fd32f4c
chore: fix some typos (#33833)
* fix spelling of "retrieved"
* fix spelling of "should"
* fix spelling of "comparisons"
2023-10-25 16:21:53 +02:00
Tao Zhu af9c754690
Crates have identical build.rs to frozen-abi can just be symlink (#33787)
crates have identical build.rs to frozen-abi can just be symlink
2023-10-21 13:33:10 -05:00
steviez c98c24bd6d
Revert "Split compute budget instructions process from struct itself … (#33784)
Revert "Split compute budget instructions process from struct itself (#33513)"

This reverts commit c73bebe984. This
was found to be a consensus breaking change.
2023-10-20 15:53:45 +02:00
Tao Zhu c73bebe984
Split compute budget instructions process from struct itself (#33513)
* Split compute budget instruction processing from ComputeBudget struct itself, allow compute_budget_instructions be processed elsewhere without having to instantiate ComputeBudget

* updated tests
2023-10-19 11:10:42 -05:00
Tao Zhu a41c15e47e
Separate vote cost (#33230)
* Separate simple-vote transaction cost from non-vote transaction cost

* remove is_simple_vote flag from transaction UsageCostDetails

* update test and comment

* set static usage cost for SimpleVote transaction
2023-09-25 15:02:08 -05:00
Tao Zhu 8b8a21a52f
cleanup feature: enable request heap frame instruction #30076 (#33243)
* cleanup feature: enable request heap frame instruction #30076

* update sbf tests

* removed out dated comments and test
2023-09-18 16:06:24 -05:00
Tao Zhu dfaec7897a
loaded accounts data size cost does not apply to vote transaction (#33235)
* loaded accounts data size cost does not apply to vote transaction

* add a test for vote cost
2023-09-14 17:22:51 -05:00
Alexander Meißner bbb57be0a5
Refactor - Move interfaces of address-lookup-table into the program SDK (#33165)
* Adds a module `address_lookup_table` to the SDK.

* Adds a module `address_lookup_table::instruction` to the SDK.

* Adds a module `address_lookup_table::error` to the SDK.

* Adds a module `address_lookup_table::state` to the SDK.

* Moves AddressLookupTable into SDK as well.

* Moves AddressLookupTableAccount into address_lookup_table.

* Adds deprecation messages.

* Disentangles dependencies across cargo files.
2023-09-11 21:10:40 +02:00
Alexander Meißner 9e703f85de
Upgrades Rust to 1.72.0 & nightly-2023-08-25 (#32961)
* allow pedantic invalid cast lint

* allow lint with false-positive triggered by `test-case` crate

* nightly `fmt` correction

* adapt to rust layout changes

* remove dubious test

* Use transmute instead of pointer cast and de/ref when check_aligned is false.

* Renames clippy::integer_arithmetic to clippy::arithmetic_side_effects.

* bump rust nightly to 2023-08-25

* Upgrades Rust to 1.72.0

---------

Co-authored-by: Trent Nelson <trent@solana.com>
2023-09-01 07:26:13 +00:00
Jon Cinque 8c14886891
sdk: Limited Borsh 0.9 support (Pubkey and helpers) (#32511)
* sdk: Implement Borsh 0.9 traits on Pubkey

* Alphabetize cargo.toml

* Add backwards-compatible borsh file

* Add borsh0_10.rs for more clarity

* Deprecate `borsh` utils, use borsh0_10 everywhere

* Mark borsh 0.9 helpers as deprecated

* Add macros for deriving helper impls

* Add borsh 0.9 tests

* Refactor tests into macro
2023-08-02 23:15:24 +02:00
Tao Zhu 62b9fcfa76
cleanup feature: Use default units per instruction in fee calculation (#32570)
* cleanup feature: Use default units per instruction in fee calculation
2023-07-21 18:37:58 -05:00
Tao Zhu c69bc00f69
cost model could double count builtin instruction cost (#32422)
1. add tests to demo builtin cost could be double counted;
2. quick fix for now
2023-07-17 15:50:13 -05:00
Pankaj Garg 7177dd9809
Remove calculate_fee()'s dependency on ComputeBudget (#32487) 2023-07-14 12:25:04 -07:00
Pankaj Garg 4674b0099f
Move CostModel and CostTracker to its own crate (#32354)
* Move CostModel and CostTracker to its own crate

* compile new crate and update imports

* update sbf Cargo.lock

* fix AbiExample

* fix cargo sort

* Fix AbiExample
2023-07-06 10:08:18 -07:00