Test Point Evaluation Precompile¶
Documentation for tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
.
Generate fixtures for these test cases with:
fill -v tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
Tests point evaluation precompile for EIP-4844: Shard Blob Transactions
Test point evaluation precompile for EIP-4844: Shard Blob Transactions.
Adding a new test
Add a function that is named test_<test_name>
and takes at least the following arguments:
- blockchain_test | state_test
- pre
- tx
- post
The following arguments need to be parametrized or the test will not be generated:
- versioned_hash
- kzg_commitment
- z
- y
- kzg_proof
- success
These values correspond to a single call of the precompile, and success
refers to
whether the call should succeed or fail.
All other pytest.fixture
fixtures can be parametrized to generate new combinations and test
cases.
test_valid_precompile_calls(state_test, pre, tx, post)
¶
Test valid sanity precompile calls that are expected to succeed.
kzg_commitment
andkzg_proof
are set to values such thatp(z)==0
for all values ofz
, hencey
is tested to be zero, and call to be successful.
Source code in tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
|
test_invalid_precompile_calls(state_test, pre, tx, post)
¶
Test invalid precompile calls:
- Out of bounds inputs
z
andy
- Correct proof, commitment, z and y, but incorrect lengths
- Null inputs
- Zero inputs
- Correct proof, commitment, z and y, but incorrect version versioned hash
Source code in tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
|
test_point_evaluation_precompile_external_vectors(state_test, pre, tx, post)
¶
Test precompile calls using external test vectors compiled from different sources:
go_kzg_4844_verify_kzg_proof.json
: test vectors from the go-kzg-4844 repository.
Source code in tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 |
|
test_point_evaluation_precompile_calls(state_test, pre, tx, post)
¶
Test calling the Point Evaluation Precompile with different call types, gas and parameter configuration:
- Using CALL, DELEGATECALL, CALLCODE and STATICCALL.
- Using correct and incorrect proofs
- Using barely insufficient gas
Source code in tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
|
test_point_evaluation_precompile_gas_tx_to(state_test, precompile_input, call_gas, proof_correct)
¶
Test calling the Point Evaluation Precompile directly as transaction entry point, and measure the gas consumption.
- Using
gas_limit
with exact necessary gas, insufficient gas and extra gas. - Using correct and incorrect proofs
Source code in tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
|
test_point_evaluation_precompile_before_fork(state_test, pre, tx)
¶
Test calling the Point Evaluation Precompile before the appropriate fork.
Source code in tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 |
|
test_point_evaluation_precompile_during_fork(blockchain_test, pre, tx)
¶
Test calling the Point Evaluation Precompile before the appropriate fork.
Source code in tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 |
|