Skip to content

Commit 3b9ac4e

Browse files
authored
Merge pull request #542 from technoch1ef/main
feat: improve the identification of writeable accounts
2 parents 997af00 + e8646e0 commit 3b9ac4e

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@ spl-token-interface = "2.0.0"
191191
spl-token-metadata-interface = "0.8.0"
192192
spl-type-length-value = "0.9.0"
193193
sqlx = { version = "0.8.6", features = [
194-
"macros",
195-
"runtime-tokio-rustls",
196-
"postgres",
197-
"uuid",
198-
"chrono",
199-
"rust_decimal",
200-
"bigdecimal",
194+
"macros",
195+
"runtime-tokio-rustls",
196+
"postgres",
197+
"uuid",
198+
"chrono",
199+
"rust_decimal",
200+
"bigdecimal",
201201
] }
202202
sqlx_migrator = { version = "0.17.0", features = ["postgres"] }
203203
syn = { version = "1.0", features = ["full"] }

crates/core/src/transformers.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,22 @@ pub fn extract_instructions_with_metadata(
107107
&meta.inner_instructions,
108108
transaction_metadata,
109109
&mut instructions_with_metadata,
110-
|key, _| meta.loaded_addresses.writable.contains(key),
110+
|key, idx| {
111+
let num_static = v0.account_keys.len();
112+
if idx < num_static {
113+
let num_signers = v0.header.num_required_signatures as usize;
114+
let num_readonly_signed = v0.header.num_readonly_signed_accounts as usize;
115+
let num_readonly_unsigned =
116+
v0.header.num_readonly_unsigned_accounts as usize;
117+
if idx < num_signers {
118+
idx < num_signers - num_readonly_signed
119+
} else {
120+
idx < num_static - num_readonly_unsigned
121+
}
122+
} else {
123+
meta.loaded_addresses.writable.contains(key)
124+
}
125+
},
111126
|_, idx| idx < v0.header.num_required_signatures as usize,
112127
);
113128
}

0 commit comments

Comments
 (0)