Test Point Evaluation Precompile¶
Documentation for test cases from tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
.
Generate fixtures for these test cases for Cancun with:
Cancun only:
fill -v tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py --fork=Cancun --evm-bin=/path/to/evm-tool-dev-version
fill -v tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py --until=Cancun --evm-bin=/path/to/evm-tool-dev-version
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
- 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(blockchain_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 succesful.
Source code in tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
test_invalid_precompile_calls(blockchain_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
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 324 325 326 327 328 329 330 331 332 333 334 |
|
test_point_evaluation_precompile_external_vectors(blockchain_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
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
|
test_point_evaluation_precompile_calls(blockchain_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
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 485 486 487 488 489 490 491 492 493 |
|
test_point_evaluation_precompile_gas_tx_to(blockchain_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
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 564 565 566 567 568 569 570 571 |
|
test_point_evaluation_precompile_before_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
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 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 |
|