diff --git a/src/ballet/txn/fd_txn_parse.c b/src/ballet/txn/fd_txn_parse.c index 9652c99e104..2e3bed3d277 100644 --- a/src/ballet/txn/fd_txn_parse.c +++ b/src/ballet/txn/fd_txn_parse.c @@ -137,6 +137,14 @@ fd_txn_parse_core( uchar const * payload, CHECK_LEFT( FD_TXN_ACCT_ADDR_SZ*acct_addr_cnt ); ulong acct_addr_off = i ; i+=FD_TXN_ACCT_ADDR_SZ*acct_addr_cnt; + /* Throw out transactions with duplicate addresses at parse time. + Agave rejects these at sanitisation time. */ + for( ulong j=0UL; j<(ulong)acct_addr_cnt; j++ ) { + for( ulong k=j+1UL; k<(ulong)acct_addr_cnt; k++ ) { + CHECK( memcmp( payload+acct_addr_off+FD_TXN_ACCT_ADDR_SZ*j, payload+acct_addr_off+FD_TXN_ACCT_ADDR_SZ*k, FD_TXN_ACCT_ADDR_SZ ) ); + } + } + /* Config values: 4 bytes per set mask bit */ ulong config_values_off = i; ulong num_config_values = (ulong)fd_uint_popcnt( config_mask ); diff --git a/src/ballet/txn/test_txn_parse.c b/src/ballet/txn/test_txn_parse.c index 47c879877fa..18682f99d1b 100644 --- a/src/ballet/txn/test_txn_parse.c +++ b/src/ballet/txn/test_txn_parse.c @@ -43,7 +43,7 @@ build_legacy_one_instr( uchar * buf, ushort instr_acct_cnt ) { buf[ o++ ] = 0x01; /* header: num_readonly_unsigned = 1 */ buf[ o++ ] = 0x02; /* account address count = 2 */ for( ulong a=0UL; a<2UL; a++ ) - for( ulong j=0UL; j<32UL; j++ ) buf[ o++ ] = (uchar)(a*32UL+j); /* 2 addresses */ + for( ulong j=0UL; j<32UL; j++ ) buf[ o++ ] = (uchar)( j ? 0xA0UL+j : a ); /* 2 distinct addresses */ for( ulong j=0UL; j<32UL; j++ ) buf[ o++ ] = (uchar)(0xB0+j); /* recent blockhash */ buf[ o++ ] = 0x01; /* instruction count = 1 */ buf[ o++ ] = 0x01; /* program_id index = 1 */ @@ -307,7 +307,7 @@ build_v1( uchar * buf, buf[ o++ ] = num_addr; /* addresses */ for( ulong a=0UL; aacct_addr_cnt == 64 ); + } + /* num_addr exceeds FD_TXN_ACCT_ADDR_MAX (64) */ { ulong sz = build_v1( v1_buf, 1, 0, 1, 0u, 65, ix1, 1 ); diff --git a/src/disco/keyguard/test_keyguard.c b/src/disco/keyguard/test_keyguard.c index 77cc2af168c..fff5718a8f9 100644 --- a/src/disco/keyguard/test_keyguard.c +++ b/src/disco/keyguard/test_keyguard.c @@ -20,7 +20,7 @@ build_txn_v1( uchar * buf, buf[ o++ ] = (uchar)instr_cnt; buf[ o++ ] = (uchar)num_addr; for( ulong a=0UL; a