Skip to content

Commit

Permalink
fix(@embark/cockpit): Fix decode transaction error
Browse files Browse the repository at this point in the history
Reproduce:
1. Go to cockpit > transactions
2. Click a transaction
3. There will be a flicker of an error, then the decoded tx displays OK. Inspecting the network requests, there is a 500 error with a response of
```
AssertionError [ERR_ASSERTION]: invalid remainder
```
This error is also printed in the console.

The issue is that the transaction is not a raw transaction, so instead of trying to decode the non-raw transaction, the transaction can be decoded by web3.
  • Loading branch information
emizzle committed Mar 5, 2019
1 parent 9bd33a9 commit f957ba5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
3 changes: 0 additions & 3 deletions packages/embark-ui/src/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import {EMBARK_PROCESS_NAME} from '../constants';
import {ansiToHtml} from '../utils/utils';

export const REQUEST = 'REQUEST';
export const SUCCESS = 'SUCCESS';
export const FAILURE = 'FAILURE';
Expand Down
4 changes: 2 additions & 2 deletions packages/embark-ui/src/components/ContractsDeployment.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const LayoutContract = ({contract, children, cardTitle}) => (

LayoutContract.propTypes = {
contract: PropTypes.object,
children: PropTypes.array,
cardTitle: PropTypes.object
children: PropTypes.any,
cardTitle: PropTypes.any
};

const DeploymentResult = ({deployment}) => {
Expand Down
11 changes: 5 additions & 6 deletions packages/embark-ui/src/services/web3.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ export function estimateGas({web3, contract, args}) {

export function deploy({web3, contract, args}) {
return new Promise((resolve, reject) => {
const cleanup = () => { promiEvent.removeAllListeners(); };
const promiEvent = new web3.eth.Contract(contract.abiDefinition)
new web3.eth.Contract(contract.abiDefinition)
.deploy({data: `0x${contract.code}`, arguments: args})
.send({from: web3.eth.defaultAccount})
.on('error', reject)
.on('receipt', resolve)
.then(cleanup)
.catch(cleanup);
});
.once('receipt', resolve)
.catch(reject)
.then(() => {});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ class BlockchainConnector {
'get',
'/embark-api/blockchain/transactions/:hash',
(req, res) => {
self.getTransactionByRawTransactionHash(req.params.hash, (err, transaction) => {
self.getTransactionByHash(req.params.hash, (err, transaction) => {
if (err) {
self.logger.error(err);
}
Expand Down

0 comments on commit f957ba5

Please sign in to comment.