Skip to content

Commit

Permalink
Remove migrated-to-tenderbake as its redundant.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajinkyaraj-23 committed Apr 2, 2024
1 parent 646430f commit 964fc41
Show file tree
Hide file tree
Showing 181 changed files with 27 additions and 48 deletions.
21 changes: 6 additions & 15 deletions src/apdu_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,14 @@ int handle_query_all_hwm(void) {
write_u32_be(resp, offset, N_data.hwm.main.highest_level);
offset += sizeof(uint32_t);

bool has_a_chain_migrated =
N_data.hwm.main.migrated_to_tenderbake || N_data.hwm.test.migrated_to_tenderbake;

if (has_a_chain_migrated) {
write_u32_be(resp, offset, N_data.hwm.main.highest_round);
offset += sizeof(uint32_t);
}
write_u32_be(resp, offset, N_data.hwm.main.highest_round);
offset += sizeof(uint32_t);

write_u32_be(resp, offset, N_data.hwm.test.highest_level);
offset += sizeof(uint32_t);

if (has_a_chain_migrated) {
write_u32_be(resp, offset, N_data.hwm.test.highest_round);
offset += sizeof(uint32_t);
}
write_u32_be(resp, offset, N_data.hwm.test.highest_round);
offset += sizeof(uint32_t);

write_u32_be(resp, offset, N_data.main_chain_id.v);
offset += sizeof(uint32_t);
Expand All @@ -69,10 +62,8 @@ int handle_query_main_hwm(void) {
write_u32_be(resp, offset, N_data.hwm.main.highest_level);
offset += sizeof(uint32_t);

if (N_data.hwm.main.migrated_to_tenderbake) {
write_u32_be(resp, offset, N_data.hwm.main.highest_round);
offset += sizeof(uint32_t);
}
write_u32_be(resp, offset, N_data.hwm.main.highest_round);
offset += sizeof(uint32_t);

return io_send_response_pointer(resp, offset, SW_OK);
}
Expand Down
2 changes: 0 additions & 2 deletions src/apdu_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ static bool ok(void) {
ram->hwm.main.highest_round = 0;
ram->hwm.main.had_attestation = false;
ram->hwm.main.had_preattestation = false;
ram->hwm.main.migrated_to_tenderbake = false;
ram->hwm.test.highest_level = G.hwm.test;
ram->hwm.test.highest_round = 0;
ram->hwm.test.had_attestation = false;
ram->hwm.test.had_preattestation = false;
ram->hwm.test.migrated_to_tenderbake = false;
});

provide_pubkey(&global.path_with_curve);
Expand Down
1 change: 0 additions & 1 deletion src/baking_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ tz_exc write_high_water_mark(parsed_baking_data_t const *const in) {
dest->highest_round = in->round;
dest->had_attestation |= in->type == BAKING_TYPE_ATTESTATION;
dest->had_preattestation |= in->type == BAKING_TYPE_PREATTESTATION;
dest->migrated_to_tenderbake |= in->is_tenderbake;
});

end:
Expand Down
28 changes: 12 additions & 16 deletions src/to_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,25 +305,21 @@ int hwm_to_string(char *dest, size_t dest_size, high_watermark_t const *const hw
if (dest == NULL) {
return -1;
}
if (hwm->migrated_to_tenderbake) {
int result = number_to_string(dest, dest_size, hwm->highest_level);
if (result < 0) {
return result;
}
size_t offset = (size_t) result;

dest[offset] = ' ';
offset++;
int result = number_to_string(dest, dest_size, hwm->highest_level);
if (result < 0) {
return result;
}
size_t offset = (size_t) result;

result = number_to_string(dest + offset, dest_size - offset, hwm->highest_round);
if (result < 0) {
return result;
}
dest[offset] = ' ';
offset++;

return offset + (size_t) result;
} else {
return number_to_string(dest, dest_size, hwm->highest_level);
result = number_to_string(dest + offset, dest_size - offset, hwm->highest_round);
if (result < 0) {
return result;
}

return offset + (size_t) result;
}

int hwm_status_to_string(char *dest, size_t dest_size, bool const *hwm_disabled) {
Expand Down
9 changes: 4 additions & 5 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,10 @@ static inline bool bip32_path_with_curve_eq(bip32_path_with_curve_t volatile con
*
*/
typedef struct {
level_t highest_level; ///< highest level seen
round_t highest_round; ///< highest round seen
bool had_attestation; ///< if an attestation has been seen at current level/round
bool had_preattestation; ///< if a pre-attestation has been seen at current level/round
bool migrated_to_tenderbake; ///< if chain has migrated to tenderbake
level_t highest_level; ///< highest level seen
round_t highest_round; ///< highest round seen
bool had_attestation; ///< if an attestation has been seen at current level/round
bool had_preattestation; ///< if a pre-attestation has been seen at current level/round
} high_watermark_t;

/**
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/snapshots/nanos/test_review_home/high_watermark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/snapshots/nanosp/test_review_home/high_watermark.png
Binary file modified test/snapshots/nanox/test_review_home/high_watermark.png
Binary file modified test/snapshots/stax/test_deauthorize/app_context/app_context.png
Binary file modified test/snapshots/stax/test_review_home/app_context.png
8 changes: 3 additions & 5 deletions test/utils/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ class Hwm:
"""Class representing app high water mark."""

highest_level: int
highest_round: Optional[int]
highest_round: int

def __init__(self,
highest_level: int,
highest_round: Optional[int] = None,
highest_round: int = 0,
):
self.highest_level = highest_level
self.highest_round = highest_round
Expand Down Expand Up @@ -113,9 +113,7 @@ def from_bytes(cls, raw_hwm: bytes) -> 'Hwm':

reader = BytesReader(raw_hwm)
highest_level = reader.read_int(4)
highest_round = \
None if reader.has_finished() else \
reader.read_int(4)
highest_round = reader.read_int(4)
reader.assert_finished()

return Hwm(highest_level, highest_round)
Expand Down
6 changes: 2 additions & 4 deletions test/utils/navigator.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,8 @@ def check_app_context(self,
self.sub_settings.next()
self.backend.wait_for_screen_change()
self.assert_screen("hwm_status", snap_path=snap_path)
self.settings.multi_page_exit()
self.backend.wait_for_screen_change()
self.assert_screen("home_screen", snap_path=snap_path)

self.sub_settings.exit()
self.backend.wait_for_home_screen()
@contextmanager
def goto_home_public_key(self, snap_path: Path = Path("")) -> Generator[None, None, None]:
snap_path = snap_path / APP_CONTEXT
Expand Down

0 comments on commit 964fc41

Please sign in to comment.