Skip to content

Commit

Permalink
Entropy field type change (#25)
Browse files Browse the repository at this point in the history
* fix: Change extraEntropy to Tuple

* fix: Bump snapshot version
  • Loading branch information
satran004 authored Sep 16, 2023
1 parent 9647437 commit e892ed8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.bloxbean.cardano.yaci.core.model;

import com.bloxbean.cardano.yaci.core.util.Tuple;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

Expand Down Expand Up @@ -28,7 +29,7 @@ public class ProtocolParamUpdate {
private BigDecimal expansionRate; //unit interval //10
private BigDecimal treasuryGrowthRate; //11
private BigDecimal decentralisationParam; //12
private String extraEntropy; //TODO //13
private Tuple<Integer, String> extraEntropy; //13
private Integer protocolMajorVer; //14
private Integer protocolMinorVer; //14
private BigInteger minUtxo; //TODO //15
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import co.nstant.in.cbor.model.*;
import com.bloxbean.cardano.client.crypto.Blake2bUtil;
import com.bloxbean.cardano.client.util.Tuple;
import com.bloxbean.cardano.yaci.core.model.ProtocolParamUpdate;
import com.bloxbean.cardano.yaci.core.model.Update;
import com.bloxbean.cardano.yaci.core.protocol.Serializer;
import com.bloxbean.cardano.yaci.core.util.CborSerializationUtil;
import com.bloxbean.cardano.yaci.core.util.HexUtil;
import com.bloxbean.cardano.yaci.core.util.Tuple;

import java.math.BigDecimal;
import java.math.BigInteger;
Expand Down Expand Up @@ -90,7 +90,7 @@ public ProtocolParamUpdate getProtocolParams(Map genesisProtocolParamsMap) {
itemDI = genesisProtocolParamsMap.get(new UnsignedInteger(12));
BigDecimal decentralizationParam = itemDI != null ? toRationalNumber(itemDI) : null;

String extraEntropy = null;
Tuple<Integer, String> extraEntropy = null;
// $nonce /= [ 0 // 1, bytes .size 32 ]
itemDI = genesisProtocolParamsMap.get(new UnsignedInteger(13)); //Removed
if (itemDI != null) {
Expand All @@ -100,7 +100,7 @@ public ProtocolParamUpdate getProtocolParams(Map genesisProtocolParamsMap) {
if (extraEntropyDIList.size() == 2) {
extraEntropy_2 = HexUtil.encodeHexString(toBytes(extraEntropyDIList.get(1)));
}
extraEntropy = List.of(extraEntropy_1, extraEntropy_2).toString();
extraEntropy = new Tuple<>(extraEntropy_1, extraEntropy_2);
}

Integer protocolMajorVersion = null;
Expand Down
16 changes: 16 additions & 0 deletions core/src/main/java/com/bloxbean/cardano/yaci/core/util/Tuple.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.bloxbean.cardano.yaci.core.util;

import lombok.EqualsAndHashCode;
import lombok.ToString;

@ToString
@EqualsAndHashCode
public class Tuple<T, Z> {
public T _1;
public Z _2;

public Tuple(T _1, Z _2) {
this._1 = _1;
this._2 = _2;
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group = com.bloxbean.cardano
artifactId = yaci
version = 0.2.3.2-SNAPSHOT
version = 0.2.3.3-SNAPSHOT

0 comments on commit e892ed8

Please sign in to comment.