Skip to content

Conversation

@shargon
Copy link
Member

@shargon shargon commented Nov 5, 2023

Close #2932
Can be tested with #2925

@shargon shargon requested review from AnnaShaleva and Jim8y November 5, 2023 14:01
@shargon shargon marked this pull request as ready for review November 5, 2023 14:15
@Jim8y
Copy link
Contributor

Jim8y commented Nov 6, 2023

@shargon does this native update still require a resync?

Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

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

I started reviewing, @shargon,
The changes looks good and compact.

I still did not reach the part where we can call functions from previous versions while re-syncing. Can you pin that for me?
I will soon be back to the code and, then, test it. It will require some good attention.

@vncoelho vncoelho mentioned this pull request Nov 6, 2023
@shargon
Copy link
Member Author

shargon commented Nov 6, 2023

@shargon does this native update still require a resync?

In this version I think that is not required. But I want to remove currentAllowedMethods and I think that we can do it better changing the current offsets and native scripts.

@shargon
Copy link
Member Author

shargon commented Feb 21, 2024

@superboyiii I promise that now it will work :)

@superboyiii
Copy link
Member

@shargon All feature works well on my privatenet now. To ensure everything compatible, I will re-check storage on mainnet. Give me 1 more day.

@shargon shargon added the Blocker Issues that are blocking other issues. Check issues details to see what it is blocking. label Feb 22, 2024
@shargon
Copy link
Member Author

shargon commented Feb 22, 2024

@neo-project/core is reviewed?

Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

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

Since I reviewed I think it is not changed

@shargon
Copy link
Member Author

shargon commented Feb 23, 2024

@superboyiii ready?

Copy link
Member

@superboyiii superboyiii left a comment

Choose a reason for hiding this comment

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

Mainnet data is compatible.

@shargon shargon merged commit b467613 into master Feb 23, 2024
@shargon shargon deleted the update-native-contracts branch February 23, 2024 11:31
AnnaShaleva added a commit to nspcc-dev/neo-go that referenced this pull request Apr 9, 2024
AnnaShaleva added a commit to nspcc-dev/neo-go that referenced this pull request Apr 9, 2024
AnnaShaleva added a commit to nspcc-dev/neo-go that referenced this pull request Apr 18, 2024
AnnaShaleva added a commit to nspcc-dev/neo-go that referenced this pull request Apr 18, 2024
AnnaShaleva added a commit to nspcc-dev/neo-go that referenced this pull request Apr 18, 2024
AnnaShaleva added a commit to nspcc-dev/neo-go that referenced this pull request Apr 25, 2024
AnnaShaleva added a commit that referenced this pull request Apr 23, 2025
Problem:

Consider a hardfork (Echidna in our case) that is:
 1. Explicitly ommitted from the node configuration;
 2. Given the fact that the set of previous hardforks are explicitly enabled
    in the node configuration.
The problem is that this hardfork is treated as "enabled from genesis"
by `IsInitializeBlock` function.

This problem is discovered when running N3 mainnet/testnet node with the default
configuration on the current master. This behaviour leads to unexected
Echidna-related changes being included into the node state starting from genesis
block. Here are some data:

Hardforks configuration that is used in config.json file:
```
    "Hardforks": {
      "HF_Aspidochelone": 210000,
      "HF_Basilisk": 2680000,
      "HF_Cockatrice": 3967000,
      "HF_Domovoi": 4144000
    },
```

Genesis block state difference between the current master and 3.7 version:
```
Processing directory BlockStorage_0
file BlockStorage_0/dump-block-0.json: block 0, changes length mismatch: 34 vs 41
```

In particular, there are 7 extra storage items stored in genesis. All
these changes relate to new functionality added in Echidna hardfork
(Policy extensions, Notary contract and etc.):
```
        {
            "id": -7,
            "key": "+f///xQi",
            "state": "Added",
            "value": "gJaYAA=="
        },
        {
            "id": -7,
            "key": "+f///xU=",
            "state": "Added",
            "value": "mDo="
        },
        {
            "id": -7,
            "key": "+f///xY=",
            "state": "Added",
            "value": "gBY="
        },
        {
            "id": -7,
            "key": "+f///xc=",
            "state": "Added",
            "value": "gBQg"
        },
        {
            "id": -1,
            "key": "/////wg77DUxEZu6123QRJILDebDGU/hwQ==",
            "state": "Added",
            "value": "QAUhAfYhACgUO+w1MRGbutdt0ESSCw3mwxlP4cEohk5FRjNuZW8tY29yZS12My4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0CdOC1CQQgoBk5vdGFyeUAASABAASgGTkVQLTI3QQJACEEFKAliYWxhbmNlT2ZAAUECKAdhY2NvdW50IQEUIQERIQAgAUEFKAxleHBpcmF0aW9uT2ZAAUECKAdhY2NvdW50IQEUIQERIQEHIAFBBSgZZ2V0TWF4Tm90VmFsaWRCZWZvcmVEZWx0YUAAIQERIQEOIAFBBSgQbG9ja0RlcG9zaXRVbnRpbEACQQIoB2FjY291bnQhARRBAigEdGlsbCEBESEBECEBFSAAQQUoDm9uTkVQMTdQYXltZW50QANBAigEZnJvbSEBFEECKAZhbW91bnQhARFBAigEZGF0YSEAIQL/ACEBHCAAQQUoGXNldE1heE5vdFZhbGlkQmVmb3JlRGVsdGFAAUECKAV2YWx1ZSEBESEC/wAhASMgAEEFKAZ2ZXJpZnlAAUECKAlzaWduYXR1cmUhARIhARAhASogAUEFKAh3aXRoZHJhd0ACQQIoBGZyb20hARRBAigCdG8hARQhARAhATEgAEAAQAFBAgAAQAAoBG51bGw="
        },
        {
            "id": -1,
            "key": "/////wz////2",
            "state": "Added",
            "value": "O+w1MRGbutdt0ESSCw3mwxlP4cE="
        },
        {
            "id": -10,
            "key": "9v///wo=",
            "state": "Added",
            "value": "jAA="
        },
```

Solution:

Since EnsureOmittedHardforks is always applied to configured hardfork
values, this function ensures that all omitted hardfork heights are set
to 0. We don't need additional checks anywhere and can rely on
settings.Hardforks explicitly after that. If hardfork is not in
settings.Hardforks then it is disabled.

Originaly it was an intention of #2942 (comment),
but somehow we missed this bug during review.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this pull request Apr 23, 2025
Problem:

Consider a hardfork (Echidna in our case) that is:
 1. Explicitly ommitted from the node configuration;
 2. Given the fact that the set of previous hardforks are explicitly enabled
    in the node configuration.
The problem is that this hardfork is treated as "enabled from genesis"
by `IsInitializeBlock` function.

This problem is discovered when running N3 mainnet/testnet node with the default
configuration on the current master. This behaviour leads to unexected
Echidna-related changes being included into the node state starting from genesis
block. Here are some data:

Hardforks configuration that is used in config.json file (given this
config, Echidna should be treated as disabled):
```
    "Hardforks": {
      "HF_Aspidochelone": 210000,
      "HF_Basilisk": 2680000,
      "HF_Cockatrice": 3967000,
      "HF_Domovoi": 4144000
    },
```

Genesis block state difference between the current master and 3.7 version:
```
Processing directory BlockStorage_0
file BlockStorage_0/dump-block-0.json: block 0, changes length mismatch: 34 vs 41
```

In particular, there are 7 extra storage items stored in genesis. All
these changes relate to new functionality added in Echidna hardfork
(Policy extensions, Notary contract and etc.):
```
        {
            "id": -7,
            "key": "+f///xQi",
            "state": "Added",
            "value": "gJaYAA=="
        },
        {
            "id": -7,
            "key": "+f///xU=",
            "state": "Added",
            "value": "mDo="
        },
        {
            "id": -7,
            "key": "+f///xY=",
            "state": "Added",
            "value": "gBY="
        },
        {
            "id": -7,
            "key": "+f///xc=",
            "state": "Added",
            "value": "gBQg"
        },
        {
            "id": -1,
            "key": "/////wg77DUxEZu6123QRJILDebDGU/hwQ==",
            "state": "Added",
            "value": "QAUhAfYhACgUO+w1MRGbutdt0ESSCw3mwxlP4cEohk5FRjNuZW8tY29yZS12My4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0CdOC1CQQgoBk5vdGFyeUAASABAASgGTkVQLTI3QQJACEEFKAliYWxhbmNlT2ZAAUECKAdhY2NvdW50IQEUIQERIQAgAUEFKAxleHBpcmF0aW9uT2ZAAUECKAdhY2NvdW50IQEUIQERIQEHIAFBBSgZZ2V0TWF4Tm90VmFsaWRCZWZvcmVEZWx0YUAAIQERIQEOIAFBBSgQbG9ja0RlcG9zaXRVbnRpbEACQQIoB2FjY291bnQhARRBAigEdGlsbCEBESEBECEBFSAAQQUoDm9uTkVQMTdQYXltZW50QANBAigEZnJvbSEBFEECKAZhbW91bnQhARFBAigEZGF0YSEAIQL/ACEBHCAAQQUoGXNldE1heE5vdFZhbGlkQmVmb3JlRGVsdGFAAUECKAV2YWx1ZSEBESEC/wAhASMgAEEFKAZ2ZXJpZnlAAUECKAlzaWduYXR1cmUhARIhARAhASogAUEFKAh3aXRoZHJhd0ACQQIoBGZyb20hARRBAigCdG8hARQhARAhATEgAEAAQAFBAgAAQAAoBG51bGw="
        },
        {
            "id": -1,
            "key": "/////wz////2",
            "state": "Added",
            "value": "O+w1MRGbutdt0ESSCw3mwxlP4cE="
        },
        {
            "id": -10,
            "key": "9v///wo=",
            "state": "Added",
            "value": "jAA="
        },
```

Solution:

Since EnsureOmittedHardforks is always applied to configured hardfork
values, this function ensures that all omitted hardfork heights are set
to 0. We don't need additional checks anywhere and can rely on
settings.Hardforks explicitly after that. If hardfork is not in
settings.Hardforks then it is disabled.

Originaly it was an intention of #2942 (comment),
but somehow we missed this bug during review.

Signed-off-by: Anna Shaleva <[email protected]>
shargon added a commit that referenced this pull request Apr 25, 2025
Problem:

Consider a hardfork (Echidna in our case) that is:
 1. Explicitly ommitted from the node configuration;
 2. Given the fact that the set of previous hardforks are explicitly enabled
    in the node configuration.
The problem is that this hardfork is treated as "enabled from genesis"
by `IsInitializeBlock` function.

This problem is discovered when running N3 mainnet/testnet node with the default
configuration on the current master. This behaviour leads to unexected
Echidna-related changes being included into the node state starting from genesis
block. Here are some data:

Hardforks configuration that is used in config.json file (given this
config, Echidna should be treated as disabled):
```
    "Hardforks": {
      "HF_Aspidochelone": 210000,
      "HF_Basilisk": 2680000,
      "HF_Cockatrice": 3967000,
      "HF_Domovoi": 4144000
    },
```

Genesis block state difference between the current master and 3.7 version:
```
Processing directory BlockStorage_0
file BlockStorage_0/dump-block-0.json: block 0, changes length mismatch: 34 vs 41
```

In particular, there are 7 extra storage items stored in genesis. All
these changes relate to new functionality added in Echidna hardfork
(Policy extensions, Notary contract and etc.):
```
        {
            "id": -7,
            "key": "+f///xQi",
            "state": "Added",
            "value": "gJaYAA=="
        },
        {
            "id": -7,
            "key": "+f///xU=",
            "state": "Added",
            "value": "mDo="
        },
        {
            "id": -7,
            "key": "+f///xY=",
            "state": "Added",
            "value": "gBY="
        },
        {
            "id": -7,
            "key": "+f///xc=",
            "state": "Added",
            "value": "gBQg"
        },
        {
            "id": -1,
            "key": "/////wg77DUxEZu6123QRJILDebDGU/hwQ==",
            "state": "Added",
            "value": "QAUhAfYhACgUO+w1MRGbutdt0ESSCw3mwxlP4cEohk5FRjNuZW8tY29yZS12My4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0CdOC1CQQgoBk5vdGFyeUAASABAASgGTkVQLTI3QQJACEEFKAliYWxhbmNlT2ZAAUECKAdhY2NvdW50IQEUIQERIQAgAUEFKAxleHBpcmF0aW9uT2ZAAUECKAdhY2NvdW50IQEUIQERIQEHIAFBBSgZZ2V0TWF4Tm90VmFsaWRCZWZvcmVEZWx0YUAAIQERIQEOIAFBBSgQbG9ja0RlcG9zaXRVbnRpbEACQQIoB2FjY291bnQhARRBAigEdGlsbCEBESEBECEBFSAAQQUoDm9uTkVQMTdQYXltZW50QANBAigEZnJvbSEBFEECKAZhbW91bnQhARFBAigEZGF0YSEAIQL/ACEBHCAAQQUoGXNldE1heE5vdFZhbGlkQmVmb3JlRGVsdGFAAUECKAV2YWx1ZSEBESEC/wAhASMgAEEFKAZ2ZXJpZnlAAUECKAlzaWduYXR1cmUhARIhARAhASogAUEFKAh3aXRoZHJhd0ACQQIoBGZyb20hARRBAigCdG8hARQhARAhATEgAEAAQAFBAgAAQAAoBG51bGw="
        },
        {
            "id": -1,
            "key": "/////wz////2",
            "state": "Added",
            "value": "O+w1MRGbutdt0ESSCw3mwxlP4cE="
        },
        {
            "id": -10,
            "key": "9v///wo=",
            "state": "Added",
            "value": "jAA="
        },
```

Solution:

Since EnsureOmittedHardforks is always applied to configured hardfork
values, this function ensures that all omitted hardfork heights are set
to 0. We don't need additional checks anywhere and can rely on
settings.Hardforks explicitly after that. If hardfork is not in
settings.Hardforks then it is disabled.

Originaly it was an intention of #2942 (comment),
but somehow we missed this bug during review.

Signed-off-by: Anna Shaleva <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
cschuchardt88 pushed a commit to cschuchardt88/neo that referenced this pull request Jun 8, 2025
Problem:

Consider a hardfork (Echidna in our case) that is:
 1. Explicitly ommitted from the node configuration;
 2. Given the fact that the set of previous hardforks are explicitly enabled
    in the node configuration.
The problem is that this hardfork is treated as "enabled from genesis"
by `IsInitializeBlock` function.

This problem is discovered when running N3 mainnet/testnet node with the default
configuration on the current master. This behaviour leads to unexected
Echidna-related changes being included into the node state starting from genesis
block. Here are some data:

Hardforks configuration that is used in config.json file (given this
config, Echidna should be treated as disabled):
```
    "Hardforks": {
      "HF_Aspidochelone": 210000,
      "HF_Basilisk": 2680000,
      "HF_Cockatrice": 3967000,
      "HF_Domovoi": 4144000
    },
```

Genesis block state difference between the current master and 3.7 version:
```
Processing directory BlockStorage_0
file BlockStorage_0/dump-block-0.json: block 0, changes length mismatch: 34 vs 41
```

In particular, there are 7 extra storage items stored in genesis. All
these changes relate to new functionality added in Echidna hardfork
(Policy extensions, Notary contract and etc.):
```
        {
            "id": -7,
            "key": "+f///xQi",
            "state": "Added",
            "value": "gJaYAA=="
        },
        {
            "id": -7,
            "key": "+f///xU=",
            "state": "Added",
            "value": "mDo="
        },
        {
            "id": -7,
            "key": "+f///xY=",
            "state": "Added",
            "value": "gBY="
        },
        {
            "id": -7,
            "key": "+f///xc=",
            "state": "Added",
            "value": "gBQg"
        },
        {
            "id": -1,
            "key": "/////wg77DUxEZu6123QRJILDebDGU/hwQ==",
            "state": "Added",
            "value": "QAUhAfYhACgUO+w1MRGbutdt0ESSCw3mwxlP4cEohk5FRjNuZW8tY29yZS12My4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0CdOC1CQQgoBk5vdGFyeUAASABAASgGTkVQLTI3QQJACEEFKAliYWxhbmNlT2ZAAUECKAdhY2NvdW50IQEUIQERIQAgAUEFKAxleHBpcmF0aW9uT2ZAAUECKAdhY2NvdW50IQEUIQERIQEHIAFBBSgZZ2V0TWF4Tm90VmFsaWRCZWZvcmVEZWx0YUAAIQERIQEOIAFBBSgQbG9ja0RlcG9zaXRVbnRpbEACQQIoB2FjY291bnQhARRBAigEdGlsbCEBESEBECEBFSAAQQUoDm9uTkVQMTdQYXltZW50QANBAigEZnJvbSEBFEECKAZhbW91bnQhARFBAigEZGF0YSEAIQL/ACEBHCAAQQUoGXNldE1heE5vdFZhbGlkQmVmb3JlRGVsdGFAAUECKAV2YWx1ZSEBESEC/wAhASMgAEEFKAZ2ZXJpZnlAAUECKAlzaWduYXR1cmUhARIhARAhASogAUEFKAh3aXRoZHJhd0ACQQIoBGZyb20hARRBAigCdG8hARQhARAhATEgAEAAQAFBAgAAQAAoBG51bGw="
        },
        {
            "id": -1,
            "key": "/////wz////2",
            "state": "Added",
            "value": "O+w1MRGbutdt0ESSCw3mwxlP4cE="
        },
        {
            "id": -10,
            "key": "9v///wo=",
            "state": "Added",
            "value": "jAA="
        },
```

Solution:

Since EnsureOmittedHardforks is always applied to configured hardfork
values, this function ensures that all omitted hardfork heights are set
to 0. We don't need additional checks anywhere and can rely on
settings.Hardforks explicitly after that. If hardfork is not in
settings.Hardforks then it is disabled.

Originaly it was an intention of neo-project#2942 (comment),
but somehow we missed this bug during review.

Signed-off-by: Anna Shaleva <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blocker Issues that are blocking other issues. Check issues details to see what it is blocking. Critical Issues (bugs) that need to be fixed ASAP Waiting for Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix/Allow Native Contracts to be updated or receive new functions

6 participants