Commit 90ade85a authored by clabby's avatar clabby

Remove unused dependencies from `contracts-bedrock`

parent eeed99ed
......@@ -114,7 +114,7 @@ func (n *nodeAPI) OutputAtBlock(ctx context.Context, number hexutil.Uint64) (*et
}
var l2OutputRootVersion eth.Bytes32 // it's zero for now
l2OutputRoot := rollup.ComputeL2OutputRoot(l2OutputRootVersion, head.Hash(), head.Root(), proof.StorageHash)
l2OutputRoot := rollup.ComputeL2OutputRoot(l2OutputRootVersion, head.Root(), proof.StorageHash, head.Hash())
return &eth.OutputResponse{
Version: l2OutputRootVersion,
......
......@@ -8,7 +8,7 @@ import (
)
// ComputeL2OutputRoot computes the L2 output root
func ComputeL2OutputRoot(l2OutputRootVersion eth.Bytes32, blockHash common.Hash, blockRoot common.Hash, storageRoot common.Hash) eth.Bytes32 {
func ComputeL2OutputRoot(l2OutputRootVersion eth.Bytes32, blockRoot common.Hash, storageRoot common.Hash, blockHash common.Hash) eth.Bytes32 {
digest := crypto.Keccak256Hash(
l2OutputRootVersion[:],
blockRoot.Bytes(),
......
......@@ -59,8 +59,6 @@
},
"devDependencies": {
"@eth-optimism/hardhat-deploy-config": "^0.2.5",
"@ethereumjs/trie": "^5.0.0-beta.1",
"@ethereumjs/util": "^8.0.0-beta.1",
"@ethersproject/abstract-provider": "^5.7.0",
"@ethersproject/abstract-signer": "^5.7.0",
"ethereumjs-wallet": "^1.0.2",
......
......@@ -5,17 +5,16 @@ import (
"fmt"
"math/big"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-chain-ops/crossdomain"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
)
var UnknownNonceVersion = errors.New("Unknown nonce version")
var ZeroPadding = [32]byte{}
// checkOk checks if ok is false, and panics if so.
// Shorthand to ease go's god awful error handling
func checkOk(ok bool) {
......@@ -53,52 +52,26 @@ func encodeCrossDomainMessage(nonce *big.Int, sender common.Address, target comm
// hashWithdrawal hashes a withdrawal transaction.
func hashWithdrawal(nonce *big.Int, sender common.Address, target common.Address, value *big.Int, gasLimit *big.Int, data []byte) (common.Hash, error) {
// Pack withdrawal
wdtx := struct {
Nonce *big.Int
Sender common.Address
Target common.Address
Value *big.Int
GasLimit *big.Int
Data []byte
}{
wd := crossdomain.Withdrawal{
Nonce: nonce,
Sender: sender,
Target: target,
Sender: &sender,
Target: &target,
Value: value,
GasLimit: gasLimit,
Data: data,
}
packed, err := withdrawalTransactionArgs.Pack(&wdtx)
if err != nil {
return common.Hash{}, err
}
// Hash packed withdrawal (we ignore the pointer)
return crypto.Keccak256Hash(packed[32:]), nil
return wd.Hash()
}
// hashOutputRootProof hashes an output root proof.
func hashOutputRootProof(version common.Hash, stateRoot common.Hash, messagePasserStorageRoot common.Hash, latestBlockHash common.Hash) (common.Hash, error) {
// Pack proof
proof := struct {
Version common.Hash
StateRoot common.Hash
MessagePasserStorageRoot common.Hash
LatestBlockHash common.Hash
}{
func hashOutputRootProof(version common.Hash, stateRoot common.Hash, messagePasserStorageRoot common.Hash, latestBlockHash common.Hash) common.Hash {
proof := bindings.TypesOutputRootProof{
Version: version,
StateRoot: stateRoot,
MessagePasserStorageRoot: messagePasserStorageRoot,
LatestBlockHash: latestBlockHash,
}
packed, err := outputRootProofArgs.Pack(&proof)
if err != nil {
return common.Hash{}, err
LatestBlockhash: latestBlockHash,
}
// Hash packed proof
return crypto.Keccak256Hash(packed), nil
return common.Hash(rollup.HashOutputRootProof(&proof))
}
// makeDepositTx creates a deposit transaction type.
......@@ -139,3 +112,15 @@ func makeDepositTx(
return depositTx
}
// Custom type to write the generated proof to
type proofList [][]byte
func (n *proofList) Put(key []byte, value []byte) error {
*n = append(*n, value)
return nil
}
func (n *proofList) Delete(key []byte) error {
panic("not supported")
}
This diff is collapsed.
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