Skip to content

Commit 2f8e390

Browse files
committed
memory: increase max number of allowed multisig registrations
The previous limit of 10 was not enough for a user. While we want keep as much space reserved for future use as possible, this change should be okay and still leaves plenty of space. One multisig registration takes 64 bytes, so we go from 0.625kB to 1.525kB of occupied memory, out of 8kB in the chunk, with more chunks available for future use. We can bump the limit easily now since the the space after the multisigs is unused, so a migration is not necessary. An alternative to bumping the limit is to provide a way to delete previous registrations, which would force a re-registration and re-verification when that multisig account would be used again. This is also not ideal - having more space to fit accounts is better and a simpler solution for now. We can observe if there will be users than require an even greater number, in which case we might offer a way to delete entries, or suggest to purchase more devices.
1 parent 2d5b1cb commit 2f8e390

File tree

3 files changed

+12
-30
lines changed

3 files changed

+12
-30
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Add securechip_model to DeviceInfo: ATECCC608A or ATECC608B.
66
- Added reboot purpose for clearer UX: "Proceed to upgrade?" vs. "Go to startup settings?"
77
- Allow creation of 128 bit seeds (12 BIP39 recovery words)
8+
- Increase maximum number of registered multisig accounts from 10 to 25.
89

910
## 9.5.0 [released 2021-03-10]
1011
- RestoreFrommnemonic: ported to Rust. Will now return UserAbortError on user abort instead of GenericError.

src/memory/memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define MEMORY_MULTISIG_NAME_MAX_LEN (31)
2828

2929
// How many multisig configurations (accounts) can be registered.
30-
#define MEMORY_MULTISIG_NUM_ENTRIES 10
30+
#define MEMORY_MULTISIG_NUM_ENTRIES 25
3131

3232
typedef struct {
3333
void (*const random_32_bytes)(uint8_t* buf_out);

test/unit-test/test_memory_functional.c

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -104,38 +104,19 @@ static void _test_memory_multisig_invalid(void** state)
104104
static void _test_memory_multisig_full(void** state)
105105
{
106106
_reset_memory();
107-
const uint8_t hashes[][32] = {
108-
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
109-
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
110-
"cccccccccccccccccccccccccccccccc",
111-
"dddddddddddddddddddddddddddddddd",
112-
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
113-
"ffffffffffffffffffffffffffffffff",
114-
"gggggggggggggggggggggggggggggggg",
115-
"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
116-
"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii",
117-
"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj",
118-
"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk",
119-
};
120-
const char* names[] = {
121-
"name1",
122-
"name2",
123-
"name3",
124-
"name4",
125-
"name5",
126-
"name6",
127-
"name7",
128-
"name8",
129-
"name9",
130-
"name10",
131-
"name11",
132-
};
107+
// Only 25 slots available.
108+
const size_t limit = 25;
109+
uint8_t hashes[limit + 1][32];
110+
char names[limit + 1][10];
111+
for (size_t i = 0; i < limit + 1; i++) {
112+
memset(hashes[i], i + i, 32);
113+
snprintf(names[i], sizeof(names[i]), "name%ld", i);
114+
}
133115

134-
// Only 5 slots available.
135-
for (int i = 0; i < 10; i++) {
116+
for (size_t i = 0; i < limit; i++) {
136117
assert_int_equal(MEMORY_OK, memory_multisig_set_by_hash(hashes[i], names[i]));
137118
}
138-
assert_int_equal(MEMORY_ERR_FULL, memory_multisig_set_by_hash(hashes[10], names[10]));
119+
assert_int_equal(MEMORY_ERR_FULL, memory_multisig_set_by_hash(hashes[limit], names[limit]));
139120
}
140121

141122
int main(void)

0 commit comments

Comments
 (0)