Commit 1ae32684 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into refactor/invariants-hash

parents 0f91494b 85423be5
---
'@eth-optimism/contracts-bedrock': minor
'@eth-optimism/contracts': minor
'@eth-optimism/sdk': minor
---
Update sdk contract addresses for bedrock
...@@ -293,7 +293,7 @@ jobs: ...@@ -293,7 +293,7 @@ jobs:
contracts-bedrock-coverage: contracts-bedrock-coverage:
docker: docker:
- image: ethereumoptimism/ci-builder:latest - image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
resource_class: large resource_class: large
steps: steps:
- checkout - checkout
...@@ -553,7 +553,7 @@ jobs: ...@@ -553,7 +553,7 @@ jobs:
sdk-next-tests: sdk-next-tests:
docker: docker:
- image: ethereumoptimism/ci-builder:latest - image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
resource_class: large resource_class: large
steps: steps:
- checkout - checkout
...@@ -700,7 +700,7 @@ jobs: ...@@ -700,7 +700,7 @@ jobs:
atst-tests: atst-tests:
docker: docker:
- image: ethereumoptimism/ci-builder:latest - image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
resource_class: large resource_class: large
steps: steps:
- checkout - checkout
......
...@@ -51,6 +51,8 @@ func main() { ...@@ -51,6 +51,8 @@ func main() {
return err return err
} }
log.Info("Requires an archive node")
log.Info("Connecting to AddressManager", "address", addresses.AddressManager) log.Info("Connecting to AddressManager", "address", addresses.AddressManager)
addressManager, err := bindings.NewAddressManager(addresses.AddressManager, clients.L1Client) addressManager, err := bindings.NewAddressManager(addresses.AddressManager, clients.L1Client)
if err != nil { if err != nil {
...@@ -70,28 +72,42 @@ func main() { ...@@ -70,28 +72,42 @@ func main() {
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)
} }
shutoffBlock, err := addressManager.GetAddress(&bind.CallOpts{}, "DTL_SHUTOFF_BLOCK")
if err != nil {
return err
}
shutoffHeight := shutoffBlock.Big()
log.Info("Connecting to CanonicalTransactionChain", "address", addresses.CanonicalTransactionChain) log.Info("Connecting to CanonicalTransactionChain", "address", addresses.CanonicalTransactionChain)
ctc, err := legacy_bindings.NewCanonicalTransactionChain(addresses.CanonicalTransactionChain, clients.L1Client) ctc, err := legacy_bindings.NewCanonicalTransactionChain(addresses.CanonicalTransactionChain, clients.L1Client)
if err != nil { if err != nil {
return err return err
} }
queueLength, err := ctc.GetQueueLength(&bind.CallOpts{}) queueLength, err := ctc.GetQueueLength(&bind.CallOpts{
BlockNumber: shutoffHeight,
})
if err != nil { if err != nil {
return err return err
} }
totalElements, err := ctc.GetTotalElements(&bind.CallOpts{}) totalElements, err := ctc.GetTotalElements(&bind.CallOpts{
BlockNumber: shutoffHeight,
})
if err != nil { if err != nil {
return err return err
} }
totalBatches, err := ctc.GetTotalBatches(&bind.CallOpts{}) totalBatches, err := ctc.GetTotalBatches(&bind.CallOpts{
BlockNumber: shutoffHeight,
})
if err != nil { if err != nil {
return err return err
} }
pending, err := ctc.GetNumPendingQueueElements(&bind.CallOpts{}) pending, err := ctc.GetNumPendingQueueElements(&bind.CallOpts{
BlockNumber: shutoffHeight,
})
if err != nil { if err != nil {
return err return err
} }
...@@ -131,6 +147,7 @@ func main() { ...@@ -131,6 +147,7 @@ func main() {
if err != nil { if err != nil {
return err return err
} }
// If the queue origin is l1, then it is a deposit. // If the queue origin is l1, then it is a deposit.
if json.QueueOrigin == "l1" { if json.QueueOrigin == "l1" {
if json.QueueIndex == nil { if json.QueueIndex == nil {
...@@ -138,12 +155,26 @@ func main() { ...@@ -138,12 +155,26 @@ func main() {
return fmt.Errorf("queue index is nil for tx %s at height %d", hash.Hex(), blockNumber) return fmt.Errorf("queue index is nil for tx %s at height %d", hash.Hex(), blockNumber)
} }
queueIndex := uint64(*json.QueueIndex) queueIndex := uint64(*json.QueueIndex)
if json.L1BlockNumber == nil {
// This should never happen.
return fmt.Errorf("L1 block number is nil for tx %s at height %d", hash.Hex(), blockNumber)
}
l1BlockNumber := json.L1BlockNumber.ToInt()
log.Info("Deposit found", "l2-block", blockNumber, "l1-block", l1BlockNumber, "queue-index", queueIndex)
// This should never happen
if json.L1BlockNumber.ToInt().Uint64() > shutoffHeight.Uint64() {
log.Warn("Lost deposit")
return fmt.Errorf("Lost deposit: %s", hash.Hex())
}
// Check to see if the final deposit was ingested. Subtract 1 here to handle zero // Check to see if the final deposit was ingested. Subtract 1 here to handle zero
// indexing. // indexing.
if queueIndex == queueLength.Uint64()-1 { if queueIndex == queueLength.Uint64()-1 {
log.Info("Found final deposit in l2geth", "queue-index", queueIndex) log.Info("Found final deposit in l2geth", "queue-index", queueIndex)
break break
} }
// If the queue index is less than the queue length, then not all deposits have // If the queue index is less than the queue length, then not all deposits have
// been ingested by l2geth yet. This means that we need to reset the blocknumber // been ingested by l2geth yet. This means that we need to reset the blocknumber
// to the latest block number to restart walking backwards to find deposits that // to the latest block number to restart walking backwards to find deposits that
...@@ -258,7 +289,7 @@ func waitForTotalElements(wg *sync.WaitGroup, contract RollupContract, client *e ...@@ -258,7 +289,7 @@ func waitForTotalElements(wg *sync.WaitGroup, contract RollupContract, client *e
log.Info( log.Info(
"Waiting for elements to be submitted", "Waiting for elements to be submitted",
"name", name, "name", name,
"count", totalElements.Uint64()-bn, "count", bn-totalElements.Uint64(),
"height", bn, "height", bn,
"total-elements", totalElements.Uint64(), "total-elements", totalElements.Uint64(),
) )
......
...@@ -187,7 +187,7 @@ func NewL2OutputSubmitter(cfg Config, l log.Logger, m metrics.Metricer) (*L2Outp ...@@ -187,7 +187,7 @@ func NewL2OutputSubmitter(cfg Config, l log.Logger, m metrics.Metricer) (*L2Outp
l2ooContract, err := bindings.NewL2OutputOracleCaller(cfg.L2OutputOracleAddr, cfg.L1Client) l2ooContract, err := bindings.NewL2OutputOracleCaller(cfg.L2OutputOracleAddr, cfg.L1Client)
if err != nil { if err != nil {
cancel() cancel()
return nil, err return nil, fmt.Errorf("failed to create L2OO at address %s: %w", cfg.L2OutputOracleAddr, err)
} }
cCtx, cCancel := context.WithTimeout(ctx, cfg.NetworkTimeout) cCtx, cCancel := context.WithTimeout(ctx, cfg.NetworkTimeout)
......
...@@ -3,6 +3,20 @@ import { ...@@ -3,6 +3,20 @@ import {
getDeployedContractDefinition, getDeployedContractDefinition,
} from '@eth-optimism/contracts' } from '@eth-optimism/contracts'
import { predeploys as bedrockPredeploys } from '@eth-optimism/contracts-bedrock' import { predeploys as bedrockPredeploys } from '@eth-optimism/contracts-bedrock'
import portalArtifactsMainnet from '@eth-optimism/contracts-bedrock/deployments/mainnet/OptimismPortalProxy.json'
import portalArtifactsGoerli from '@eth-optimism/contracts-bedrock/deployments/goerli/OptimismPortalProxy.json'
import l2OutputOracleArtifactsMainnet from '@eth-optimism/contracts-bedrock/deployments/mainnet/L2OutputOracleProxy.json'
import l2OutputOracleArtifactsGoerli from '@eth-optimism/contracts-bedrock/deployments/goerli/L2OutputOracleProxy.json'
const portalAddresses = {
mainnet: portalArtifactsMainnet,
goerli: portalArtifactsGoerli,
}
const l2OutputOracleAddresses = {
mainnet: l2OutputOracleArtifactsMainnet,
goerli: l2OutputOracleArtifactsGoerli,
}
import { import {
L1ChainID, L1ChainID,
...@@ -64,6 +78,7 @@ export const DEFAULT_L2_CONTRACT_ADDRESSES: OEL2ContractsLike = { ...@@ -64,6 +78,7 @@ export const DEFAULT_L2_CONTRACT_ADDRESSES: OEL2ContractsLike = {
* @returns The L1 contracts for the given network. * @returns The L1 contracts for the given network.
*/ */
const getL1ContractsByNetworkName = (network: string): OEL1ContractsLike => { const getL1ContractsByNetworkName = (network: string): OEL1ContractsLike => {
// TODO this doesn't code split and makes the sdk artifacts way too big
const getDeployedAddress = (name: string) => { const getDeployedAddress = (name: string) => {
return getDeployedContractDefinition(name, network).address return getDeployedContractDefinition(name, network).address
} }
...@@ -77,8 +92,8 @@ const getL1ContractsByNetworkName = (network: string): OEL1ContractsLike => { ...@@ -77,8 +92,8 @@ const getL1ContractsByNetworkName = (network: string): OEL1ContractsLike => {
StateCommitmentChain: getDeployedAddress('StateCommitmentChain'), StateCommitmentChain: getDeployedAddress('StateCommitmentChain'),
CanonicalTransactionChain: getDeployedAddress('CanonicalTransactionChain'), CanonicalTransactionChain: getDeployedAddress('CanonicalTransactionChain'),
BondManager: getDeployedAddress('BondManager'), BondManager: getDeployedAddress('BondManager'),
OptimismPortal: '0x5b47E1A08Ea6d985D6649300584e6722Ec4B1383' as const, OptimismPortal: portalAddresses[network].address,
L2OutputOracle: '0xE6Dfba0953616Bacab0c9A8ecb3a9BBa77FC15c0' as const, L2OutputOracle: l2OutputOracleAddresses[network].address,
} }
} }
...@@ -109,6 +124,7 @@ export const CONTRACT_ADDRESSES: { ...@@ -109,6 +124,7 @@ export const CONTRACT_ADDRESSES: {
CanonicalTransactionChain: CanonicalTransactionChain:
'0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9' as const, '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9' as const,
BondManager: '0x5FC8d32690cc91D4c39d9d3abcBD16989F875707' as const, BondManager: '0x5FC8d32690cc91D4c39d9d3abcBD16989F875707' as const,
// FIXME
OptimismPortal: '0x0000000000000000000000000000000000000000' as const, OptimismPortal: '0x0000000000000000000000000000000000000000' as const,
L2OutputOracle: '0x0000000000000000000000000000000000000000' as const, L2OutputOracle: '0x0000000000000000000000000000000000000000' as const,
}, },
......
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