-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correctly encode create2 params (#1065)
* fix: correctly encode create2 params We have tests for this, but they're unit tests that use this structure. fixes filecoin-project/ref-fvm#1468 * test: add a test for create2 We need to flesh these tests out, but this is a start.
- Loading branch information
Showing
16 changed files
with
132 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"inputs":[{"internalType":"int32","name":"value","type":"int32"}],"name":"create","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"int32","name":"value","type":"int32"}],"name":"create2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
608060405234801561001057600080fd5b5061048a806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630876a11e1461003b5780631e1932941461006b575b600080fd5b6100556004803603810190610050919061019c565b61009b565b604051610062919061021d565b60405180910390f35b61008560048036038101906100809190610238565b6100de565b604051610092919061021d565b60405180910390f35b600082826040516100ab9061011b565b6100b59190610274565b8190604051809103906000f59050801580156100d5573d6000803e3d6000fd5b50905092915050565b6000816040516100ed9061011b565b6100f79190610274565b604051809103906000f080158015610113573d6000803e3d6000fd5b509050919050565b6101c58061029083390190565b600080fd5b6000819050919050565b6101408161012d565b811461014b57600080fd5b50565b60008135905061015d81610137565b92915050565b60008160030b9050919050565b61017981610163565b811461018457600080fd5b50565b60008135905061019681610170565b92915050565b600080604083850312156101b3576101b2610128565b5b60006101c18582860161014e565b92505060206101d285828601610187565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610207826101dc565b9050919050565b610217816101fc565b82525050565b6000602082019050610232600083018461020e565b92915050565b60006020828403121561024e5761024d610128565b5b600061025c84828501610187565b91505092915050565b61026e81610163565b82525050565b60006020820190506102896000830184610265565b9291505056fe608060405234801561001057600080fd5b506040516101c53803806101c583398181016040528101906100329190610099565b806000806101000a81548163ffffffff021916908360030b63ffffffff160217905550506100c6565b600080fd5b60008160030b9050919050565b61007681610060565b811461008157600080fd5b50565b6000815190506100938161006d565b92915050565b6000602082840312156100af576100ae61005b565b5b60006100bd84828501610084565b91505092915050565b60f1806100d46000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806333cf508014603757806335f46994146051575b600080fd5b603d6059565b6040516048919060a2565b60405180910390f35b6057606f565b005b60008060009054906101000a900460030b905090565b3373ffffffffffffffffffffffffffffffffffffffff16ff5b60008160030b9050919050565b609c816088565b82525050565b600060208201905060b560008301846095565b9291505056fea2646970667358221220515fddaf42d9a26595aaf38ed0775a03d845e2d847b5e94a23ec84f414bea90e64736f6c63430008110033a264697066735822122060b27608659f19cc27f02c0145ae6714d9886ccd9a56178f95522973c86d813864736f6c63430008110033 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Function signatures: | ||
1e193294: create(int32) | ||
0876a11e: create2(bytes32,int32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"inputs":[{"internalType":"int32","name":"arg","type":"int32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"die","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"get_value","outputs":[{"internalType":"int32","name":"","type":"int32"}],"stateMutability":"view","type":"function"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
608060405234801561001057600080fd5b506040516101c53803806101c583398181016040528101906100329190610099565b806000806101000a81548163ffffffff021916908360030b63ffffffff160217905550506100c6565b600080fd5b60008160030b9050919050565b61007681610060565b811461008157600080fd5b50565b6000815190506100938161006d565b92915050565b6000602082840312156100af576100ae61005b565b5b60006100bd84828501610084565b91505092915050565b60f1806100d46000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806333cf508014603757806335f46994146051575b600080fd5b603d6059565b6040516048919060a2565b60405180910390f35b6057606f565b005b60008060009054906101000a900460030b905090565b3373ffffffffffffffffffffffffffffffffffffffff16ff5b60008160030b9050919050565b609c816088565b82525050565b600060208201905060b560008301846095565b9291505056fea2646970667358221220515fddaf42d9a26595aaf38ed0775a03d845e2d847b5e94a23ec84f414bea90e64736f6c63430008110033 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Function signatures: | ||
35f46994: die() | ||
33cf5080: get_value() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"storage":[{"astId":42,"contract":"tests/contracts/Lifecycle.sol:FactoryChild","label":"value","offset":0,"slot":"0","type":"t_int32"}],"types":{"t_int32":{"encoding":"inplace","label":"int32","numberOfBytes":"4"}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"storage":[]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
608060405234801561001057600080fd5b5061048a806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630876a11e1461003b5780631e1932941461006b575b600080fd5b6100556004803603810190610050919061019c565b61009b565b604051610062919061021d565b60405180910390f35b61008560048036038101906100809190610238565b6100de565b604051610092919061021d565b60405180910390f35b600082826040516100ab9061011b565b6100b59190610274565b8190604051809103906000f59050801580156100d5573d6000803e3d6000fd5b50905092915050565b6000816040516100ed9061011b565b6100f79190610274565b604051809103906000f080158015610113573d6000803e3d6000fd5b509050919050565b6101c58061029083390190565b600080fd5b6000819050919050565b6101408161012d565b811461014b57600080fd5b50565b60008135905061015d81610137565b92915050565b60008160030b9050919050565b61017981610163565b811461018457600080fd5b50565b60008135905061019681610170565b92915050565b600080604083850312156101b3576101b2610128565b5b60006101c18582860161014e565b92505060206101d285828601610187565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610207826101dc565b9050919050565b610217816101fc565b82525050565b6000602082019050610232600083018461020e565b92915050565b60006020828403121561024e5761024d610128565b5b600061025c84828501610187565b91505092915050565b61026e81610163565b82525050565b60006020820190506102896000830184610265565b9291505056fe608060405234801561001057600080fd5b506040516101c53803806101c583398181016040528101906100329190610099565b806000806101000a81548163ffffffff021916908360030b63ffffffff160217905550506100c6565b600080fd5b60008160030b9050919050565b61007681610060565b811461008157600080fd5b50565b6000815190506100938161006d565b92915050565b6000602082840312156100af576100ae61005b565b5b60006100bd84828501610084565b91505092915050565b60f1806100d46000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806333cf508014603757806335f46994146051575b600080fd5b603d6059565b6040516048919060a2565b60405180910390f35b6057606f565b005b60008060009054906101000a900460030b905090565b3373ffffffffffffffffffffffffffffffffffffffff16ff5b60008160030b9050919050565b609c816088565b82525050565b600060208201905060b560008301846095565b9291505056fea2646970667358221220515fddaf42d9a26595aaf38ed0775a03d845e2d847b5e94a23ec84f414bea90e64736f6c63430008110033a264697066735822122060b27608659f19cc27f02c0145ae6714d9886ccd9a56178f95522973c86d813864736f6c63430008110033 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// SPDX-License-Identifier: Apache-2.0 MIT | ||
pragma solidity >=0.4.25 <=0.8.17; | ||
|
||
contract Factory { | ||
function create(int32 value) public returns (address) { | ||
return address(new FactoryChild(value)); | ||
} | ||
|
||
function create2(bytes32 salt, int32 value) public returns (address) { | ||
return address(new FactoryChild{salt: salt}(value)); | ||
} | ||
} | ||
|
||
contract FactoryChild { | ||
int32 value; | ||
constructor(int32 arg) { | ||
value = arg; | ||
} | ||
function die() public { | ||
selfdestruct(payable(msg.sender)); | ||
} | ||
function get_value() public view returns (int32) { | ||
return value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"storage":[{"astId":3,"contract":"tests/contracts/Lifecycle.sol:SelfDestruct","label":"value","offset":0,"slot":"0","type":"t_int32"}],"types":{"t_int32":{"encoding":"inplace","label":"int32","numberOfBytes":"4"}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
608060405234801561001057600080fd5b506107d8806100206000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806380a5fa431161005b57806380a5fa43146100d95780639ab3c8bb14610109578063aa835c4814610125578063ea437a3a1461014157610088565b806302c6564b1461008d57806327e561f6146100a9578063339f8645146100b357806373ef151a146100cf575b600080fd5b6100a760048036038101906100a291906105f4565b610171565b005b6100b16101f0565b005b6100cd60048036038101906100c89190610621565b6102f1565b005b6100d761036d565b005b6100f360048036038101906100ee9190610674565b6103ae565b60405161010091906106c3565b60405180910390f35b610123600480360381019061011e9190610621565b61043b565b005b61013f600480360381019061013a91906105f4565b6104b7565b005b61015b60048036038101906101569190610674565b610536565b60405161016891906106c3565b60405180910390f35b6000600190505b8163ffffffff168163ffffffff16116101ec5760018190806001815401808255809150506001900390600052602060002090600891828204019190066004029091909190916101000a81548163ffffffff021916908363ffffffff16021790555080806101e49061070d565b915050610178565b5050565b60016000808282829054906101000a900463ffffffff166102119190610739565b92506101000a81548163ffffffff021916908363ffffffff1602179055506001600060048282829054906101000a900463ffffffff166102519190610739565b92506101000a81548163ffffffff021916908363ffffffff1602179055506001600060088282829054906101000a900463ffffffff166102919190610739565b92506101000a81548163ffffffff021916908363ffffffff16021790555060016000600c8282829054906101000a900463ffffffff166102d19190610739565b92506101000a81548163ffffffff021916908363ffffffff160217905550565b60008390505b82846103039190610739565b63ffffffff168163ffffffff1610156103675781600460008363ffffffff1663ffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff160217905550808061035f9061070d565b9150506102f7565b50505050565b60016000808282829054906101000a900463ffffffff1661038e9190610739565b92506101000a81548163ffffffff021916908363ffffffff160217905550565b6000808390505b82846103c19190610739565b63ffffffff168163ffffffff1610156104345760018163ffffffff16815481106103ee576103ed610773565b5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff168261041f9190610739565b9150808061042c9061070d565b9150506103b5565b5092915050565b60008390505b828461044d9190610739565b63ffffffff168163ffffffff1610156104b15781600360008363ffffffff1663ffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff16021790555080806104a99061070d565b915050610441565b50505050565b6000600190505b8163ffffffff168163ffffffff16116105325760028190806001815401808255809150506001900390600052602060002090600891828204019190066004029091909190916101000a81548163ffffffff021916908363ffffffff160217905550808061052a9061070d565b9150506104be565b5050565b6000808390505b82846105499190610739565b63ffffffff168163ffffffff1610156105ac57600360008263ffffffff1663ffffffff16815260200190815260200160002060009054906101000a900463ffffffff16826105979190610739565b915080806105a49061070d565b91505061053d565b5092915050565b600080fd5b600063ffffffff82169050919050565b6105d1816105b8565b81146105dc57600080fd5b50565b6000813590506105ee816105c8565b92915050565b60006020828403121561060a576106096105b3565b5b6000610618848285016105df565b91505092915050565b60008060006060848603121561063a576106396105b3565b5b6000610648868287016105df565b9350506020610659868287016105df565b925050604061066a868287016105df565b9150509250925092565b6000806040838503121561068b5761068a6105b3565b5b6000610699858286016105df565b92505060206106aa858286016105df565b9150509250929050565b6106bd816105b8565b82525050565b60006020820190506106d860008301846106b4565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610718826105b8565b915063ffffffff820361072e5761072d6106de565b5b600182019050919050565b6000610744826105b8565b915061074f836105b8565b92508263ffffffff03821115610768576107676106de565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea26469706673582212204627e855ec638124e86ac435a22bc2e64114895f4cfa3ad1db43962f0273c67a64736f6c634300080f0033 | ||
608060405234801561001057600080fd5b506107d6806100206000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806380a5fa431161005b57806380a5fa43146100d95780639ab3c8bb14610109578063aa835c4814610125578063ea437a3a1461014157610088565b806302c6564b1461008d57806327e561f6146100a9578063339f8645146100b357806373ef151a146100cf575b600080fd5b6100a760048036038101906100a291906105f4565b610171565b005b6100b16101f0565b005b6100cd60048036038101906100c89190610621565b6102f1565b005b6100d761036d565b005b6100f360048036038101906100ee9190610674565b6103ae565b60405161010091906106c3565b60405180910390f35b610123600480360381019061011e9190610621565b61043b565b005b61013f600480360381019061013a91906105f4565b6104b7565b005b61015b60048036038101906101569190610674565b610536565b60405161016891906106c3565b60405180910390f35b6000600190505b8163ffffffff168163ffffffff16116101ec5760018190806001815401808255809150506001900390600052602060002090600891828204019190066004029091909190916101000a81548163ffffffff021916908363ffffffff16021790555080806101e49061070d565b915050610178565b5050565b60016000808282829054906101000a900463ffffffff166102119190610739565b92506101000a81548163ffffffff021916908363ffffffff1602179055506001600060048282829054906101000a900463ffffffff166102519190610739565b92506101000a81548163ffffffff021916908363ffffffff1602179055506001600060088282829054906101000a900463ffffffff166102919190610739565b92506101000a81548163ffffffff021916908363ffffffff16021790555060016000600c8282829054906101000a900463ffffffff166102d19190610739565b92506101000a81548163ffffffff021916908363ffffffff160217905550565b60008390505b82846103039190610739565b63ffffffff168163ffffffff1610156103675781600460008363ffffffff1663ffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff160217905550808061035f9061070d565b9150506102f7565b50505050565b60016000808282829054906101000a900463ffffffff1661038e9190610739565b92506101000a81548163ffffffff021916908363ffffffff160217905550565b6000808390505b82846103c19190610739565b63ffffffff168163ffffffff1610156104345760018163ffffffff16815481106103ee576103ed610771565b5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff168261041f9190610739565b9150808061042c9061070d565b9150506103b5565b5092915050565b60008390505b828461044d9190610739565b63ffffffff168163ffffffff1610156104b15781600360008363ffffffff1663ffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff16021790555080806104a99061070d565b915050610441565b50505050565b6000600190505b8163ffffffff168163ffffffff16116105325760028190806001815401808255809150506001900390600052602060002090600891828204019190066004029091909190916101000a81548163ffffffff021916908363ffffffff160217905550808061052a9061070d565b9150506104be565b5050565b6000808390505b82846105499190610739565b63ffffffff168163ffffffff1610156105ac57600360008263ffffffff1663ffffffff16815260200190815260200160002060009054906101000a900463ffffffff16826105979190610739565b915080806105a49061070d565b91505061053d565b5092915050565b600080fd5b600063ffffffff82169050919050565b6105d1816105b8565b81146105dc57600080fd5b50565b6000813590506105ee816105c8565b92915050565b60006020828403121561060a576106096105b3565b5b6000610618848285016105df565b91505092915050565b60008060006060848603121561063a576106396105b3565b5b6000610648868287016105df565b9350506020610659868287016105df565b925050604061066a868287016105df565b9150509250925092565b6000806040838503121561068b5761068a6105b3565b5b6000610699858286016105df565b92505060206106aa858286016105df565b9150509250929050565b6106bd816105b8565b82525050565b60006020820190506106d860008301846106b4565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610718826105b8565b915063ffffffff820361072e5761072d6106de565b5b600182019050919050565b6000610744826105b8565b915061074f836105b8565b9250828201905063ffffffff81111561076b5761076a6106de565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea26469706673582212209ead5577e72317eb390c1db842de5179a6cf2a8df9cc840fb0a80f11d1fcf07064736f6c63430008110033 |
Oops, something went wrong.