@@ -185,12 +185,6 @@ fn decode_deoxysii_call_args(
185185 let text = text. to_vec ( ) ;
186186 let ad = ad. to_vec ( ) ;
187187
188- if nonce_bytes[ NONCE_SIZE ..] . iter ( ) . any ( |& x| x != 0 ) {
189- return Err ( PrecompileFailure :: Error {
190- exit_status : ExitError :: Other ( "invalid nonce size" . into ( ) ) ,
191- } ) ;
192- }
193-
194188 let mut nonce = [ 0u8 ; NONCE_SIZE ] ;
195189 nonce. copy_from_slice ( & nonce_bytes[ ..NONCE_SIZE ] ) ;
196190 let mut key = [ 0u8 ; KEY_SIZE ] ;
@@ -505,7 +499,7 @@ mod test {
505499 #[ test]
506500 fn test_deoxysii ( ) {
507501 let key = b"this must be the excelentest key" ;
508- let nonce = b"short nonce \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 " ;
502+ let nonce = b"complete noncence, and too long. " ;
509503 let plaintext = b"0123456789" ;
510504 let ad = b"additional data" ;
511505 let ret_ct = call_contract (
@@ -541,28 +535,6 @@ mod test {
541535 assert_eq ! ( plaintext. as_slice( ) , ret_pt. output) ;
542536 }
543537
544- #[ test]
545- fn test_deoxysii_invalid_nonce ( ) {
546- let key = b"this must be the excelentest key" ;
547- let nonce = b"invalid nonce, which is too long" ;
548- let plaintext = b"0123456789" ;
549- let ad = b"additional data" ;
550- let _ = call_contract (
551- H160 ( [
552- 0x01 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x03 ,
553- ] ) ,
554- & solabi:: encode ( & (
555- solabi:: Bytes :: < [ u8 ; 32 ] > ( * key) ,
556- solabi:: Bytes :: < [ u8 ; 32 ] > ( * nonce) ,
557- solabi:: Bytes ( plaintext. to_vec ( ) ) ,
558- solabi:: Bytes ( ad. to_vec ( ) ) ,
559- ) ) ,
560- 10_000_000 ,
561- )
562- . expect ( "call should return something" )
563- . expect_err ( "call should fail" ) ;
564- }
565-
566538 #[ test]
567539 fn test_random_bytes ( ) {
568540 let ret = call_contract (
@@ -579,7 +551,7 @@ mod test {
579551 #[ bench]
580552 fn bench_deoxysii_short ( b : & mut Bencher ) {
581553 let key = b"this must be the excelentest key" ;
582- let nonce = b"short nonce \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 " ;
554+ let nonce = b"complete noncence, and too long. " ;
583555 let plaintext = b"01234567890123456789" ;
584556 let ad = b"additional data" ;
585557 b. iter ( || {
@@ -603,7 +575,7 @@ mod test {
603575 #[ bench]
604576 fn bench_deoxysii_long ( b : & mut Bencher ) {
605577 let key = b"this must be the excelentest key" ;
606- let nonce = b"short nonce \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 " ;
578+ let nonce = b"complete noncence, and too long. " ;
607579 let plaintext = b"0123456789" . repeat ( 200 ) ;
608580 let ad = b"additional data" ;
609581 b. iter ( || {
0 commit comments