New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction receipt contractAddress injection #3265

Merged
merged 2 commits into from Nov 16, 2017

Conversation

Projects
None yet
6 participants
@evertonfraga
Member

evertonfraga commented Nov 9, 2017

What does it do?

Overrides eth_getTransactionReceipt to properly add contractAddress.

It comes in handy as the light client currently doesn't return that for now.

evertonfraga added some commits Nov 9, 2017

@evertonfraga

This comment has been minimized.

Member

evertonfraga commented Nov 10, 2017

TODO: add support to batch requests

@ghost

This comment has been minimized.

ghost commented Nov 10, 2017

Thank you for this, can you explain how to use it?

@evertonfraga

This comment has been minimized.

Member

evertonfraga commented Nov 13, 2017

@ni2k10 you can try to build Mist from source, or wait for a release, that will happen ~2 days after this has been merged.

@bliekp

This comment has been minimized.

bliekp commented Nov 13, 2017

Please merge this ASAP. This is a real showstopper and it would be great if this is fixed...

@evertonfraga

This comment has been minimized.

Member

evertonfraga commented Nov 13, 2017

@marcgarreau

:shipit: successfully resolves hanging contracts in tandem with ethereum/meteor-dapp-wallet#427

@evertonfraga evertonfraga merged commit c58353f into develop Nov 16, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@evertonfraga evertonfraga deleted the transactionReceipt-injection branch Nov 16, 2017

@pokjs

This comment has been minimized.

pokjs commented Dec 29, 2017

@@ -0,0 +1,60 @@
+const _ = global._;
+const BaseProcessor = require('./base');
+const eth = require('ethereumjs-util');
+
+/**

    • Process method: eth_getTransactionReceipt
  • */

+module.exports = class extends BaseProcessor {
+

  • sanitizeRequestPayload(conn, payload, isPartOfABatch) {
  •    return super.sanitizeRequestPayload(conn, payload, isPartOfABatch);
    
  • }
  • async exec(conn, payload) {
  •    const txHash = payload.params[0];
    
  •    // Sends regular eth_getTransactionReceipt request
    
  •    const ret = await conn.socket.send(payload, {
    
  •        fullResult: true
    
  •    });
    
  •    // If that contains a contractAddress already, fine.
    
  •    if (ret.result.result.contractAddress != null) {
    
  •        return ret.result;
    
  •    }
    
  •    // Due to a geth's light client v1 bug, it does not return
    
  •    // contractAddress value on the receipts. Let's fix that.
    
  •    // 1. GET TRANSACTION from AND nonce VALUES
    
  •    const transactionInfo = await conn.socket.send({
    
  •        jsonrpc: '2.0',
    
  •        id: _.uuid(),
    
  •        method: 'eth_getTransactionByHash',
    
  •        params: [txHash]
    
  •    }, { fullResult: true });
    
  •    const fromAddress = transactionInfo.result.result.from;
    
  •    const nonce = parseInt(transactionInfo.result.result.nonce, 16);
    
  •    const possibleContractAddress = `0x${eth.generateAddress(fromAddress, nonce).toString('hex')}`;
    
  •    // 2. GET CODE FROM ADDRESS
    
  •    const contractCode = await conn.socket.send({
    
  •        jsonrpc: '2.0',
    
  •        id: _.uuid(),
    
  •        method: 'eth_getCode',
    
  •        params: [possibleContractAddress, 'latest']
    
  •    }, { fullResult: true });
    
  •    const contractCodeResult = contractCode.result.result;
    
  •    // 3. IF IT EXISTS, ASSIGN TO RETURN VALUE
    
  •    if (contractCodeResult && contractCodeResult.length > 2) {
    
  •        ret.result.result.contractAddress = possibleContractAddress;
    
  •    }
    
  •    return ret.result;
    
  • }
    +};
@jnd510

This comment has been minimized.

jnd510 commented on package.json in c44891e Dec 31, 2017

Contract Name:ControllerCompiler Version:v0.4.11+commit.68ef5810

This comment has been minimized.

toya999 replied Feb 26, 2018

E

@lock

This comment has been minimized.

lock bot commented Mar 29, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked and limited conversation to collaborators Mar 29, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.