Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: upgrade ckb-vm to fix snapshot behavior #3177

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

driftluo
Copy link
Collaborator

@driftluo driftluo commented Nov 15, 2021

What problem does this PR solve?

chunk run with the snapshot unable to support the binary replacement behavior of exec, which will cause abnormal behavior after resume.

The upgraded VM supports backing up the current code(executable pages) to the snapshot to fix the above problems. nervosnetwork/ckb-vm#218

and #3176 should keep its behavior until hardfork activated

Check List

Tests

  • Unit test
  • Integration test

Release note

Title Only: Include only the PR title in the release note.

script/src/syscalls/load_cell_data.rs Outdated Show resolved Hide resolved
@quake
Copy link
Member

quake commented Nov 15, 2021 via email

@yangby-cryptape
Copy link
Collaborator

yangby-cryptape commented Nov 16, 2021

I pushed #3178 to add more tests, I think that PR should be merged before this PR.

Notice

#3178 doesn't fix the snapshot behavior.

How to enable the test for resuming from snapshot?

  • This PR and my PR has conflicts, so resolved the conflicts at first.

    • This PR add true for all LoadCellData::new(..) in tests, but I think test both true and false is better.

    • Find is_vm_version_1_and_syscalls_2_enabled is a bit complicated, I think make a method is better than copied those code twice.

  • Then find the follow code in script/src/verify/tests/ckb_latest/features_since_v2021.rs:

        // TODO fix resume from snapshot
        let should_be_invalid_permission = script_version <= ScriptVersion::V1;

    Apply the follow changes:

    -    // TODO fix resume from snapshot
    -    let should_be_invalid_permission = script_version <= ScriptVersion::V1;
    +    let should_be_invalid_permission = script_version < ScriptVersion::V1;

    See details in test: add more tests to ckb-script for resuming from snapshot #3178 (comment).

  • Make sure all tests are passed at last.

@driftluo driftluo marked this pull request as ready for review November 16, 2021 06:38
@driftluo driftluo requested a review from a team as a code owner November 16, 2021 06:38
@driftluo driftluo requested a review from mohanson November 16, 2021 06:38
@zhangsoledad
Copy link
Member

bors r= yangby-cryptape,mohanson,zhangsoledad

@bors bors bot merged commit 571c402 into nervosnetwork:develop Nov 16, 2021
@driftluo driftluo deleted the fix-exec-syscall branch November 16, 2021 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants