File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
ethcontract/src/transaction Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -98,8 +98,8 @@ impl Account {
9898 r. 0 . copy_from_slice ( & compact[ ..32 ] ) ;
9999
100100 // If `s` happens to be "on the dark side of the curve", we need to invert it (EIP-2)
101- let mut s_tentative: U256 = U256 :: from ( & compact[ 32 ..] ) ;
102- let secp256k1_n = U256 :: from ( CURVE_ORDER ) ;
101+ let mut s_tentative: U256 = U256 :: from_big_endian ( & compact[ 32 ..] ) ;
102+ let secp256k1_n = U256 :: from_big_endian ( & CURVE_ORDER ) ;
103103 if s_tentative > secp256k1_n / 2 {
104104 s_tentative = secp256k1_n - s_tentative;
105105 }
@@ -162,8 +162,8 @@ impl Account {
162162 encoder. append ( & v) ;
163163 // RLP encoding doesn't allow leading zeros for s & r, yet default H256 RLP encoding preserves leading 0s
164164 // By converting and encoding U256, we get rid of the leading zeros.
165- encoder. append ( & U256 :: from ( signature. r . as_bytes ( ) ) ) ;
166- encoder. append ( & U256 :: from ( signature. s . as_bytes ( ) ) ) ;
165+ encoder. append ( & U256 :: from_big_endian ( signature. r . as_bytes ( ) ) ) ;
166+ encoder. append ( & U256 :: from_big_endian ( signature. s . as_bytes ( ) ) ) ;
167167
168168 let raw_transaction = Bytes ( match id {
169169 Some ( id) => [ & [ id] , encoder. as_raw ( ) ] . concat ( ) ,
You can’t perform that action at this time.
0 commit comments