Commit Graph

392 Commits

Author SHA1 Message Date
HaoranYi d25d53e979
Fix bug of same-epoch stake deactivation after stake redelegation (#32606)
* 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>
2023-09-25 16:35:40 -05:00
dependabot[bot] d9a113baa2
build(deps): bump semver from 1.0.18 to 1.0.19 (#33389)
* build(deps): bump semver from 1.0.18 to 1.0.19

Bumps [semver](https://github.com/dtolnay/semver) from 1.0.18 to 1.0.19.
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.18...1.0.19)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-25 16:15:21 +00:00
Alexander Meißner def8b8fc62
Bump solana_rbpf to v0.7.2 (#33394) 2023-09-25 17:03:45 +02:00
ananas-block 997aa0a3f8
Feat(syscall): add altbn128 g1 & g2 compression (#32870)
* 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
2023-09-25 05:43:34 -07:00
Jeff Washington (jwash) d2464d9d7c
use bytemuck for disk bucket restart (#33371) 2023-09-22 10:17:04 -07:00
dependabot[bot] cd9b2cc20b
build(deps): bump quinn-proto from 0.10.4 to 0.10.5 (#33345)
* build(deps): bump quinn-proto from 0.10.4 to 0.10.5

Bumps [quinn-proto](https://github.com/quinn-rs/quinn) from 0.10.4 to 0.10.5.
- [Release notes](https://github.com/quinn-rs/quinn/releases)
- [Commits](https://github.com/quinn-rs/quinn/commits)

---
updated-dependencies:
- dependency-name: quinn-proto
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-21 23:17:58 +08:00
Pankaj Garg f50342a790
Split vote related code from runtime to its own crate (#32882)
* Move vote related code to its own crate

* Update imports in code and tests

* update programs/sbf/Cargo.lock

* fix check errors

* update abi_digest

* rebase fixes

* fixes after rebase
2023-09-19 10:46:37 -07:00
Kevin Heavey 92ab3827fd
program: move array-bytes to dev-dependencies (#33277)
* program: move array-bytes to dev-dependencies

* run cargo-for-all-lock-files.sh tree
2023-09-19 09:07:35 -07:00
dependabot[bot] f20466d278
build(deps): bump syn from 2.0.33 to 2.0.37 (#33286)
* build(deps): bump syn from 2.0.33 to 2.0.37

Bumps [syn](https://github.com/dtolnay/syn) from 2.0.33 to 2.0.37.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.33...2.0.37)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-18 12:55:15 +00:00
dependabot[bot] 694e7b9456
build(deps): bump chrono from 0.4.30 to 0.4.31 (#33284)
* build(deps): bump chrono from 0.4.30 to 0.4.31

Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.30 to 0.4.31.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.30...v0.4.31)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-18 12:54:52 +00:00
dependabot[bot] 0df6749550
build(deps): bump syn from 2.0.32 to 2.0.33 (#33264)
* build(deps): bump syn from 2.0.32 to 2.0.33

Bumps [syn](https://github.com/dtolnay/syn) from 2.0.32 to 2.0.33.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.32...2.0.33)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-15 13:30:53 +00:00
dependabot[bot] 432cacdb0e
build(deps): bump proc-macro2 from 1.0.66 to 1.0.67 (#33250)
* build(deps): bump proc-macro2 from 1.0.66 to 1.0.67

Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.66 to 1.0.67.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.66...1.0.67)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-14 16:15:22 +00:00
dependabot[bot] a13fb1d220
build(deps): bump libc from 0.2.147 to 0.2.148 (#33249)
* build(deps): bump libc from 0.2.147 to 0.2.148

Bumps [libc](https://github.com/rust-lang/libc) from 0.2.147 to 0.2.148.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.147...0.2.148)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-14 16:14:36 +00:00
dependabot[bot] 5d29ed196f
build(deps): bump serde_json from 1.0.106 to 1.0.107 (#33248)
* build(deps): bump serde_json from 1.0.106 to 1.0.107

Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.106 to 1.0.107.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.106...v1.0.107)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-14 12:48:34 +00:00
Christian Kamm 525e59f01a
sdk, programs/bpf_loader: add sol_remaining_compute_units syscall (#31640)
bpf_loader: add sol_remaining_compute_units syscall

Co-authored-by: jonch <9093549+jon-chuang@users.noreply.github.com>
2023-09-13 08:57:08 -06:00
dependabot[bot] d34a881b12
build(deps): bump serde_json from 1.0.105 to 1.0.106 (#33200)
* build(deps): bump serde_json from 1.0.105 to 1.0.106

Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.105 to 1.0.106.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.105...v1.0.106)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-12 14:11:39 +00:00
dependabot[bot] 2b1a30d81f
build(deps): bump syn from 2.0.31 to 2.0.32 (#33201)
* build(deps): bump syn from 2.0.31 to 2.0.32

Bumps [syn](https://github.com/dtolnay/syn) from 2.0.31 to 2.0.32.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.31...2.0.32)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-12 14:11:13 +00:00
dependabot[bot] 212f1b4735
build(deps): bump base64 from 0.21.3 to 0.21.4 (#33202)
* build(deps): bump base64 from 0.21.3 to 0.21.4

Bumps [base64](https://github.com/marshallpierce/rust-base64) from 0.21.3 to 0.21.4.
- [Changelog](https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/marshallpierce/rust-base64/compare/v0.21.3...v0.21.4)

---
updated-dependencies:
- dependency-name: base64
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-12 14:10:49 +00:00
dependabot[bot] 5f4f593acd
build(deps): bump socket2 from 0.5.3 to 0.5.4 (#33218)
* build(deps): bump socket2 from 0.5.3 to 0.5.4

Bumps [socket2](https://github.com/rust-lang/socket2) from 0.5.3 to 0.5.4.
- [Release notes](https://github.com/rust-lang/socket2/releases)
- [Changelog](https://github.com/rust-lang/socket2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/socket2/commits)

---
updated-dependencies:
- dependency-name: socket2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-12 14:10:09 +00: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
dependabot[bot] b588bebce0
build(deps): bump chrono from 0.4.29 to 0.4.30 (#33191)
* build(deps): bump chrono from 0.4.29 to 0.4.30

Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.29 to 0.4.30.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.29...v0.4.30)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-08 12:25:44 +00:00
dependabot[bot] 70f17ceb9f
build(deps): bump bytes from 1.4.0 to 1.5.0 (#33190)
* build(deps): bump bytes from 1.4.0 to 1.5.0

Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: bytes
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-08 12:25:25 +00:00
behzad nouri 9ff0b35f29
adds QUIC endpoint for repair service (#33057)
Working towards using QUIC protocol for repair, the commit adds a QUIC
endpoint for repair service.

Outgoing local requests are sent as

    struct LocalRequest {
        remote_address: SocketAddr,
        bytes: Vec<u8>,
        num_expected_responses: usize,
        response_sender: Sender<(SocketAddr, Vec<u8>)>,
    }

to the client-side of the endpoint. The client opens a bidirectional
stream with the LocalRequest.remote_address and once received the
response, sends it down the LocalRequest.response_sender channel.

Incoming requests from remote nodes are received from bidirectional
streams and sent as

    struct RemoteRequest {
        remote_pubkey: Option<Pubkey>,
        remote_address: SocketAddr,
        bytes: Vec<u8>,
        response_sender: Option<OneShotSender<Vec<Vec<u8>>>>,
    }

to the repair-service. The response is received from the receiver end of
RemoteRequest.response_sender channel and send back to the remote node
using the send side of the bidirectional stream.
2023-09-07 18:00:25 +00:00
behzad nouri 528a03f32a
removes outdated matches crate from dependencies (#33172)
removes outdated matches crate from the dependencies

std::matches has been stable since rust 1.42.0.
Other use-cases are covered by assert_matches crate.
2023-09-07 12:52:57 +00:00
Yihau Chen 5d15380132
Bump solana_rbpf to v0.7.1 (#33168)
bump solana_rbpf to 0.7.1
2023-09-07 02:47:36 +08:00
Brooks a80819b029
PrunedBanksRequestHandler::handle_request() is only pub with dcou (#33155) 2023-09-06 17:02:52 +00:00
behzad nouri 88ee8f5820
replaces once_cell::sync::OnceCell with std::sync::OnceLock (#33140)
std::sync::OnceLock has become stable since rust 1.70.0 and there is no
longer a need for an external crate dependency.
2023-09-06 16:46:51 +00:00
dependabot[bot] 865276f0ed
build(deps): bump bytemuck from 1.13.1 to 1.14.0 (#33161)
* build(deps): bump bytemuck from 1.13.1 to 1.14.0

Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.13.1 to 1.14.0.
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.13.1...v1.14.0)

---
updated-dependencies:
- dependency-name: bytemuck
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-06 12:33:55 +00:00
dependabot[bot] 47d828cd71
build(deps): bump chrono from 0.4.28 to 0.4.29 (#33160)
* build(deps): bump chrono from 0.4.28 to 0.4.29

Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.28 to 0.4.29.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.28...v0.4.29)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-06 12:33:00 +00:00
Alexander Meißner 424666e341
Bump solana_rbpf to v0.7.0 (#33104)
* Upgrades RBPF in Cargo.toml

* Adjustments to updated interfaces.
2023-09-06 10:54:15 +02:00
Alessandro Decina 25d3db0c18
Fix CI (#33139)
* programs/sbf: fix invalid_reference_casting errors in tests

* programs/sbf: enable dev-context-only-utils on solana-sdk

* programs/sbf: switch to clippy::arithmetic_side_effects

* solana-program: fix formatting
2023-09-05 18:01:20 +00:00
dependabot[bot] 9ab5c34543
build(deps): bump thiserror from 1.0.47 to 1.0.48 (#33134)
* build(deps): bump thiserror from 1.0.47 to 1.0.48

Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.47 to 1.0.48.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.47...1.0.48)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-05 12:44:50 +00:00
dependabot[bot] 170ad08cc8
build(deps): bump regex from 1.9.4 to 1.9.5 (#33133)
* build(deps): bump regex from 1.9.4 to 1.9.5

Bumps [regex](https://github.com/rust-lang/regex) from 1.9.4 to 1.9.5.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.9.4...1.9.5)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-05 12:28:00 +00:00
dependabot[bot] 552dc83511
build(deps): bump syn from 2.0.29 to 2.0.31 (#33135)
* build(deps): bump syn from 2.0.29 to 2.0.31

Bumps [syn](https://github.com/dtolnay/syn) from 2.0.29 to 2.0.31.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.29...2.0.31)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-09-05 12:25:39 +00:00
Alessandro Decina 6679153ca1
CPI: improve test coverage (#31986)
* programs/sbf: add TEST_[FORBID|ALLOW]_WRITE_AFTER_OWNERSHIP_CHANGE*

* programs/sbf: add tests for the AccessViolation -> InstructionError mapping

* cpi: add more tests

* programs/sbf: add tests for immutable AccountInfo pointers

* programs/sbf: add tests for verification of SolAccountInfo pointers too

* programs/sbf: add tests for ref_to_len_in_vm handling in CPI

Add TEST_FORBID_LEN_UPDATE_AFTER_OWNERSHIP_CHANGE_MOVING_DATA_POINTER
and TEST_FORBID_LEN_UPDATE_AFTER_OWNERSHIP_CHANGE that exercise the new
logic.

* cpi: tweak tests

Remove some copy pasta and rename two tests to better describe what they're doing

* cpi: add tests that check that CPI updates all accounts at once

* direct mapping: test that writes to executable accounts trigger ExecutableDataModified

* programs/sbf: add explicit tests for when an account's data allocation changes
2023-09-05 14:27:26 +07:00
Alessandro Decina 16ea141402
sdk: put AccountSharedData::set_data() behind feature="dev-context-only-utils" (#33086)
set_data() is deprecated in favor of set_data_from_slice().
2023-09-01 21:02:14 +07:00
dependabot[bot] d14605666c
build(deps): bump chrono from 0.4.26 to 0.4.28 (#33094)
* build(deps): bump chrono from 0.4.26 to 0.4.28

Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.26 to 0.4.28.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.26...v0.4.28)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

* Switch from deprecated chrono api

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2023-08-31 16:58:06 -06:00
Trent Nelson b13589b588
round two preliminaries for bumping nightly to 2023-08-25 (#33064)
* work around nightly ICE

seems to be something related to `const ref`s in generic contexts...

* allow lint false-positive on ignored trait bounds
2023-08-30 21:46:20 +02:00
vadorovsky e6dc3dac45
feat(sbf): Add Poseidon syscall (#32680)
Computing Poseidon[0] hashes is too expensive to be done in a Solana
program in one transaction. Poseidon is a zero-knowlege proof friendly
hash function, used by the majority of ZK-based projects, including the
ones built on top of Solana.

This change introduces the `sol_poseidon` syscall which takes 2D byte
slice as an input and then calculates a Poseidon hash using a BN254
curve and the following Poseidon parameters:

* x^5 S-boxes
* width - 2 ≤ t ≤ 13
* inputs - 1 ≤ n ≤ 12
* 8 full rounds and partial rounds depending on t: [56, 57, 56, 60, 60,
  63, 64, 63, 60, 66, 60, 65]

Computation of Poseidon hashes is done with the light-poseidon[1]
crate, which is audited[2] and compatible with Circom[3] (BN254 curve,
the same parameters and constants).

Proposed compute costs depend on number of inputs and are based on
light-poseidon benchmarks[4].

[0] https://www.poseidon-hash.info/
[1] https://crates.io/crates/light-poseidon
[2] https://github.com/Lightprotocol/light-poseidon/blob/main/assets/audit.pdf
[3] https://docs.circom.io/
[4] https://github.com/Lightprotocol/light-poseidon/tree/main#performance
2023-08-30 09:43:31 -07:00
Alessandro Decina 0f41719918
direct mapping: misc fixes (#32649)
* transaction_context: update make_data_mut comment

* bpf_loader: cpi: pass SerializeAccountMetadata to CallerAccount::from*

We now have a way to provide CallerAccount with trusted values coming
from our internal serialization code and not from untrusted vm space

* bpf_loader: direct_mapping: enforce account info pointers to be immutable

When direct mapping is enabled, we might need to update account data
memory regions across CPI calls. Since the only way we have to retrieve
the regions is based on their vm addresses, we enforce vm addresses to
be stable.  Accounts can still be mutated and resized of course, but it
must be done in place.

This also locks all other AccountInfo pointers, since there's no legitimate
reason to make them point to anything else.

* bpf_loader: cpi: access ref_to_len_in_vm through VmValue

Direct mapping needs to translate vm values at each access since
permissions of the underlying memory might have changed.

* direct mapping: improve memory permission tracking across CPI calls

Ensure that the data and realloc regions of an account always track the
account's permissions. In order to do this, we also need to split
realloc regions in their own self contained regions, where before we
had:

[account fields][account data][account realloc + more account fields + next account fields][next account data][...]

we now have:

[account fields][account data][account realloc][more account fields + next account fields][next account data][...]

Tested in TEST_[FORBID|ALLOW]_WRITE_AFTER_OWNERSHIP_CHANGE*

Additionally when direct mapping is on, we must update all perms at once before
doing account data updates. Otherwise, updating an account might write into
another account whose perms we haven't updated yet. Tested in
TEST_FORBID_LEN_UPDATE_AFTER_OWNERSHIP_CHANGE.

* bpf_loader: serialization: address review comment don't return vm_addr from push_account_region

* bpf_loader: rename push_account_region to push_account_data_region

* cpi: fix slow edge case zeroing extra account capacity after shrinking an account

When returning from CPI we need to zero all the account memory up to the
original length only if we know we're potentially dealing with uninitialized
memory.

When we know that the spare capacity has deterministic content, we only need to
zero new_len..prev_len.

This fixes a slow edge case that was triggerable by the following scenario:

- load a large account (say 10MB) into the vm
- shrink to 10 bytes - would memset 10..10MB
- shrink to 9 bytes - would memset 9..10MB
- shrink to 8 bytes - would memset 8..10MB
- ...

Now instead in the scenario above the following will happen:

- load a large account (say 10MB) into the vm
- shrink to 10 bytes - memsets 10..10MB
- shrink to 9 bytes - memsets 9..10
- shrink to 8 bytes - memset 8..9
- ...

* bpf_loader: add account_data_region_memory_state helper

Shared between serialization and CPI to figure out the MemoryState of an
account.

* cpi: direct_mapping: error out if ref_to_len_in_vm points to account memory

If ref_to_len_in_vm is allowed to be in account memory, calles could mutate it,
essentially letting callees directly mutate callers memory.

* bpf_loader: direct_mapping: map AccessViolation -> InstructionError

Return the proper ReadonlyDataModified / ExecutableDataModified /
ExternalAccountDataModified depending on where the violation occurs

* bpf_loader: cpi: remove unnecessary infallible slice::get call
2023-08-30 16:57:24 +07:00
dependabot[bot] 1c5c783765
build(deps): bump url from 2.4.0 to 2.4.1 (#33052)
* build(deps): bump url from 2.4.0 to 2.4.1

Bumps [url](https://github.com/servo/rust-url) from 2.4.0 to 2.4.1.
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/v2.4.0...v2.4.1)

---
updated-dependencies:
- dependency-name: url
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-08-29 13:15:18 +00:00
dependabot[bot] 542fcaef38
build(deps): bump regex from 1.9.3 to 1.9.4 (#33051)
* build(deps): bump regex from 1.9.3 to 1.9.4

Bumps [regex](https://github.com/rust-lang/regex) from 1.9.3 to 1.9.4.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.9.3...1.9.4)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-08-29 13:14:57 +00:00
dependabot[bot] b7cdfb7a09
build(deps): bump rustls from 0.21.6 to 0.21.7 (#33050)
* build(deps): bump rustls from 0.21.6 to 0.21.7

Bumps [rustls](https://github.com/rustls/rustls) from 0.21.6 to 0.21.7.
- [Release notes](https://github.com/rustls/rustls/releases)
- [Commits](https://github.com/rustls/rustls/compare/v/0.21.6...v/0.21.7)

---
updated-dependencies:
- dependency-name: rustls
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-08-29 13:14:34 +00:00
dependabot[bot] 0726a7119a
build(deps): bump nix from 0.26.3 to 0.26.4 (#33049)
* build(deps): bump nix from 0.26.3 to 0.26.4

Bumps [nix](https://github.com/nix-rust/nix) from 0.26.3 to 0.26.4.
- [Changelog](https://github.com/nix-rust/nix/blob/v0.26.4/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.26.3...v0.26.4)

---
updated-dependencies:
- dependency-name: nix
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-08-29 13:14:08 +00:00
dependabot[bot] 5de27d9a0d
build(deps): bump serde from 1.0.186 to 1.0.188 (#33023)
* build(deps): bump serde from 1.0.186 to 1.0.188

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.186 to 1.0.188.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.186...v1.0.188)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-08-28 13:40:25 +00:00
dependabot[bot] cf4bd0c6d6
build(deps): bump base64 from 0.21.2 to 0.21.3 (#33022)
* build(deps): bump base64 from 0.21.2 to 0.21.3

Bumps [base64](https://github.com/marshallpierce/rust-base64) from 0.21.2 to 0.21.3.
- [Changelog](https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/marshallpierce/rust-base64/compare/v0.21.2...v0.21.3)

---
updated-dependencies:
- dependency-name: base64
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-08-28 13:40:06 +00:00
dependabot[bot] 272db84e61
build(deps): bump nix from 0.26.2 to 0.26.3 (#33021)
* build(deps): bump nix from 0.26.2 to 0.26.3

Bumps [nix](https://github.com/nix-rust/nix) from 0.26.2 to 0.26.3.
- [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.26.2...v0.26.3)

---
updated-dependencies:
- dependency-name: nix
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-08-28 13:39:24 +00:00
dependabot[bot] e98cc10d1f
build(deps): bump openssl from 0.10.56 to 0.10.57 (#33020)
* build(deps): bump openssl from 0.10.56 to 0.10.57

Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.56 to 0.10.57.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.56...openssl-v0.10.57)

---
updated-dependencies:
- dependency-name: openssl
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-08-28 13:38:48 +00:00
Yihau Chen 25317f7ed6
fix cargo lock (#33018) 2023-08-28 04:28:28 +00:00
Yihau Chen 8940dd01fe
ci: bump tungstenite and tokio-tungstenite to 0.20.0 (#32996)
* ci: bump tungstenite and tokio-tungstenite to 0.20.0

* replace deprecated functions, read_message => read

* replace deprecated functions, write_message => send
2023-08-28 11:20:00 +08:00