Skip to content

is there a bug in decodeNonce? #146

@Sxs7513

Description

@Sxs7513

function decodeNonce(uint256 nonce)
internal
pure
returns (ValidationMode mode, ValidationType vType, ValidationId identifier)
{
// 2bytes mode (1byte currentMode, 1byte type)
// 21bytes identifier
// 1byte mode | 1byte type | 20bytes identifierWithoutType | 2byte nonceKey | 8byte nonce == 32bytes
assembly {
mode := nonce
vType := shl(8, nonce)
identifier := shl(8, nonce)
switch shr(248, identifier)
case 0x0000000000000000000000000000000000000000000000000000000000000002 {
identifier := and(identifier, 0xffffffffff000000000000000000000000000000000000000000000000000000)
}
}
}

it should be: "vType := shr(8, nonce)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions