bump stew, fix warnings (#655)

This commit is contained in:
Jacek Sieka 2019-12-20 14:25:33 +01:00 committed by GitHub
parent 07c37517ea
commit 746659bdc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 13 deletions

View File

@ -330,7 +330,7 @@ proc sendAttestation(node: BeaconNode,
validatorSignature = await validator.signAttestation(attestationData, fork) validatorSignature = await validator.signAttestation(attestationData, fork)
var aggregationBits = CommitteeValidatorsBits.init(committeeLen) var aggregationBits = CommitteeValidatorsBits.init(committeeLen)
aggregationBits.raiseBit indexInCommittee aggregationBits.setBit indexInCommittee
var attestation = Attestation( var attestation = Attestation(
data: attestationData, data: attestationData,

View File

@ -536,8 +536,8 @@ template bytes*(x: BitList): auto = bytes(BitSeq(x))
template `[]`*(x: BitList, idx: auto): auto = BitSeq(x)[idx] template `[]`*(x: BitList, idx: auto): auto = BitSeq(x)[idx]
template `[]=`*(x: var BitList, idx: auto, val: bool) = BitSeq(x)[idx] = val template `[]=`*(x: var BitList, idx: auto, val: bool) = BitSeq(x)[idx] = val
template `==`*(a, b: BitList): bool = BitSeq(a) == BitSeq(b) template `==`*(a, b: BitList): bool = BitSeq(a) == BitSeq(b)
template raiseBit*(x: var BitList, idx: int) = raiseBit(BitSeq(x), idx) template setBit*(x: var BitList, idx: int) = setBit(BitSeq(x), idx)
template lowerBit*(x: var BitList, idx: int) = lowerBit(BitSeq(x), idx) template clearBit*(x: var BitList, idx: int) = clearBit(BitSeq(x), idx)
template overlaps*(a, b: BitList): bool = overlaps(BitSeq(a), BitSeq(b)) template overlaps*(a, b: BitList): bool = overlaps(BitSeq(a), BitSeq(b))
template combine*(a: var BitList, b: BitList) = combine(BitSeq(a), BitSeq(b)) template combine*(a: var BitList, b: BitList) = combine(BitSeq(a), BitSeq(b))
template isSubsetOf*(a, b: BitList): bool = isSubsetOf(BitSeq(a), BitSeq(b)) template isSubsetOf*(a, b: BitList): bool = isSubsetOf(BitSeq(a), BitSeq(b))

View File

@ -164,7 +164,7 @@ proc process_justification_and_finalization*(
state.current_justified_checkpoint = state.current_justified_checkpoint =
Checkpoint(epoch: previous_epoch, Checkpoint(epoch: previous_epoch,
root: get_block_root(state, previous_epoch)) root: get_block_root(state, previous_epoch))
state.justification_bits.raiseBit 1 state.justification_bits.setBit 1
debug "Justified with previous epoch", debug "Justified with previous epoch",
current_epoch = current_epoch, current_epoch = current_epoch,
@ -178,7 +178,7 @@ proc process_justification_and_finalization*(
state.current_justified_checkpoint = state.current_justified_checkpoint =
Checkpoint(epoch: current_epoch, Checkpoint(epoch: current_epoch,
root: get_block_root(state, current_epoch)) root: get_block_root(state, current_epoch))
state.justification_bits.raiseBit 0 state.justification_bits.setBit 0
debug "Justified with current epoch", debug "Justified with current epoch",
current_epoch = current_epoch, current_epoch = current_epoch,

View File

@ -474,7 +474,7 @@ func bitlistHashTreeRoot(merkelizer: SszChunksMerkelizer, x: BitSeq): Eth2Digest
lastCorrectedByte = Bytes(x)[^2] lastCorrectedByte = Bytes(x)[^2]
else: else:
let markerPos = log2trunc(lastCorrectedByte) let markerPos = log2trunc(lastCorrectedByte)
lastCorrectedByte.lowerBit(markerPos) lastCorrectedByte.clearBit(markerPos)
var var
bytesInLastChunk = totalBytes mod bytesPerChunk bytesInLastChunk = totalBytes mod bytesPerChunk

View File

@ -46,8 +46,8 @@ proc finalizeOn234(state: var BeaconState, epoch: Epoch, sufficient_support: boo
state.justification_bits = 0'u8 # Bitvector of length 4 state.justification_bits = 0'u8 # Bitvector of length 4
# mock 3rd and 4th latest epochs as justified # mock 3rd and 4th latest epochs as justified
# indices are pre-shift # indices are pre-shift
state.justification_bits.raiseBit 1 state.justification_bits.setBit 1
state.justification_bits.raiseBit 2 state.justification_bits.setBit 2
# mock the 2nd latest epoch as justifiable, with 4th as the source # mock the 2nd latest epoch as justifiable, with 4th as the source
addMockAttestations( addMockAttestations(
state, state,
@ -92,7 +92,7 @@ proc finalizeOn23(state: var BeaconState, epoch: Epoch, sufficient_support: bool
state.justification_bits = 0'u8 # Bitvector of length 4 state.justification_bits = 0'u8 # Bitvector of length 4
# mock 3rd as justified # mock 3rd as justified
# indices are pre-shift # indices are pre-shift
state.justification_bits.raiseBit 1 state.justification_bits.setBit 1
# mock the 2nd latest epoch as justifiable, with 3rd as the source # mock the 2nd latest epoch as justifiable, with 3rd as the source
addMockAttestations( addMockAttestations(
state, state,
@ -137,7 +137,7 @@ proc finalizeOn123(state: var BeaconState, epoch: Epoch, sufficient_support: boo
state.justification_bits = 0'u8 # Bitvector of length 4 state.justification_bits = 0'u8 # Bitvector of length 4
# mock 3rd as justified # mock 3rd as justified
# indices are pre-shift # indices are pre-shift
state.justification_bits.raiseBit 1 state.justification_bits.setBit 1
# mock the 2nd latest epoch as justifiable, with 5th as the source # mock the 2nd latest epoch as justifiable, with 5th as the source
addMockAttestations( addMockAttestations(
state, state,
@ -190,7 +190,7 @@ proc finalizeOn12(state: var BeaconState, epoch: Epoch, sufficient_support: bool
state.justification_bits = 0'u8 # Bitvector of length 4 state.justification_bits = 0'u8 # Bitvector of length 4
# mock 3rd as justified # mock 3rd as justified
# indices are pre-shift # indices are pre-shift
state.justification_bits.raiseBit 0 state.justification_bits.setBit 0
# mock the 2nd latest epoch as justifiable, with 3rd as the source # mock the 2nd latest epoch as justifiable, with 3rd as the source
addMockAttestations( addMockAttestations(
state, state,

View File

@ -164,7 +164,7 @@ proc makeAttestation*(
doAssert sac_index != -1, "find_beacon_committee should guarantee this" doAssert sac_index != -1, "find_beacon_committee should guarantee this"
var aggregation_bits = CommitteeValidatorsBits.init(committee.len) var aggregation_bits = CommitteeValidatorsBits.init(committee.len)
aggregation_bits.raiseBit sac_index aggregation_bits.setBit sac_index
let let
msg = hash_tree_root(data) msg = hash_tree_root(data)

2
vendor/nim-stew vendored

@ -1 +1 @@
Subproject commit 9c18a1cc553bc61cdf67f0b4c12b538bde95a599 Subproject commit 1edeabb453724aa452a940ab03ddc82f5aeeff6e