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

Latest develop build incorrectly(?) handles sub qualifiers #1188

Open
kralverde opened this issue Mar 17, 2022 · 6 comments
Open

Latest develop build incorrectly(?) handles sub qualifiers #1188

kralverde opened this issue Mar 17, 2022 · 6 comments

Comments

@kralverde
Copy link
Contributor

kralverde commented Mar 17, 2022

Describe the issue

https://rvnt.cryptoscope.io/tx/?txid=39f584821bfaeb6472969f008d219d6886a9ea430ac948858530a2e252f7ba58
A restricted asset is sent to mnzcdtNKpTY7kpuaW7Th88HPnzxes3BLEd. This h160 is not qualified for the associated tag, but is qualified by the sub qualifier.

>>> address_to_h160('mnzcdtNKpTY7kpuaW7Th88HPnzxes3BLEd')
"52041e2126f9afb70f082caf28cbc0ea4568c682"
>>> send_custom_script('blockchain.asset.validator_string', '$RENEWABLOX')
{
    "height": 1124545,
    "qualifying_tx_pos": 3,
    "restricted_tx_pos": 4,
    "string": "KYCTEST",
    "tx_hash": "a2791de8bfca034f9801ac3a6411d6a8302d9e08a8064abe8e83c2a206e317cc"
}
>>> send_custom_script('blockchain.asset.all_tags', '52041e2126f9afb70f082caf28cbc0ea4568c682')
{
    "#KYCTEST": {
        "flag": false,
        "height": 1124625,
        "tx_hash": "ccebd395b263817f2f1ccf6e9a76a287332b1a5ed98d7fcd29ca1970739b3540",
        "tx_pos": 2
    },
    "#KYCTEST/#RNBX1_TEST": {
        "flag": true,
        "height": 1124809,
        "tx_hash": "744ae2f262efdab76d2398430cd9fe5213ee06e1925d709435d684e2e5afed23",
        "tx_pos": 2
    }
}

On nodes running 4.7.0-test3, this is valid. On nodes running the latest develop build (7f27d35), this fails (it works occasionally after some time for some reason). The error is: ERROR: ContextualCheckVerifierString: The address mnzcdtNKpTY7kpuaW7Th88HPnzxes3BLEd failed to verify against: KYCTEST. Is null 1.

As I understand, h160's tagged with a sub qualifier are treated as though they were tagged with the parent qualifier, correct?

@kralverde
Copy link
Contributor Author

kralverde commented Mar 18, 2022

It looks like fdov's test3 is the latest that is able to sync from scratch https://github.com/fdoving/Ravencoin/releases/tag/v4.7.0test3-fdov

@kralverde
Copy link
Contributor Author

kralverde commented Mar 18, 2022

This is causing an issue on test3 as well now... unsure of what the issue could be

edit: invalidating the best chain at block 1126000 and reconsidering fixes the issue. Could it be that data from the chain is not brought into memory in time or something?

@kralverde
Copy link
Contributor Author

The invalidateblock reconsiderblock spam works on all versions

@kralverde
Copy link
Contributor Author

kralverde commented Mar 26, 2022

It does appear to be a fast fail from the cache:

Printout: ADD 2 false #KYCTEST mnzcdtNKpTY7kpuaW7Th88HPnzxes3BLEd

From

setIterator = passets->setNewQualifierAddressToAdd.find(cachedQualifierAddress);
    if (setIterator != passets->setNewQualifierAddressToAdd.end()) {
        // Return true if we are adding the qualifier, and false if we are removing it
        bool b = setIterator->type == QualifierType::ADD_QUALIFIER;
                        std::cout << "ADD 2 " << (b ? "true " : "false ") << qualifier_name << " " << address << "\n";

        return b;
    }

Modified from

setIterator = passets->setNewQualifierAddressToAdd.find(cachedQualifierAddress);

Returns false without checking the sub-qualifier tag for the address. It appears to me that this is accounted for later when pulling from the db which is why the reconsider works.

@kralverde
Copy link
Contributor Author

Actually this isn't quite correct; another sync resulted in ADD 2 true #KYCTEST mnzcdtNKpTY7kpuaW7Th88HPnzxes3BLEd... there error must lie in how the cache is populated...

@hans-schmidt
Copy link
Contributor

PR #1189 was written today specifically to fix this Issue

The bug is related to the use of SubQualifiers for Restricted Assets and exists in all previous versions of core which support Restricted Assets. Since it is a failure in reading cache properly, it does not occur once the cache flushes to database, making it dependent on node speed, compile types, and other things which affect timing.

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

No branches or pull requests

2 participants