forked from firedancer-io/firedancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds constant for minimum serialized txn size. Adds CBMC proof for lower bound, i.e.: "There is no byte array with sz <= FD_TXN_MIN_SERIALIZED_SZ that is successfully parsed by fd_txn_parse()."
- Loading branch information
1 parent
5c71339
commit d43e011
Showing
4 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
HARNESS_ENTRY = harness | ||
HARNESS_FILE = fd_txn_minsz_harness | ||
|
||
PROOF_UID = fd_txn_minsz | ||
|
||
DEFINES += | ||
INCLUDES += -I$(SRCDIR) | ||
|
||
REMOVE_FUNCTION_BODY += | ||
|
||
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c | ||
PROOF_SOURCES += $(PROOF_STUB)/fd_log.c | ||
PROJECT_SOURCES = $(SRCDIR)/ballet/txn/fd_txn_parse.c | ||
|
||
include ../../Makefile.common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ "expected-missing-functions": | ||
[ | ||
|
||
], | ||
"proof-name": "fd_txn_minsz", | ||
"proof-root": "verification/proofs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <ballet/txn/fd_txn.h> | ||
|
||
#include <assert.h> | ||
#include <stdlib.h> | ||
|
||
/* Prove that there is no valid serialized txn with size less than | ||
FD_TXN_MIN_SERIALIZED_SZ. */ | ||
|
||
void | ||
harness( void ) { | ||
/* Input */ | ||
ulong input_sz; | ||
__CPROVER_assume( input_sz<FD_TXN_MIN_SERIALIZED_SZ ); | ||
uchar * input = malloc( input_sz ); | ||
if( !input ) return; | ||
|
||
/* Parsing target buffers */ | ||
fd_txn_parse_counters_t counters = {0}; | ||
uchar __attribute__((aligned((alignof(fd_txn_t))))) txn_buf[ FD_TXN_MAX_SZ ]; | ||
|
||
/* Parse */ | ||
ulong res = fd_txn_parse( input, input_sz, txn_buf, &counters ); | ||
|
||
/* Parsing must have failed */ | ||
assert( res==0UL ); | ||
} |