Skip to content

test_deposit_negative()

Documentation for tests/prague/eip6110_deposits/test_deposits.py::test_deposit_negative@c17999c0.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/prague/eip6110_deposits/test_deposits.py::test_deposit_negative --fork Amsterdam

Test producing a block with the incorrect deposits in the body of the block, and/or Engine API payload.

Source code in tests/prague/eip6110_deposits/test_deposits.py
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
@pytest.mark.parametrize(
    "requests,block_body_override_requests,exception",
    [
        pytest.param(
            [],
            [
                DepositRequest(
                    pubkey=0x01,
                    withdrawal_credentials=0x02,
                    amount=1_000_000_000,
                    signature=0x03,
                    index=0x0,
                ),
            ],
            BlockException.INVALID_REQUESTS,
            id="no_deposits_non_empty_requests_list",
        ),
        pytest.param(
            [
                SystemContractInteractionTransaction(
                    requests=[
                        DepositRequest(
                            pubkey=0x01,
                            withdrawal_credentials=0x02,
                            amount=1_000_000_000,
                            signature=0x03,
                            index=0x0,
                        )
                    ],
                ),
            ],
            [],
            BlockException.INVALID_REQUESTS,
            id="single_deposit_empty_requests_list",
        ),
        pytest.param(
            [
                SystemContractInteractionTransaction(
                    requests=[
                        DepositRequest(
                            pubkey=0x01,
                            withdrawal_credentials=0x02,
                            amount=1_000_000_000,
                            signature=0x03,
                            index=0x0,
                        )
                    ],
                ),
            ],
            [
                DepositRequest(
                    pubkey=0x02,
                    withdrawal_credentials=0x02,
                    amount=1_000_000_000,
                    signature=0x03,
                    index=0x0,
                )
            ],
            BlockException.INVALID_REQUESTS,
            id="single_deposit_pubkey_mismatch",
        ),
        pytest.param(
            [
                SystemContractInteractionTransaction(
                    requests=[
                        DepositRequest(
                            pubkey=0x01,
                            withdrawal_credentials=0x02,
                            amount=1_000_000_000,
                            signature=0x03,
                            index=0x0,
                        )
                    ],
                ),
            ],
            [
                DepositRequest(
                    pubkey=0x01,
                    withdrawal_credentials=0x03,
                    amount=1_000_000_000,
                    signature=0x03,
                    index=0x0,
                )
            ],
            BlockException.INVALID_REQUESTS,
            id="single_deposit_credentials_mismatch",
        ),
        pytest.param(
            [
                SystemContractInteractionTransaction(
                    requests=[
                        DepositRequest(
                            pubkey=0x01,
                            withdrawal_credentials=0x02,
                            amount=1_000_000_000,
                            signature=0x03,
                            index=0x0,
                        )
                    ],
                ),
            ],
            [
                DepositRequest(
                    pubkey=0x01,
                    withdrawal_credentials=0x02,
                    amount=2_000_000_000,
                    signature=0x03,
                    index=0x0,
                )
            ],
            BlockException.INVALID_REQUESTS,
            id="single_deposit_amount_mismatch",
        ),
        pytest.param(
            [
                SystemContractInteractionTransaction(
                    requests=[
                        DepositRequest(
                            pubkey=0x01,
                            withdrawal_credentials=0x02,
                            amount=1_000_000_000,
                            signature=0x03,
                            index=0x0,
                        )
                    ],
                ),
            ],
            [
                DepositRequest(
                    pubkey=0x01,
                    withdrawal_credentials=0x02,
                    amount=1_000_000_000,
                    signature=0x04,
                    index=0x0,
                )
            ],
            BlockException.INVALID_REQUESTS,
            id="single_deposit_signature_mismatch",
        ),
        pytest.param(
            [
                SystemContractInteractionTransaction(
                    requests=[
                        DepositRequest(
                            pubkey=0x01,
                            withdrawal_credentials=0x02,
                            amount=1_000_000_000,
                            signature=0x03,
                            index=0x0,
                        )
                    ],
                ),
            ],
            [
                DepositRequest(
                    pubkey=0x01,
                    withdrawal_credentials=0x02,
                    amount=1_000_000_000,
                    signature=0x03,
                    index=0x1,
                )
            ],
            BlockException.INVALID_REQUESTS,
            id="single_deposit_index_mismatch",
        ),
        pytest.param(
            [
                SystemContractInteractionTransaction(
                    requests=[
                        DepositRequest(
                            pubkey=0x01,
                            withdrawal_credentials=0x02,
                            amount=1_000_000_000,
                            signature=0x03,
                            index=0x0,
                        ),
                        DepositRequest(
                            pubkey=0x01,
                            withdrawal_credentials=0x02,
                            amount=1_000_000_000,
                            signature=0x03,
                            index=0x1,
                        ),
                    ],
                ),
            ],
            [
                DepositRequest(
                    pubkey=0x01,
                    withdrawal_credentials=0x02,
                    amount=1_000_000_000,
                    signature=0x03,
                    index=0x1,
                ),
                DepositRequest(
                    pubkey=0x01,
                    withdrawal_credentials=0x02,
                    amount=1_000_000_000,
                    signature=0x03,
                    index=0x0,
                ),
            ],
            BlockException.INVALID_REQUESTS,
            id="two_deposits_out_of_order",
        ),
        pytest.param(
            [
                SystemContractInteractionTransaction(
                    requests=[
                        DepositRequest(
                            pubkey=0x01,
                            withdrawal_credentials=0x02,
                            amount=1_000_000_000,
                            signature=0x03,
                            index=0x0,
                        )
                    ],
                ),
            ],
            [
                DepositRequest(
                    pubkey=0x01,
                    withdrawal_credentials=0x02,
                    amount=1_000_000_000,
                    signature=0x03,
                    index=0x0,
                ),
                DepositRequest(
                    pubkey=0x01,
                    withdrawal_credentials=0x02,
                    amount=1_000_000_000,
                    signature=0x03,
                    index=0x0,
                ),
            ],
            BlockException.INVALID_REQUESTS,
            id="single_deposit_duplicate_in_requests_list",
        ),
    ],
)
@pytest.mark.exception_test
def test_deposit_negative(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    blocks: List[Block],
) -> None:
    """
    Test producing a block with the incorrect deposits in the body of the
    block, and/or Engine API payload.
    """
    blockchain_test(
        pre=pre,
        post={},
        blocks=blocks,
    )

Parametrized Test Cases

This test generates 9 parametrized test cases across 3 forks.