Skip to content

Commit

Permalink
resolving issues from auto-merges
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhea committed May 27, 2019
1 parent d70c81c commit 280c955
Show file tree
Hide file tree
Showing 41 changed files with 459 additions and 522 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

package tech.pegasys.artemis.datastructures;

import com.google.common.primitives.UnsignedLong;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import tech.pegasys.artemis.util.bls.BLSSignature;
Expand Down Expand Up @@ -54,10 +55,10 @@ public class Constants {

// Initial values
public static int GENESIS_FORK_VERSION = 0;
public static long GENESIS_SLOT = 0; // 2^32
public static long GENESIS_SLOT = 4294967296L; // 2^32
public static long GENESIS_EPOCH = slot_to_epoch(GENESIS_SLOT);
public static long GENESIS_START_SHARD = 0;
public static long FAR_FUTURE_EPOCH = -1L;
public static UnsignedLong FAR_FUTURE_EPOCH = UnsignedLong.MAX_VALUE;
public static Bytes32 ZERO_HASH = Bytes32.ZERO;
public static BLSSignature EMPTY_SIGNATURE = BLSSignature.empty();
public static Bytes BLS_WITHDRAWAL_PREFIX_BYTE = Bytes.EMPTY;
Expand Down Expand Up @@ -197,7 +198,9 @@ public static void init(ArtemisConfiguration config) {
? config.getGenesisStartShard()
: GENESIS_START_SHARD;
FAR_FUTURE_EPOCH =
config.getFarFutureEpoch() != -1L ? config.getFarFutureEpoch() : FAR_FUTURE_EPOCH;
!UnsignedLong.valueOf(config.getFarFutureEpoch()).equals(UnsignedLong.MAX_VALUE)
? UnsignedLong.valueOf(config.getFarFutureEpoch())
: FAR_FUTURE_EPOCH;
ZERO_HASH =
!config.getZeroHash().equals(Bytes32.ZERO)
? (Bytes32) config.getZeroHash()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

import java.util.Arrays;
import java.util.Objects;
import net.consensys.cava.ssz.SSZ;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import net.consensys.cava.ssz.SSZ;
import tech.pegasys.artemis.util.bls.BLSSignature;
import tech.pegasys.artemis.util.hashtree.HashTreeUtil;
import tech.pegasys.artemis.util.hashtree.HashTreeUtil.SSZTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import net.consensys.cava.ssz.SSZ;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import net.consensys.cava.ssz.SSZ;
import tech.pegasys.artemis.datastructures.operations.Attestation;
import tech.pegasys.artemis.datastructures.operations.AttesterSlashing;
import tech.pegasys.artemis.datastructures.operations.Deposit;
Expand Down Expand Up @@ -89,17 +89,17 @@ public static BeaconBlockBody fromBytes(Bytes bytes) {

public Bytes toBytes() {
List<Bytes> proposerSlashingsBytes =
proposer_slashings.stream().map(ProposerSlashing::toBytes).collect(Collectors.toList());
proposer_slashings.stream().map(item -> item.toBytes()).collect(Collectors.toList());
List<Bytes> attesterSlashingsBytes =
attester_slashings.stream().map(AttesterSlashing::toBytes).collect(Collectors.toList());
attester_slashings.stream().map(item -> item.toBytes()).collect(Collectors.toList());
List<Bytes> attestationsBytes =
attestations.stream().map(Attestation::toBytes).collect(Collectors.toList());
attestations.stream().map(item -> item.toBytes()).collect(Collectors.toList());
List<Bytes> depositsBytes =
deposits.stream().map(Deposit::toBytes).collect(Collectors.toList());
deposits.stream().map(item -> item.toBytes()).collect(Collectors.toList());
List<Bytes> voluntaryExitsBytes =
voluntary_exits.stream().map(item -> item.toBytes()).collect(Collectors.toList());
List<Bytes> transfersBytes =
transfers.stream().map(Transfer::toBytes).collect(Collectors.toList());
transfers.stream().map(item -> item.toBytes()).collect(Collectors.toList());

return SSZ.encode(
writer -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import com.google.common.primitives.UnsignedLong;
import java.util.Arrays;
import java.util.Objects;
import net.consensys.cava.bytes.Bytes;
import net.consensys.cava.bytes.Bytes32;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import net.consensys.cava.ssz.SSZ;
import tech.pegasys.artemis.util.bls.BLSSignature;
import tech.pegasys.artemis.util.hashtree.HashTreeUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

import java.util.Arrays;
import java.util.Objects;
import net.consensys.cava.ssz.SSZ;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import net.consensys.cava.ssz.SSZ;
import tech.pegasys.artemis.util.hashtree.HashTreeUtil;
import tech.pegasys.artemis.util.hashtree.HashTreeUtil.SSZTypes;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,23 @@

package tech.pegasys.artemis.datastructures.blocks;

import com.google.common.primitives.UnsignedLong;
import java.util.Arrays;
import java.util.Objects;
import net.consensys.cava.ssz.SSZ;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import net.consensys.cava.ssz.SSZ;
import tech.pegasys.artemis.datastructures.Copyable;
import tech.pegasys.artemis.util.hashtree.HashTreeUtil;
import tech.pegasys.artemis.util.hashtree.HashTreeUtil.SSZTypes;
import tech.pegasys.artemis.util.hashtree.Merkleizable;

public final class Eth1DataVote implements Copyable<Eth1DataVote>, Merkleizable {

private Eth1Data eth1_data;
private long vote_count;
private UnsignedLong vote_count;

public Eth1DataVote(Eth1Data eth1_data, long vote_count) {
public Eth1DataVote(Eth1Data eth1_data, UnsignedLong vote_count) {
this.eth1_data = eth1_data;
this.vote_count = vote_count;
}
Expand All @@ -45,14 +47,17 @@ public Eth1DataVote copy() {
public static Eth1DataVote fromBytes(Bytes bytes) {
return SSZ.decode(
bytes,
reader -> new Eth1DataVote(Eth1Data.fromBytes(reader.readBytes()), reader.readUInt64()));
reader ->
new Eth1DataVote(
Eth1Data.fromBytes(reader.readBytes()),
UnsignedLong.fromLongBits(reader.readUInt64())));
}

public Bytes toBytes() {
return SSZ.encode(
writer -> {
writer.writeBytes(eth1_data.toBytes());
writer.writeUInt64(vote_count);
writer.writeUInt64(vote_count.longValue());
});
}

Expand Down Expand Up @@ -91,12 +96,12 @@ public void setEth1_data(Eth1Data eth1_data) {
}

/** @return the vote_count */
public long getVote_count() {
public UnsignedLong getVote_count() {
return vote_count;
}

/** @param vote_count the vote_count to set */
public void setVote_count(long vote_count) {
public void setVote_count(UnsignedLong vote_count) {
this.vote_count = vote_count;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import com.google.common.primitives.UnsignedLong;
import java.util.Arrays;
import java.util.Objects;
import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import net.consensys.cava.ssz.SSZ;
import tech.pegasys.artemis.util.bls.BLSSignature;
import tech.pegasys.artemis.util.hashtree.HashTreeUtil;
Expand Down Expand Up @@ -122,7 +122,7 @@ public void setAggregate_signature(BLSSignature aggregate_signature) {
this.aggregate_signature = aggregate_signature;
}

public long getSlot() {
public UnsignedLong getSlot() {
return data.getSlot();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ public boolean equals(Object obj) {
}

/** ******************* * GETTERS & SETTERS * * ******************* */
public long getSlot() {
public UnsignedLong getSlot() {
return slot;
}

public void setSlot(long slot) {
public void setSlot(UnsignedLong slot) {
this.slot = slot;
}

Expand Down Expand Up @@ -177,11 +177,11 @@ public void setTarget_root(Bytes32 target_root) {
this.target_root = target_root;
}

public long getShard() {
public UnsignedLong getShard() {
return shard;
}

public void setShard(long shard) {
public void setShard(UnsignedLong shard) {
this.shard = shard;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

import java.util.Arrays;
import java.util.Objects;
import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import net.consensys.cava.ssz.SSZ;
import tech.pegasys.artemis.util.hashtree.HashTreeUtil;
import tech.pegasys.artemis.util.hashtree.HashTreeUtil.SSZTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import net.consensys.cava.ssz.SSZ;
import net.consensys.cava.ssz.SSZ;
import tech.pegasys.artemis.util.hashtree.HashTreeUtil;
import tech.pegasys.artemis.util.hashtree.Merkleizable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ public void setProof(List<Bytes32> branch) {
this.proof = branch;
}

public long getIndex() {
public UnsignedLong getIndex() {
return index;
}

public void setIndex(long index) {
public void setIndex(UnsignedLong index) {
this.index = index;
}

Expand Down
Loading

0 comments on commit 280c955

Please sign in to comment.