Skip to content

Commit ab50cdf

Browse files
committed
Bump to Anchor v0.30.1
This fixes IDL generation mismatch with the newly introduced `anchor-lang-idl`
1 parent 23a0039 commit ab50cdf

File tree

10 files changed

+340
-234
lines changed

10 files changed

+340
-234
lines changed

Cargo.lock

Lines changed: 236 additions & 208 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[workspace]
2-
members = [
3-
"programs/*"
4-
]
2+
members = ["programs/*"]
53
resolver = "2"
64

75
[profile.release]
@@ -12,3 +10,9 @@ codegen-units = 1
1210
opt-level = 3
1311
incremental = false
1412
codegen-units = 1
13+
14+
[workspace.dependencies]
15+
anchor-lang = { version = "0.30.1" }
16+
anchor-spl = { version = "0.30.1" }
17+
solana-security-txt = { version = "1.1.1" }
18+
ahash = "=0.8.7" # Used to fix a version mismatch: https://solana.stackexchange.com/questions/15692/errore0635-unknown-feature-stdsimd

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
77
},
88
"dependencies": {
9-
"@coral-xyz/anchor": "0.29.0",
9+
"@coral-xyz/anchor": "0.30.1",
1010
"@metadaoproject/futarchy": "0.4.0-alpha.23",
1111
"@metaplex-foundation/mpl-token-metadata": "^3.2.0",
1212
"@metaplex-foundation/umi": "^0.9.1",

programs/amm/Cargo.toml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,20 @@ no-idl = []
1414
no-log-ix-name = []
1515
cpi = ["no-entrypoint"]
1616
default = []
17+
idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"]
18+
anchor-debug = []
19+
custom-heap = []
20+
custom-panic = []
1721

1822
[dependencies]
19-
anchor-lang = { version = "0.29.0", features = ["init-if-needed", "event-cpi"] }
20-
anchor-spl = "0.29.0"
21-
solana-security-txt = "1.1.1"
23+
anchor-lang = { workspace = true, features = ["init-if-needed", "event-cpi"] }
24+
anchor-spl = { workspace = true }
25+
solana-security-txt = { workspace = true }
26+
27+
[dev-dependencies]
28+
ahash = { workspace = true }
29+
30+
[lints.rust]
31+
unexpected_cfgs = { level = "warn", check-cfg = [
32+
'cfg(target_os, values("solana"))',
33+
] }

programs/amm/src/state/amm.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,18 +246,27 @@ impl Amm {
246246
initial_observation: oracle.initial_observation,
247247
};
248248

249-
require!(new_oracle.last_updated_slot > oracle.last_updated_slot, AmmError::AssertFailed);
249+
require!(
250+
new_oracle.last_updated_slot > oracle.last_updated_slot,
251+
AmmError::AssertFailed
252+
);
250253
// assert that the new observation is between price and last observation
251254
match price.cmp(&oracle.last_observation) {
252255
Ordering::Greater => {
253-
require!(new_observation >= oracle.last_observation, AmmError::AssertFailed);
256+
require!(
257+
new_observation >= oracle.last_observation,
258+
AmmError::AssertFailed
259+
);
254260
require!(new_observation <= price, AmmError::AssertFailed);
255261
}
256262
Ordering::Equal => {
257263
require!(new_observation == price, AmmError::AssertFailed);
258264
}
259265
Ordering::Less => {
260-
require!(new_observation <= oracle.last_observation, AmmError::AssertFailed);
266+
require!(
267+
new_observation <= oracle.last_observation,
268+
AmmError::AssertFailed
269+
);
261270
require!(new_observation >= price, AmmError::AssertFailed);
262271
}
263272
}
@@ -341,10 +350,13 @@ mod simple_amm_tests {
341350
};
342351

343352
// minute hasn't passed since last slot
344-
assert_eq!(amm.update_twap(1), None);
353+
assert_eq!(amm.update_twap(1), Err(AmmError::AssertFailed.into()));
345354
assert_eq!(amm.oracle.last_updated_slot, 0);
346355

347-
assert_eq!(amm.update_twap(ONE_MINUTE_IN_SLOTS), Some(10 * PRICE_SCALE));
356+
assert_eq!(
357+
amm.update_twap(ONE_MINUTE_IN_SLOTS),
358+
Ok(Some(10 * PRICE_SCALE))
359+
);
348360
}
349361

350362
#[test]
@@ -360,15 +372,15 @@ mod simple_amm_tests {
360372

361373
let slots_until_overflow = u128::MAX / (u64::MAX as u128 * PRICE_SCALE);
362374

363-
amm.update_twap(slots_until_overflow as u64);
364-
require!(amm.oracle.aggregator > MAX_PRICE * 18_400_000);
375+
let _ = amm.update_twap(slots_until_overflow as u64);
376+
assert!(amm.oracle.aggregator > MAX_PRICE * 18_400_000);
365377
assert_ne!(amm.oracle.aggregator, u128::MAX);
366378

367-
amm_clone.update_twap(slots_until_overflow as u64 + 1);
379+
let _ = amm_clone.update_twap(slots_until_overflow as u64 + 1);
368380
assert_eq!(amm_clone.oracle.aggregator, u128::MAX);
369381

370382
// check that it wraps over
371-
amm_clone.update_twap(slots_until_overflow as u64 + 1 + ONE_MINUTE_IN_SLOTS);
383+
let _ = amm_clone.update_twap(slots_until_overflow as u64 + 1 + ONE_MINUTE_IN_SLOTS);
372384
assert_eq!(
373385
amm_clone.oracle.aggregator,
374386
ONE_MINUTE_IN_SLOTS as u128 * MAX_PRICE - 1

programs/autocrat/Cargo.toml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,22 @@ no-idl = []
1414
no-log-ix-name = []
1515
cpi = ["no-entrypoint"]
1616
default = []
17+
idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"]
18+
anchor-debug = []
19+
custom-heap = []
20+
custom-panic = []
1721

1822
[dependencies]
19-
anchor-lang = "^0.29.0"
20-
anchor-spl = "^0.29.0"
21-
solana-security-txt = "1.1.1"
23+
anchor-lang = { workspace = true }
24+
anchor-spl = { workspace = true }
25+
solana-security-txt = { workspace = true }
2226
conditional_vault = { path = "../conditional_vault", features = ["cpi"] }
2327
amm = { path = "../amm", features = ["cpi"] }
28+
29+
[dev-dependencies]
30+
ahash = { workspace = true }
31+
32+
[lints.rust]
33+
unexpected_cfgs = { level = "warn", check-cfg = [
34+
'cfg(target_os, values("solana"))',
35+
] }

programs/autocrat_migrator/Cargo.toml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,19 @@ no-idl = []
1414
no-log-ix-name = []
1515
cpi = ["no-entrypoint"]
1616
default = []
17+
idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"]
18+
anchor-debug = []
19+
custom-heap = []
20+
custom-panic = []
1721

1822
[dependencies]
19-
anchor-lang = "0.29.0"
20-
anchor-spl = "0.29.0"
23+
anchor-lang = { workspace = true }
24+
anchor-spl = { workspace = true }
25+
26+
[dev-dependencies]
27+
ahash = { workspace = true }
28+
29+
[lints.rust]
30+
unexpected_cfgs = { level = "warn", check-cfg = [
31+
'cfg(target_os, values("solana"))',
32+
] }

programs/conditional_vault/Cargo.toml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,20 @@ no-log-ix-name = []
1515
cpi = ["no-entrypoint"]
1616
default = []
1717
production = []
18+
idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"]
19+
anchor-debug = []
20+
custom-heap = []
21+
custom-panic = []
1822

1923
[dependencies]
20-
anchor-lang = { version = "0.29.0", features = ["init-if-needed", "event-cpi"] }
21-
anchor-spl = { version = "0.29.0", features = ["metadata"] }
22-
solana-security-txt = "1.1.1"
24+
anchor-lang = { workspace = true, features = ["init-if-needed", "event-cpi"] }
25+
anchor-spl = { workspace = true, features = ["metadata"] }
26+
solana-security-txt = { workspace = true }
27+
28+
[dev-dependencies]
29+
ahash = { workspace = true }
30+
31+
[lints.rust]
32+
unexpected_cfgs = { level = "warn", check-cfg = [
33+
'cfg(target_os, values("solana"))',
34+
] }

programs/optimistic_timelock/Cargo.toml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,19 @@ no-idl = []
1818
no-log-ix-name = []
1919
cpi = ["no-entrypoint"]
2020
default = []
21+
idl-build = ["anchor-lang/idl-build"]
22+
anchor-debug = []
23+
custom-heap = []
24+
custom-panic = []
2125

2226
[dependencies]
23-
anchor-lang = "0.29.0"
24-
solana-security-txt = "1.1.1"
27+
anchor-lang = { workspace = true }
28+
solana-security-txt = { workspace = true }
29+
30+
[dev-dependencies]
31+
ahash = { workspace = true }
32+
33+
[lints.rust]
34+
unexpected_cfgs = { level = "warn", check-cfg = [
35+
'cfg(target_os, values("solana"))',
36+
] }

rust-toolchain.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[toolchain]
2+
channel = "1.78.0"

0 commit comments

Comments
 (0)