Commit 206f6033 authored by Maurelian's avatar Maurelian Committed by GitHub

ctb: Fix outdated references to 'withdrawal contract' (#3497)

Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 9bb9fb28
---
'@eth-optimism/contracts-bedrock': patch
'@eth-optimism/core-utils': patch
'@eth-optimism/integration-tests-bedrock': patch
'@eth-optimism/sdk': patch
---
Fix outdated references to 'withdrawal contract'
This diff is collapsed.
...@@ -221,7 +221,7 @@ func FinalizeWithdrawalParameters(ctx context.Context, l2client ProofClient, txH ...@@ -221,7 +221,7 @@ func FinalizeWithdrawalParameters(ctx context.Context, l2client ProofClient, txH
OutputRootProof: bindings.TypesOutputRootProof{ OutputRootProof: bindings.TypesOutputRootProof{
Version: [32]byte{}, // Empty for version 1 Version: [32]byte{}, // Empty for version 1
StateRoot: header.Root, StateRoot: header.Root,
WithdrawerStorageRoot: p.StorageHash, MessagePasserStorageRoot: p.StorageHash,
LatestBlockhash: header.Hash(), LatestBlockhash: header.Hash(),
}, },
WithdrawalProof: withdrawalProof, WithdrawalProof: withdrawalProof,
...@@ -235,7 +235,8 @@ var ( ...@@ -235,7 +235,8 @@ var (
AddressType, _ = abi.NewType("address", "", nil) AddressType, _ = abi.NewType("address", "", nil)
) )
// WithdrawalHash computes the hash of the withdrawal that was stored in the L2 withdrawal contract state. // WithdrawalHash computes the hash of the withdrawal that was stored in the L2toL1MessagePasser
// contract state.
// TODO: // TODO:
// - I don't like having to use the ABI Generated struct // - I don't like having to use the ABI Generated struct
// - There should be a better way to run the ABI encoding // - There should be a better way to run the ABI encoding
......
...@@ -119,8 +119,8 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver { ...@@ -119,8 +119,8 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
* *
* @param _tx Withdrawal transaction to finalize. * @param _tx Withdrawal transaction to finalize.
* @param _l2BlockNumber L2 block number of the outputRoot. * @param _l2BlockNumber L2 block number of the outputRoot.
* @param _outputRootProof Inclusion proof of the withdrawer contracts storage root. * @param _outputRootProof Inclusion proof of the L2ToL1MessagePasser contract's storage root.
* @param _withdrawalProof Inclusion proof for the given withdrawal in the withdrawer contract. * @param _withdrawalProof Inclusion proof of the withdrawal in L2ToL1MessagePasser contract.
*/ */
function finalizeWithdrawalTransaction( function finalizeWithdrawalTransaction(
Types.WithdrawalTransaction memory _tx, Types.WithdrawalTransaction memory _tx,
...@@ -163,13 +163,13 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver { ...@@ -163,13 +163,13 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
// and to prevent replay attacks. // and to prevent replay attacks.
bytes32 withdrawalHash = Hashing.hashWithdrawal(_tx); bytes32 withdrawalHash = Hashing.hashWithdrawal(_tx);
// Verify that the hash of this withdrawal was stored in the withdrawal contract on L2. If // Verify that the hash of this withdrawal was stored in the L2toL1MessagePasser contract on
// this is true, then we know that this withdrawal was actually triggered on L2 can can // L2. If this is true, then we know that this withdrawal was actually triggered on L2
// therefore be relayed on L1. // and can therefore be relayed on L1.
require( require(
_verifyWithdrawalInclusion( _verifyWithdrawalInclusion(
withdrawalHash, withdrawalHash,
_outputRootProof.withdrawerStorageRoot, _outputRootProof.messagePasserStorageRoot,
_withdrawalProof _withdrawalProof
), ),
"OptimismPortal: invalid withdrawal inclusion proof" "OptimismPortal: invalid withdrawal inclusion proof"
......
...@@ -164,7 +164,7 @@ library Hashing { ...@@ -164,7 +164,7 @@ library Hashing {
abi.encode( abi.encode(
_outputRootProof.version, _outputRootProof.version,
_outputRootProof.stateRoot, _outputRootProof.stateRoot,
_outputRootProof.withdrawerStorageRoot, _outputRootProof.messagePasserStorageRoot,
_outputRootProof.latestBlockhash _outputRootProof.latestBlockhash
) )
); );
......
...@@ -23,7 +23,7 @@ library Types { ...@@ -23,7 +23,7 @@ library Types {
struct OutputRootProof { struct OutputRootProof {
bytes32 version; bytes32 version;
bytes32 stateRoot; bytes32 stateRoot;
bytes32 withdrawerStorageRoot; bytes32 messagePasserStorageRoot;
bytes32 latestBlockhash; bytes32 latestBlockhash;
} }
......
...@@ -538,7 +538,7 @@ contract FFIInterface is Test { ...@@ -538,7 +538,7 @@ contract FFIInterface is Test {
function hashOutputRootProof( function hashOutputRootProof(
bytes32 _version, bytes32 _version,
bytes32 _stateRoot, bytes32 _stateRoot,
bytes32 _withdrawerStorageRoot, bytes32 _messagePasserStorageRoot,
bytes32 _latestBlockhash bytes32 _latestBlockhash
) external returns (bytes32) { ) external returns (bytes32) {
string[] memory cmds = new string[](7); string[] memory cmds = new string[](7);
...@@ -547,7 +547,7 @@ contract FFIInterface is Test { ...@@ -547,7 +547,7 @@ contract FFIInterface is Test {
cmds[2] = "hashOutputRootProof"; cmds[2] = "hashOutputRootProof";
cmds[3] = Strings.toHexString(uint256(_version)); cmds[3] = Strings.toHexString(uint256(_version));
cmds[4] = Strings.toHexString(uint256(_stateRoot)); cmds[4] = Strings.toHexString(uint256(_stateRoot));
cmds[5] = Strings.toHexString(uint256(_withdrawerStorageRoot)); cmds[5] = Strings.toHexString(uint256(_messagePasserStorageRoot));
cmds[6] = Strings.toHexString(uint256(_latestBlockhash)); cmds[6] = Strings.toHexString(uint256(_latestBlockhash));
bytes memory result = vm.ffi(cmds); bytes memory result = vm.ffi(cmds);
......
...@@ -90,13 +90,13 @@ contract Hashing_Test is CommonTest { ...@@ -90,13 +90,13 @@ contract Hashing_Test is CommonTest {
function test_hashOutputRootProof_differential( function test_hashOutputRootProof_differential(
bytes32 _version, bytes32 _version,
bytes32 _stateRoot, bytes32 _stateRoot,
bytes32 _withdrawerStorageRoot, bytes32 _messagePasserStorageRoot,
bytes32 _latestBlockhash bytes32 _latestBlockhash
) external { ) external {
Types.OutputRootProof memory proof = Types.OutputRootProof({ Types.OutputRootProof memory proof = Types.OutputRootProof({
version: _version, version: _version,
stateRoot: _stateRoot, stateRoot: _stateRoot,
withdrawerStorageRoot: _withdrawerStorageRoot, messagePasserStorageRoot: _messagePasserStorageRoot,
latestBlockhash: _latestBlockhash latestBlockhash: _latestBlockhash
}); });
...@@ -105,7 +105,7 @@ contract Hashing_Test is CommonTest { ...@@ -105,7 +105,7 @@ contract Hashing_Test is CommonTest {
bytes32 _hash = ffi.hashOutputRootProof( bytes32 _hash = ffi.hashOutputRootProof(
_version, _version,
_stateRoot, _stateRoot,
_withdrawerStorageRoot, _messagePasserStorageRoot,
_latestBlockhash _latestBlockhash
); );
......
...@@ -293,7 +293,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer { ...@@ -293,7 +293,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer {
_outputRootProof = Types.OutputRootProof({ _outputRootProof = Types.OutputRootProof({
version: bytes32(uint256(0)), version: bytes32(uint256(0)),
stateRoot: _stateRoot, stateRoot: _stateRoot,
withdrawerStorageRoot: _storageRoot, messagePasserStorageRoot: _storageRoot,
latestBlockhash: bytes32(uint256(0)) latestBlockhash: bytes32(uint256(0))
}); });
_proposedBlockNumber = oracle.nextBlockNumber(); _proposedBlockNumber = oracle.nextBlockNumber();
...@@ -432,7 +432,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer { ...@@ -432,7 +432,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer {
Types.OutputRootProof memory outputRootProof = Types.OutputRootProof({ Types.OutputRootProof memory outputRootProof = Types.OutputRootProof({
version: bytes32(0), version: bytes32(0),
stateRoot: stateRoot, stateRoot: stateRoot,
withdrawerStorageRoot: storageRoot, messagePasserStorageRoot: storageRoot,
latestBlockhash: bytes32(0) latestBlockhash: bytes32(0)
}); });
vm.mockCall( vm.mockCall(
...@@ -494,7 +494,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer { ...@@ -494,7 +494,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer {
Types.OutputRootProof memory outputRootProof = Types.OutputRootProof({ Types.OutputRootProof memory outputRootProof = Types.OutputRootProof({
version: bytes32(0), version: bytes32(0),
stateRoot: stateRoot, stateRoot: stateRoot,
withdrawerStorageRoot: storageRoot, messagePasserStorageRoot: storageRoot,
latestBlockhash: bytes32(0) latestBlockhash: bytes32(0)
}); });
...@@ -555,7 +555,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer { ...@@ -555,7 +555,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer {
Types.OutputRootProof memory proof = Types.OutputRootProof({ Types.OutputRootProof memory proof = Types.OutputRootProof({
version: bytes32(uint256(0)), version: bytes32(uint256(0)),
stateRoot: stateRoot, stateRoot: stateRoot,
withdrawerStorageRoot: storageRoot, messagePasserStorageRoot: storageRoot,
latestBlockhash: bytes32(uint256(0)) latestBlockhash: bytes32(uint256(0))
}); });
......
...@@ -146,7 +146,7 @@ const command = args[0] ...@@ -146,7 +146,7 @@ const command = args[0]
case 'hashOutputRootProof': { case 'hashOutputRootProof': {
const version = hexZeroPad(BigNumber.from(args[1]).toHexString(), 32) const version = hexZeroPad(BigNumber.from(args[1]).toHexString(), 32)
const stateRoot = hexZeroPad(BigNumber.from(args[2]).toHexString(), 32) const stateRoot = hexZeroPad(BigNumber.from(args[2]).toHexString(), 32)
const withdrawerStorageRoot = hexZeroPad( const messagePasserStorageRoot = hexZeroPad(
BigNumber.from(args[3]).toHexString(), BigNumber.from(args[3]).toHexString(),
32 32
) )
...@@ -158,7 +158,7 @@ const command = args[0] ...@@ -158,7 +158,7 @@ const command = args[0]
const hash = hashOutputRootProof({ const hash = hashOutputRootProof({
version, version,
stateRoot, stateRoot,
withdrawerStorageRoot, messagePasserStorageRoot,
latestBlockhash, latestBlockhash,
}) })
const output = utils.defaultAbiCoder.encode(['bytes32'], [hash]) const output = utils.defaultAbiCoder.encode(['bytes32'], [hash])
...@@ -211,7 +211,7 @@ const command = args[0] ...@@ -211,7 +211,7 @@ const command = args[0]
const outputRoot = hashOutputRootProof({ const outputRoot = hashOutputRootProof({
version: constants.HashZero, version: constants.HashZero,
stateRoot: bufferToHex(world.root), stateRoot: bufferToHex(world.root),
withdrawerStorageRoot: bufferToHex(storage.root), messagePasserStorageRoot: bufferToHex(storage.root),
latestBlockhash: constants.HashZero, latestBlockhash: constants.HashZero,
}) })
......
...@@ -25,7 +25,7 @@ export interface BedrockOutputData { ...@@ -25,7 +25,7 @@ export interface BedrockOutputData {
export interface OutputRootProof { export interface OutputRootProof {
version: string version: string
stateRoot: string stateRoot: string
withdrawerStorageRoot: string messagePasserStorageRoot: string
latestBlockhash: string latestBlockhash: string
} }
...@@ -162,7 +162,7 @@ export const hashOutputRootProof = (proof: OutputRootProof): string => { ...@@ -162,7 +162,7 @@ export const hashOutputRootProof = (proof: OutputRootProof): string => {
[ [
proof.version, proof.version,
proof.stateRoot, proof.stateRoot,
proof.withdrawerStorageRoot, proof.messagePasserStorageRoot,
proof.latestBlockhash, proof.latestBlockhash,
] ]
) )
......
...@@ -241,7 +241,7 @@ describe('Withdrawals', () => { ...@@ -241,7 +241,7 @@ describe('Withdrawals', () => {
{ {
version: constants.HashZero, version: constants.HashZero,
stateRoot: targetStateRoot, stateRoot: targetStateRoot,
withdrawerStorageRoot: proof.storageHash, messagePasserStorageRoot: proof.storageHash,
latestBlockhash: targetHash, latestBlockhash: targetHash,
}, },
rlp.encode(proof.storageProof[0].proof), rlp.encode(proof.storageProof[0].proof),
......
...@@ -1306,7 +1306,7 @@ export class CrossChainMessenger { ...@@ -1306,7 +1306,7 @@ export class CrossChainMessenger {
// TODO: Handle multiple versions in the future // TODO: Handle multiple versions in the future
version: ethers.constants.HashZero, version: ethers.constants.HashZero,
stateRoot: block.stateRoot, stateRoot: block.stateRoot,
withdrawerStorageRoot: stateTrieProof.storageRoot, messagePasserStorageRoot: stateTrieProof.storageRoot,
latestBlockhash: block.hash, latestBlockhash: block.hash,
}, },
withdrawalProof: ethers.utils.RLP.encode(stateTrieProof.storageProof), withdrawalProof: ethers.utils.RLP.encode(stateTrieProof.storageProof),
...@@ -1691,7 +1691,7 @@ export class CrossChainMessenger { ...@@ -1691,7 +1691,7 @@ export class CrossChainMessenger {
[ [
proof.outputRootProof.version, proof.outputRootProof.version,
proof.outputRootProof.stateRoot, proof.outputRootProof.stateRoot,
proof.outputRootProof.withdrawerStorageRoot, proof.outputRootProof.messagePasserStorageRoot,
proof.outputRootProof.latestBlockhash, proof.outputRootProof.latestBlockhash,
], ],
proof.withdrawalProof, proof.withdrawalProof,
......
...@@ -82,10 +82,10 @@ where: ...@@ -82,10 +82,10 @@ where:
inclusion in the pre-image of the `latest_block_hash`. This reduces the merkle proof depth and cost of accessing the inclusion in the pre-image of the `latest_block_hash`. This reduces the merkle proof depth and cost of accessing the
L2 state root on L1. L2 state root on L1.
1. The `withdrawal_storage_root` (`bytes32`) elevates the Merkle-Patricia-Trie ([MPT][g-mpt]) root of the [L2 Withdrawal 1. The `withdrawal_storage_root` (`bytes32`) elevates the Merkle-Patricia-Trie ([MPT][g-mpt]) root of the [Message
contract](./withdrawals.md#the-l2tol1messagepasser-contract) storage. Instead of making an MPT proof for a withdrawal Passer contract](./withdrawals.md#the-l2tol1messagepasser-contract) storage. Instead of making an MPT proof for a
against the state root (proving first the storage root of the L2 withdrawal contract against the state root, then withdrawal against the state root (proving first the storage root of the L2toL1MessagePasser against the state root,
the withdrawal against that storage root), we can prove against the L2 withdrawal contract's storage root directly, then the withdrawal against that storage root), we can prove against the L2toL1MessagePasser's storage root directly,
thus reducing the verification cost of withdrawals on L1. thus reducing the verification cost of withdrawals on L1.
## L2 Output Oracle Smart Contract ## L2 Output Oracle Smart Contract
......
...@@ -21,9 +21,9 @@ more specific terms to differentiate: ...@@ -21,9 +21,9 @@ more specific terms to differentiate:
- A *withdrawal finalizing transaction* refers specifically to an L1 transaction which finalizes and relays the - A *withdrawal finalizing transaction* refers specifically to an L1 transaction which finalizes and relays the
withdrawal. withdrawal.
Withdrawals are initiated on L2 via a call to the Withdrawals predeploy contract, which records the important properties Withdrawals are initiated on L2 via a call to the Message Passer predeploy contract, which records the important
of the message in its storage. Withdrawals are finalized on L1 via a call to the `L2WithdrawalVerifier` contract, which properties of the message in its storage. Withdrawals are finalized on L1 via a call to the `L2WithdrawalVerifier`
proves the inclusion of this withdrawal message. contract, which proves the inclusion of this withdrawal message.
In this way, withdrawals are different from [deposits][g-deposits] which make use of a special transaction type in the In this way, withdrawals are different from [deposits][g-deposits] which make use of a special transaction type in the
[execution engine][g-execution-engine] client. Rather, withdrawals transaction must use smart contracts on L1 for [execution engine][g-execution-engine] client. Rather, withdrawals transaction must use smart contracts on L1 for
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment