Skip to content

Latest commit

 

History

History
279 lines (223 loc) · 8.13 KB

SignatureBouncer.md

File metadata and controls

279 lines (223 loc) · 8.13 KB

SignatureBouncer (SignatureBouncer.sol)

View Source: contracts/drafts/SignatureBouncer.sol

↗ Extends: SignerRole ↘ Derived Contracts: SignatureBouncerMock

SignatureBouncer

A method that uses the onlyValidSignatureAndData modifier must make the _signature parameter the "last" parameter. You cannot sign a message that has its own signature in it so the last 128 bytes of msg.data (which represents the length of the _signature data and the _signaature data itself) is ignored when validating. Also non fixed sized parameters make constructing the data in the signature much more complex. See https://ethereum.stackexchange.com/a/50616 for more details.

Contract Members

Constants & Variables

uint256 private constant _METHOD_ID_SIZE;
uint256 private constant _SIGNATURE_SIZE;

Modifiers

onlyValidSignature

requires that a valid signature of a signer was provided

modifier onlyValidSignature(bytes signature) internal

Arguments

Name Type Description
signature bytes

onlyValidSignatureAndMethod

requires that a valid signature with a specifed method of a signer was provided

modifier onlyValidSignatureAndMethod(bytes signature) internal

Arguments

Name Type Description
signature bytes

onlyValidSignatureAndData

requires that a valid signature with a specifed method and params of a signer was provided

modifier onlyValidSignatureAndData(bytes signature) internal

Arguments

Name Type Description
signature bytes

Functions

_isValidSignature

is the signature of this + sender from a signer?

function _isValidSignature(address account, bytes signature) internal
returns(bool)

Returns

bool

Arguments

Name Type Description
account address
signature bytes

_isValidSignatureAndMethod

is the signature of this + sender + methodId from a signer?

function _isValidSignatureAndMethod(address account, bytes signature) internal
returns(bool)

Returns

bool

Arguments

Name Type Description
account address
signature bytes

_isValidSignatureAndData

the signature parameter of the method being validated must be the "last" parameter

function _isValidSignatureAndData(address account, bytes signature) internal
returns(bool)

Returns

bool

Arguments

Name Type Description
account address
signature bytes

_isValidDataHash

internal function to convert a hash to an eth signed message and then recover the signature and check it against the signer role

function _isValidDataHash(bytes32 hash, bytes signature) internal
returns(bool)

Returns

bool

Arguments

Name Type Description
hash bytes32
signature bytes

Contracts