From e6f35a4f6f8d012d3424b9c5bd01bf6ecc305837 Mon Sep 17 00:00:00 2001 From: Oleksandr Date: Fri, 20 Dec 2024 14:59:57 +0200 Subject: [PATCH] fixed comments --- .../grandpa/messages/consensus/GrandpaConsensusMessage.java | 2 +- .../messages/consensus/GrandpaConsensusMessageReader.java | 5 +++-- .../consensus/GrandpaConsensusMessageReaderTest.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/limechain/network/protocol/grandpa/messages/consensus/GrandpaConsensusMessage.java b/src/main/java/com/limechain/network/protocol/grandpa/messages/consensus/GrandpaConsensusMessage.java index 3eb24563..a29e436a 100644 --- a/src/main/java/com/limechain/network/protocol/grandpa/messages/consensus/GrandpaConsensusMessage.java +++ b/src/main/java/com/limechain/network/protocol/grandpa/messages/consensus/GrandpaConsensusMessage.java @@ -8,7 +8,7 @@ @Data public class GrandpaConsensusMessage { - private long bestFinalizedBlock; + private BigInteger delayStartBlockNumber; private List authorities; private BigInteger disabledAuthority; private long delay; diff --git a/src/main/java/com/limechain/network/protocol/grandpa/messages/consensus/GrandpaConsensusMessageReader.java b/src/main/java/com/limechain/network/protocol/grandpa/messages/consensus/GrandpaConsensusMessageReader.java index 68e4270e..cfaa48cf 100644 --- a/src/main/java/com/limechain/network/protocol/grandpa/messages/consensus/GrandpaConsensusMessageReader.java +++ b/src/main/java/com/limechain/network/protocol/grandpa/messages/consensus/GrandpaConsensusMessageReader.java @@ -7,6 +7,7 @@ import io.emeraldpay.polkaj.scale.reader.ListReader; import io.emeraldpay.polkaj.scale.reader.UInt64Reader; +import java.math.BigInteger; import java.util.List; public class GrandpaConsensusMessageReader implements ScaleReader { @@ -24,10 +25,10 @@ public GrandpaConsensusMessage read(ScaleCodecReader reader) { grandpaConsensusMessage.setDelay(delay); } case GRANDPA_FORCED_CHANGE -> { - long bestFinalizedBlock = reader.readUint32(); + long delayStartBlockNumber = reader.readUint32(); List authorities = reader.read(new ListReader<>(new AuthorityReader())); long delay = reader.readUint32(); - grandpaConsensusMessage.setBestFinalizedBlock(bestFinalizedBlock); + grandpaConsensusMessage.setDelayStartBlockNumber(BigInteger.valueOf(delayStartBlockNumber)); grandpaConsensusMessage.setAuthorities(authorities); grandpaConsensusMessage.setDelay(delay); } diff --git a/src/test/java/com/limechain/network/protocol/grandpa/messages/consensus/GrandpaConsensusMessageReaderTest.java b/src/test/java/com/limechain/network/protocol/grandpa/messages/consensus/GrandpaConsensusMessageReaderTest.java index bf129ac8..6e85ba82 100644 --- a/src/test/java/com/limechain/network/protocol/grandpa/messages/consensus/GrandpaConsensusMessageReaderTest.java +++ b/src/test/java/com/limechain/network/protocol/grandpa/messages/consensus/GrandpaConsensusMessageReaderTest.java @@ -32,7 +32,7 @@ void testForcedChangeInput() { GrandpaConsensusMessage message = reader.read(new ScaleCodecReader(input)); assertNotNull(message); assertEquals(GrandpaConsensusMessageFormat.GRANDPA_FORCED_CHANGE, message.getFormat()); - assertEquals(3, message.getBestFinalizedBlock()); + assertEquals(BigInteger.valueOf(3), message.getDelayStartBlockNumber()); assertNotNull(message.getAuthorities()); assertEquals(1, message.getAuthorities().size());