During a cluster upgrade when only half of the cluster can ingest the new shred
variant, sending shreds of the new variant can cause nodes to diverge.
The commit adds a feature to enable chained Merkle shreds explicitly.
* gossip: notify state machine of duplicate proofs
* Add feature flag for ingesting duplicate proofs from Gossip.
* Use the Epoch the shred is in instead of the root bank epoch.
* Fix unittest by activating the feature.
* Add a test for feature disabled case.
* EpochSchedule is now not copyable, clone it explicitly.
* pr feedback: read epoch schedule on startup, add guard for ff recache
* pr feedback: bank_forks lock, -cached_slots_in_epoch, init ff
* pr feedback: bank.forks_try_read() -> read()
* pr feedback: fix local-cluster setup
* local-cluster: do not expose gossip internals, use retry mechanism instead
* local-cluster: split out case 4b into separate test and ignore
* pr feedback: avoid taking lock if ff is already found
* pr feedback: do not cache ff epoch
* pr feedback: bank_forks lock, revert to cached_slots_in_epoch
* pr feedback: move local variable into helper function
* pr feedback: use let else, remove epoch 0 hack
---------
Co-authored-by: Wen <crocoxu@gmail.com>
* implement a custom parser for `VoteState` which is usuable in a bpf context
* derive or impl `Arbitrary` for `VoteStateVersions` and its component types, for test builds only
* Move EpochRewardsHasher to solana-sdk
* Cargo.lock
* Apparently we're allowing arithmetic_side_effects in all of runtime
* Move allow stmt to block instead of module
* Also allow in test mod
* remove println from a test
* sync fee_structure with fee_rate_governor;
remove congestion_multiplier from calculacte_fee(), leave parameters unused for now.
* restrict curve25519 multiscalar multiplication vector length to 512
* add syscall tests for msm vector length
* add new feature gate `curve25519_restrict_msm_length`
* update tests for feature new gate
* Update programs/bpf_loader/src/syscalls/mod.rs
Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
* remove length guard on the multisicalar mult lib function
---------
Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
* add functionality to read proof from accounts instead of instruction data
* update add tests
* clippy
* clarify instruction data discriminator
* avoid cloning entire proof data
* Update programs/zk-token-proof/src/lib.rs
Co-authored-by: Jon C <me@jonc.dev>
* update `PROOF_OFFSET_LENGTH` to `INSTRUCTION_DATA_LENGTH_WITH_PROOF_ACCOUNT`
* update instruction docs
* add feature gate
* Update sdk/src/feature_set.rs
Co-authored-by: Jon C <me@jonc.dev>
* update feature name `enable_zk_from_account` to `enable_zk_proof_from_account`
* Apply suggestions from code review
Co-authored-by: Jon C <me@jonc.dev>
* clarify the instruction data length more precisely
---------
Co-authored-by: Jon C <me@jonc.dev>
* use PROGRAM_OWNER + program data for account executable
mock account data with executable_meta in precompiled program and update
test_bank_hash_consistency test
pr: return const slice and add comments
pr: use ReadableAccount
use const to get rid of magic number
add featuregate disable_bpf_loader_instructions to disable bpf loader management instructions, and deprecate_executable_meta_update_in_bpf_loader to deprecate executable flag update in bpf loader
deprecate usage of executable in Account
fix a test
fix sbp bench
fix sbf program tests
add feature gate to account and borrowed account apis
fix tests
more test fixes
* restore bpf_loader v2 tests
---------
Co-authored-by: HaoranYi <haoran.yi@solana.com>
* Add allow_commission_decrease_at_any_time feature which will allow
vote account commission to be lowered at any time during the epoch
regardless of the commission_updates_only_allowed_in_first_half_of_epoch
feature. Fixes#33843.
SIMD: 0080
* Remove unused `feature_set` import
---------
Co-authored-by: Jon Cinque <me@jonc.dev>
* add a feature to disable rent collection
* fix a test
* fix a test
* rekey
* should collect rent
* Update runtime/src/bank/fee_distribution.rs
Co-authored-by: Brooks <brooks@prumo.org>
* expand tests to cover both rent collection disabled and enabled
* feedbacks
* reviews - move should collect rent check out of rent collector into bank
* enforce rent_epoch to u64:max when rent collection is disabled
* review feedbacks and fix a test
When rent fee collection is disabled, we won't collect rent for any account. If there are any rent paying accounts, their `rent_epoch` won't change too.
* revise comments
* update rent_epoch for rent exempted account
* rebase
* set rent_epoch in rent collection for rent exempted account
* revert test change
* don't assert
---------
Co-authored-by: HaoranYi <haoran.yi@solana.com>
Co-authored-by: Brooks <brooks@prumo.org>
* Create runtime-transaction crate to host transaction type for runtime that comes with metadata
* create separate structs for runtime in different state, add corresponding traits for transaction_meta
* share simple-vote checking code
* not to expose private fields to outside of sdk
---------
Co-authored-by: Andrew Fitzgerald <apfitzge@gmail.com>
That new release contains an important change which prevents a
potential DDoS.
* Lightprotocol/light-poseidon#32
Invoking `from_bytes_be` function light-poseidon 0.1.1 inverts all
the inputs before performing a check whether their length exceeds
the modulus of the prime field. Therefore, it was prone to an
attack, where a mailicious user could submit long byte slices just
to DDoS the validator, being stuck on inverting large byte sequences.
The update and mentioned change fixes the same issue as #33363 aims
to address.
The new release contains also few other less important changes like:
* Lightprotocol/light-poseidon#37
* Lightprotocol/light-poseidon#38
* Lightprotocol/light-poseidon#39
It is a pretty standard set of traits to implement on most types. Both `Pubkey`
and `LoadedAddresses` contained within the `AccountKeys` already implement them.
Doing the same for `AccountKeys` could simplify unit tests and/or some common
value manipulation logic.
* Enable frozen_abi on banking trace file
* Fix ci with really correct bugfix...
* Remove tracker_callers
* Fix typo...
* Fix AbiExample for Arc/Rc's Weaks
* Added comment for AbiExample impl of SystemTime
* Simplify and document EvenAsOpaque with new usage
* Minor clean-ups
* Simplify SystemTime::example() with UNIX_EPOCH...
* Add comment for AbiExample subtleties
* replace program account
* modify for all cases
* remove non-data swap
* address tests & conditional feedback
* get the rent involved
* mix in owner & executable
* feature-related cases
* stripped back to feature-specific case only
* added feature
* address initial feedback
* added more lamport checks
* condense tests
* using test_case
* add fail cases to tests
* more cleanup
* add verifiably built program
* update program account state
* cleaned up serializing logic
* use full word capitalization
* rename old & new to dst & src
* swap src and dst in parameters
* add warnings and errors
* rename feature to programify
* test suite description clarity
* remove strings from datapoints
* spell out source and destination
* more verbose comments in account replace functions
* move lamport calculation
* swap lamport check for state check
* move replace functions to helper module
* make replace_account methods fallible
* refactor error handling
* add test for source program state
* fix stake deactivation in the same epoch after redelegation bug
add tests
refactor common code into fn
avoid early return
add feature gate for the new stake redelegate behavior
move stake tests out of cli
add stake-program-test crate
reimplemnt stake test with program-test
remove stake-program-test crate
reviews
add setup.rs
remove clippy
reveiws
* reviews
* review comments
---------
Co-authored-by: HaoranYi <haoran.yi@solana.com>
* solana-program - altbn128: add g1 & g2 compression
still fixing tests for point of infinity
feat: proof compression syscall working
add rust test to ci
remove prints
added c test
added sycall pricing
* fixed ci checks
* refactored altbn128 and compression
Replaces `TransactionError::InstructionError(0, InstructionError::UnbalancedInstruction)` with `TransactionError::UnbalancedTransaction`.
Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
* Add feature gate
* Add helper fn
* Require split destination to be rent-exempt if it is active
* Update cli to prefund split accounts
* cli: require rent param with sign-only
* Update tokens to prefund split accounts
* Update split tests with sysvar accounts
* Fix test_split_to_account_with_rent_exempt_reserve
* Fix test_staked_split_destination_minimum_balance
* Fix test_split_more_than_staked
* Fix test_split_minimum_stake_delegation and remove misleading StakeState::Initialized case
* Fix test_split_from_larger_sized_account
* Add test for pre-/post-activation behavior splitting some or all of stake account
* Assert active stake
* Fix runtime test
* Ignore stake-pool downstream
* Review comments
* Feature gate sysvar reads
* Processors to compile and send LoaderV4 CLI commands
* suppress unused code warning
* clippy fixes
* redeploy program using source buffer
* unify deploy and redeploy to a single function
* clippy fixes
* fixes after testing the CLI frontend
Recalculating new_warmup_cooldown_rate_epoch for each item is redundant
and wasteful and instead can be done only once outside the iterators and
for loops.
Also NewWarmupCooldownRateEpoch is unnecessary and verbose and is
removed in this commit.
* 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.
* Fix a typo & phrasing of `bpf_loader_upgradeable` docs
Originally, I was just going to fix the typo, replacing 'the' with
'that.' But I thought that the sentence was phrased awkwardly anyway, so
I tried to correct that as well.
* Fix second typo
Co-authored-by: ripatel-fd <ripatel+git@jumptrading.com>
---------
Co-authored-by: ripatel-fd <ripatel+git@jumptrading.com>
* 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>
* Moves initialization and growth of program accounts
from "write" to "truncate" instruction in loader-v4.
* Removes the parameter payer account from the truncate instruction.