Commit 55b3e492 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

op-chain-ops: remove dead code (#11261)

This code was used as part of the migration from the legacy system to
bedrock for op mainnet. It is no longer needed and exists in the
optimism-legacy repo if it is needed. The state transition that
represented the migration to bedrock can be reproduced using the
optimism legacy repo. Since this code is no longer used, we can delete
it here.
parent 11c6f059
package crossdomain
import (
"bytes"
"errors"
"fmt"
"math/big"
"github.com/ethereum-optimism/optimism/op-chain-ops/crossdomain/bindings"
"github.com/ethereum-optimism/optimism/op-service/predeploys"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)
// LegacyWithdrawal represents a pre bedrock upgrade withdrawal.
type LegacyWithdrawal struct {
// MessageSender is the caller of the message passer
MessageSender common.Address `json:"who"`
// XDomainTarget is the L1 target of the withdrawal message
XDomainTarget common.Address `json:"target"`
// XDomainSender is the L2 withdrawing account
XDomainSender common.Address `json:"sender"`
// XDomainData represents the calldata of the withdrawal message
XDomainData hexutil.Bytes `json:"data"`
// XDomainNonce represents the nonce of the withdrawal
XDomainNonce *big.Int `json:"nonce"`
}
var _ WithdrawalMessage = (*LegacyWithdrawal)(nil)
// NewLegacyWithdrawal will construct a LegacyWithdrawal
func NewLegacyWithdrawal(msgSender, target, sender common.Address, data []byte, nonce *big.Int) *LegacyWithdrawal {
return &LegacyWithdrawal{
MessageSender: msgSender,
XDomainTarget: target,
XDomainSender: sender,
XDomainData: data,
XDomainNonce: nonce,
}
}
// Encode will serialize the Withdrawal in the legacy format so that it
// is suitable for hashing. This assumes that the message is being withdrawn
// through the standard optimism cross domain messaging system by hashing in
// the L2CrossDomainMessenger address.
func (w *LegacyWithdrawal) Encode() ([]byte, error) {
enc, err := EncodeCrossDomainMessageV0(w.XDomainTarget, w.XDomainSender, []byte(w.XDomainData), w.XDomainNonce)
if err != nil {
return nil, fmt.Errorf("cannot encode LegacyWithdrawal: %w", err)
}
out := make([]byte, len(enc)+len(predeploys.L2CrossDomainMessengerAddr.Bytes()))
copy(out, enc)
copy(out[len(enc):], predeploys.L2CrossDomainMessengerAddr.Bytes())
return out, nil
}
// Decode will decode a serialized LegacyWithdrawal. There is a known inconsistency
// where the decoded `msg.sender` is not authenticated. A round trip of encoding and
// decoding with a spoofed withdrawal will result in a different message being recovered.
func (w *LegacyWithdrawal) Decode(data []byte) error {
if len(data) < len(predeploys.L2CrossDomainMessengerAddr)+4 {
return fmt.Errorf("withdrawal data too short: %d", len(data))
}
selector := crypto.Keccak256([]byte("relayMessage(address,address,bytes,uint256)"))[0:4]
if !bytes.Equal(data[0:4], selector) {
return fmt.Errorf("invalid selector: 0x%x", data[0:4])
}
// This should be the L2CrossDomainMessenger address but is not guaranteed
// to be.
msgSender := data[len(data)-len(predeploys.L2CrossDomainMessengerAddr):]
raw := data[4 : len(data)-len(predeploys.L2CrossDomainMessengerAddr)]
args := abi.Arguments{
{Name: "target", Type: AddressType},
{Name: "sender", Type: AddressType},
{Name: "data", Type: BytesType},
{Name: "nonce", Type: Uint256Type},
}
decoded, err := args.Unpack(raw)
if err != nil {
return err
}
target, ok := decoded[0].(common.Address)
if !ok {
return errors.New("cannot abi decode target")
}
sender, ok := decoded[1].(common.Address)
if !ok {
return errors.New("cannot abi decode sender")
}
msgData, ok := decoded[2].([]byte)
if !ok {
return errors.New("cannot abi decode data")
}
nonce, ok := decoded[3].(*big.Int)
if !ok {
return errors.New("cannot abi decode nonce")
}
w.MessageSender = common.BytesToAddress(msgSender)
w.XDomainTarget = target
w.XDomainSender = sender
w.XDomainData = msgData
w.XDomainNonce = nonce
return nil
}
// Hash will compute the legacy style hash that is computed in the
// OVM_L2ToL1MessagePasser.
func (w *LegacyWithdrawal) Hash() (common.Hash, error) {
encoded, err := w.Encode()
if err != nil {
return common.Hash{}, fmt.Errorf("cannot hash LegacyWithdrawal: %w", err)
}
hash := crypto.Keccak256(encoded)
return common.BytesToHash(hash), nil
}
// StorageSlot will compute the storage slot that is set
// to true in the legacy L2ToL1MessagePasser.
func (w *LegacyWithdrawal) StorageSlot() (common.Hash, error) {
hash, err := w.Hash()
if err != nil {
return common.Hash{}, fmt.Errorf("cannot compute storage slot: %w", err)
}
preimage := make([]byte, 64)
copy(preimage, hash.Bytes())
slot := crypto.Keccak256(preimage)
return common.BytesToHash(slot), nil
}
// Value returns the ETH value associated with the withdrawal. Since
// ETH was represented as an ERC20 token before the Bedrock upgrade,
// the sender and calldata must be observed and the value must be parsed
// out if "finalizeETHWithdrawal" is the method.
func (w *LegacyWithdrawal) Value() (*big.Int, error) {
abi, err := bindings.L1StandardBridgeMetaData.GetAbi()
if err != nil {
return nil, err
}
value := new(big.Int)
// Parse the 4byte selector
method, err := abi.MethodById(w.XDomainData)
// If it is an unknown selector, there is no value
if err != nil {
return value, nil
}
isFromL2StandardBridge := w.XDomainSender == predeploys.L2StandardBridgeAddr
if isFromL2StandardBridge && method.Name == "finalizeETHWithdrawal" {
data, err := method.Inputs.Unpack(w.XDomainData[4:])
if err != nil {
return nil, err
}
// bounds check
if len(data) < 3 {
return nil, errors.New("not enough data")
}
var ok bool
value, ok = data[2].(*big.Int)
if !ok {
return nil, errors.New("not big.Int")
}
}
return value, nil
}
// CrossDomainMessage turns the LegacyWithdrawal into
// a CrossDomainMessage. LegacyWithdrawals do not have
// the concept of value or gaslimit, so set them to 0.
func (w *LegacyWithdrawal) CrossDomainMessage() *CrossDomainMessage {
return &CrossDomainMessage{
Nonce: w.XDomainNonce,
Sender: w.XDomainSender,
Target: w.XDomainTarget,
Value: new(big.Int),
GasLimit: new(big.Int),
Data: []byte(w.XDomainData),
}
}
This diff is collapsed.
package crossdomain
import (
"fmt"
"math/big"
"github.com/ethereum-optimism/optimism/op-chain-ops/crossdomain/bindings"
"github.com/ethereum-optimism/optimism/op-service/predeploys"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/params"
)
// Constants used by `CrossDomainMessenger.baseGas`
var (
RelayConstantOverhead uint64 = 200_000
RelayPerByteDataCost uint64 = params.TxDataNonZeroGasEIP2028
MinGasDynamicOverheadNumerator uint64 = 64
MinGasDynamicOverheadDenominator uint64 = 63
RelayCallOverhead uint64 = 40_000
RelayReservedGas uint64 = 40_000
RelayGasCheckBuffer uint64 = 5_000
)
// MigrateWithdrawal will turn a LegacyWithdrawal into a bedrock
// style Withdrawal.
func MigrateWithdrawal(
withdrawal *LegacyWithdrawal,
l1CrossDomainMessenger *common.Address,
chainID *big.Int,
) (*Withdrawal, error) {
// Attempt to parse the value
value, err := withdrawal.Value()
if err != nil {
return nil, fmt.Errorf("cannot migrate withdrawal: %w", err)
}
abi, err := bindings.L1CrossDomainMessengerMetaData.GetAbi()
if err != nil {
return nil, err
}
// Migrated withdrawals are specified as version 0. Both the
// L2ToL1MessagePasser and the CrossDomainMessenger use the same
// versioning scheme. Both should be set to version 0
versionedNonce := EncodeVersionedNonce(withdrawal.XDomainNonce, new(big.Int))
// Encode the call to `relayMessage` on the `CrossDomainMessenger`.
// The minGasLimit can safely be 0 here.
data, err := abi.Pack(
"relayMessage",
versionedNonce,
withdrawal.XDomainSender,
withdrawal.XDomainTarget,
value,
new(big.Int),
[]byte(withdrawal.XDomainData),
)
if err != nil {
return nil, fmt.Errorf("cannot abi encode relayMessage: %w", err)
}
gasLimit := MigrateWithdrawalGasLimit(data, chainID)
w := NewWithdrawal(
versionedNonce,
&predeploys.L2CrossDomainMessengerAddr,
l1CrossDomainMessenger,
value,
new(big.Int).SetUint64(gasLimit),
data,
)
return w, nil
}
// MigrateWithdrawalGasLimit computes the gas limit for the migrated withdrawal.
// The chain id is used to determine the overhead.
func MigrateWithdrawalGasLimit(data []byte, chainID *big.Int) uint64 {
// Compute the upper bound on the gas limit. This could be more
// accurate if individual 0 bytes and non zero bytes were accounted
// for.
dataCost := uint64(len(data)) * RelayPerByteDataCost
// Goerli has a lower gas limit than other chains.
var overhead uint64
if chainID.Cmp(big.NewInt(420)) == 0 {
overhead = uint64(200_000)
} else {
// Mimic `baseGas` from `CrossDomainMessenger.sol`
overhead = uint64(
// Constant overhead
RelayConstantOverhead +
// Dynamic overhead (EIP-150)
// We use a constant 1 million gas limit due to the overhead of simulating all migrated withdrawal
// transactions during the migration. This is a conservative estimate, and if a withdrawal
// uses more than the minimum gas limit, it will fail and need to be replayed with a higher
// gas limit.
(MinGasDynamicOverheadNumerator*1_000_000)/MinGasDynamicOverheadDenominator +
// Gas reserved for the worst-case cost of 3/5 of the `CALL` opcode's dynamic gas
// factors. (Conservative)
RelayCallOverhead +
// Relay reserved gas (to ensure execution of `relayMessage` completes after the
// subcontext finishes executing) (Conservative)
RelayReservedGas +
// Gas reserved for the execution between the `hasMinGas` check and the `CALL`
// opcode. (Conservative)
RelayGasCheckBuffer,
)
}
// Set the outer minimum gas limit. This cannot be zero
gasLimit := dataCost + overhead
// Cap the gas limit to be 25 million to prevent creating withdrawals
// that go over the block gas limit.
if gasLimit > 25_000_000 {
gasLimit = 25_000_000
}
return gasLimit
}
package crossdomain_test
import (
"fmt"
"math/big"
"testing"
"github.com/ethereum-optimism/optimism/op-chain-ops/crossdomain"
"github.com/ethereum-optimism/optimism/op-service/predeploys"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
)
var (
big25Million = big.NewInt(25_000_000)
bigGoerliChainID = big.NewInt(420)
)
func TestMigrateWithdrawal(t *testing.T) {
withdrawals := make([]*crossdomain.LegacyWithdrawal, 0)
for _, receipt := range receipts {
msg, err := findCrossDomainMessage(receipt)
require.Nil(t, err)
legacyWithdrawal := toWithdrawal(t, predeploys.L2CrossDomainMessengerAddr, msg)
withdrawals = append(withdrawals, legacyWithdrawal)
}
l1CrossDomainMessenger := common.HexToAddress("0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1")
for i, legacy := range withdrawals {
t.Run(fmt.Sprintf("test%d", i), func(t *testing.T) {
withdrawal, err := crossdomain.MigrateWithdrawal(legacy, &l1CrossDomainMessenger, bigGoerliChainID)
require.Nil(t, err)
require.NotNil(t, withdrawal)
require.Equal(t, legacy.XDomainNonce.Uint64(), withdrawal.Nonce.Uint64())
require.Equal(t, *withdrawal.Sender, predeploys.L2CrossDomainMessengerAddr)
require.Equal(t, *withdrawal.Target, l1CrossDomainMessenger)
// Always equal to or lower than the cap
require.True(t, withdrawal.GasLimit.Cmp(big25Million) <= 0)
})
}
}
// TestMigrateWithdrawalGasLimitMax computes the migrated withdrawal
// gas limit with a very large amount of data. The max value for a migrated
// withdrawal's gas limit is 25 million.
func TestMigrateWithdrawalGasLimitMax(t *testing.T) {
size := 300_000_000 / 16
data := make([]byte, size)
for _, i := range data {
data[i] = 0xff
}
result := crossdomain.MigrateWithdrawalGasLimit(data, bigGoerliChainID)
require.Equal(t, result, big25Million.Uint64())
}
// TestMigrateWithdrawalGasLimit tests an assortment of zero and non zero
// bytes when computing the migrated withdrawal's gas limit.
func TestMigrateWithdrawalGasLimit(t *testing.T) {
tests := []struct {
input []byte
output uint64
}{
{
input: []byte{},
output: 200_000,
},
{
input: []byte{0xff},
output: 200_000 + 16,
},
{
input: []byte{0xff, 0x00},
output: 200_000 + 16 + 16,
},
{
input: []byte{0x00},
output: 200_000 + 16,
},
{
input: []byte{0x00, 0x00, 0x00},
output: 200_000 + 16 + 16 + 16,
},
}
for _, test := range tests {
result := crossdomain.MigrateWithdrawalGasLimit(test.input, bigGoerliChainID)
require.Equal(t, test.output, result)
}
}
# crossdomain/testdata
Real world test data is used to generate test vectors for the withdrawal
hashing. The `trace.sh` script will generate artifacts used as part of the
tests. It accepts a single argument, being the transaction hash to fetch
artifacts for. It will fetch a receipt, a call trace and a state diff.
The tests require that a file named after the transaction hash exists
in each of the directories `call-traces`, `receipts` and `state-diffs`.
The `trace.sh` script will ensure that the files are created correctly.
{
"calls": [
{
"from": "0x4200000000000000000000000000000000000010",
"gas": "0x1647d",
"gasUsed": "0x341b",
"input": "0x9dc29fac0000000000000000000000009c8f005ab27adb94f3d49020a15722db2fcd9f2700000000000000000000000000000000000000000000000000232bff5f46c000",
"output": "0x",
"to": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000",
"type": "CALL",
"value": "0x0"
},
{
"from": "0x4200000000000000000000000000000000000010",
"gas": "0x12fe8",
"gasUsed": "0x94b",
"input": "0xc01e1bd6",
"output": "0x0000000000000000000000000000000000000000000000000000000000000000",
"to": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000",
"type": "CALL",
"value": "0x0"
},
{
"calls": [
{
"from": "0x4200000000000000000000000000000000000007",
"gas": "0x8ea6",
"gasUsed": "0x5e1e",
"input": "0xcafa81dc00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000164cbd4ece900000000000000000000000099c9fc46f92e8a1c0dec1b1747d010903e884be100000000000000000000000042000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000001b04d00000000000000000000000000000000000000000000000000000000000000a41532ec340000000000000000000000009c8f005ab27adb94f3d49020a15722db2fcd9f270000000000000000000000009c8f005ab27adb94f3d49020a15722db2fcd9f2700000000000000000000000000000000000000000000000000232bff5f46c000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"output": "0x",
"to": "0x4200000000000000000000000000000000000000",
"type": "CALL",
"value": "0x0"
}
],
"from": "0x4200000000000000000000000000000000000010",
"gas": "0x10644",
"gasUsed": "0xf29d",
"input": "0x3dbb202b00000000000000000000000099c9fc46f92e8a1c0dec1b1747d010903e884be10000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a41532ec340000000000000000000000009c8f005ab27adb94f3d49020a15722db2fcd9f270000000000000000000000009c8f005ab27adb94f3d49020a15722db2fcd9f2700000000000000000000000000000000000000000000000000232bff5f46c0000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"output": "0x",
"to": "0x4200000000000000000000000000000000000007",
"type": "CALL",
"value": "0x0"
}
],
"from": "0x9c8f005ab27adb94f3d49020a15722db2fcd9f27",
"gas": "0x177d2",
"gasUsed": "0x16ce2",
"input": "0x32b7006d000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead000000000000000000000000000000000000000000000000000000232bff5f46c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
"output": "0x",
"time": "112.522948ms",
"to": "0x4200000000000000000000000000000000000010",
"type": "CALL",
"value": "0x0"
}
{
"calls": [
{
"from": "0x4200000000000000000000000000000000000010",
"gas": "0x318ce",
"gasUsed": "0x427b",
"input": "0x9dc29fac0000000000000000000000003178490d60b5cceaa5a79fd4d9050c7405bab80c0000000000000000000000000000000000000000000000a3b61828488b117259",
"output": "0x",
"to": "0x76fb31fb4af56892a25e32cfc43de717950c9278",
"type": "CALL",
"value": "0x0"
},
{
"from": "0x4200000000000000000000000000000000000010",
"gas": "0x2d612",
"gasUsed": "0xa14",
"input": "0xc01e1bd6",
"output": "0x0000000000000000000000007fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",
"to": "0x76fb31fb4af56892a25e32cfc43de717950c9278",
"type": "CALL",
"value": "0x0"
},
{
"calls": [
{
"from": "0x4200000000000000000000000000000000000007",
"gas": "0x22b8c",
"gasUsed": "0x5ecf",
"input": "0xcafa81dc000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001a4cbd4ece900000000000000000000000099c9fc46f92e8a1c0dec1b1747d010903e884be100000000000000000000000042000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000001b04f00000000000000000000000000000000000000000000000000000000000000e4a9f9e6750000000000000000000000007fc66500c84a76ad7e9c93437bfc5ac33e2ddae900000000000000000000000076fb31fb4af56892a25e32cfc43de717950c92780000000000000000000000003178490d60b5cceaa5a79fd4d9050c7405bab80c0000000000000000000000003178490d60b5cceaa5a79fd4d9050c7405bab80c0000000000000000000000000000000000000000000000a3b61828488b11725900000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"output": "0x",
"to": "0x4200000000000000000000000000000000000000",
"type": "CALL",
"value": "0x0"
}
],
"from": "0x4200000000000000000000000000000000000010",
"gas": "0x2aae9",
"gasUsed": "0xf705",
"input": "0x3dbb202b00000000000000000000000099c9fc46f92e8a1c0dec1b1747d010903e884be10000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e4a9f9e6750000000000000000000000007fc66500c84a76ad7e9c93437bfc5ac33e2ddae900000000000000000000000076fb31fb4af56892a25e32cfc43de717950c92780000000000000000000000003178490d60b5cceaa5a79fd4d9050c7405bab80c0000000000000000000000003178490d60b5cceaa5a79fd4d9050c7405bab80c0000000000000000000000000000000000000000000000a3b61828488b11725900000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"output": "0x",
"to": "0x4200000000000000000000000000000000000007",
"type": "CALL",
"value": "0x0"
}
],
"from": "0x3178490d60b5cceaa5a79fd4d9050c7405bab80c",
"gas": "0x33310",
"gasUsed": "0x18136",
"input": "0x32b7006d00000000000000000000000076fb31fb4af56892a25e32cfc43de717950c92780000000000000000000000000000000000000000000000a3b61828488b117259000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
"output": "0x",
"time": "40.447524ms",
"to": "0x4200000000000000000000000000000000000010",
"type": "CALL",
"value": "0x0"
}
{
"calls": [
{
"from": "0x467194771dae2967aef3ecbedd3bf9a310c76c65",
"gas": "0x150b9",
"gasUsed": "0x395f",
"input": "0x9dc29fac0000000000000000000000006659612eb0e2464ccadf7a5e851bcd12873f6e040000000000000000000000000000000000000000000211654585005212800000",
"output": "0x",
"to": "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1",
"type": "CALL",
"value": "0x0"
},
{
"calls": [
{
"from": "0x4200000000000000000000000000000000000007",
"gas": "0x86e2",
"gasUsed": "0x5ecf",
"input": "0xcafa81dc000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001a4cbd4ece900000000000000000000000010e6593cdda8c58a1d0f14c5164b376352a55f2f000000000000000000000000467194771dae2967aef3ecbedd3bf9a310c76c650000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000001b05e00000000000000000000000000000000000000000000000000000000000000e4a9f9e6750000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da10000000000000000000000006659612eb0e2464ccadf7a5e851bcd12873f6e040000000000000000000000006659612eb0e2464ccadf7a5e851bcd12873f6e04000000000000000000000000000000000000000000021165458500521280000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"output": "0x",
"to": "0x4200000000000000000000000000000000000000",
"type": "CALL",
"value": "0x0"
}
],
"from": "0x467194771dae2967aef3ecbedd3bf9a310c76c65",
"gas": "0xff92",
"gasUsed": "0xf705",
"input": "0x3dbb202b00000000000000000000000010e6593cdda8c58a1d0f14c5164b376352a55f2f0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e4a9f9e6750000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da10000000000000000000000006659612eb0e2464ccadf7a5e851bcd12873f6e040000000000000000000000006659612eb0e2464ccadf7a5e851bcd12873f6e04000000000000000000000000000000000000000000021165458500521280000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"output": "0x",
"to": "0x4200000000000000000000000000000000000007",
"type": "CALL",
"value": "0x0"
}
],
"from": "0x6659612eb0e2464ccadf7a5e851bcd12873f6e04",
"gas": "0x16bb3",
"gasUsed": "0x16bb3",
"input": "0x32b7006d000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da10000000000000000000000000000000000000000000211654585005212800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
"output": "0x",
"time": "30.357952ms",
"to": "0x467194771dae2967aef3ecbedd3bf9a310c76c65",
"type": "CALL",
"value": "0x0"
}
{
"blockHash": "0x4f5fdc9747712cb61871d6d35618a6580671d5ddb85796c9d0790453509cf4cc",
"blockNumber": "0x169900c",
"contractAddress": null,
"cumulativeGasUsed": "0x1c2ca",
"from": "0x9c8f005ab27adb94f3d49020a15722db2fcd9f27",
"gasUsed": "0x1c2ca",
"logs": [
{
"address": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000",
"blockHash": "0x4f5fdc9747712cb61871d6d35618a6580671d5ddb85796c9d0790453509cf4cc",
"blockNumber": "0x169900c",
"data": "0x00000000000000000000000000000000000000000000000000232bff5f46c000",
"logIndex": "0x0",
"removed": false,
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000009c8f005ab27adb94f3d49020a15722db2fcd9f27",
"0x0000000000000000000000000000000000000000000000000000000000000000"
],
"transactionHash": "0x26b854fe0b8f0c5ad15d5c3c1291107cc870f5d7351cfc399e23e68f22231fbe",
"transactionIndex": "0x0"
},
{
"address": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000",
"blockHash": "0x4f5fdc9747712cb61871d6d35618a6580671d5ddb85796c9d0790453509cf4cc",
"blockNumber": "0x169900c",
"data": "0x00000000000000000000000000000000000000000000000000232bff5f46c000",
"logIndex": "0x1",
"removed": false,
"topics": [
"0xcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5",
"0x0000000000000000000000009c8f005ab27adb94f3d49020a15722db2fcd9f27"
],
"transactionHash": "0x26b854fe0b8f0c5ad15d5c3c1291107cc870f5d7351cfc399e23e68f22231fbe",
"transactionIndex": "0x0"
},
{
"address": "0x4200000000000000000000000000000000000007",
"blockHash": "0x4f5fdc9747712cb61871d6d35618a6580671d5ddb85796c9d0790453509cf4cc",
"blockNumber": "0x169900c",
"data": "0x00000000000000000000000042000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000001b04d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a41532ec340000000000000000000000009c8f005ab27adb94f3d49020a15722db2fcd9f270000000000000000000000009c8f005ab27adb94f3d49020a15722db2fcd9f2700000000000000000000000000000000000000000000000000232bff5f46c0000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logIndex": "0x2",
"removed": false,
"topics": [
"0xcb0f7ffd78f9aee47a248fae8db181db6eee833039123e026dcbff529522e52a",
"0x00000000000000000000000099c9fc46f92e8a1c0dec1b1747d010903e884be1"
],
"transactionHash": "0x26b854fe0b8f0c5ad15d5c3c1291107cc870f5d7351cfc399e23e68f22231fbe",
"transactionIndex": "0x0"
},
{
"address": "0x4200000000000000000000000000000000000010",
"blockHash": "0x4f5fdc9747712cb61871d6d35618a6580671d5ddb85796c9d0790453509cf4cc",
"blockNumber": "0x169900c",
"data": "0x0000000000000000000000009c8f005ab27adb94f3d49020a15722db2fcd9f2700000000000000000000000000000000000000000000000000232bff5f46c00000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
"logIndex": "0x3",
"removed": false,
"topics": [
"0x73d170910aba9e6d50b102db522b1dbcd796216f5128b445aa2135272886497e",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead0000",
"0x0000000000000000000000009c8f005ab27adb94f3d49020a15722db2fcd9f27"
],
"transactionHash": "0x26b854fe0b8f0c5ad15d5c3c1291107cc870f5d7351cfc399e23e68f22231fbe",
"transactionIndex": "0x0"
}
],
"logsBloom": "0x00000000000000000010000000000000000000000000001000100000001000000000000000000080000000000000008000000800000000000000000000000240000000000000000040000008000000000000000000000000000000004000000100000000020000000000000000000800080000000000000000000010000000000001000000000000000000000000000000800000000000000020000000200000000000000000000001000000000000000000200000000000000000000000000000000002010000000000000400000000000002100000000008000004000020001000000000000000000000000000000100000000000000000000000000000000",
"status": "0x1",
"to": "0x4200000000000000000000000000000000000010",
"transactionHash": "0x26b854fe0b8f0c5ad15d5c3c1291107cc870f5d7351cfc399e23e68f22231fbe",
"transactionIndex": "0x0"
}
{
"blockHash": "0x13bf6e592e572c0a021488b6f2d910114be3491fc08a35f2ee2b38063df24abf",
"blockNumber": "0x169a45d",
"contractAddress": null,
"cumulativeGasUsed": "0x1c49a",
"from": "0x3178490d60b5cceaa5a79fd4d9050c7405bab80c",
"gasUsed": "0x1c49a",
"logs": [
{
"address": "0x76fb31fb4af56892a25e32cfc43de717950c9278",
"blockHash": "0x13bf6e592e572c0a021488b6f2d910114be3491fc08a35f2ee2b38063df24abf",
"blockNumber": "0x169a45d",
"data": "0x0000000000000000000000000000000000000000000000a3b61828488b117259",
"logIndex": "0x0",
"removed": false,
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000003178490d60b5cceaa5a79fd4d9050c7405bab80c",
"0x0000000000000000000000000000000000000000000000000000000000000000"
],
"transactionHash": "0x32d3b5a0178a33cfbf904cfd36f66a13ff8576f409f15aae86dc3ff0e101c93a",
"transactionIndex": "0x0"
},
{
"address": "0x76fb31fb4af56892a25e32cfc43de717950c9278",
"blockHash": "0x13bf6e592e572c0a021488b6f2d910114be3491fc08a35f2ee2b38063df24abf",
"blockNumber": "0x169a45d",
"data": "0x0000000000000000000000000000000000000000000000a3b61828488b117259",
"logIndex": "0x1",
"removed": false,
"topics": [
"0xcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5",
"0x0000000000000000000000003178490d60b5cceaa5a79fd4d9050c7405bab80c"
],
"transactionHash": "0x32d3b5a0178a33cfbf904cfd36f66a13ff8576f409f15aae86dc3ff0e101c93a",
"transactionIndex": "0x0"
},
{
"address": "0x4200000000000000000000000000000000000007",
"blockHash": "0x13bf6e592e572c0a021488b6f2d910114be3491fc08a35f2ee2b38063df24abf",
"blockNumber": "0x169a45d",
"data": "0x00000000000000000000000042000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000001b04f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e4a9f9e6750000000000000000000000007fc66500c84a76ad7e9c93437bfc5ac33e2ddae900000000000000000000000076fb31fb4af56892a25e32cfc43de717950c92780000000000000000000000003178490d60b5cceaa5a79fd4d9050c7405bab80c0000000000000000000000003178490d60b5cceaa5a79fd4d9050c7405bab80c0000000000000000000000000000000000000000000000a3b61828488b11725900000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logIndex": "0x2",
"removed": false,
"topics": [
"0xcb0f7ffd78f9aee47a248fae8db181db6eee833039123e026dcbff529522e52a",
"0x00000000000000000000000099c9fc46f92e8a1c0dec1b1747d010903e884be1"
],
"transactionHash": "0x32d3b5a0178a33cfbf904cfd36f66a13ff8576f409f15aae86dc3ff0e101c93a",
"transactionIndex": "0x0"
},
{
"address": "0x4200000000000000000000000000000000000010",
"blockHash": "0x13bf6e592e572c0a021488b6f2d910114be3491fc08a35f2ee2b38063df24abf",
"blockNumber": "0x169a45d",
"data": "0x0000000000000000000000003178490d60b5cceaa5a79fd4d9050c7405bab80c0000000000000000000000000000000000000000000000a3b61828488b11725900000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
"logIndex": "0x3",
"removed": false,
"topics": [
"0x73d170910aba9e6d50b102db522b1dbcd796216f5128b445aa2135272886497e",
"0x0000000000000000000000007fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",
"0x00000000000000000000000076fb31fb4af56892a25e32cfc43de717950c9278",
"0x0000000000000000000000003178490d60b5cceaa5a79fd4d9050c7405bab80c"
],
"transactionHash": "0x32d3b5a0178a33cfbf904cfd36f66a13ff8576f409f15aae86dc3ff0e101c93a",
"transactionIndex": "0x0"
}
],
"logsBloom": "0x00000000000000000010000000000000000000000000001000100000001000000000000000000080000000000000008000000000000000000000040000000000000000000000000040000008000000000000100000000000000000004000000000000000020000000000000000000820080000000000000000000010014000000001000000000000000000000000000000800000000000000004000000200000000000000000000001000000000000000000200000000000000000000000000000000002000000000000000400000000000002100400000008000000000020000000000000000000000010000000000000000000000000002000000000248000",
"status": "0x1",
"to": "0x4200000000000000000000000000000000000010",
"transactionHash": "0x32d3b5a0178a33cfbf904cfd36f66a13ff8576f409f15aae86dc3ff0e101c93a",
"transactionIndex": "0x0"
}
{
"blockHash": "0x1fae89e0362ec677f76f7f3b7693b0dc05de5b5e1c4f34ee9add4339cb6391b6",
"blockNumber": "0x16a58e2",
"contractAddress": null,
"cumulativeGasUsed": "0x1aef3",
"from": "0x6659612eb0e2464ccadf7a5e851bcd12873f6e04",
"gasUsed": "0x1aef3",
"logs": [
{
"address": "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1",
"blockHash": "0x1fae89e0362ec677f76f7f3b7693b0dc05de5b5e1c4f34ee9add4339cb6391b6",
"blockNumber": "0x16a58e2",
"data": "0x0000000000000000000000000000000000000000000211654585005212800000",
"logIndex": "0x0",
"removed": false,
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000006659612eb0e2464ccadf7a5e851bcd12873f6e04",
"0x0000000000000000000000000000000000000000000000000000000000000000"
],
"transactionHash": "0x38236157c6941ef64f4dd0dfa7efed4a82ef9fccdcdda75a8ee89cbe831b182b",
"transactionIndex": "0x0"
},
{
"address": "0x4200000000000000000000000000000000000007",
"blockHash": "0x1fae89e0362ec677f76f7f3b7693b0dc05de5b5e1c4f34ee9add4339cb6391b6",
"blockNumber": "0x16a58e2",
"data": "0x000000000000000000000000467194771dae2967aef3ecbedd3bf9a310c76c650000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000001b05e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e4a9f9e6750000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da10000000000000000000000006659612eb0e2464ccadf7a5e851bcd12873f6e040000000000000000000000006659612eb0e2464ccadf7a5e851bcd12873f6e04000000000000000000000000000000000000000000021165458500521280000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logIndex": "0x1",
"removed": false,
"topics": [
"0xcb0f7ffd78f9aee47a248fae8db181db6eee833039123e026dcbff529522e52a",
"0x00000000000000000000000010e6593cdda8c58a1d0f14c5164b376352a55f2f"
],
"transactionHash": "0x38236157c6941ef64f4dd0dfa7efed4a82ef9fccdcdda75a8ee89cbe831b182b",
"transactionIndex": "0x0"
},
{
"address": "0x467194771dae2967aef3ecbedd3bf9a310c76c65",
"blockHash": "0x1fae89e0362ec677f76f7f3b7693b0dc05de5b5e1c4f34ee9add4339cb6391b6",
"blockNumber": "0x16a58e2",
"data": "0x0000000000000000000000006659612eb0e2464ccadf7a5e851bcd12873f6e04000000000000000000000000000000000000000000021165458500521280000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
"logIndex": "0x2",
"removed": false,
"topics": [
"0x73d170910aba9e6d50b102db522b1dbcd796216f5128b445aa2135272886497e",
"0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f",
"0x000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da1",
"0x0000000000000000000000006659612eb0e2464ccadf7a5e851bcd12873f6e04"
],
"transactionHash": "0x38236157c6941ef64f4dd0dfa7efed4a82ef9fccdcdda75a8ee89cbe831b182b",
"transactionIndex": "0x0"
}
],
"logsBloom": "0x000000000000008000100000000000000000000000000000001000000010000000000000000000800000000000000080000000000000000000000000000000c0000000000000000041000008000080000000000000000000000000000000008000400000020000000000000000000800000000000000000000002010000000200000000100000000000000000000000000000000800000000000000400000200000000000000000001000000010000000000000000000000000000000000000000000002000000000000000400000000200000100000000000000000000020000000000020000000000800000000000000000000000000100000000000000000",
"status": "0x1",
"to": "0x467194771dae2967aef3ecbedd3bf9a310c76c65",
"transactionHash": "0x38236157c6941ef64f4dd0dfa7efed4a82ef9fccdcdda75a8ee89cbe831b182b",
"transactionIndex": "0x0"
}
{
"blockHash": "0x8a150d06f327859edb6e45e347105df56e047c690617d784c7aadedd0d426ff9",
"blockNumber": "0x1698be0",
"contractAddress": null,
"cumulativeGasUsed": "0x36ebf",
"from": "0x90f1cb932dbf94385434c40d53df3727f00e50b1",
"gasUsed": "0x36ebf",
"logs": [
{
"address": "0x8700daec35af8ff88c16bdf0418774cb3d7599b4",
"blockHash": "0x8a150d06f327859edb6e45e347105df56e047c690617d784c7aadedd0d426ff9",
"blockNumber": "0x1698be0",
"data": "0x0000000000000000000000000000000000000000000001c9f23e7ccc897c65e5",
"logIndex": "0x0",
"removed": false,
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x00000000000000000000000090f1cb932dbf94385434c40d53df3727f00e50b1",
"0x0000000000000000000000000000000000000000000000000000000000000000"
],
"transactionHash": "0xed57a510022157b14542491a501daed1d58003e4b274b331d2fc40dcc43f0941",
"transactionIndex": "0x0"
},
{
"address": "0x4200000000000000000000000000000000000007",
"blockHash": "0x8a150d06f327859edb6e45e347105df56e047c690617d784c7aadedd0d426ff9",
"blockNumber": "0x1698be0",
"data": "0x000000000000000000000000136b1ec699c62b0606854056f02dc7bb80482d630000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000001b04c00000000000000000000000000000000000000000000000000000000002dc6c00000000000000000000000000000000000000000000000000000000000000044f4f7b41a00000000000000000000000090f1cb932dbf94385434c40d53df3727f00e50b10000000000000000000000000000000000000000000001c9f23e7ccc897c65e500000000000000000000000000000000000000000000000000000000",
"logIndex": "0x1",
"removed": false,
"topics": [
"0xcb0f7ffd78f9aee47a248fae8db181db6eee833039123e026dcbff529522e52a",
"0x00000000000000000000000039ea01a0298c315d149a490e34b59dbf2ec7e48f"
],
"transactionHash": "0xed57a510022157b14542491a501daed1d58003e4b274b331d2fc40dcc43f0941",
"transactionIndex": "0x0"
},
{
"address": "0x136b1ec699c62b0606854056f02dc7bb80482d63",
"blockHash": "0x8a150d06f327859edb6e45e347105df56e047c690617d784c7aadedd0d426ff9",
"blockNumber": "0x1698be0",
"data": "0x00000000000000000000000090f1cb932dbf94385434c40d53df3727f00e50b10000000000000000000000000000000000000000000001c9f23e7ccc897c65e5",
"logIndex": "0x2",
"removed": false,
"topics": [
"0xbb2689ff876f7ef453cf8865dde5ab10349d222e2e1383c5152fbdb083f02da2",
"0x00000000000000000000000090f1cb932dbf94385434c40d53df3727f00e50b1"
],
"transactionHash": "0xed57a510022157b14542491a501daed1d58003e4b274b331d2fc40dcc43f0941",
"transactionIndex": "0x0"
}
],
"logsBloom": "0x00000000000000000010000000000040000000000000000000000000081000000000000000000080000000000000008000000000000000001000000000000000000000080000000041000008000000000000000000000000000000000000080000100000020000000000000200000800000000000000000000000010000000000002000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000002000000000200000000000001000000100000000000000000000020020000000000000000000000000000000000000000000000800000000000000000",
"status": "0x1",
"to": "0x136b1ec699c62b0606854056f02dc7bb80482d63",
"transactionHash": "0xed57a510022157b14542491a501daed1d58003e4b274b331d2fc40dcc43f0941",
"transactionIndex": "0x0"
}
#!/usr/bin/env bash
HASH=$1
if [[ -z $HASH ]]; then
exit 1
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
TRACES=$DIR/call-traces
RECEIPTS=$DIR/receipts
DIFFS=$DIR/state-diffs
mkdir -p "$TRACES"
mkdir -p "$RECEIPTS"
mkdir -p "$DIFFS"
cast rpc \
debug_traceTransaction \
"$HASH" \
'{"tracer": "callTracer"}' | jq > "$TRACES"/"$HASH".json
cast receipt "$HASH" --json | jq > "$RECEIPTS"/"$HASH".json
cast rpc \
debug_traceTransaction \
"$HASH" \
'{"tracer": "prestateTracer"}' | jq > "$DIFFS"/"$HASH".json
MSG|0x4200000000000000000000000000000000000007|cafa81dc000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001a4cbd4ece900000000000000000000000099c9fc46f92e8a1c0dec1b1747d010903e884be1000000000000000000000000420000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000019bd000000000000000000000000000000000000000000000000000000000000000e4a9f9e675000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd520000000000000000000000000994206dfe8de6ec6920ff4d779b0d950605fb53000000000000000000000000e3a44dd2a8c108be56a78635121ec914074da16d000000000000000000000000e3a44dd2a8c108be56a78635121ec914074da16d0000000000000000000000000000000000000000000001b0ac98ab3858d7547800000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
MSG|0x8B1d477410344785ff1DF52500032E6D5f532EE4|cafa81dc000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000030420690000000000000000000000000000000000000000000000000000000000
ETH|0x6340d44c5174588B312F545eEC4a42f8a514eF50
\ No newline at end of file
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