File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,9 +36,8 @@ var SolidityParam = require('./param');
3636 * @returns {SolidityParam }
3737 */
3838var formatInputInt = function ( value ) {
39- var padding = c . ETH_PADDING * 2 ;
4039 BigNumber . config ( c . ETH_BIGNUMBER_ROUNDING_MODE ) ;
41- var result = utils . padLeft ( utils . toTwosComplement ( value ) . round ( ) . toString ( 16 ) , padding ) ;
40+ var result = utils . padLeft ( utils . toTwosComplement ( value ) . round ( ) . toString ( 16 ) , 64 ) ;
4241 return new SolidityParam ( result ) ;
4342} ;
4443
@@ -50,7 +49,9 @@ var formatInputInt = function (value) {
5049 * @returns {SolidityParam }
5150 */
5251var formatInputBytes = function ( value ) {
53- var result = utils . padRight ( utils . toHex ( value ) . substr ( 2 ) , 64 ) ;
52+ var result = utils . toHex ( value ) . substr ( 2 ) ;
53+ var l = Math . floor ( ( result . length + 63 ) / 64 ) ;
54+ result = utils . padRight ( result , l * 64 ) ;
5455 return new SolidityParam ( result ) ;
5556} ;
5657
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ SolidityParam.prototype.combine = function (param) {
7272 * @returns {Boolean }
7373 */
7474SolidityParam . prototype . isDynamic = function ( ) {
75- return this . value . length > 64 || this . offset !== undefined ;
75+ return this . offset !== undefined ;
7676} ;
7777
7878/**
Original file line number Diff line number Diff line change @@ -43,6 +43,10 @@ describe('lib/solidity/coder', function () {
4343 'c3a40000c3a40000000000000000000000000000000000000000000000000000' } ) ;
4444 test ( { type : 'bytes32' , value : '0xc3a40000c3a4' ,
4545 expected : 'c3a40000c3a40000000000000000000000000000000000000000000000000000' } ) ;
46+ test ( { type : 'bytes64' , value : '0xc3a40000c3a40000000000000000000000000000000000000000000000000000' +
47+ 'c3a40000c3a40000000000000000000000000000000000000000000000000000' ,
48+ expected : 'c3a40000c3a40000000000000000000000000000000000000000000000000000' +
49+ 'c3a40000c3a40000000000000000000000000000000000000000000000000000' } ) ;
4650 test ( { type : 'string' , value : 'ää' ,
4751 expected : '0000000000000000000000000000000000000000000000000000000000000020' +
4852 '0000000000000000000000000000000000000000000000000000000000000008' +
You can’t perform that action at this time.
0 commit comments