Skip to content

Commit

Permalink
feat: Removed old Schedule schema states. (#16437)
Browse files Browse the repository at this point in the history
Signed-off-by: Iris Simon <[email protected]>
  • Loading branch information
iwsimon authored Nov 6, 2024
1 parent c636e8f commit 9b0f656
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,21 @@ public final class V0570ScheduleSchema extends Schema {
* Instantiates a new V0570 (version 0.57.0) schedule schema.
*/
public V0570ScheduleSchema() {

super(VERSION);
}

@SuppressWarnings("rawtypes")
@NonNull
@Override
public Set<StateDefinition> statesToCreate() {
return Set.of(scheduleIdsByExpirySec(), schedulesByEquality());
return Set.of(scheduleIdsByExpirySec(), scheduleIdByEquality());
}

// @NonNull
// @Override
// public Set<String> statesToRemove() {
// return Set.of(SCHEDULES_BY_EXPIRY_SEC_KEY, SCHEDULES_BY_EQUALITY_KEY);
// }
@NonNull
@Override
public Set<String> statesToRemove() {
return Set.of(SCHEDULES_BY_EXPIRY_SEC_KEY, SCHEDULES_BY_EQUALITY_KEY);
}

@Override
public void migrate(@NonNull final MigrationContext ctx) {
Expand Down Expand Up @@ -137,7 +136,7 @@ private static StateDefinition<ProtoLong, ScheduleIdList> scheduleIdsByExpirySec
MAX_SCHEDULE_IDS_BY_EXPIRY_SEC_KEY);
}

private static StateDefinition<ProtoBytes, ScheduleID> schedulesByEquality() {
private static StateDefinition<ProtoBytes, ScheduleID> scheduleIdByEquality() {
return StateDefinition.onDisk(
SCHEDULE_ID_BY_EQUALITY_KEY, ProtoBytes.PROTOBUF, ScheduleID.PROTOBUF, MAX_SCHEDULE_ID_BY_EQUALITY);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static org.assertj.core.api.AssertionsForClassTypes.assertThatCode;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.BDDMockito.given;

import com.hedera.hapi.node.base.ScheduleID;
Expand Down Expand Up @@ -116,9 +117,8 @@ void statesToCreateIsCorrect() {
void testStatesToRemove() {
Set<String> statesToRemove = subject.statesToRemove();
assertNotNull(statesToRemove);
assertEquals(0, statesToRemove.size());
// assertTrue(statesToRemove.containsAll(Set.of(SCHEDULES_BY_EXPIRY_SEC_KEY,
// SCHEDULES_BY_EQUALITY_KEY)));
assertEquals(2, statesToRemove.size());
assertTrue(statesToRemove.containsAll(Set.of(SCHEDULES_BY_EXPIRY_SEC_KEY, SCHEDULES_BY_EQUALITY_KEY)));
}

@SuppressWarnings("DataFlowIssue")
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.56.0
0.57.0

0 comments on commit 9b0f656

Please sign in to comment.