Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guess the number #1608

Merged
merged 43 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2438bf4
init new pallet. C&P
brenzi Sep 27, 2024
33c434e
initial round timing logic and tests
brenzi Sep 30, 2024
4294683
new randomness trait and crate (from raffle PR) to use in pallets and…
brenzi Oct 1, 2024
1f676ad
build works
brenzi Oct 1, 2024
b6a5b42
add cli and PublicGetter
brenzi Oct 1, 2024
c150bb4
broken approach with own trait. trying to just extend traits now
brenzi Oct 1, 2024
3d371d3
empty on_initialize and on_finalize builds now
brenzi Oct 1, 2024
5d01d56
on_initialize executes on_timestamp_set which starts a new round and …
brenzi Oct 1, 2024
fa360ff
cant make BoundedVec work reasonably. will use vec
brenzi Oct 1, 2024
f295fe5
refactored to Vec
brenzi Oct 1, 2024
b292d3c
fix recursion loop
brenzi Oct 1, 2024
5da7daf
add unit tests
brenzi Oct 2, 2024
12e830b
limit number of guess attempts
brenzi Oct 2, 2024
1977973
flow works with cli
brenzi Oct 2, 2024
29af6b3
add total issuance getter
brenzi Oct 2, 2024
32781da
nested guess-the-number subcommand and other cosmetics
brenzi Oct 2, 2024
541ee08
fmt
brenzi Oct 2, 2024
27d3e2d
better error logging
brenzi Oct 2, 2024
f10a7ea
remove set-balance command which was deprecated long ago
brenzi Oct 2, 2024
90211d6
cargo fix
brenzi Oct 2, 2024
099aab6
fmt
brenzi Oct 2, 2024
9015741
clippy
brenzi Oct 2, 2024
8b6e1b0
taplo fmt
brenzi Oct 2, 2024
b584a81
fix enclave test
brenzi Oct 2, 2024
d360f00
Merge branch 'master' into ab/guess-the-number
brenzi Oct 4, 2024
59029ff
bump lockfile
brenzi Oct 4, 2024
0c73abd
review comments fixed
brenzi Oct 4, 2024
804a8bf
re-inject set-balance TC but feature gate for test
brenzi Oct 4, 2024
1e093a2
fix cargo test
brenzi Oct 4, 2024
3648069
make CI scripts use shielding via vault instead of set-balance
brenzi Oct 5, 2024
e645710
restore enum order for TC to make cargo test work again
brenzi Oct 5, 2024
233c688
fmt
brenzi Oct 5, 2024
68b8a30
shuffle TC enum
brenzi Oct 5, 2024
215c5c7
fmt
brenzi Oct 5, 2024
ecd4204
pin TC,TG,PG enum encoding for upgrade compatibility
brenzi Oct 5, 2024
0f236a9
explicit enum pin type
brenzi Oct 5, 2024
772901c
use Charlie instead of Alice for sidechain demo to avoid genesis fund…
brenzi Oct 5, 2024
6ff36bb
fix clippy
brenzi Oct 5, 2024
f05b2ec
tiny alignment
brenzi Oct 5, 2024
0c406b2
fix demo script bug
brenzi Oct 5, 2024
5dfa92b
fix some more
brenzi Oct 5, 2024
6861d39
align CI tests and use non-prefunded Charlie too
brenzi Oct 5, 2024
b6f1003
charge fees to guess
brenzi Oct 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2799,9 +2799,11 @@ dependencies = [
"frame-executive",
"frame-support",
"frame-system",
"itp-randomness",
"itp-sgx-runtime-primitives",
"pallet-balances",
"pallet-evm",
"pallet-guess-the-number",
"pallet-parentchain",
"pallet-sudo",
"pallet-timestamp",
Expand Down Expand Up @@ -2836,6 +2838,7 @@ dependencies = [
"pallet-balances",
"pallet-parentchain",
"pallet-sudo",
"pallet-timestamp",
"parity-scale-codec",
"rlp",
"sgx_tstd",
Expand Down Expand Up @@ -3360,6 +3363,13 @@ dependencies = [
"thiserror 1.0.9",
]

[[package]]
name = "itp-randomness"
version = "0.1.0"
dependencies = [
"sgx_rand",
]

[[package]]
name = "itp-rpc"
version = "0.9.0"
Expand Down Expand Up @@ -5153,6 +5163,27 @@ dependencies = [
"sp-std",
]

[[package]]
name = "pallet-guess-the-number"
version = "0.11.0"
dependencies = [
"env_logger 0.9.3",
"frame-support",
"frame-system",
"itp-randomness",
"log 0.4.20",
"pallet-balances",
"pallet-timestamp",
"parity-scale-codec",
"scale-info",
"serde 1.0.193",
"sp-core",
"sp-io 7.0.0 (git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42)",
"sp-keyring",
"sp-runtime",
"sp-std",
]

[[package]]
name = "pallet-parentchain"
version = "0.11.0"
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ members = [
"app-libs/oracle",
"app-libs/parentchain-interface",
"app-libs/sgx-runtime",
"app-libs/sgx-runtime/pallets/parentchain",
"app-libs/sgx-runtime/pallets/guess-the-number",
"app-libs/stf",
"cli",
"core/direct-rpc-server",
Expand Down Expand Up @@ -37,6 +39,7 @@ members = [
"core-primitives/ocall-api",
"core-primitives/pallet-storage",
"core-primitives/primitives-cache",
"core-primitives/randomness",
"core-primitives/rpc",
"core-primitives/settings",
"core-primitives/sgx/crypto",
Expand Down
6 changes: 5 additions & 1 deletion app-libs/sgx-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }

# local dependencies
itp-randomness = { path = "../../core-primitives/randomness", default-features = false }
itp-sgx-runtime-primitives = { path = "../../core-primitives/sgx-runtime-primitives", default-features = false }
pallet-guess-the-number = { default-features = false, path = "pallets/guess-the-number" }
pallet-parentchain = { default-features = false, path = "pallets/parentchain" }

# Substrate dependencies
Expand All @@ -36,7 +38,9 @@ pallet-evm = { default-features = false, optional = true, git = "https://github.
default = ["std"]
# Compile the sgx-runtime with evm support.
evm = ["pallet-evm"]

sgx = [
"itp-randomness/sgx",
]
std = [
"codec/std",
"scale-info/std",
Expand Down
50 changes: 50 additions & 0 deletions app-libs/sgx-runtime/pallets/guess-the-number/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[package]
name = "pallet-guess-the-number"
description = "a little game that only works with confidentiality"
version = "0.11.0"
authors = ["Integritee AG <[email protected]>"]
homepage = "https://integritee.network/"
repository = "https://github.com/integritee-network/pallets/"
license = "Apache-2.0"
edition = "2021"

[dependencies]
codec = { version = "3.0.0", default-features = false, features = ["derive"], package = "parity-scale-codec" }
log = { version = "0.4.14", default-features = false }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.13", features = ["derive"], optional = true }

# substrate dependencies
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }

itp-randomness = { path = "../../../../core-primitives/randomness" }

[dev-dependencies]
env_logger = "0.9.0"
sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }

[features]
default = ["std"]
std = [
"codec/std",
"log/std",
"scale-info/std",
"serde",
# substrate dependencies
"frame-support/std",
"frame-system/std",
"pallet-balances/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
]

try-runtime = ["frame-support/try-runtime"]
Loading
Loading