Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
slashing: add duplicate block proof verification (#7418)
Browse files Browse the repository at this point in the history
* slashing: add duplicate block proof verification

* pr feedback: use local record dep

* pr feedback: update to v2.1 crates

* pr feedback: rename errors for consistency

* pr feedback: do not log pubkey

* pass along workspace lints

* pr feedback: use zerocopy for instruction data

* add one epoch statue of limitations

* pr feedback: zerocopy from proof account to proof data struct

* Fix `proof_account_length` for the new size of a proof account

* pr feedback: revert Cargo.lock

* pr feedback: remove unecessary allow(dead_code)

* pr feedback: use SLOT - 1 and constants in test code

* pr feedback: return error if proof buffer is too small for shred1_length

* pr feedback: remove lifetime on shred reference in get_payload

* pr feedback: use rwlock in test rather than unsafe const modification

* pr feedback: use epoch schedule sysvar instead of hardcoding length

* Add Cargo.lock just for slashing crate
  • Loading branch information
AshwinSekar authored Nov 28, 2024
1 parent dcfc02b commit 633f061
Show file tree
Hide file tree
Showing 14 changed files with 2,409 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ members = [
"shared-memory/program",
"single-pool/cli",
"single-pool/program",
"slashing/program",
"stake-pool/cli",
"stake-pool/program",
"stateless-asks/program",
Expand Down
Empty file added slashing/README.md
Empty file.
48 changes: 48 additions & 0 deletions slashing/program/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[package]
name = "spl-slashing"
version = "0.1.0"
description = "Solana Program Library Slashing"
authors = ["Solana Labs Maintainers <[email protected]>"]
repository = "https://github.com/solana-labs/solana-program-library"
license = "Apache-2.0"
edition = "2021"

[features]
no-entrypoint = []
test-sbf = []

[dependencies]
bitflags = { version = "2.6.0", features = ["serde"] }
bytemuck = { version = "1.19.0", features = ["derive"] }
num_enum = "0.7.3"
generic-array = { version = "0.14.7", features = ["serde"], default-features = false }
bincode = "1.3.3"
num-derive = "0.4"
num-traits = "0.2"
solana-program = "2.1.0"
serde = "1.0.210" # must match the serde_derive version, see https://github.com/serde-rs/serde/issues/2584#issuecomment-1685252251
serde_bytes = "0.11.15"
serde_derive = "1.0.210" # must match the serde version, see https://github.com/serde-rs/serde/issues/2584#issuecomment-1685252251
serde_with = { version = "3.11.0", default-features = false }

thiserror = "1.0"
spl-pod = { version = "0.5.0", path = "../../libraries/pod" }

[dev-dependencies]
lazy_static = "1.5.0"
solana-program-test = "2.1.0"
solana-sdk = "2.1.0"
solana-ledger = "2.1.0"
solana-entry = "2.1.0"
solana-client = "2.1.0"
spl-record = { version = "0.3.0", path = "../../record/program" }
rand = "0.8.5"

[lib]
crate-type = ["cdylib", "lib"]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[lints]
workspace = true
1 change: 1 addition & 0 deletions slashing/program/program-id.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
S1ashing11111111111111111111111111111111111
Loading

0 comments on commit 633f061

Please sign in to comment.