Skip to content

Change Deploy and Update CallFlags#2653

Merged
shargon merged 1 commit intoneo-project:masterfrom
shargon:fix-deploy-update
Jan 25, 2022
Merged

Change Deploy and Update CallFlags#2653
shargon merged 1 commit intoneo-project:masterfrom
shargon:fix-deploy-update

Conversation

@shargon
Copy link
Member

@shargon shargon commented Jan 19, 2022

Close #2652

@shargon shargon requested a review from erikzhang January 19, 2022 10:12
@shargon shargon merged commit abd53e8 into neo-project:master Jan 25, 2022
@shargon shargon deleted the fix-deploy-update branch January 25, 2022 09:11
roman-khimov added a commit to nspcc-dev/neo-go that referenced this pull request Jan 31, 2022
roman-khimov added a commit to nspcc-dev/neo-go that referenced this pull request Feb 1, 2022
AnnaShaleva pushed a commit to nspcc-dev/neo-go that referenced this pull request Feb 17, 2022
ixje added a commit to CityOfZion/neo-mamba that referenced this pull request Apr 4, 2022
ixje added a commit to CityOfZion/neo-mamba that referenced this pull request Apr 4, 2022
AnnaShaleva added a commit that referenced this pull request Apr 22, 2025
#2653 changed required callflags
of native ContractManagement's Update and Deploy methods from
States|AllowNotify to All. This change didn't affect N3 mainnet/T5
(ref. #2673), but the problem
is that this change affected NeoFS mainnet network (see
nspcc-dev/neo-go#2848 and commits description).

This commit fixes state difference between Go and C# nodes at height
451626 of NeoFS mainnet. Note that this commit does not affect existing
N3 mainnet/testnet states, so no resynchronisation is required on
update.

The difference itself:
```
go run scripts/compare-dumps/compare-dumps.go ./godump-echidna-neofs-mainnet/ ../../neo-project/neo/neo-cli-notary-mainnet/Storage_0572dfa5/
Processing directory BlockStorage_0
Processing directory BlockStorage_100000
Processing directory BlockStorage_200000
Processing directory BlockStorage_300000
Processing directory BlockStorage_400000
Processing directory BlockStorage_500000
file BlockStorage_500000/dump-block-452000.json: block 451626, changes length mismatch: 25 vs 11
compare-dumps dumpDirA dumpDirB
exit status 1
```

Go node application log for the problem transaction:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "getapplicationlog", "params": ["0x5028585a5c27b7f357771fa8b512c2d1b0ba40dcb3ea30e67d3db2d75d2da60d"] }' localhost:40332 | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   592  100   450  100   142   461k   145k --:--:-- --:--:-- --:--:--  578k
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : null,
            "gasconsumed" : "900316660",
            "invocations" : null,
            "notifications" : [
               {
                  "contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
                  "eventname" : "Update",
                  "state" : {
                     "type" : "Array",
                     "value" : [
                        {
                           "type" : "ByteString",
                           "value" : "r6jbcP2s5N7DIvRYS2ZiFdP7YXA="
                        }
                     ]
                  }
               }
            ],
            "stack" : [
               {
                  "type" : "Any"
               }
            ],
            "trigger" : "Application",
            "vmstate" : "HALT"
         }
      ],
      "txid" : "0x5028585a5c27b7f357771fa8b512c2d1b0ba40dcb3ea30e67d3db2d75d2da60d"
   }
}
```

C# application log for the same transaction:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "getapplicationlog", "params": ["0x5028585a5c27b7f357771fa8b512c2d1b0ba40dcb3ea30e67d3db2d75d2da60d"] }' localhost:50332 | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   439    0   297  100   142   3502   1674 --:--:-- --:--:-- --:--:--  5226
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : "Cannot call this method with the flag States, AllowNotify.",
            "gasconsumed" : "5684010",
            "notifications" : [],
            "stack" : [],
            "trigger" : "Application",
            "vmstate" : "FAULT"
         }
      ],
      "txid" : "0x5028585a5c27b7f357771fa8b512c2d1b0ba40dcb3ea30e67d3db2d75d2da60d"
   }
}
```

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
NGDAdmin pushed a commit that referenced this pull request Apr 24, 2025
…3909)

* Native: revert Update/Deploy callflag change for pre-Aspidochelone

#2653 changed required callflags
of native ContractManagement's Update and Deploy methods from
States|AllowNotify to All. This change didn't affect N3 mainnet/T5
(ref. #2673), but the problem
is that this change affected NeoFS mainnet network (see
nspcc-dev/neo-go#2848 and commits description).

This commit fixes state difference between Go and C# nodes at height
451626 of NeoFS mainnet. Note that this commit does not affect existing
N3 mainnet/testnet states, so no resynchronisation is required on
update.

The difference itself:
```
go run scripts/compare-dumps/compare-dumps.go ./godump-echidna-neofs-mainnet/ ../../neo-project/neo/neo-cli-notary-mainnet/Storage_0572dfa5/
Processing directory BlockStorage_0
Processing directory BlockStorage_100000
Processing directory BlockStorage_200000
Processing directory BlockStorage_300000
Processing directory BlockStorage_400000
Processing directory BlockStorage_500000
file BlockStorage_500000/dump-block-452000.json: block 451626, changes length mismatch: 25 vs 11
compare-dumps dumpDirA dumpDirB
exit status 1
```

Go node application log for the problem transaction:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "getapplicationlog", "params": ["0x5028585a5c27b7f357771fa8b512c2d1b0ba40dcb3ea30e67d3db2d75d2da60d"] }' localhost:40332 | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   592  100   450  100   142   461k   145k --:--:-- --:--:-- --:--:--  578k
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : null,
            "gasconsumed" : "900316660",
            "invocations" : null,
            "notifications" : [
               {
                  "contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
                  "eventname" : "Update",
                  "state" : {
                     "type" : "Array",
                     "value" : [
                        {
                           "type" : "ByteString",
                           "value" : "r6jbcP2s5N7DIvRYS2ZiFdP7YXA="
                        }
                     ]
                  }
               }
            ],
            "stack" : [
               {
                  "type" : "Any"
               }
            ],
            "trigger" : "Application",
            "vmstate" : "HALT"
         }
      ],
      "txid" : "0x5028585a5c27b7f357771fa8b512c2d1b0ba40dcb3ea30e67d3db2d75d2da60d"
   }
}
```

C# application log for the same transaction:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "getapplicationlog", "params": ["0x5028585a5c27b7f357771fa8b512c2d1b0ba40dcb3ea30e67d3db2d75d2da60d"] }' localhost:50332 | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   439    0   297  100   142   3502   1674 --:--:-- --:--:-- --:--:--  5226
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : "Cannot call this method with the flag States, AllowNotify.",
            "gasconsumed" : "5684010",
            "notifications" : [],
            "stack" : [],
            "trigger" : "Application",
            "vmstate" : "FAULT"
         }
      ],
      "txid" : "0x5028585a5c27b7f357771fa8b512c2d1b0ba40dcb3ea30e67d3db2d75d2da60d"
   }
}
```

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>

* Native: move Update/Deploy callflags check to Management implementation

Make these checks implementation-specific in order not to affect the
general native invocation code. Ref.
#3909 (review).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>

---------

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
cschuchardt88 pushed a commit to cschuchardt88/neo that referenced this pull request Jun 8, 2025
…eo-project#3909)

* Native: revert Update/Deploy callflag change for pre-Aspidochelone

neo-project#2653 changed required callflags
of native ContractManagement's Update and Deploy methods from
States|AllowNotify to All. This change didn't affect N3 mainnet/T5
(ref. neo-project#2673), but the problem
is that this change affected NeoFS mainnet network (see
nspcc-dev/neo-go#2848 and commits description).

This commit fixes state difference between Go and C# nodes at height
451626 of NeoFS mainnet. Note that this commit does not affect existing
N3 mainnet/testnet states, so no resynchronisation is required on
update.

The difference itself:
```
go run scripts/compare-dumps/compare-dumps.go ./godump-echidna-neofs-mainnet/ ../../neo-project/neo/neo-cli-notary-mainnet/Storage_0572dfa5/
Processing directory BlockStorage_0
Processing directory BlockStorage_100000
Processing directory BlockStorage_200000
Processing directory BlockStorage_300000
Processing directory BlockStorage_400000
Processing directory BlockStorage_500000
file BlockStorage_500000/dump-block-452000.json: block 451626, changes length mismatch: 25 vs 11
compare-dumps dumpDirA dumpDirB
exit status 1
```

Go node application log for the problem transaction:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "getapplicationlog", "params": ["0x5028585a5c27b7f357771fa8b512c2d1b0ba40dcb3ea30e67d3db2d75d2da60d"] }' localhost:40332 | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   592  100   450  100   142   461k   145k --:--:-- --:--:-- --:--:--  578k
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : null,
            "gasconsumed" : "900316660",
            "invocations" : null,
            "notifications" : [
               {
                  "contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
                  "eventname" : "Update",
                  "state" : {
                     "type" : "Array",
                     "value" : [
                        {
                           "type" : "ByteString",
                           "value" : "r6jbcP2s5N7DIvRYS2ZiFdP7YXA="
                        }
                     ]
                  }
               }
            ],
            "stack" : [
               {
                  "type" : "Any"
               }
            ],
            "trigger" : "Application",
            "vmstate" : "HALT"
         }
      ],
      "txid" : "0x5028585a5c27b7f357771fa8b512c2d1b0ba40dcb3ea30e67d3db2d75d2da60d"
   }
}
```

C# application log for the same transaction:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "getapplicationlog", "params": ["0x5028585a5c27b7f357771fa8b512c2d1b0ba40dcb3ea30e67d3db2d75d2da60d"] }' localhost:50332 | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   439    0   297  100   142   3502   1674 --:--:-- --:--:-- --:--:--  5226
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : "Cannot call this method with the flag States, AllowNotify.",
            "gasconsumed" : "5684010",
            "notifications" : [],
            "stack" : [],
            "trigger" : "Application",
            "vmstate" : "FAULT"
         }
      ],
      "txid" : "0x5028585a5c27b7f357771fa8b512c2d1b0ba40dcb3ea30e67d3db2d75d2da60d"
   }
}
```

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>

* Native: move Update/Deploy callflags check to Management implementation

Make these checks implementation-specific in order not to affect the
general native invocation code. Ref.
neo-project#3909 (review).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>

---------

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
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.

ContractManagement deploy/update should require CallFlags.AllowCall

2 participants