forked from Consensys/teku
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix PendingPartialWithdrawal deserialization (Consensys#8195)
Co-authored-by: Paul Harris <[email protected]>
- Loading branch information
Showing
13 changed files
with
244 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...t/java/tech/pegasys/teku/spec/datastructures/state/PendingBalanceDepositPropertyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright Consensys Software Inc., 2024 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package tech.pegasys.teku.spec.datastructures.state; | ||
|
||
import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertDeserializeMutatedThrowsExpected; | ||
import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertRoundTrip; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import net.jqwik.api.ForAll; | ||
import net.jqwik.api.Property; | ||
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingBalanceDeposit; | ||
import tech.pegasys.teku.spec.propertytest.suppliers.state.PendingBalanceDepositSupplier; | ||
|
||
public class PendingBalanceDepositPropertyTest { | ||
@Property | ||
void roundTrip( | ||
@ForAll(supplier = PendingBalanceDepositSupplier.class) | ||
final PendingBalanceDeposit pendingBalanceDeposit) | ||
throws JsonProcessingException { | ||
assertRoundTrip(pendingBalanceDeposit); | ||
} | ||
|
||
@Property | ||
void deserializeMutated( | ||
@ForAll(supplier = PendingBalanceDepositSupplier.class) | ||
final PendingBalanceDeposit pendingBalanceDeposit, | ||
@ForAll final int seed) { | ||
assertDeserializeMutatedThrowsExpected(pendingBalanceDeposit, seed); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...st/java/tech/pegasys/teku/spec/datastructures/state/PendingConsolidationPropertyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright Consensys Software Inc., 2024 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package tech.pegasys.teku.spec.datastructures.state; | ||
|
||
import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertDeserializeMutatedThrowsExpected; | ||
import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertRoundTrip; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import net.jqwik.api.ForAll; | ||
import net.jqwik.api.Property; | ||
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingConsolidation; | ||
import tech.pegasys.teku.spec.propertytest.suppliers.state.PendingConsolidationSupplier; | ||
|
||
public class PendingConsolidationPropertyTest { | ||
@Property | ||
void roundTrip( | ||
@ForAll(supplier = PendingConsolidationSupplier.class) | ||
final PendingConsolidation pendingConsolidation) | ||
throws JsonProcessingException { | ||
assertRoundTrip(pendingConsolidation); | ||
} | ||
|
||
@Property | ||
void deserializeMutated( | ||
@ForAll(supplier = PendingConsolidationSupplier.class) | ||
final PendingConsolidation pendingConsolidation, | ||
@ForAll final int seed) { | ||
assertDeserializeMutatedThrowsExpected(pendingConsolidation, seed); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...ava/tech/pegasys/teku/spec/datastructures/state/PendingPartialWithdrawalPropertyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright Consensys Software Inc., 2024 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package tech.pegasys.teku.spec.datastructures.state; | ||
|
||
import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertDeserializeMutatedThrowsExpected; | ||
import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertRoundTrip; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import net.jqwik.api.ForAll; | ||
import net.jqwik.api.Property; | ||
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingPartialWithdrawal; | ||
import tech.pegasys.teku.spec.propertytest.suppliers.state.PendingPartialWithdrawalSupplier; | ||
|
||
public class PendingPartialWithdrawalPropertyTest { | ||
@Property | ||
void roundTrip( | ||
@ForAll(supplier = PendingPartialWithdrawalSupplier.class) | ||
final PendingPartialWithdrawal pendingPartialWithdrawal) | ||
throws JsonProcessingException { | ||
assertRoundTrip(pendingPartialWithdrawal); | ||
} | ||
|
||
@Property | ||
void deserializeMutated( | ||
@ForAll(supplier = PendingPartialWithdrawalSupplier.class) | ||
final PendingPartialWithdrawal pendingPartialWithdrawal, | ||
@ForAll final int seed) { | ||
assertDeserializeMutatedThrowsExpected(pendingPartialWithdrawal, seed); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...va/tech/pegasys/teku/spec/propertytest/suppliers/state/PendingBalanceDepositSupplier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright Consensys Software Inc., 2024 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package tech.pegasys.teku.spec.propertytest.suppliers.state; | ||
|
||
import tech.pegasys.teku.spec.SpecMilestone; | ||
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingBalanceDeposit; | ||
import tech.pegasys.teku.spec.propertytest.suppliers.DataStructureUtilSupplier; | ||
import tech.pegasys.teku.spec.util.DataStructureUtil; | ||
|
||
public class PendingBalanceDepositSupplier | ||
extends DataStructureUtilSupplier<PendingBalanceDeposit> { | ||
public PendingBalanceDepositSupplier() { | ||
super(DataStructureUtil::randomPendingBalanceDeposit, SpecMilestone.ELECTRA); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...ava/tech/pegasys/teku/spec/propertytest/suppliers/state/PendingConsolidationSupplier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright Consensys Software Inc., 2024 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package tech.pegasys.teku.spec.propertytest.suppliers.state; | ||
|
||
import tech.pegasys.teku.spec.SpecMilestone; | ||
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingConsolidation; | ||
import tech.pegasys.teku.spec.propertytest.suppliers.DataStructureUtilSupplier; | ||
import tech.pegasys.teku.spec.util.DataStructureUtil; | ||
|
||
public class PendingConsolidationSupplier extends DataStructureUtilSupplier<PendingConsolidation> { | ||
public PendingConsolidationSupplier() { | ||
super(DataStructureUtil::randomPendingConsolidation, SpecMilestone.ELECTRA); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...tech/pegasys/teku/spec/propertytest/suppliers/state/PendingPartialWithdrawalSupplier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright Consensys Software Inc., 2024 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package tech.pegasys.teku.spec.propertytest.suppliers.state; | ||
|
||
import tech.pegasys.teku.spec.SpecMilestone; | ||
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingPartialWithdrawal; | ||
import tech.pegasys.teku.spec.propertytest.suppliers.DataStructureUtilSupplier; | ||
import tech.pegasys.teku.spec.util.DataStructureUtil; | ||
|
||
public class PendingPartialWithdrawalSupplier | ||
extends DataStructureUtilSupplier<PendingPartialWithdrawal> { | ||
public PendingPartialWithdrawalSupplier() { | ||
super(DataStructureUtil::randomPendingPartialWithdrawal, SpecMilestone.ELECTRA); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters