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 native contract stack #2087

Merged
merged 1 commit into from
Nov 24, 2020
Merged

Fix native contract stack #2087

merged 1 commit into from
Nov 24, 2020

Conversation

erikzhang
Copy link
Member

Close #2085

Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, wait for @superboyiii test

@ProDog
Copy link
Contributor

ProDog commented Nov 23, 2020

I found Runtime.InvocationCounter changed to 2 here:
https://github.com/neo-project/neo-devpack-dotnet/blob/821f834485a30e1254eaef15a2a8f0483ce214ef/templates/Template.NEP17.CSharp/NEP17.Crowdsale.cs#L28

@superboyiii
Copy link
Member

OnPayment is fine now.

        public static void OnPayment(UInt160 from, BigInteger amount)
        {
            if (AssetStorage.GetPaymentStatus())
            {
                Payment(from, amount);
            } else
            {
                throw new Exception("Payment is disable on this contract!");
            }
            
        }
neo> deploy Template.NEP17.CSharp.nef Template.NEP17.CSharp.manifest.json
Contract hash: 0x5ac8d09e4039571141b7b923e11fac46f0eddd81
Gas: 3.91626

Signed and relayed transaction with hash=0x35a0b1222733ac0b486bb8cccedd8f0f5ca074e2413c773c9faa80d3a6e4f345
neo> invoke 0x5ac8d09e4039571141b7b923e11fac46f0eddd81 enablePayment [] NLtDqwnj9s7wQVyaiD5ohjV3e9fUVkZxDp  NLtDqwnj9s7wQVyaiD5ohjV3e9fUVkZxDp
Invoking script with: 'EMAMDWVuYWJsZVBheW1lbnQMFIHd7fBGrB/hI7m3QRFXOUCe0MhaQWJ9W1I='
VM State: FAULT
Gas Consumed: 0.0101539
Result Stack: []
Error: Called Contract Does Not Exist: 0x5ac8d09e4039571141b7b923e11fac46f0eddd81
neo> invoke 0x5ac8d09e4039571141b7b923e11fac46f0eddd81 enablePayment [] NLtDqwnj9s7wQVyaiD5ohjV3e9fUVkZxDp  NLtDqwnj9s7wQVyaiD5ohjV3e9fUVkZxDp
Invoking script with: 'EMAMDWVuYWJsZVBheW1lbnQMFIHd7fBGrB/hI7m3QRFXOUCe0MhaQWJ9W1I='
VM State: HALT
Gas Consumed: 0.0391795
Result Stack: [{"type":"Any"}]
Relay tx(no|yes): y
Signed and relayed transaction with hash=0x3d15ca5c9e599d42fb9f9341c094b668d4dfadf1b7465e6b3aad8288fa5382e6
neo> send gas 0x5ac8d09e4039571141b7b923e11fac46f0eddd81 100
password: *
TXID: 0x0f70b1a8409d81334990276a41ad3d53085cc359679960111d9b206932d7179c
neo> invoke 0x5ac8d09e4039571141b7b923e11fac46f0eddd81 disablePayment [] NLtDqwnj9s7wQVyaiD5ohjV3e9fUVkZxDp  NLtDqwnj9s7wQVyaiD5ohjV3e9fUVkZxDp
Invoking script with: 'EMAMDmRpc2FibGVQYXltZW50DBSB3e3wRqwf4SO5t0ERVzlAntDIWkFifVtS'
VM State: HALT
Gas Consumed: 0.0281795
Result Stack: [{"type":"Any"}]
Relay tx(no|yes): y
Signed and relayed transaction with hash=0x937bc1f50696cc7c1055ca8cc07fe0d99d8c336de61c54b26eabdcd50aa5697b
neo> send gas 0x5ac8d09e4039571141b7b923e11fac46f0eddd81 100
password: *
Error: An unhandled exception was thrown. Payment is disable on this contract!

@shargon
Copy link
Member

shargon commented Nov 23, 2020

I found Runtime.InvocationCounter changed to 2 here:

From this PR?

@ProDog
Copy link
Contributor

ProDog commented Nov 23, 2020

From this PR?

This PR is ok, I just see Runtime.InvocationCounter changed to 2, I can reopen an issue to discuss it.😅

@roman-khimov
Copy link
Contributor

This PR is ok, I just see Runtime.InvocationCounter changed to 2, I can reopen an issue to discuss it.sweat_smile

This particular contract can probably be changed to using onPayment instead of Mint, but see #2092 also.

@Tommo-L
Copy link
Contributor

Tommo-L commented Nov 24, 2020

Merge?

@erikzhang erikzhang merged commit ddb1184 into master Nov 24, 2020
@erikzhang erikzhang deleted the fixes/native-stack branch November 24, 2020 07:44
ShawnYun pushed a commit to ShawnYun/neo that referenced this pull request Jan 8, 2021
cloud8little pushed a commit to cloud8little/neo that referenced this pull request Jan 24, 2021
ixje added a commit to CityOfZion/neo-mamba that referenced this pull request Feb 2, 2021
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.

onPayment Context Evaluation Stack not empty on unload
7 participants