Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
33b5ea8
test: bls tests moved to new format
zilm13 Apr 29, 2019
005c994
test: added links to test format descriptions of various BLS tests
zilm13 Apr 30, 2019
2e2be49
test: generic ssz tests (for primitive values) updated for to new sta…
zilm13 Apr 30, 2019
1f31c94
test: ssz/hash tree/signing root static type tests added
zilm13 May 1, 2019
6aae5fe
test: forgotten mapper for Fork class added to ssz tests
zilm13 May 1, 2019
2e843f0
Merge branch 'spec/v0.6.0' into test/spec
zilm13 May 1, 2019
ece8a8b
test: update serializer/mappers according to models updated to v0.6.0
zilm13 May 1, 2019
f923670
models updated to use vectors according to 0.6.0
zilm13 May 1, 2019
8723ca9
test: comment out tests to make not updated tests compile
zilm13 May 1, 2019
816ebe2
test: fix ssz/hash tree/signing root tests with known model types
zilm13 May 1, 2019
98bca29
test: fix code style of SszStaticRunner
zilm13 May 1, 2019
f75093b
update MiscParametersData to match 0.6.0 spec
zilm13 May 1, 2019
46fc0ea
test: fix shuffling tests
zilm13 May 1, 2019
00644b4
test: fix state tests
zilm13 May 1, 2019
f8c9576
Merge branch 'spec/v0.6.0' into test/spec
zilm13 May 2, 2019
2a4640b
test: refactor compute_committee plus optimized version, so general g…
zilm13 May 2, 2019
419a2cd
test: final cleanup and refactoring of general github test runners
zilm13 May 2, 2019
8e993c9
Merge branch 'spec/v0.6.1' into test/spec
zilm13 May 6, 2019
b782eae
fix convert_to_indexed according to v0.6.1 spec
zilm13 May 6, 2019
ab094b0
Merge branch 'spec/v0.6.1' into test/spec
zilm13 May 7, 2019
311274c
Merge branch 'spec/v0.6.1' into test/spec
zilm13 May 7, 2019
446f1e6
test: add replaceAll in WriteList
zilm13 May 7, 2019
7f31841
test: catch only certain exceptions, so we could be able to catch bug…
zilm13 May 7, 2019
534858a
test: refactor ComparableBigIntegerNode
zilm13 May 7, 2019
95d0590
refactor SpecAssertion error
zilm13 May 8, 2019
85a24e5
test: state test runner refactor + add processing error where needed
zilm13 May 8, 2019
0b4a817
Merge branch 'develop' into test/spec
zilm13 May 11, 2019
7fd6d11
test: fix AttestationData according to v0.6.1
zilm13 May 11, 2019
fde9c97
test: operations/attestations state tests are ignored until fixtures …
zilm13 May 11, 2019
3144406
Merge branch 'feature/ssz-sos' into test/spec
zilm13 May 14, 2019
d985456
Merge branch 'feature/ssz-sos' into test/spec
zilm13 May 15, 2019
beaa7f9
Merge branch 'develop' into test/spec
zilm13 May 16, 2019
a75d7d5
test: added @ignore to 2 bls tests which fails because of old hashing…
zilm13 May 16, 2019
5e0dadc
Merge branch 'develop' into test/spec
zilm13 May 21, 2019
a7ec1ac
test: removed old tests repository
zilm13 May 21, 2019
57850b6
test: update tests to use eth2.0-spec-tests repository with temp copi…
zilm13 May 21, 2019
181973f
test: added lfs install on tests task
zilm13 May 21, 2019
c04e77d
add git-lfs install on Circle CI
zilm13 May 21, 2019
50bfa01
add apt-get repository to ci
zilm13 May 21, 2019
75425b3
fix circle ci command to install git-lfs
zilm13 May 21, 2019
aa7b67c
fixed circle ci sources.list update
zilm13 May 21, 2019
81ecd2f
fixed quotes in ci command
zilm13 May 21, 2019
85257f6
added trusted
zilm13 May 21, 2019
495665a
ci: updated apt-get repo to latest
zilm13 May 21, 2019
3eb2c30
ci: trying ssh url
zilm13 May 22, 2019
a699cdd
Revert "ci: trying ssh url"
zilm13 May 22, 2019
0f22fbb
empty commit
zilm13 May 22, 2019
c91495f
test: add javadoc
zilm13 May 22, 2019
834f925
empty commit
zilm13 May 22, 2019
3d1d07a
empty commit
zilm13 May 22, 2019
ae0afcb
test: ignore lines updated
zilm13 May 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ jobs:
keys:
- v1-gradle-dir-{{ checksum "build.gradle" }}
- v1-gradle-dir-

- run:
name: Install git-lfs for submodules with large files
command: |
sudo sh -c "echo 'deb http://ftp.debian.org/debian stretch-backports main' >> /etc/apt/sources.list"
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get update && sudo apt-get install -y git-lfs
- run:
name: Downloading dependencies
command: ./gradlew allDependencies
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "test/src/test/resources/eth2.0-tests"]
path = test/src/test/resources/eth2.0-tests
url = https://github.com/ethereum/eth2.0-tests.git
[submodule "crypto/src/main/resources/bls-key-pairs"]
path = crypto/src/main/resources/bls-key-pairs
url = https://github.com/harmony-dev/bls-key-pairs
[submodule "test/src/test/resources/eth2.0-spec-tests"]
path = test/src/test/resources/eth2.0-spec-tests
url = https://github.com/ethereum/eth2.0-spec-tests.git
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,7 @@ def process_crosslinks(state: BeaconState) -> None:
state.current_crosslinks[shard] = winning_crosslink
*/
default void process_crosslinks(MutableBeaconState state) {
state.getPreviousCrosslinks().clear();
state.getPreviousCrosslinks().addAll(state.getCurrentCrosslinks().listCopy());
state.getPreviousCrosslinks().replaceAll(state.getCurrentCrosslinks().listCopy());

for (EpochNumber epoch : get_previous_epoch(state).iterateTo(get_current_epoch(state).increment())) {
for (UInt64 offset : UInt64s.iterate(UInt64.ZERO, get_epoch_committee_count(state, epoch))) {
Expand Down Expand Up @@ -694,8 +693,7 @@ default void process_final_updates(MutableBeaconState state) {
/* Rotate current/previous epoch attestations
state.previous_epoch_attestations = state.current_epoch_attestations
state.current_epoch_attestations = [] */
state.getPreviousEpochAttestations().clear();
state.getPreviousEpochAttestations().addAll(state.getCurrentEpochAttestations().listCopy());
state.getPreviousEpochAttestations().replaceAll(state.getCurrentEpochAttestations().listCopy());
state.getCurrentEpochAttestations().clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,15 @@ def compute_committee(indices: List[ValidatorIndex], seed: Bytes32, index: int,
default List<ValidatorIndex> compute_committee(List<ValidatorIndex> indices, Bytes32 seed, UInt64 index, UInt64 count) {
UInt64 start = index.times(indices.size()).dividedBy(count);
UInt64 end = index.increment().times(indices.size()).dividedBy(count);

return compute_committee(indices, start, end, seed);
}

default List<ValidatorIndex> compute_committee(List<ValidatorIndex> validator_indices, UInt64 start, UInt64 end, Bytes32 seed) {
List<ValidatorIndex> result = new ArrayList<>();
for (UInt64 i = start; i.compareTo(end) < 0; i = i.increment()) {
UInt64 shuffled_index = get_shuffled_index(i, UInt64.valueOf(indices.size()), seed);
result.add(indices.get(shuffled_index.getIntValue()));
UInt64 shuffled_index = get_shuffled_index(i, UInt64.valueOf(validator_indices.size()), seed);
result.add(validator_indices.get(shuffled_index.getIntValue()));
}
return result;
}
Expand All @@ -497,9 +502,15 @@ default List<ValidatorIndex> compute_committee(List<ValidatorIndex> indices, Byt
* Based on {@link #get_permuted_list(List, Bytes32)}.
*/
default List<ValidatorIndex> compute_committee2(List<ValidatorIndex> indices, Bytes32 seed, UInt64 index, UInt64 count) {
List<ValidatorIndex> shuffled_indices = get_permuted_list(indices, seed)
UInt64 start = index.times(indices.size()).dividedBy(count);
UInt64 end = index.increment().times(indices.size()).dividedBy(count);
return compute_committee2(indices, start, end, seed);
}

default List<ValidatorIndex> compute_committee2(List<ValidatorIndex> validator_indices, UInt64 start, UInt64 end, Bytes32 seed) {
List<ValidatorIndex> shuffled_indices = get_permuted_list(validator_indices, seed)
.stream().map(ValidatorIndex::new).collect(toList());
return split(shuffled_indices, count.getIntValue()).get(index.getIntValue());
return shuffled_indices.subList(start.intValue(), end.intValue());
}

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.ethereum.beacon.consensus.spec;

import java.util.function.Function;
import org.ethereum.beacon.consensus.hasher.ObjectHasher;
import org.ethereum.beacon.core.BeaconState;
import org.ethereum.beacon.core.spec.SpecConstants;
Expand All @@ -9,6 +8,8 @@
import tech.pegasys.artemis.ethereum.core.Hash32;
import tech.pegasys.artemis.util.bytes.BytesValue;

import java.util.function.Function;

/**
* A common part of the spec that is shared by all its components.
*/
Expand Down Expand Up @@ -42,5 +43,17 @@ default void checkShardRange(ShardNumber shard) {
assertTrue(shard.less(getConstants().getShardCount()));
}

class SpecAssertionFailed extends RuntimeException {}
class SpecAssertionFailed extends RuntimeException {
@Override
public String getMessage() {
return toString();
}

@Override
public String toString() {
return String.format(
"SpecAssertionFailed{%s}",
getStackTrace().length > 1 ? getStackTrace()[1].toString() : "");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ethereum.beacon.consensus.verifier.operation;

import org.ethereum.beacon.consensus.BeaconChainSpec;
import org.ethereum.beacon.consensus.spec.SpecCommons;
import org.ethereum.beacon.consensus.verifier.OperationVerifier;
import org.ethereum.beacon.consensus.verifier.VerificationResult;
import org.ethereum.beacon.core.BeaconState;
Expand All @@ -27,7 +28,7 @@ public VerificationResult verify(Attestation attestation, BeaconState state) {
try {
spec.verify_attestation(state, attestation);
return VerificationResult.PASSED;
} catch (Exception e) {
} catch (SpecCommons.SpecAssertionFailed e) {
return VerificationResult.failedResult(e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ethereum.beacon.consensus.verifier.operation;

import org.ethereum.beacon.consensus.BeaconChainSpec;
import org.ethereum.beacon.consensus.spec.SpecCommons;
import org.ethereum.beacon.consensus.verifier.OperationVerifier;
import org.ethereum.beacon.consensus.verifier.VerificationResult;
import org.ethereum.beacon.core.BeaconState;
Expand All @@ -27,7 +28,7 @@ public VerificationResult verify(AttesterSlashing attesterSlashing, BeaconState
try {
spec.verify_attester_slashing(state, attesterSlashing);
return VerificationResult.PASSED;
} catch (Exception e) {
} catch (SpecCommons.SpecAssertionFailed e) {
return VerificationResult.failedResult(e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ethereum.beacon.consensus.verifier.operation;

import org.ethereum.beacon.consensus.BeaconChainSpec;
import org.ethereum.beacon.consensus.spec.SpecCommons;
import org.ethereum.beacon.consensus.verifier.OperationVerifier;
import org.ethereum.beacon.consensus.verifier.VerificationResult;
import org.ethereum.beacon.core.BeaconState;
Expand Down Expand Up @@ -30,7 +31,7 @@ public VerificationResult verify(Deposit deposit, BeaconState state) {
try {
spec.verify_deposit(state, deposit);
return VerificationResult.PASSED;
} catch (Exception e) {
} catch (SpecCommons.SpecAssertionFailed e) {
return VerificationResult.failedResult(e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ethereum.beacon.consensus.verifier.operation;

import org.ethereum.beacon.consensus.BeaconChainSpec;
import org.ethereum.beacon.consensus.spec.SpecCommons;
import org.ethereum.beacon.consensus.verifier.OperationVerifier;
import org.ethereum.beacon.consensus.verifier.VerificationResult;
import org.ethereum.beacon.core.BeaconState;
Expand All @@ -27,7 +28,7 @@ public VerificationResult verify(ProposerSlashing proposerSlashing, BeaconState
try {
spec.verify_proposer_slashing(state, proposerSlashing);
return VerificationResult.PASSED;
} catch (Exception e) {
} catch (SpecCommons.SpecAssertionFailed e) {
return VerificationResult.failedResult(e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ethereum.beacon.consensus.verifier.operation;

import org.ethereum.beacon.consensus.BeaconChainSpec;
import org.ethereum.beacon.consensus.spec.SpecCommons;
import org.ethereum.beacon.consensus.verifier.OperationVerifier;
import org.ethereum.beacon.consensus.verifier.VerificationResult;
import org.ethereum.beacon.core.BeaconState;
Expand All @@ -26,7 +27,7 @@ public VerificationResult verify(Transfer transfer, BeaconState state) {
try {
spec.verify_transfer(state, transfer);
return VerificationResult.PASSED;
} catch (Exception e) {
} catch (SpecCommons.SpecAssertionFailed e) {
return VerificationResult.failedResult(e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ethereum.beacon.consensus.verifier.operation;

import org.ethereum.beacon.consensus.BeaconChainSpec;
import org.ethereum.beacon.consensus.spec.SpecCommons;
import org.ethereum.beacon.consensus.verifier.OperationVerifier;
import org.ethereum.beacon.consensus.verifier.VerificationResult;
import org.ethereum.beacon.core.BeaconState;
Expand All @@ -27,7 +28,7 @@ public VerificationResult verify(VoluntaryExit voluntaryExit, BeaconState state)
try {
spec.verify_voluntary_exit(state, voluntaryExit);
return VerificationResult.PASSED;
} catch (Exception e) {
} catch (SpecCommons.SpecAssertionFailed e) {
return VerificationResult.failedResult(e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public EpochNumber getMinValidatorWithdrawabilityDelay() {

@Override
public EpochNumber getGenesisEpoch() {
return initialValues.getGenesisEpoch();
return getGenesisSlot().dividedBy(getSlotsPerEpoch());
}

@Override
Expand Down
1 change: 1 addition & 0 deletions test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies {

task submodulesUpdate(type:Exec) {
description 'Updates (and inits) git submodules'
commandLine 'git', 'lfs', 'install'
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
group 'Build Setup'
}
Expand Down
Loading