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 #62 incorrect hex of the locking script #64

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

zhfnjust
Copy link

@zhfnjust zhfnjust commented Oct 20, 2023

The locking script of the sCrypt contract is somewhat special. After the last opreturn, there may be situations where the data is not stored according to oppushdata. But this is subject to agreement.

For example, under normal circumstances:

4c03000000 // OP_PUSHDATA1, len = 3, data = 000000

But the scrypt contract will have the following situations:

4c0300 // OP_PUSHDATA1, len = 3, data = 00

data only has one byte.

We have to deal with this situation. Otherwise, the correct signature cannot be obtained.

@zhfnjust
Copy link
Author

@deanmlittle can you merge this , and republish it.

@zhfnjust
Copy link
Author

@deanmlittle The current implementation of the interpreter is incomplete and I cannot add tests for rawdata

@zhfnjust
Copy link
Author

image

@zhfnjust
Copy link
Author

zhfnjust commented Oct 21, 2023

Hi, @deanmlittle , I think we can check NonScriptData in the following three situations:

  1. Dynamic, that is, in the script virtual machine, when push NonScriptData always be error here

  2. Static, when deserializing hex. The algorithm itself has ensured that NonScriptData only appears after OP_RETURN and at the end. here

  3. Static, when new a Script from a passed ScriptBits, we ensured the passed ScriptBits only contains NonScriptData at toplevel and after OP_RETURN here

Since previous ASM could not correctly represent cases containing malformed NonScriptData, such as: "6a4c0300", the following ASM format is now used:

OP_RETURN non-script-data:4c0300

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.

None yet

1 participant