web3p / ethereum-tx

Ethereum transaction library in PHP.
https://www.web3p.xyz/ethereumtx.html
MIT License
183 stars 63 forks source link

getFromAddress() does not work with r, s, v #56

Open kelvinzer0 opened 1 year ago

kelvinzer0 commented 1 year ago

The expected outcome on this website https://rawtxdecode.in/?rawTx=f86b0b85250523760082520894eafaf9bb8f35235d0df61275e86fd65d9ef2c3f9870aaa0065c66b8b8026a05fd883bb01a10915ebc06621b925bd6d624cb6768976b73c0d468b31f657d15ba0121d855c539a23aadf6f06ac21165db1ad5efd261842e82a719c9863ca4ac04c.

getFromAddress() does not work with r, s, v: $transaction['r'] = $r; $transaction['s'] = $s; $transaction['v'] = $v; $fromB = $transaction->getFromAddress();

output error: Deprecated: Return type of Web3p\EthereumTx\Transaction::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/qindexmedia/xxx/vendor/web3p/ethereum-tx/src/Transaction.php on line 292

Deprecated: Return type of Web3p\EthereumTx\Transaction::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/qindexmedia/xxx/vendor/web3p/ethereum-tx/src/Transaction.php on line 323

Deprecated: Return type of Web3p\EthereumTx\Transaction::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/qindexmedia/xxx/vendor/web3p/ethereum-tx/src/Transaction.php on line 252

Deprecated: Return type of Web3p\EthereumTx\Transaction::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/qindexmedia/xxx/vendor/web3p/ethereum-tx/src/Transaction.php on line 308

Fatal error: Uncaught AssertionError: assert((3 & $j) === $j) in /Users/qindexmedia/xxx/vendor/simplito/elliptic-php/lib/EC.php:224 Stack trace:

0 /Users/qindexmedia/xxx/vendor/simplito/elliptic-php/lib/EC.php(224): assert(false, 'assert((3 & $j)...')

1 /Users/qindexmedia/xxx/vendor/web3p/ethereum-tx/src/Transaction.php(474): Elliptic\EC->recoverPubKey('5b6cccfc272b73f...', Array, -12.0)

2 /Users/qindexmedia/xxx/tes.php(61): Web3p\EthereumTx\Transaction->getFromAddress()

3 {main}

thrown in /Users/qindexmedia/xxx/vendor/simplito/elliptic-php/lib/EC.php on line 224

kelvinzer0 commented 1 year ago

Improvement reference can be found at https://github.com/flightwallet/decode-eth-tx/blob/master/ethereumjs-tx-1.3.3.js