Skip to content

Commit

Permalink
Rule for missing function selector.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariaKt committed Nov 5, 2024
1 parent 75c4e73 commit edb5c40
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/solidity.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ module SOLIDITY-CONFIGURATION
// The active contract should be the last one in the list of contracts as
// decoded by the provided $PGM.
// When the function selector is found, call the corresponding function
rule <k> execute(false, B) =>
#let ARGS::CallArgumentList = decodeArgs(substrBytes(B, 4, lengthBytes(B)), ParamTypes) #in
F ( ARGS )
Expand All @@ -111,6 +112,9 @@ module SOLIDITY-CONFIGURATION
<contract-fn-id> F </contract-fn-id>
<contract-fn-arg-types> ParamTypes </contract-fn-arg-types>
// When the function selector is not found, fail.
rule execute(false, _B:Bytes) => require(v(false, bool), "Missing function selector") [owise]
syntax TypedVal ::= decodeArg(Bytes, Int, ElementaryTypeName) [function]
rule decodeArg(B:Bytes, I:Int, uint256) =>
v(Int2MInt(Bytes2Int(substrBytes(B, I, I +Int 32), BE, Unsigned))::MInt{256}, uint256)
Expand Down

0 comments on commit edb5c40

Please sign in to comment.