Repository navigation
Commit fe6ebed
committed
Lowercase authorized users before sorting in convert_to_multi_sig_user
convert_to_multi_sig_user sorts authorized_users to give the signers list
a canonical order, then serialises it into the signed action. The sort
runs on the strings as given, so with checksummed addresses it orders on
ASCII, where every uppercase letter sorts before every lowercase one.
The result is that the same set of signers produces a different signers
string depending only on how the caller happened to case its input:
users = ["0xB1C4b0f9E7fD0B9d2F0c0F6C0B0D0E0F0A0b0C0D",
"0xa2c4B0F9e7Fd0b9D2f0C0f6c0b0d0e0f0A0B0c0D"]
sorted(users) -> ["0xB1C4...", "0xa2c4..."]
sorted(u.lower() for u in users) -> ["0xa2c4...", "0xb1c4..."]
so the canonical ordering is not canonical, and the addresses go out
checksummed rather than lowercased.
Every other address the SDK puts into an action is lowercased first
(multi_sig_user, the builder address, the userGenesis and freezeUser
users, oracleUpdater, and the multi-sig payload fields). Lowercasing
before the sort makes this consistent with those and makes the ordering
depend only on the set of signers.
Added a test asserting the emitted signers list is the same for
checksummed input, lowercased input, and reversed input.1 parent 2fdb18f commit fe6ebed
2 files changed
Lines changed: 37 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
665 | 665 | | |
666 | 666 | | |
667 | 667 | | |
668 | | - | |
| 668 | + | |
669 | 669 | | |
670 | 670 | | |
671 | 671 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | | - | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
228 | 230 | | |
229 | 231 | | |
230 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
231 | 266 | | |
232 | 267 | | |
233 | 268 | | |
| |||
0 commit comments